diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2020-04-12 18:16:50 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2020-05-02 15:37:23 +0200 |
commit | d9c671d14dacf3d7c02305df9b7d5fba67357a55 (patch) | |
tree | 5cc26dbfa910a4a7b6357157bea439d6330b0532 /plugingui | |
parent | 2c395c676ebe4c821ac7126323ab0c15febb9bfe (diff) |
Add setting and knob for controlling resampling quality.
Diffstat (limited to 'plugingui')
-rw-r--r-- | plugingui/maintab.cc | 2 | ||||
-rw-r--r-- | plugingui/resamplingframecontent.cc | 35 | ||||
-rw-r--r-- | plugingui/resamplingframecontent.h | 13 |
3 files changed, 44 insertions, 6 deletions
diff --git a/plugingui/maintab.cc b/plugingui/maintab.cc index 9959f7e..771e0d2 100644 --- a/plugingui/maintab.cc +++ b/plugingui/maintab.cc @@ -105,7 +105,7 @@ MainTab::MainTab(Widget* parent, , humanizerframe_content{this, settings, settings_notifier} , diskstreamingframe_content{this, settings, settings_notifier} , bleedcontrolframe_content{this, settings, settings_notifier} - , resamplingframe_content{this, settings_notifier} + , resamplingframe_content{this, settings, settings_notifier} , timingframe_content{this, settings, settings_notifier} , sampleselectionframe_content{this, settings, settings_notifier} , visualizerframe_content{this, settings, settings_notifier} diff --git a/plugingui/resamplingframecontent.cc b/plugingui/resamplingframecontent.cc index 6026154..717df0f 100644 --- a/plugingui/resamplingframecontent.cc +++ b/plugingui/resamplingframecontent.cc @@ -31,9 +31,11 @@ namespace GUI { -ResamplingframeContent::ResamplingframeContent( - Widget* parent, SettingsNotifier& settings_notifier) - : Widget(parent) +ResamplingframeContent::ResamplingframeContent(Widget* parent, + Settings& settings, + SettingsNotifier& settings_notifier) + : Widget(parent) + , settings(settings) , settings_notifier(settings_notifier) { CONNECT(this, settings_notifier.drumkit_samplerate, @@ -42,10 +44,23 @@ ResamplingframeContent::ResamplingframeContent( this, &ResamplingframeContent::updateSessionSamplerate); CONNECT(this, settings_notifier.resampling_recommended, this, &ResamplingframeContent::updateResamplingRecommended); + CONNECT(this, settings_notifier.resampling_quality, + this, &ResamplingframeContent::updateResamplingQuality); text_field.move(0, 0); text_field.setReadOnly(true); + quality_knob.resize(30, 30); + quality_knob.setDefaultValue(0.7f); + quality_knob.showValue(false); + + quality_label.setText("Quality"); + quality_label.setAlignment(TextAlignment::center); + quality_label.resize(40, 16); + + CONNECT(&quality_knob, valueChangedNotifier, + this, &ResamplingframeContent::valueChangedNotifier); + updateContent(); text_field.show(); } @@ -53,7 +68,9 @@ ResamplingframeContent::ResamplingframeContent( void ResamplingframeContent::resize(std::size_t width, std::size_t height) { Widget::resize(width, height); - text_field.resize(width, height); + text_field.resize(width - 50, height); + quality_knob.move(width - 36, 20); + quality_label.move(width - 40, 0); } void ResamplingframeContent::updateContent() @@ -88,4 +105,14 @@ void ResamplingframeContent::updateResamplingRecommended(bool resampling_recomme updateContent(); } +void ResamplingframeContent::updateResamplingQuality(float resampling_quality) +{ + quality_knob.setValue(resampling_quality); +} + +void ResamplingframeContent::valueChangedNotifier(float value) +{ + settings.resampling_quality.store(value); +} + } // GUI:: diff --git a/plugingui/resamplingframecontent.h b/plugingui/resamplingframecontent.h index b5530c2..3efc62e 100644 --- a/plugingui/resamplingframecontent.h +++ b/plugingui/resamplingframecontent.h @@ -28,8 +28,11 @@ #include "widget.h" #include "textedit.h" +#include "knob.h" +#include "label.h" class SettingsNotifier; +struct Settings; namespace GUI { @@ -38,20 +41,28 @@ class ResamplingframeContent : public Widget { public: - ResamplingframeContent(Widget* parent, SettingsNotifier& settings_notifier); + ResamplingframeContent(Widget* parent, + Settings& settings, + SettingsNotifier& settings_notifier); // From Widget virtual void resize(std::size_t width, std::size_t height) override; +private: void updateContent(); void updateDrumkitSamplerate(std::size_t drumkit_samplerate); void updateSessionSamplerate(double samplerate); void updateResamplingRecommended(bool resampling_recommended); + void updateResamplingQuality(float resampling_quality); + void valueChangedNotifier(float value); private: TextEdit text_field{this}; + Knob quality_knob{this}; + Label quality_label{this}; + Settings& settings; SettingsNotifier& settings_notifier; std::string drumkit_samplerate; |