summaryrefslogtreecommitdiff
path: root/libs/ardour/route.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2016-03-27 21:33:40 +0200
committerRobin Gareus <robin@gareus.org>2016-03-27 21:33:40 +0200
commitc444105710cc540d3d6a14c9cf710f1e14fdbe26 (patch)
tree70d7bff0313d9232efbc32ac77eaf09aba00404d /libs/ardour/route.cc
parent41b1ecaaf0a99698070cbb256cfe0183595f0f71 (diff)
closing in on pin management.
overall the PluginInsert API is complete. many implementation details remain.
Diffstat (limited to 'libs/ardour/route.cc')
-rw-r--r--libs/ardour/route.cc75
1 files changed, 72 insertions, 3 deletions
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc
index 0614ab7ef5..2ce15a6149 100644
--- a/libs/ardour/route.cc
+++ b/libs/ardour/route.cc
@@ -1463,7 +1463,7 @@ Route::add_processors (const ProcessorList& others, boost::shared_ptr<Processor>
boost::shared_ptr<PluginInsert> pi;
if ((pi = boost::dynamic_pointer_cast<PluginInsert>(*i)) != 0) {
- pi->set_count (1);
+ pi->set_count (1); // why? configure_processors_unlocked() will re-do this
pi->set_strict_io (_strict_io);
}
@@ -2167,8 +2167,8 @@ Route::configure_processors_unlocked (ProcessorStreams* err)
*/
processor_max_streams = ChanCount::max(processor_max_streams, pi->input_streams());
processor_max_streams = ChanCount::max(processor_max_streams, pi->output_streams());
- processor_max_streams = ChanCount::max(processor_max_streams, pi->natural_input_streams());
- processor_max_streams = ChanCount::max(processor_max_streams, pi->natural_output_streams());
+ processor_max_streams = ChanCount::max(processor_max_streams, pi->natural_input_streams() * pi->get_count());
+ processor_max_streams = ChanCount::max(processor_max_streams, pi->natural_output_streams() * pi->get_count());
}
out = c->second;
@@ -2402,6 +2402,75 @@ Route::reorder_processors (const ProcessorList& new_order, ProcessorStreams* err
}
bool
+Route::reset_plugin_insert (boost::shared_ptr<Processor> proc)
+{
+ ChanCount unused;
+ return customize_plugin_insert (proc, 0, unused);
+}
+
+bool
+Route::customize_plugin_insert (boost::shared_ptr<Processor> proc, uint32_t count, ChanCount outs)
+{
+ if (_strict_io) {
+ return false;
+ }
+
+ boost::shared_ptr<PluginInsert> pi;
+ if ((pi = boost::dynamic_pointer_cast<PluginInsert>(proc)) == 0) {
+ return false;
+ }
+
+ {
+ bool found = false;
+ Glib::Threads::RWLock::ReaderLock lm (_processor_lock);
+ for (ProcessorList::iterator p = _processors.begin(); p != _processors.end(); ++p) {
+ if (*p == proc) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ return false;
+ }
+ }
+
+ {
+ Glib::Threads::Mutex::Lock lx (AudioEngine::instance()->process_lock ());
+ Glib::Threads::RWLock::WriterLock lm (_processor_lock);
+ ProcessorState pstate (this);
+
+ assert (!pi->strict_io ());
+ bool old_cust = pi->custom_cfg ();
+ uint32_t old_cnt = pi->get_count ();
+ ChanCount old_chan = pi->output_streams ();
+
+ if (count == 0) {
+ pi->set_custom_cfg (false);
+ } else {
+ pi->set_custom_cfg (true);
+ pi->set_count (count);
+ pi->set_outputs (outs);
+ }
+
+ list<pair<ChanCount, ChanCount> > c = try_configure_processors_unlocked (n_inputs (), 0);
+ if (c.empty()) {
+ /* not possible */
+
+ pi->set_count (old_cnt);
+ pi->set_outputs (old_chan);
+ pi->set_custom_cfg (old_cust);
+
+ return false;
+ }
+ configure_processors_unlocked (0);
+ }
+
+ processors_changed (RouteProcessorChange ()); /* EMIT SIGNAL */
+ _session.set_dirty ();
+ return true;
+}
+
+bool
Route::set_strict_io (const bool enable)
{
if (_strict_io != enable) {