Merge pull request #321 from fryshorts/volume-handling-fixes

Volume change signal fixes
This commit is contained in:
Jim 2015-01-02 14:57:20 -08:00
commit 92659ba69b
3 changed files with 12 additions and 0 deletions

View File

@ -180,7 +180,9 @@ void OBSAdvAudioCtrl::SourceFlagsChanged(uint32_t flags)
void OBSAdvAudioCtrl::SourceVolumeChanged(float value)
{
volume->blockSignals(true);
volume->setValue(int(value * 100));
volume->blockSignals(false);
}
void OBSAdvAudioCtrl::SourceSyncChanged(int64_t offset)

View File

@ -35,7 +35,11 @@ void VolControl::OBSVolumeLevel(void *data, calldata_t *calldata)
void VolControl::VolumeChanged()
{
slider->blockSignals(true);
slider->setValue((int) (obs_fader_get_deflection(obs_fader) * 100.0f));
slider->blockSignals(false);
updateText();
}
void VolControl::VolumeLevel(float mag, float peak, float peakHold)
@ -46,6 +50,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);