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:
@@ -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"));
|
||||
}
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user