From 3a6e3c2c13de210f2e7b70767270f5b2ba564230 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 29 Mar 2023 01:48:25 +0200 Subject: [PATCH] Add audition volume control to clip-picker --- gtk2_ardour/trigger_clip_picker.cc | 17 ++++++++++++++--- gtk2_ardour/trigger_clip_picker.h | 2 ++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/gtk2_ardour/trigger_clip_picker.cc b/gtk2_ardour/trigger_clip_picker.cc index f50c03448e..f7e232bd4e 100644 --- a/gtk2_ardour/trigger_clip_picker.cc +++ b/gtk2_ardour/trigger_clip_picker.cc @@ -61,6 +61,8 @@ using namespace Gtk; using namespace PBD; using namespace ARDOUR; +#define PX_SCALE(px) std::max((float)px, rintf((float)px * UIConfiguration::instance().get_ui_scale())) + TriggerClipPicker::TriggerClipPicker () : _fcd (_("Select clip folder"), FILE_CHOOSER_ACTION_SELECT_FOLDER) , _seek_slider (0, 1000, 1) @@ -108,6 +110,9 @@ TriggerClipPicker::TriggerClipPicker () _stop_btn.set_icon (ArdourWidgets::ArdourIcon::TransportStop); _stop_btn.signal_clicked.connect (sigc::mem_fun (*this, &TriggerClipPicker::stop_audition)); + _gain_control.set_name("monitor section knob"); + _gain_control.set_size_request (PX_SCALE(24), PX_SCALE(24)); + _open_library_btn.set_name ("generic button"); _open_library_btn.set_icon (ArdourWidgets::ArdourIcon::Folder); _open_library_btn.signal_clicked.connect (sigc::mem_fun (*this, &TriggerClipPicker::open_library)); @@ -133,6 +138,7 @@ TriggerClipPicker::TriggerClipPicker () ArdourWidgets::set_tooltip (_play_btn, _("Audition selected clip")); ArdourWidgets::set_tooltip (_stop_btn, _("Stop the audition")); + ArdourWidgets::set_tooltip (_gain_control, _("Audition Volume")); ArdourWidgets::set_tooltip (_open_library_btn, _("Open clip library folder")); ArdourWidgets::set_tooltip (_refresh_btn, _("Refresh clip list")); ArdourWidgets::set_tooltip (_auditioner_combo, _("Select the Synth used for auditioning")); @@ -153,9 +159,10 @@ TriggerClipPicker::TriggerClipPicker () _auditable.set_homogeneous(false); _auditable.attach (_play_btn, 0, 1, r,r+1, SHRINK, SHRINK); _auditable.attach (_stop_btn, 1, 2, r,r+1, SHRINK, SHRINK); - _auditable.attach (_autoplay_btn, 2, 3, r,r+1, EXPAND | FILL, SHRINK); r++; - _auditable.attach (_seek_slider, 0, 4, r,r+1, EXPAND | FILL, SHRINK); r++; - _auditable.attach (_midi_prop_table, 0, 4, r,r+1, EXPAND | FILL, SHRINK); + _auditable.attach (_gain_control, 2, 3, r,r+1, SHRINK, SHRINK); + _auditable.attach (_autoplay_btn, 3, 4, r,r+1, EXPAND | FILL, SHRINK); r++; + _auditable.attach (_seek_slider, 0, 5, r,r+1, EXPAND | FILL, SHRINK); r++; + _auditable.attach (_midi_prop_table, 0, 5, r,r+1, EXPAND | FILL, SHRINK); _auditable.set_border_width (4); _auditable.set_spacings (4); @@ -852,12 +859,16 @@ TriggerClipPicker::set_session (Session* s) _auditioner_connections.drop_connections (); _processor_connections.drop_connections (); audition_processor_going_away (); + std::shared_ptr none; + _gain_control.set_controllable (none); } else { _auditioner_connections.drop_connections (); _session->AuditionActive.connect (_auditioner_connections, invalidator (*this), boost::bind (&TriggerClipPicker::audition_active, this, _1), gui_context ()); _session->the_auditioner ()->AuditionProgress.connect (_auditioner_connections, invalidator (*this), boost::bind (&TriggerClipPicker::audition_progress, this, _1, _2), gui_context ()); _session->the_auditioner ()->processors_changed.connect (_auditioner_connections, invalidator (*this), boost::bind (&TriggerClipPicker::audition_processors_changed, this), gui_context ()); audition_processors_changed (); /* set sensitivity */ + + _gain_control.set_controllable (_session->the_auditioner ()->gain_control ()); } } diff --git a/gtk2_ardour/trigger_clip_picker.h b/gtk2_ardour/trigger_clip_picker.h index fe1c58a29f..ab9bb2604b 100644 --- a/gtk2_ardour/trigger_clip_picker.h +++ b/gtk2_ardour/trigger_clip_picker.h @@ -36,6 +36,7 @@ #include "widgets/ardour_dropdown.h" #include "widgets/ardour_button.h" +#include "widgets/ardour_knob.h" #include "instrument_selector.h" @@ -120,6 +121,7 @@ private: Gtk::Table _auditable; ArdourWidgets::ArdourButton _play_btn; ArdourWidgets::ArdourButton _stop_btn; + ArdourWidgets::ArdourKnob _gain_control; ArdourWidgets::ArdourButton _open_library_btn; ArdourWidgets::ArdourButton _refresh_btn; ArdourWidgets::ArdourButton _show_plugin_btn;