diff options
author | André Nusser <andre.nusser@googlemail.com> | 2019-05-11 16:33:28 +0200 |
---|---|---|
committer | André Nusser <andre.nusser@googlemail.com> | 2019-05-11 16:33:28 +0200 |
commit | 0cb6057fd3a55b23b419ebfe9648cb63d4e13b24 (patch) | |
tree | 66441a1380cb00ac324cfcbc450f575b663f0c89 /plugingui | |
parent | 9c5efc23764522597a53a8745860cec54ea55d69 (diff) |
Move sample selection GUI parameters to own frame.
Diffstat (limited to 'plugingui')
-rw-r--r-- | plugingui/Makefile.am | 1 | ||||
-rw-r--r-- | plugingui/humanizerframecontent.cc | 66 | ||||
-rw-r--r-- | plugingui/humanizerframecontent.h | 17 | ||||
-rw-r--r-- | plugingui/maintab.cc | 4 | ||||
-rw-r--r-- | plugingui/maintab.h | 3 | ||||
-rw-r--r-- | plugingui/sampleselectionframecontent.cc | 115 | ||||
-rw-r--r-- | plugingui/sampleselectionframecontent.h | 75 |
7 files changed, 198 insertions, 83 deletions
diff --git a/plugingui/Makefile.am b/plugingui/Makefile.am index 09e5474..c4c2fa0 100644 --- a/plugingui/Makefile.am +++ b/plugingui/Makefile.am @@ -95,6 +95,7 @@ nodist_libdggui_la_SOURCES = \ resamplingframecontent.cc \ resource.cc \ resource_data.cc \ + sampleselectionframecontent.cc \ scrollbar.cc \ slider.cc \ stackedwidget.cc \ diff --git a/plugingui/humanizerframecontent.cc b/plugingui/humanizerframecontent.cc index db3fd97..475f16d 100644 --- a/plugingui/humanizerframecontent.cc +++ b/plugingui/humanizerframecontent.cc @@ -63,33 +63,9 @@ HumanizerframeContent::HumanizerframeContent(Widget* parent, stddev.setControl(&stddev_knob); layout.addItem(&stddev); - f_distance.resize(80, 80); - f_distance_knob.resize(30, 30); - f_distance_knob.showValue(false); - f_distance_knob.setDefaultValue(Settings::sample_selection_f_distance_default/f_distance_factor); - f_distance.setControl(&f_distance_knob); - layout.addItem(&f_distance); - - f_recent.resize(80, 80); - f_recent_knob.resize(30, 30); - f_recent_knob.showValue(false); - f_recent_knob.setDefaultValue(Settings::sample_selection_f_recent_default/f_recent_factor); - f_recent.setControl(&f_recent_knob); - layout.addItem(&f_recent); - - f_random.resize(80, 80); - f_random_knob.resize(30, 30); - f_random_knob.showValue(false); - f_random_knob.setDefaultValue(Settings::sample_selection_f_random_default/f_random_factor); - f_random.setControl(&f_random_knob); - layout.addItem(&f_random); - layout.setPosition(&attack, GridLayout::GridRange{0, 1, 0, 1}); layout.setPosition(&falloff, GridLayout::GridRange{1, 2, 0, 1}); layout.setPosition(&stddev, GridLayout::GridRange{2, 3, 0, 1}); - layout.setPosition(&f_distance, GridLayout::GridRange{0, 1, 1, 2}); - layout.setPosition(&f_recent, GridLayout::GridRange{1, 2, 1, 2}); - layout.setPosition(&f_random, GridLayout::GridRange{2, 3, 1, 2}); CONNECT(this, settings_notifier.velocity_modifier_weight, &attack_knob, &Knob::setValue); @@ -97,12 +73,6 @@ HumanizerframeContent::HumanizerframeContent(Widget* parent, &falloff_knob, &Knob::setValue); CONNECT(this, settings_notifier.velocity_stddev, this, &HumanizerframeContent::stddevSettingsValueChanged); - CONNECT(this, settings_notifier.sample_selection_f_distance, - this, &HumanizerframeContent::fDistanceSettingsValueChanged); - CONNECT(this, settings_notifier.sample_selection_f_recent, - this, &HumanizerframeContent::fRecentSettingsValueChanged); - CONNECT(this, settings_notifier.sample_selection_f_random, - this, &HumanizerframeContent::fRandomSettingsValueChanged); CONNECT(&attack_knob, valueChangedNotifier, this, &HumanizerframeContent::attackValueChanged); @@ -110,12 +80,6 @@ HumanizerframeContent::HumanizerframeContent(Widget* parent, this, &HumanizerframeContent::falloffValueChanged); CONNECT(&stddev_knob, valueChangedNotifier, this, &HumanizerframeContent::stddevKnobValueChanged); - CONNECT(&f_distance_knob, valueChangedNotifier, - this, &HumanizerframeContent::fDistanceKnobValueChanged); - CONNECT(&f_recent_knob, valueChangedNotifier, - this, &HumanizerframeContent::fRecentKnobValueChanged); - CONNECT(&f_random_knob, valueChangedNotifier, - this, &HumanizerframeContent::fRandomKnobValueChanged); } void HumanizerframeContent::attackValueChanged(float value) @@ -133,39 +97,9 @@ void HumanizerframeContent::stddevKnobValueChanged(float value) settings.velocity_stddev.store(value*stddev_factor); } -void HumanizerframeContent::fDistanceKnobValueChanged(float value) -{ - settings.sample_selection_f_distance.store(value*f_distance_factor); -} - -void HumanizerframeContent::fRecentKnobValueChanged(float value) -{ - settings.sample_selection_f_recent.store(value*f_recent_factor); -} - -void HumanizerframeContent::fRandomKnobValueChanged(float value) -{ - settings.sample_selection_f_random.store(value*f_random_factor); -} - void HumanizerframeContent::stddevSettingsValueChanged(float value) { stddev_knob.setValue(value/stddev_factor); } -void HumanizerframeContent::fDistanceSettingsValueChanged(float value) -{ - f_distance_knob.setValue(value/f_distance_factor); -} - -void HumanizerframeContent::fRecentSettingsValueChanged(float value) -{ - f_recent_knob.setValue(value/f_recent_factor); -} - -void HumanizerframeContent::fRandomSettingsValueChanged(float value) -{ - f_random_knob.setValue(value/f_random_factor); -} - } // GUI:: diff --git a/plugingui/humanizerframecontent.h b/plugingui/humanizerframecontent.h index e8c0810..048aea7 100644 --- a/plugingui/humanizerframecontent.h +++ b/plugingui/humanizerframecontent.h @@ -47,37 +47,22 @@ public: private: static float constexpr stddev_factor = 4.5f; - static float constexpr f_distance_factor = 4.f; - static float constexpr f_recent_factor = 1.f; - static float constexpr f_random_factor = .5f; void attackValueChanged(float value); void falloffValueChanged(float value); void stddevKnobValueChanged(float value); - void fDistanceKnobValueChanged(float value); - void fRecentKnobValueChanged(float value); - void fRandomKnobValueChanged(float value); void stddevSettingsValueChanged(float value); - void fDistanceSettingsValueChanged(float value); - void fRecentSettingsValueChanged(float value); - void fRandomSettingsValueChanged(float value); - GridLayout layout{this, 3, 2}; + GridLayout layout{this, 3, 1}; LabeledControl attack{this, "Attack"}; // drummer strength LabeledControl falloff{this, "Release"}; // regain LabeledControl stddev{this, "StdDev"}; - LabeledControl f_distance{this, "fDistance"}; - LabeledControl f_recent{this, "fRecent"}; - LabeledControl f_random{this, "fRandom"}; Knob attack_knob{&attack}; Knob falloff_knob{&falloff}; Knob stddev_knob{&stddev}; - Knob f_distance_knob{&f_distance}; - Knob f_recent_knob{&f_recent}; - Knob f_random_knob{&f_random}; Settings& settings; SettingsNotifier& settings_notifier; diff --git a/plugingui/maintab.cc b/plugingui/maintab.cc index 4b65092..18fed6c 100644 --- a/plugingui/maintab.cc +++ b/plugingui/maintab.cc @@ -41,6 +41,7 @@ MainTab::MainTab(Widget* parent, , bleedcontrolframe_content{this, settings, settings_notifier} , resamplingframe_content{this, settings_notifier} , timingframe_content{this, settings, settings_notifier} + , sampleselectionframe_content{this, settings, settings_notifier} , visualizerframe_content{this, settings, settings_notifier} , settings(settings) , settings_notifier(settings_notifier) @@ -52,9 +53,10 @@ MainTab::MainTab(Widget* parent, add("Status", status_frame, statusframe_content, 24, 0); add("Resampling", resampling_frame, resamplingframe_content, 10, 0); - add("Velocity Humanizer", humanizer_frame, humanizerframe_content, 20, 1); + add("Velocity Humanizer", humanizer_frame, humanizerframe_content, 10, 1); humanizer_frame.setHelpText("Hello World\nThis is a nice World\n... I think"); add("Timing Humanizer", timing_frame, timingframe_content, 10, 1); + add("Sample Selection", sampleselection_frame, sampleselectionframe_content, 10, 1); add("Visualizer", visualizer_frame, visualizerframe_content, 10, 1); add("Bleed Control", bleedcontrol_frame, bleedcontrolframe_content, 9, 1); add("Disk Streaming", diskstreaming_frame, diskstreamingframe_content, 10, 1); diff --git a/plugingui/maintab.h b/plugingui/maintab.h index 897326a..eb3e666 100644 --- a/plugingui/maintab.h +++ b/plugingui/maintab.h @@ -36,6 +36,7 @@ #include "bleedcontrolframecontent.h" #include "resamplingframecontent.h" #include "timingframecontent.h" +#include "sampleselectionframecontent.h" #include "visualizerframecontent.h" struct Settings; @@ -74,6 +75,7 @@ private: FrameWidget bleedcontrol_frame{this, true}; FrameWidget resampling_frame{this, true}; FrameWidget timing_frame{this, true}; + FrameWidget sampleselection_frame{this, false}; FrameWidget visualizer_frame{this, false}; DrumkitframeContent drumkitframe_content; @@ -83,6 +85,7 @@ private: BleedcontrolframeContent bleedcontrolframe_content; ResamplingframeContent resamplingframe_content; TimingframeContent timingframe_content; + SampleselectionframeContent sampleselectionframe_content; VisualizerframeContent visualizerframe_content; void add(std::string const& title, FrameWidget& frame, Widget& content, diff --git a/plugingui/sampleselectionframecontent.cc b/plugingui/sampleselectionframecontent.cc new file mode 100644 index 0000000..534a0b9 --- /dev/null +++ b/plugingui/sampleselectionframecontent.cc @@ -0,0 +1,115 @@ +/* -*- Mode: c++ -*- */ +/*************************************************************************** + * sampleselectionframecontent.cc + * + * Sat May 11 15:29:25 CEST 2019 + * Copyright 2019 André Nusser + * andre.nusser@googlemail.com + ****************************************************************************/ + +/* + * This file is part of DrumGizmo. + * + * DrumGizmo is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DrumGizmo is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with DrumGizmo; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ +#include "sampleselectionframecontent.h" + +#include <settings.h> + +#include "painter.h" + +namespace GUI +{ + +SampleselectionframeContent::SampleselectionframeContent(Widget* parent, + Settings& settings, + SettingsNotifier& settings_notifier) + : Widget(parent) + , settings(settings) + , settings_notifier(settings_notifier) +{ + layout.setResizeChildren(false); + + f_distance.resize(80, 80); + f_distance_knob.resize(30, 30); + f_distance_knob.showValue(false); + f_distance_knob.setDefaultValue(Settings::sample_selection_f_distance_default/f_distance_factor); + f_distance.setControl(&f_distance_knob); + layout.addItem(&f_distance); + + f_recent.resize(80, 80); + f_recent_knob.resize(30, 30); + f_recent_knob.showValue(false); + f_recent_knob.setDefaultValue(Settings::sample_selection_f_recent_default/f_recent_factor); + f_recent.setControl(&f_recent_knob); + layout.addItem(&f_recent); + + f_random.resize(80, 80); + f_random_knob.resize(30, 30); + f_random_knob.showValue(false); + f_random_knob.setDefaultValue(Settings::sample_selection_f_random_default/f_random_factor); + f_random.setControl(&f_random_knob); + layout.addItem(&f_random); + + layout.setPosition(&f_distance, GridLayout::GridRange{0, 1, 0, 1}); + layout.setPosition(&f_recent, GridLayout::GridRange{1, 2, 0, 1}); + layout.setPosition(&f_random, GridLayout::GridRange{2, 3, 0, 1}); + + CONNECT(this, settings_notifier.sample_selection_f_distance, + this, &SampleselectionframeContent::fDistanceSettingsValueChanged); + CONNECT(this, settings_notifier.sample_selection_f_recent, + this, &SampleselectionframeContent::fRecentSettingsValueChanged); + CONNECT(this, settings_notifier.sample_selection_f_random, + this, &SampleselectionframeContent::fRandomSettingsValueChanged); + + CONNECT(&f_distance_knob, valueChangedNotifier, + this, &SampleselectionframeContent::fDistanceKnobValueChanged); + CONNECT(&f_recent_knob, valueChangedNotifier, + this, &SampleselectionframeContent::fRecentKnobValueChanged); + CONNECT(&f_random_knob, valueChangedNotifier, + this, &SampleselectionframeContent::fRandomKnobValueChanged); +} + +void SampleselectionframeContent::fDistanceKnobValueChanged(float value) +{ + settings.sample_selection_f_distance.store(value*f_distance_factor); +} + +void SampleselectionframeContent::fRecentKnobValueChanged(float value) +{ + settings.sample_selection_f_recent.store(value*f_recent_factor); +} + +void SampleselectionframeContent::fRandomKnobValueChanged(float value) +{ + settings.sample_selection_f_random.store(value*f_random_factor); +} + +void SampleselectionframeContent::fDistanceSettingsValueChanged(float value) +{ + f_distance_knob.setValue(value/f_distance_factor); +} + +void SampleselectionframeContent::fRecentSettingsValueChanged(float value) +{ + f_recent_knob.setValue(value/f_recent_factor); +} + +void SampleselectionframeContent::fRandomSettingsValueChanged(float value) +{ + f_random_knob.setValue(value/f_random_factor); +} + +} // GUI:: diff --git a/plugingui/sampleselectionframecontent.h b/plugingui/sampleselectionframecontent.h new file mode 100644 index 0000000..097bc20 --- /dev/null +++ b/plugingui/sampleselectionframecontent.h @@ -0,0 +1,75 @@ +/* -*- Mode: c++ -*- */ +/*************************************************************************** + * sampleselectionframecontent.h + * + * Sat May 11 15:29:25 CEST 2019 + * Copyright 2019 André Nusser + * andre.nusser@googlemail.com + ****************************************************************************/ + +/* + * This file is part of DrumGizmo. + * + * DrumGizmo is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DrumGizmo is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with DrumGizmo; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ +#pragma once + +#include "knob.h" +#include "labeledcontrol.h" +#include "layout.h" +#include "widget.h" + +struct Settings; +class SettingsNotifier; + +namespace GUI +{ + +class SampleselectionframeContent + : public Widget +{ +public: + SampleselectionframeContent(Widget* parent, + Settings& settings, + SettingsNotifier& settings_notifier); + +private: + static float constexpr f_distance_factor = 4.f; + static float constexpr f_recent_factor = 1.f; + static float constexpr f_random_factor = .5f; + + void fDistanceKnobValueChanged(float value); + void fRecentKnobValueChanged(float value); + void fRandomKnobValueChanged(float value); + + void fDistanceSettingsValueChanged(float value); + void fRecentSettingsValueChanged(float value); + void fRandomSettingsValueChanged(float value); + + GridLayout layout{this, 3, 1}; + + LabeledControl f_distance{this, "fDistance"}; + LabeledControl f_recent{this, "fRecent"}; + LabeledControl f_random{this, "fRandom"}; + + Knob f_distance_knob{&f_distance}; + Knob f_recent_knob{&f_recent}; + Knob f_random_knob{&f_random}; + + Settings& settings; + SettingsNotifier& settings_notifier; +}; + +} // GUI:: |