obs: Fix label in volume control

Use a dedicated method for setting the dB label in the volume control
and make sure to call it regardless if the volume was changed through
the slider or from somewhere else.
This commit is contained in:
fryshorts
2014-12-28 12:31:21 +01:00
parent 11106c2fce
commit 0f8b2faed4
2 changed files with 7 additions and 0 deletions

View File

@@ -36,6 +36,7 @@ void VolControl::OBSVolumeLevel(void *data, calldata_t *calldata)
void VolControl::VolumeChanged()
{
slider->setValue((int) (obs_fader_get_deflection(obs_fader) * 100.0f));
updateText();
}
void VolControl::VolumeLevel(float mag, float peak, float peakHold)
@@ -46,6 +47,11 @@ void VolControl::VolumeLevel(float mag, float peak, float peakHold)
void VolControl::SliderChanged(int vol)
{
obs_fader_set_deflection(obs_fader, float(vol) * 0.01f);
updateText();
}
void VolControl::updateText()
{
volLabel->setText(QString::number(obs_fader_get_db(obs_fader), 'f', 1)
.append(" dB"));
}

View File

@@ -44,6 +44,7 @@ private slots:
void VolumeChanged();
void VolumeLevel(float mag, float peak, float peakHold);
void SliderChanged(int vol);
void updateText();
public:
VolControl(OBSSource source);