diff options
-rw-r--r-- | plugingui/bleedcontrolframecontent.cc | 35 | ||||
-rw-r--r-- | plugingui/bleedcontrolframecontent.h | 4 | ||||
-rw-r--r-- | src/settings.h | 9 |
3 files changed, 16 insertions, 32 deletions
diff --git a/plugingui/bleedcontrolframecontent.cc b/plugingui/bleedcontrolframecontent.cc index 05d9ba6..51ecf2a 100644 --- a/plugingui/bleedcontrolframecontent.cc +++ b/plugingui/bleedcontrolframecontent.cc @@ -44,63 +44,42 @@ BleedcontrolframeContent::BleedcontrolframeContent(Widget* parent, label_text.setText("Amount of Microphone Bleed:"); label_text.setAlignment(TextAlignment::center); - button.setText("Apply"); - button.setEnabled(false); - label_value.setText("0 %"); label_value.setAlignment(TextAlignment::center); - // TODO: - // connect to settings (see diskstreaming frame) - (void) this->settings; - (void) this->settings_notifier; + CONNECT(this, settings_notifier.master_bleed, + this, &BleedcontrolframeContent::bleedSettingsValueChanged); + CONNECT(&slider, valueChangedNotifier, + this, &BleedcontrolframeContent::bleedValueChanged); } void BleedcontrolframeContent::resize(std::size_t width, std::size_t height) { Widget::resize(width, height); - int slider_button_gap = 10; - slider_width = 0.8 * width; - button_width = std::max((int)width - slider_width - slider_button_gap, 0); label_text.move(0, 0); slider.move(0, 20); - button.move(slider_width + slider_button_gap, 10); label_value.move(0, 40); label_text.resize(slider_width, 15); slider.resize(slider_width, 15); - button.resize(button_width, 30); label_value.resize(slider_width, 15); - - button.setEnabled(false); } void BleedcontrolframeContent::bleedSettingsValueChanged(float value) { slider.setValue(value); - label_value.setText(std::to_string(100 * value) + " %"); + int percentage = 100 * value; + label_value.setText(std::to_string(percentage) + " %"); slider.setColour(Slider::Colour::Blue); - - button.setEnabled(true); } void BleedcontrolframeContent::bleedValueChanged(float value) { - // TODO: store new value in settings -} - -void BleedcontrolframeContent::reloadClicked() -{ - // TODO -} - -void BleedcontrolframeContent::reloaded(float) -{ - button.setEnabled(false); + settings.master_bleed.store(value); } } // GUI:: diff --git a/plugingui/bleedcontrolframecontent.h b/plugingui/bleedcontrolframecontent.h index 2fefd64..6b323b9 100644 --- a/plugingui/bleedcontrolframecontent.h +++ b/plugingui/bleedcontrolframecontent.h @@ -25,7 +25,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include "button.h" #include "label.h" #include "slider.h" #include "widget.h" @@ -49,14 +48,11 @@ public: private: void bleedSettingsValueChanged(float value); void bleedValueChanged(float value); - void reloadClicked(); - void reloaded(float); Label label_text{this}; Label label_value{this}; Slider slider{this}; - Button button{this}; int slider_width; int button_width; diff --git a/src/settings.h b/src/settings.h index 6d094ea..b23f919 100644 --- a/src/settings.h +++ b/src/settings.h @@ -86,6 +86,8 @@ struct Settings Atomic<std::size_t> number_of_files{0}; Atomic<std::size_t> number_of_files_loaded{0}; Atomic<std::string> current_file{""}; + + Atomic<float> master_bleed{1.0f}; }; //! Settings getter class. @@ -124,6 +126,8 @@ struct SettingsGetter SettingRef<std::size_t> number_of_files_loaded; SettingRef<std::string> current_file; + SettingRef<float> master_bleed; + SettingsGetter(Settings& settings) : drumkit_file(settings.drumkit_file) , drumkit_load_status(settings.drumkit_load_status) @@ -150,6 +154,7 @@ struct SettingsGetter , number_of_files{settings.number_of_files} , number_of_files_loaded{settings.number_of_files_loaded} , current_file{settings.current_file} + , master_bleed{settings.master_bleed} { } }; @@ -191,6 +196,8 @@ public: Notifier<std::size_t> number_of_files_loaded; Notifier<std::string> current_file; + Notifier<float> master_bleed; + void evaluate() { #define EVAL(x) if(settings.x.hasChanged()) { x(settings.x.getValue()); } @@ -227,6 +234,8 @@ public: EVAL(number_of_files); EVAL(number_of_files_loaded); EVAL(current_file); + + EVAL(master_bleed); } SettingsNotifier(Settings& settings) |