From 7cc2e8c969e7b778af90f3b45a4c3fa3cbc90ef6 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 26 Jul 2016 04:17:10 +0200 Subject: [PATCH] add initial midi sidechain if plugin has one. --- libs/ardour/ardour/plugin_insert.h | 2 +- libs/ardour/plugin_insert.cc | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/libs/ardour/ardour/plugin_insert.h b/libs/ardour/ardour/plugin_insert.h index 564feb0c63..d38523a77d 100644 --- a/libs/ardour/ardour/plugin_insert.h +++ b/libs/ardour/ardour/plugin_insert.h @@ -156,7 +156,7 @@ class LIBARDOUR_API PluginInsert : public Processor void set_strict_io (bool b); void set_custom_cfg (bool b); bool set_preset_out (const ChanCount&); - bool add_sidechain (uint32_t n_audio = 1); + bool add_sidechain (uint32_t n_audio = 1, uint32_t n_midi = 0); bool del_sidechain (); void set_sidechain_latency (uint32_t, uint32_t); boost::shared_ptr sidechain () const { return _sidechain; } diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc index 7fb799d492..a7e512713d 100644 --- a/libs/ardour/plugin_insert.cc +++ b/libs/ardour/plugin_insert.cc @@ -85,8 +85,8 @@ PluginInsert::PluginInsert (Session& s, boost::shared_ptr plug) add_plugin (plug); create_automatable_parameters (); const ChanCount& sc (sidechain_input_pins ()); - if (sc.n_audio () > 0) { - add_sidechain (sc.n_audio ()); + if (sc.n_audio () > 0 || sc.n_midi () > 0) { + add_sidechain (sc.n_audio (), sc.n_midi ()); } } } @@ -190,14 +190,14 @@ PluginInsert::set_preset_out (const ChanCount& c) } bool -PluginInsert::add_sidechain (uint32_t n_audio) +PluginInsert::add_sidechain (uint32_t n_audio, uint32_t n_midi) { // caller must hold process lock if (_sidechain) { return false; } std::ostringstream n; - if (n_audio > 0) { + if (n_audio > 0 || n_midi > 0) { n << "Sidechain " << Session::next_name_id (); } else { n << "TO BE RESET FROM XML"; @@ -206,7 +206,10 @@ PluginInsert::add_sidechain (uint32_t n_audio) _sidechain = boost::shared_ptr (sc); _sidechain->activate (); for (uint32_t n = 0; n < n_audio; ++n) { - _sidechain->input()->add_port ("", owner()); // add a port, don't connect. + _sidechain->input()->add_port ("", owner(), DataType::AUDIO); // add a port, don't connect. + } + for (uint32_t n = 0; n < n_midi; ++n) { + _sidechain->input()->add_port ("", owner(), DataType::MIDI); // add a port, don't connect. } PluginConfigChanged (); /* EMIT SIGNAL */ return true;