summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gtk2_ardour/midi_time_axis.cc57
-rw-r--r--gtk2_ardour/midi_time_axis.h8
-rw-r--r--gtk2_ardour/mixer_strip.cc5
-rw-r--r--gtk2_ardour/route_time_axis.cc43
-rw-r--r--gtk2_ardour/route_time_axis.h6
-rw-r--r--gtk2_ardour/route_ui.cc37
-rw-r--r--gtk2_ardour/route_ui.h6
7 files changed, 100 insertions, 62 deletions
diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc
index c8476dc83e..91cf2b9544 100644
--- a/gtk2_ardour/midi_time_axis.cc
+++ b/gtk2_ardour/midi_time_axis.cc
@@ -123,7 +123,6 @@ MidiTimeAxisView::MidiTimeAxisView (PublicEditor& ed, Session* sess, ArdourCanva
, controller_menu (0)
, poly_pressure_menu (0)
, _step_editor (0)
- , _patch_change_dialog (0)
{
_midnam_model_selector.disable_scrolling();
_midnam_custom_device_mode_selector.disable_scrolling();
@@ -193,10 +192,6 @@ MidiTimeAxisView::set_route (boost::shared_ptr<Route> rt)
update_control_names();
processors_changed (RouteProcessorChange ());
- _route->processors_changed.connect (*this, invalidator (*this),
- boost::bind (&MidiTimeAxisView::processors_changed, this, _1),
- gui_context());
-
if (is_track()) {
_piano_roll_header->SetNoteSelection.connect (
sigc::mem_fun (*this, &MidiTimeAxisView::set_note_selection));
@@ -347,9 +342,6 @@ MidiTimeAxisView::~MidiTimeAxisView ()
delete controller_menu;
delete _step_editor;
-
- delete _patch_change_dialog;
- _patch_change_dialog = 0;
}
void
@@ -392,11 +384,6 @@ MidiTimeAxisView::setup_midnam_patches ()
}
void
-MidiTimeAxisView::drop_instrument_ref ()
-{
- midnam_connection.drop_connections ();
-}
-void
MidiTimeAxisView::start_scroomer_update ()
{
_note_range_changed_connection.disconnect();
@@ -417,18 +404,8 @@ MidiTimeAxisView::update_patch_selector ()
bool pluginprovided = false;
if (_route) {
- boost::shared_ptr<Processor> the_instrument (_route->the_instrument());
- boost::shared_ptr<PluginInsert> pi = boost::dynamic_pointer_cast<PluginInsert>(the_instrument);
+ boost::shared_ptr<PluginInsert> pi = boost::dynamic_pointer_cast<PluginInsert> (_route->the_instrument ());
if (pi && pi->plugin ()->has_midnam ()) {
- midnam_connection.drop_connections ();
- the_instrument->DropReferences.connect (midnam_connection, invalidator (*this),
- boost::bind (&MidiTimeAxisView::drop_instrument_ref, this),
- gui_context());
- pi->plugin()->UpdateMidnam.connect (midnam_connection, invalidator (*this),
- boost::bind (&MidiTimeAxisView::reread_midnam, this),
- gui_context());
- reread_midnam ();
-
pluginprovided = true;
std::string model_name = pi->plugin ()->midnam_model ();
if (gui_property (X_("midnam-model-name")) != model_name) {
@@ -446,17 +423,7 @@ MidiTimeAxisView::update_patch_selector ()
}
}
-void
-MidiTimeAxisView::reread_midnam ()
-{
- boost::shared_ptr<Processor> the_instrument (_route->the_instrument());
- boost::shared_ptr<PluginInsert> pi = boost::dynamic_pointer_cast<PluginInsert>(the_instrument);
- bool rv = pi->plugin ()->read_midnam();
- if (rv && _patch_change_dialog) {
- _patch_change_dialog->refresh ();
- }
-}
void
MidiTimeAxisView::model_changed(const std::string& model)
{
@@ -499,8 +466,8 @@ MidiTimeAxisView::model_changed(const std::string& model)
controller_menu = 0;
build_automation_action_menu(false);
- if (_patch_change_dialog) {
- _patch_change_dialog->refresh ();
+ if (patch_change_dialog ()) {
+ patch_change_dialog ()->refresh ();
}
}
@@ -581,7 +548,7 @@ MidiTimeAxisView::append_extra_display_menu_items ()
sigc::mem_fun(*this, &MidiTimeAxisView::toggle_channel_selector)));
items.push_back (MenuElem (_("Patch Selector..."),
- sigc::mem_fun(*this, &MidiTimeAxisView::send_patch_change)));
+ sigc::mem_fun(*this, &RouteUI::select_midi_patch)));
color_mode_menu = build_color_mode_menu();
if (color_mode_menu) {
@@ -1099,22 +1066,6 @@ MidiTimeAxisView::build_color_mode_menu()
}
void
-MidiTimeAxisView::send_patch_change ()
-{
- if (!_route) {
- return;
- }
- if (_patch_change_dialog) {
- _patch_change_dialog->present ();
- return;
- }
-
- PatchChangeGridDialog* d = new PatchChangeGridDialog (_route);
- _patch_change_dialog = d;
- d->present ();
-}
-
-void
MidiTimeAxisView::set_note_mode(NoteMode mode, bool apply_to_selection)
{
if (apply_to_selection) {
diff --git a/gtk2_ardour/midi_time_axis.h b/gtk2_ardour/midi_time_axis.h
index faa0e723e8..cbfc816c27 100644
--- a/gtk2_ardour/midi_time_axis.h
+++ b/gtk2_ardour/midi_time_axis.h
@@ -67,7 +67,6 @@ class PianoRollHeader;
class StepEntry;
class StepEditor;
class MidiChannelSelectorWindow;
-class PatchChangeGridDialog;
#define NO_MIDI_NOTE 0xff
@@ -121,9 +120,6 @@ private:
void setup_midnam_patches ();
void update_patch_selector ();
- void drop_instrument_ref ();
- void reread_midnam ();
- PBD::ScopedConnectionList midnam_connection;
void start_scroomer_update ();
void stop_scroomer_update ();
@@ -140,8 +136,6 @@ private:
void set_note_mode (ARDOUR::NoteMode mode, bool apply_to_selection = false);
void set_color_mode (ARDOUR::ColorMode, bool force = false, bool redisplay = true, bool apply_to_selection = false);
void set_note_range (MidiStreamView::VisibleNoteRange range, bool apply_to_selection = false);
- void send_patch_change ();
-
void route_active_changed ();
void note_range_changed ();
void contents_height_changed ();
@@ -200,8 +194,6 @@ private:
StepEditor* _step_editor;
void immediate_patch_chnage_response (int response);
- PatchChangeGridDialog* _patch_change_dialog;
-
};
#endif /* __ardour_midi_time_axis_h__ */
diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc
index 21d6a5007f..6d127262b3 100644
--- a/gtk2_ardour/mixer_strip.cc
+++ b/gtk2_ardour/mixer_strip.cc
@@ -1738,6 +1738,11 @@ MixerStrip::build_route_ops_menu ()
items.push_back (MenuElem (_("Pin Connections..."), sigc::mem_fun (*this, &RouteUI::manage_pins)));
}
+ if (boost::dynamic_pointer_cast<MidiTrack>(_route) || _route->the_instrument ()) {
+ items.push_back (MenuElem (_("Patch Selector..."),
+ sigc::mem_fun(*this, &RouteUI::select_midi_patch)));
+ }
+
if (_route->the_instrument () && _route->the_instrument ()->output_streams().n_audio() > 2) {
// TODO ..->n_audio() > 1 && separate_output_groups) hard to check here every time.
items.push_back (MenuElem (_("Fan out to Busses"), sigc::bind (sigc::mem_fun (*this, &RouteUI::fan_out), true, true)));
diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc
index 0f7ef1b8f7..e1a7fb9f03 100644
--- a/gtk2_ardour/route_time_axis.cc
+++ b/gtk2_ardour/route_time_axis.cc
@@ -46,6 +46,7 @@
#include "ardour/event_type_map.h"
#include "ardour/pannable.h"
#include "ardour/panner.h"
+#include "ardour/plugin_insert.h"
#include "ardour/processor.h"
#include "ardour/profile.h"
#include "ardour/route_group.h"
@@ -73,6 +74,7 @@
#include "item_counts.h"
#include "keyboard.h"
#include "paste_context.h"
+#include "patch_change_widget.h"
#include "playlist_selector.h"
#include "point_selection.h"
#include "public_editor.h"
@@ -795,6 +797,13 @@ RouteTimeAxisView::build_display_menu ()
items.back().set_sensitive (_editor.get_selection().tracks.size() <= 1);
}
+ if (!is_midi_track () && _route->the_instrument ()) {
+ /* MIDI Bus */
+ items.push_back (MenuElem (_("Patch Selector..."),
+ sigc::mem_fun(*this, &RouteUI::select_midi_patch)));
+ items.push_back (SeparatorElem());
+ }
+
route_group_menu->detach ();
WeakRouteList r;
@@ -2190,8 +2199,42 @@ RouteTimeAxisView::processor_menu_item_toggled (RouteTimeAxisView::ProcessorAuto
}
void
+RouteTimeAxisView::reread_midnam ()
+{
+ boost::shared_ptr<PluginInsert> pi = boost::dynamic_pointer_cast<PluginInsert> (_route->the_instrument ());
+ assert (pi);
+ bool rv = pi->plugin ()->read_midnam();
+
+ if (rv && patch_change_dialog ()) {
+ patch_change_dialog ()->refresh ();
+ }
+}
+
+void
+RouteTimeAxisView::drop_instrument_ref ()
+{
+ midnam_connection.drop_connections ();
+}
+
+void
RouteTimeAxisView::processors_changed (RouteProcessorChange c)
{
+ if (_route) {
+ boost::shared_ptr<Processor> the_instrument (_route->the_instrument());
+ boost::shared_ptr<PluginInsert> pi = boost::dynamic_pointer_cast<PluginInsert> (the_instrument);
+ if (pi && pi->plugin ()->has_midnam ()) {
+ midnam_connection.drop_connections ();
+ the_instrument->DropReferences.connect (midnam_connection, invalidator (*this),
+ boost::bind (&RouteTimeAxisView::drop_instrument_ref, this),
+ gui_context());
+ pi->plugin()->UpdateMidnam.connect (midnam_connection, invalidator (*this),
+ boost::bind (&RouteTimeAxisView::reread_midnam, this),
+ gui_context());
+
+ reread_midnam ();
+ }
+ }
+
if (c.type == RouteProcessorChange::MeterPointChange) {
/* nothing to do if only the meter point has changed */
return;
diff --git a/gtk2_ardour/route_time_axis.h b/gtk2_ardour/route_time_axis.h
index 84c5469d93..3868dfebd1 100644
--- a/gtk2_ardour/route_time_axis.h
+++ b/gtk2_ardour/route_time_axis.h
@@ -176,7 +176,7 @@ protected:
bool route_group_click (GdkEventButton *);
- void processors_changed (ARDOUR::RouteProcessorChange);
+ virtual void processors_changed (ARDOUR::RouteProcessorChange);
virtual void add_processor_to_subplugin_menu (boost::weak_ptr<ARDOUR::Processor>);
void remove_processor_automation_node (ProcessorAutomationNode* pan);
@@ -306,6 +306,10 @@ private:
void update_playlist_tip ();
void parameter_changed (std::string const & p);
void update_track_number_visibility();
+
+ void drop_instrument_ref ();
+ void reread_midnam ();
+ PBD::ScopedConnectionList midnam_connection;
};
#endif /* __ardour_route_time_axis_h__ */
diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc
index 9d6a295578..6eca450f17 100644
--- a/gtk2_ardour/route_ui.cc
+++ b/gtk2_ardour/route_ui.cc
@@ -66,6 +66,7 @@
#include "keyboard.h"
#include "latency_gui.h"
#include "mixer_strip.h"
+#include "patch_change_widget.h"
#include "plugin_pin_dialog.h"
#include "rgb_macros.h"
#include "route_time_axis.h"
@@ -121,6 +122,8 @@ RouteUI::~RouteUI()
ARDOUR_UI::instance()->gui_object_state->remove_node (route_state_id());
}
+ delete_patch_change_dialog ();
+
_route.reset (); /* drop reference to route, so that it can be cleaned up */
route_connections.drop_connections ();
@@ -246,6 +249,7 @@ RouteUI::reset ()
delete mute_menu;
mute_menu = 0;
+ delete_patch_change_dialog ();
_color_picker.reset ();
denormal_menu_item = 0;
@@ -1613,6 +1617,39 @@ RouteUI::toggle_solo_safe (Gtk::CheckMenuItem* check)
_route->solo_safe_control()->set_value (check->get_active() ? 1.0 : 0.0, Controllable::UseGroup);
}
+void
+RouteUI::delete_patch_change_dialog ()
+{
+ if (!_route) {
+ return;
+ }
+ delete _route->patch_selector_dialog ();
+ _route->set_patch_selector_dialog (0);
+}
+
+PatchChangeGridDialog*
+RouteUI::patch_change_dialog () const
+{
+ return _route->patch_selector_dialog ();
+}
+
+void
+RouteUI::select_midi_patch ()
+{
+ if (patch_change_dialog ()) {
+ patch_change_dialog()->present ();
+ return;
+ }
+
+ /* note: RouteTimeAxisView is resoponsible to updating
+ * the Dialog (PatchChangeGridDialog::refresh())
+ * when the midnam model changes.
+ */
+ PatchChangeGridDialog* d = new PatchChangeGridDialog (_route);
+ _route->set_patch_selector_dialog (d);
+ d->present ();
+}
+
/** Ask the user to choose a colour, and then apply that color to my route */
void
RouteUI::choose_color ()
diff --git a/gtk2_ardour/route_ui.h b/gtk2_ardour/route_ui.h
index 4550abd4c2..d39e8deabf 100644
--- a/gtk2_ardour/route_ui.h
+++ b/gtk2_ardour/route_ui.h
@@ -63,6 +63,7 @@ namespace ArdourWidgets {
class ArdourWindow;
class IOSelectorWindow;
class ControlSlaveUI;
+class PatchChangeGridDialog;
class SaveTemplateDialog;
class RoutePinWindowProxy : public WM::ProxyBase
@@ -113,6 +114,8 @@ public:
Gdk::Color route_color () const;
void choose_color ();
+ void select_midi_patch ();
+
bool ignore_toggle;
bool wait_for_release;
bool multiple_mute_change;
@@ -299,10 +302,13 @@ protected:
bool mark_hidden (bool yn);
+ PatchChangeGridDialog* patch_change_dialog () const;
+
private:
void parameter_changed (std::string const&);
void relabel_solo_button ();
void track_mode_changed ();
+ void delete_patch_change_dialog ();
std::string route_state_id () const;