Commit 1ced1a3f authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt4 - Volume: set the slider maximum to 200, in order to match the OSD % of...

Qt4 - Volume: set the slider maximum to 200, in order to match the OSD % of the volume, which will help to debug.
However, I still don't understand whether the "normal" volume is 256 or 512 and when starts the "dangerous" amplification


parent a026aadb
...@@ -487,7 +487,7 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i, bool b_advControls ) : ...@@ -487,7 +487,7 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i, bool b_advControls ) :
volumeSlider->setMaximumSize( QSize( 80, 200 ) ); volumeSlider->setMaximumSize( QSize( 80, 200 ) );
volumeSlider->setOrientation( Qt::Horizontal ); volumeSlider->setOrientation( Qt::Horizontal );
volumeSlider->setMaximum( 100 ); volumeSlider->setMaximum( VOLUME_MAX );
volumeSlider->setFocusPolicy( Qt::NoFocus ); volumeSlider->setFocusPolicy( Qt::NoFocus );
controlLayout->addWidget( volMuteLabel, 3, 15 ); controlLayout->addWidget( volMuteLabel, 3, 15 );
controlLayout->addWidget( volumeSlider, 3, 16, 1, 2 ); controlLayout->addWidget( volumeSlider, 3, 16, 1, 2 );
...@@ -558,13 +558,12 @@ void ControlsWidget::updateVolume( int i_sliderVolume ) ...@@ -558,13 +558,12 @@ void ControlsWidget::updateVolume( int i_sliderVolume )
{ {
if( !b_my_volume ) if( !b_my_volume )
{ {
int i_res = i_sliderVolume * AOUT_VOLUME_MAX / int i_res = i_sliderVolume * (AOUT_VOLUME_MAX / 2) / VOLUME_MAX;
( 2*volumeSlider->maximum() );
aout_VolumeSet( p_intf, i_res ); aout_VolumeSet( p_intf, i_res );
} }
if( i_sliderVolume == 0 ) if( i_sliderVolume == 0 )
volMuteLabel->setPixmap( QPixmap(":/pixmaps/volume-muted.png" ) ); volMuteLabel->setPixmap( QPixmap(":/pixmaps/volume-muted.png" ) );
else if( i_sliderVolume < volumeSlider->maximum()/2 ) else if( i_sliderVolume < VOLUME_MAX / 2 )
volMuteLabel->setPixmap( QPixmap( ":/pixmaps/volume-low.png" ) ); volMuteLabel->setPixmap( QPixmap( ":/pixmaps/volume-low.png" ) );
else volMuteLabel->setPixmap( QPixmap( ":/pixmaps/volume-high.png" ) ); else volMuteLabel->setPixmap( QPixmap( ":/pixmaps/volume-high.png" ) );
} }
...@@ -574,7 +573,7 @@ void ControlsWidget::updateOnTimer() ...@@ -574,7 +573,7 @@ void ControlsWidget::updateOnTimer()
/* Audio part */ /* Audio part */
audio_volume_t i_volume; audio_volume_t i_volume;
aout_VolumeGet( p_intf, &i_volume ); aout_VolumeGet( p_intf, &i_volume );
i_volume = ( i_volume * 200 )/ AOUT_VOLUME_MAX ; i_volume = ( i_volume * VOLUME_MAX )/ (AOUT_VOLUME_MAX/2) ;
int i_gauge = volumeSlider->value(); int i_gauge = volumeSlider->value();
b_my_volume = false; b_my_volume = false;
if( i_volume - i_gauge > 1 || i_gauge - i_volume > 1 ) if( i_volume - i_gauge > 1 || i_gauge - i_volume > 1 )
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <QWidget> #include <QWidget>
#include <QFrame> #include <QFrame>
#define VOLUME_MAX 200
class ResizeEvent; class ResizeEvent;
class QPalette; class QPalette;
...@@ -125,6 +126,8 @@ private slots: ...@@ -125,6 +126,8 @@ private slots:
void record(); void record();
}; };
class InputSlider; class InputSlider;
class QSlider; class QSlider;
class QGridLayout; class QGridLayout;
...@@ -188,7 +191,7 @@ public: ...@@ -188,7 +191,7 @@ public:
aout_VolumeMute( p_intf, NULL ); aout_VolumeMute( p_intf, NULL );
audio_volume_t i_volume; audio_volume_t i_volume;
aout_VolumeGet( p_intf, &i_volume ); aout_VolumeGet( p_intf, &i_volume );
m->updateVolume( i_volume * 200 /AOUT_VOLUME_MAX ); m->updateVolume( i_volume * VOLUME_MAX / (AOUT_VOLUME_MAX/2) );
return true; return true;
} }
return false; return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment