summaryrefslogtreecommitdiff
path: root/gtk2_ardour/midi_time_axis.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2020-04-03 14:39:03 +0200
committerRobin Gareus <robin@gareus.org>2020-04-03 14:49:03 +0200
commit11f28a4b1db4b931ac3350f0bfaaf0db5a592af7 (patch)
treed0ab4d123c60d980f7091cc3d9b58f44df6d66ec /gtk2_ardour/midi_time_axis.cc
parent35aab65d59a753c5acf33ae7da8fb7b018f3471b (diff)
NO-OP: cleanup and remove debug messages
Diffstat (limited to 'gtk2_ardour/midi_time_axis.cc')
-rw-r--r--gtk2_ardour/midi_time_axis.cc57
1 files changed, 29 insertions, 28 deletions
diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc
index bca18eb9f7..6604a923a9 100644
--- a/gtk2_ardour/midi_time_axis.cc
+++ b/gtk2_ardour/midi_time_axis.cc
@@ -264,7 +264,6 @@ MidiTimeAxisView::set_route (boost::shared_ptr<Route> rt)
_midi_controls_box.set_homogeneous(false);
_midi_controls_box.set_border_width (2);
-
/* this directly calls use_midnam_info() if there are midnam's already */
MIDI::Name::MidiPatchManager::instance().maybe_use (*this, invalidator (*this), boost::bind (&MidiTimeAxisView::use_midnam_info, this), gui_context());
@@ -308,13 +307,6 @@ MidiTimeAxisView::set_route (boost::shared_ptr<Route> rt)
}
void
-MidiTimeAxisView::processors_changed (RouteProcessorChange c)
-{
- RouteTimeAxisView::processors_changed (c);
- maybe_trigger_model_change ();
-}
-
-void
MidiTimeAxisView::first_idle ()
{
if (is_track ()) {
@@ -344,12 +336,37 @@ MidiTimeAxisView::check_step_edit ()
}
void
+MidiTimeAxisView::processors_changed (RouteProcessorChange c)
+{
+ RouteTimeAxisView::processors_changed (c);
+ maybe_trigger_model_change ();
+}
+
+void
MidiTimeAxisView::use_midnam_info ()
{
setup_midnam_patches ();
}
void
+MidiTimeAxisView::maybe_trigger_model_change ()
+{
+ if (_route->instrument_info().have_custom_plugin_info ()) {
+ /* ensure that "Plugin Provided" is at the top of the list */
+ if (_midnam_model_selector.items().empty () || _midnam_model_selector.items().begin()->get_label() != _("Plugin Provided")) {
+ /* setup_midnam_patches unconditionally calls model_changed() */
+ setup_midnam_patches ();
+ }
+ } else {
+ /* no plugin provided MIDNAM for this plugin */
+ if (!_midnam_model_selector.items().empty () && _midnam_model_selector.items().begin()->get_label() == _("Plugin Provided")) {
+ /* setup_midnam_patches unconditionally calls model_changed() */
+ setup_midnam_patches ();
+ }
+ }
+}
+
+void
MidiTimeAxisView::setup_midnam_patches ()
{
typedef MIDI::Name::MidiPatchManager PatchManager;
@@ -366,7 +383,7 @@ MidiTimeAxisView::setup_midnam_patches ()
Menu* menu = Gtk::manage(new Menu);
Menu_Helpers::MenuList& items = menu->items();
- // Build manufacturer submenu
+ /* Build manufacturer submenu */
for (MIDI::Name::MIDINameDocument::MasterDeviceNamesList::const_iterator n = m->second.begin(); n != m->second.end(); ++n) {
if (patch_manager.is_custom_model (n->first)) {
@@ -385,7 +402,7 @@ MidiTimeAxisView::setup_midnam_patches ()
continue;
}
- // Add manufacturer submenu to selector
+ /* Add manufacturer submenu to selector */
_midnam_model_selector.AddMenuElem(Menu_Helpers::MenuElem(m->first, *menu));
}
@@ -415,22 +432,6 @@ MidiTimeAxisView::setup_midnam_patches ()
}
void
-MidiTimeAxisView::maybe_trigger_model_change ()
-{
- bool changed = false;
- if (_route->instrument_info().have_custom_plugin_info ()) {
- if (_midnam_model_selector.items().empty () || _midnam_model_selector.items().begin()->get_label() != _("Plugin Provided")) {
- setup_midnam_patches ();
- }
- } else {
- /* no plugin provided MIDNAM for this plugin */
- if (!_midnam_model_selector.items().empty () && _midnam_model_selector.items().begin()->get_label() == _("Plugin Provided")) {
- setup_midnam_patches ();
- }
- }
-}
-
-void
MidiTimeAxisView::model_changed (const std::string& m)
{
typedef MIDI::Name::MidiPatchManager PatchManager;
@@ -485,14 +486,14 @@ MidiTimeAxisView::model_changed (const std::string& m)
/* set backend state */
_route->instrument_info().set_external_instrument (model, mode);
+ /* query effective model/mode -- may be plugin provided */
if (_effective_model == _route->instrument_info().model () && _effective_mode == _route->instrument_info().mode ()) {
/* no change */
- printf (" ---- SKIP ----\n");
return;
}
_effective_model = _route->instrument_info().model ();
- _effective_mode = _route->instrument_info().mode ();
+ _effective_mode = _route->instrument_info().mode ();
/* update GUI */