From 0f8b2faed4d16af8401bbc973021cce67ab10f4e Mon Sep 17 00:00:00 2001 From: fryshorts Date: Sun, 28 Dec 2014 12:31:21 +0100 Subject: [PATCH 1/3] 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. --- obs/volume-control.cpp | 6 ++++++ obs/volume-control.hpp | 1 + 2 files changed, 7 insertions(+) diff --git a/obs/volume-control.cpp b/obs/volume-control.cpp index 1d88e212d..bc2853e7a 100644 --- a/obs/volume-control.cpp +++ b/obs/volume-control.cpp @@ -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")); } diff --git a/obs/volume-control.hpp b/obs/volume-control.hpp index 087626fdb..ddc541c75 100644 --- a/obs/volume-control.hpp +++ b/obs/volume-control.hpp @@ -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); From 89792865a1276ba573a0f1c10c0903957b061d93 Mon Sep 17 00:00:00 2001 From: fryshorts Date: Fri, 2 Jan 2015 19:57:01 +0100 Subject: [PATCH 2/3] obs: Fix signal in volume control Suppress signals of the volume slider when setting a value. This stops the volume control from setting the source volume when it receives the volume changed event from the source. --- obs/volume-control.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/obs/volume-control.cpp b/obs/volume-control.cpp index bc2853e7a..5df19dda3 100644 --- a/obs/volume-control.cpp +++ b/obs/volume-control.cpp @@ -35,7 +35,10 @@ 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(); } From 10a0b08ec9768212852b7c704235f5cccf082afb Mon Sep 17 00:00:00 2001 From: fryshorts Date: Fri, 2 Jan 2015 20:10:59 +0100 Subject: [PATCH 3/3] obs: Fix signal in advanced volume controls Suppress signals of the volume input when setting a value. This stops the volume control from setting the source volume when it receives the volume changed event from the source. --- obs/adv-audio-control.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/obs/adv-audio-control.cpp b/obs/adv-audio-control.cpp index da1c0e32b..77bacb63a 100644 --- a/obs/adv-audio-control.cpp +++ b/obs/adv-audio-control.cpp @@ -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)