use new method in MidiPatchManager to use MIDNAM data when setting a MidiTimeAxisView
authorPaul Davis <paul@linuxaudiosystems.com>
Mon, 23 Dec 2019 17:26:33 +0000 (10:26 -0700)
committerPaul Davis <paul@linuxaudiosystems.com>
Mon, 23 Dec 2019 17:27:00 +0000 (10:27 -0700)
gtk2_ardour/midi_time_axis.cc
gtk2_ardour/midi_time_axis.h

index 2b6827a5c4612980b145aa96c66ed7f762e88d35..888bf3ee02bdd5fa8a707fece79e7a616111f517 100644 (file)
@@ -274,12 +274,7 @@ MidiTimeAxisView::set_route (boost::shared_ptr<Route> rt)
        _midi_controls_box.set_homogeneous(false);
        _midi_controls_box.set_border_width (2);
 
-       MIDI::Name::MidiPatchManager::instance().PatchesChanged.connect (*this, invalidator (*this),
-                       boost::bind (&MidiTimeAxisView::setup_midnam_patches, this),
-                       gui_context());
-
-       setup_midnam_patches ();
-       update_patch_selector ();
+       MIDI::Name::MidiPatchManager::instance().maybe_use (*this, invalidator (*this), boost::bind (&MidiTimeAxisView::use_midnam_info, this), gui_context());
 
        model_changed (gui_property(X_("midnam-model-name")));
        custom_device_mode_changed (gui_property(X_("midnam-custom-device-mode")));
@@ -359,6 +354,15 @@ MidiTimeAxisView::check_step_edit ()
        _step_editor->check_step_edit ();
 }
 
+
+void
+MidiTimeAxisView::use_midnam_info ()
+{
+       std::cerr << "Using MIDNAM info from " << pthread_name() << endl;
+       setup_midnam_patches ();
+       update_patch_selector ();
+}
+
 void
 MidiTimeAxisView::setup_midnam_patches ()
 {
index 585791e53ba36631025eba41576673515c91836b..ee36d4c534612e168557b34fee56a73d6fcfed00 100644 (file)
@@ -112,6 +112,7 @@ public:
        uint8_t get_channel_for_add () const;
 
        void get_per_region_note_selection (std::list<std::pair<PBD::ID, std::set<boost::shared_ptr<Evoral::Note<Temporal::Beats> > > > >&);
+       void use_midnam_info ();
 
 protected:
        void start_step_editing ();