From 2c395c676ebe4c821ac7126323ab0c15febb9bfe Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sat, 2 May 2020 13:48:23 +0200 Subject: Add new powermap widgget to the plugingui. --- plugin/drumgizmo_plugin.h | 2 +- plugingui/maintab.cc | 40 +++++++++++++++++++++++++++++++--------- plugingui/maintab.h | 4 ++++ plugingui/testmain.cc | 4 ++-- 4 files changed, 38 insertions(+), 12 deletions(-) diff --git a/plugin/drumgizmo_plugin.h b/plugin/drumgizmo_plugin.h index b422430..1f91fbc 100644 --- a/plugin/drumgizmo_plugin.h +++ b/plugin/drumgizmo_plugin.h @@ -213,5 +213,5 @@ private: bool inline_image_first_draw{true}; static constexpr std::size_t width{750}; - static constexpr std::size_t height{613}; + static constexpr std::size_t height{713}; }; diff --git a/plugingui/maintab.cc b/plugingui/maintab.cc index e09d530..9959f7e 100644 --- a/plugingui/maintab.cc +++ b/plugingui/maintab.cc @@ -81,6 +81,15 @@ The pink areas indicate the spread of the position and velocity of the\n\ next note in line. The wider the area the more the note can move in time\n\ and velocity."; +constexpr char power_tip[] = "\ +This function controls how the input powers are mapped to the powers that\n\ +DrumGizmo uses for selecting samples. You can control the function by dragging\n\ +and dropping the three colorful control points. Additionally, you can either\n\ +use a shelf, which draws a horizontal line from the green and red control\n\ +points to the left/right side. Or you can turn off the shelf, and then the\n\ +function goes through the lower left corner, then the three control points,\n\ +and then the upper right corner, enabling to draw more complicated functions."; + } // end anonymous namespace namespace GUI @@ -100,27 +109,30 @@ MainTab::MainTab(Widget* parent, , timingframe_content{this, settings, settings_notifier} , sampleselectionframe_content{this, settings, settings_notifier} , visualizerframe_content{this, settings, settings_notifier} + , powerframe_content{this, settings, settings_notifier} , settings(settings) , settings_notifier(settings_notifier) { layout.setSpacing(0); layout.setResizeChildren(true); - add("Drumkit", drumkit_frame, drumkitframe_content, 15, 0); - add("Status", status_frame, statusframe_content, 15, 0); - add("Resampling", resampling_frame, resamplingframe_content, 10, 0); - add("Disk Streaming", diskstreaming_frame, diskstreamingframe_content, 9, 0); + add("Drumkit", drumkit_frame, drumkitframe_content, 12, 0); + add("Status", status_frame, statusframe_content, 14, 0); + add("Resampling", resampling_frame, resamplingframe_content, 9, 0); + add("Disk Streaming", diskstreaming_frame, diskstreamingframe_content, 7, 0); + add("Bleed Control", bleedcontrol_frame, bleedcontrolframe_content, 7, 0); - add("Velocity Humanizer", humanizer_frame, humanizerframe_content, 10, 1); + add("Velocity Humanizer", humanizer_frame, humanizerframe_content, 8, 1); humanizer_frame.setHelpText(humanizer_tip); - add("Timing Humanizer", timing_frame, timingframe_content, 10, 1); + add("Timing Humanizer", timing_frame, timingframe_content, 8, 1); timing_frame.setHelpText(timing_tip); add("Sample Selection", sampleselection_frame, - sampleselectionframe_content, 10, 1); + sampleselectionframe_content, 8, 1); sampleselection_frame.setHelpText(sampleselection_tip); - add("Visualizer", visualizer_frame, visualizerframe_content, 10, 1); + add("Visualizer", visualizer_frame, visualizerframe_content, 8, 1); visualizer_frame.setHelpText(visualizer_tip); - add("Bleed Control", bleedcontrol_frame, bleedcontrolframe_content, 9, 1); + add("Velocity Curve", power_frame, powerframe_content, 17, 1); + power_frame.setHelpText(power_tip); humanizer_frame.setOnSwitch(settings.enable_velocity_modifier); bleedcontrol_frame.setOnSwitch(settings.enable_bleed_control); @@ -146,6 +158,11 @@ MainTab::MainTab(Widget* parent, this, &MainTab::timingOnChange); CONNECT(&bleedcontrol_frame, onEnabledChanged, &bleedcontrolframe_content, &BleedcontrolframeContent::setEnabled); + + CONNECT(&settings_notifier, enable_powermap, + &power_frame, &FrameWidget::setOnSwitch); + CONNECT(&power_frame, onSwitchChangeNotifier, + this, &MainTab::powerOnChange); } void MainTab::resize(std::size_t width, std::size_t height) @@ -178,6 +195,11 @@ void MainTab::timingOnChange(bool on) settings.enable_latency_modifier.store(on); } +void MainTab::powerOnChange(bool on) +{ + settings.enable_powermap.store(on); +} + void MainTab::add(std::string const& title, FrameWidget& frame, Widget& content, std::size_t height, int column) { diff --git a/plugingui/maintab.h b/plugingui/maintab.h index ea46f11..a19b183 100644 --- a/plugingui/maintab.h +++ b/plugingui/maintab.h @@ -38,6 +38,7 @@ #include "timingframecontent.h" #include "sampleselectionframecontent.h" #include "visualizerframecontent.h" +#include "powerwidget.h" struct Settings; class SettingsNotifier; @@ -63,6 +64,7 @@ private: void bleedcontrolOnChange(bool on); void resamplingOnChange(bool on); void timingOnChange(bool on); + void powerOnChange(bool on); Image logo{":resources/logo.png"}; @@ -77,6 +79,7 @@ private: FrameWidget timing_frame{this, true, true}; FrameWidget sampleselection_frame{this, false, true}; FrameWidget visualizer_frame{this, false, true}; + FrameWidget power_frame{this, true, true}; DrumkitframeContent drumkitframe_content; StatusframeContent statusframe_content; @@ -87,6 +90,7 @@ private: TimingframeContent timingframe_content; SampleselectionframeContent sampleselectionframe_content; VisualizerframeContent visualizerframe_content; + PowerWidget powerframe_content; void add(std::string const& title, FrameWidget& frame, Widget& content, std::size_t height, int column); diff --git a/plugingui/testmain.cc b/plugingui/testmain.cc index b122756..91effc4 100644 --- a/plugingui/testmain.cc +++ b/plugingui/testmain.cc @@ -57,9 +57,9 @@ int main() // TODO: automatically use drumgizmo_plugin.h size here #ifndef UI_PUGL - parent.resize(750, 613); + parent.resize(750, 713); #else - main_window.resize(750, 613); + main_window.resize(750, 713); #endif while(true) -- cgit v1.2.3