diff options
Diffstat (limited to 'gtk2_ardour/mixer_strip.cc')
-rw-r--r-- | gtk2_ardour/mixer_strip.cc | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index aa49e20d0c..e7c3f138b8 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -41,6 +41,7 @@ #include "ardour/pannable.h" #include "ardour/panner.h" #include "ardour/panner_shell.h" +#include "ardour/panner_manager.h" #include "ardour/port.h" #include "ardour/profile.h" #include "ardour/route.h" @@ -515,7 +516,10 @@ MixerStrip::set_route (boost::shared_ptr<Route> rt) _route->output()->changed.connect (*this, invalidator (*this), boost::bind (&MixerStrip::update_output_display, this), gui_context()); _route->route_group_changed.connect (route_connections, invalidator (*this), boost::bind (&MixerStrip::route_group_changed, this), gui_context()); + _route->io_changed.connect (route_connections, invalidator (*this), boost::bind (&MixerStrip::io_changed_proxy, this), gui_context ()); + if (_route->panner_shell()) { + update_panner_choices(); _route->panner_shell()->Changed.connect (route_connections, invalidator (*this), boost::bind (&MixerStrip::connect_to_pan, this), gui_context()); } @@ -1019,9 +1023,48 @@ MixerStrip::connect_to_pan () p->automation_state_changed.connect (panstate_connection, invalidator (*this), boost::bind (&PannerUI::pan_automation_state_changed, &panners), gui_context()); p->automation_style_changed.connect (panstyle_connection, invalidator (*this), boost::bind (&PannerUI::pan_automation_style_changed, &panners), gui_context()); - panners.panshell_changed (); + /* This call reduncant, PannerUI::set_panner() connects to _panshell->Changed itself + * However, that only works a panner was previously set. + * + * PannerUI must remain subscribed to _panshell->Changed() in case + * we switch the panner eg. AUX-Send and back + * _route->panner_shell()->Changed() vs _panshell->Changed + */ + if (panners._panner == 0) { + panners.panshell_changed (); + } } +void +MixerStrip::update_panner_choices () +{ + ENSURE_GUI_THREAD (*this, &MixerStrip::update_panner_choices) + if (!_route->panner_shell()) { return; } + + int in = _route->output()->n_ports().n_audio(); + int out = in; + + if (_route->panner()) { + in = _route->panner()->in().n_audio(); + } + + if (out < 2 || in == 0) { + panners.set_available_panners(_route, std::map<std::string,std::string>()); + return; + } + + std::map<std::string,std::string> panner_list; + std::list<PannerInfo*> panner_info = PannerManager::instance().panner_info; + /* get available panners for current configuration. */ + for (list<PannerInfo*>::iterator p = panner_info.begin(); p != panner_info.end(); ++p) { + PanPluginDescriptor* d = &(*p)->descriptor; + if (d->in != -1 && d->in != in) continue; + if (d->out != -1 && d->out != out) continue; + if (d->in == -1 && d->out == -1 && out <= 2) continue; + panner_list.insert(std::pair<std::string,std::string>(d->panner_uri,d->name)); + } + panners.set_available_panners(_route, panner_list); +} /* * Output port labelling @@ -1273,6 +1316,12 @@ MixerStrip::diskstream_changed () } void +MixerStrip::io_changed_proxy () +{ + Glib::signal_idle().connect_once (sigc::mem_fun (*this, &MixerStrip::update_panner_choices)); +} + +void MixerStrip::port_connected_or_disconnected (boost::weak_ptr<Port> wa, boost::weak_ptr<Port> wb) { boost::shared_ptr<Port> a = wa.lock (); @@ -1843,6 +1892,8 @@ MixerStrip::show_send (boost::shared_ptr<Send> send) gain_meter().setup_meters (); panner_ui().set_panner (_current_delivery->panner_shell(), _current_delivery->panner()); + panner_ui().set_available_panners(boost::shared_ptr<ARDOUR::Route>(), std::map<std::string,std::string>()); + panner_ui().setup_pan (); /* make sure the send has audio output */ @@ -1884,6 +1935,7 @@ MixerStrip::revert_to_default_display () gain_meter().setup_meters (); panner_ui().set_panner (_route->main_outs()->panner_shell(), _route->main_outs()->panner()); + update_panner_choices(); panner_ui().setup_pan (); if (has_audio_outputs ()) { |