- boost::shared_ptr<AutomationControl> bank_msb = _route->automation_control(Evoral::Parameter (MidiCCAutomation, chn, MIDI_CTL_MSB_BANK), true);
- boost::shared_ptr<AutomationControl> bank_lsb = _route->automation_control(Evoral::Parameter (MidiCCAutomation, chn, MIDI_CTL_LSB_BANK), true);
- boost::shared_ptr<AutomationControl> program = _route->automation_control(Evoral::Parameter (MidiPgmChangeAutomation, chn), true);
-
- bank_msb->Changed.connect (_ac_connections, invalidator (*this),
- boost::bind (&PatchChangeWidget::bank_changed, this), gui_context ());
- bank_lsb->Changed.connect (_ac_connections, invalidator (*this),
- boost::bind (&PatchChangeWidget::bank_changed, this), gui_context ());
- program->Changed.connect (_ac_connections, invalidator (*this),
- boost::bind (&PatchChangeWidget::program_changed, this), gui_context ());
+ if (boost::dynamic_pointer_cast<MidiTrack> (_route)) {
+ boost::shared_ptr<AutomationControl> bank_msb = _route->automation_control(Evoral::Parameter (MidiCCAutomation, chn, MIDI_CTL_MSB_BANK), true);
+ boost::shared_ptr<AutomationControl> bank_lsb = _route->automation_control(Evoral::Parameter (MidiCCAutomation, chn, MIDI_CTL_LSB_BANK), true);
+ boost::shared_ptr<AutomationControl> program = _route->automation_control(Evoral::Parameter (MidiPgmChangeAutomation, chn), true);
+
+ bank_msb->Changed.connect (_ac_connections, invalidator (*this),
+ boost::bind (&PatchChangeWidget::bank_changed, this), gui_context ());
+ bank_lsb->Changed.connect (_ac_connections, invalidator (*this),
+ boost::bind (&PatchChangeWidget::bank_changed, this), gui_context ());
+ program->Changed.connect (_ac_connections, invalidator (*this),
+ boost::bind (&PatchChangeWidget::program_changed, this), gui_context ());
+ } else if (boost::shared_ptr<PluginInsert> pi = boost::dynamic_pointer_cast<PluginInsert> (_route->the_instrument())) {
+ if (pi->plugin()->knows_bank_patch ()) {
+ pi->plugin ()->BankPatchChange.connect (_ac_connections, invalidator (*this),
+ boost::bind (&PatchChangeWidget::bankpatch_changed, this, _1), gui_context ());
+ } else {
+ _no_notifications = true;
+ // TODO add note: instrument does not report changes.
+ }
+ }