summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2016-04-06 04:59:28 +0200
committerRobin Gareus <robin@gareus.org>2016-04-06 05:15:09 +0200
commit31b2c7858124a382a59e381dc1b46212be15e046 (patch)
tree198b06fa12161d6ebbf8cd62246c0b5347362fd3 /libs
parent1c3c1055747b93da3d620cfc9adfd573e72dc07f (diff)
update processor in-place mode when pin-mapping changes
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/ardour/plugin_insert.h2
-rw-r--r--libs/ardour/plugin_insert.cc40
2 files changed, 31 insertions, 11 deletions
diff --git a/libs/ardour/ardour/plugin_insert.h b/libs/ardour/ardour/plugin_insert.h
index 26177ebf95..0053f714dc 100644
--- a/libs/ardour/ardour/plugin_insert.h
+++ b/libs/ardour/ardour/plugin_insert.h
@@ -100,6 +100,7 @@ class LIBARDOUR_API PluginInsert : public Processor
void set_output_map (uint32_t, ChanMapping);
bool reset_map (bool emit = true);
bool sanitize_maps ();
+ bool check_inplace ();
// these are ports visible on the outside
ChanCount output_streams() const;
@@ -300,6 +301,7 @@ class LIBARDOUR_API PluginInsert : public Processor
bool _strict_io;
bool _custom_cfg;
bool _maps_from_state;
+ bool _mapping_changed;
Match private_can_support_io_configuration (ChanCount const &, ChanCount &) const;
Match automatic_can_support_io_configuration (ChanCount const &, ChanCount &) const;
diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc
index eebd07a2c5..cdf1e600a8 100644
--- a/libs/ardour/plugin_insert.cc
+++ b/libs/ardour/plugin_insert.cc
@@ -468,8 +468,13 @@ PluginInsert::flush ()
void
PluginInsert::connect_and_run (BufferSet& bufs, pframes_t nframes, framecnt_t offset, bool with_auto, framepos_t now)
{
+ // TODO: atomically copy maps & _no_inplace
PinMappings in_map (_in_map);
PinMappings out_map (_out_map);
+ if (_mapping_changed) {
+ _no_inplace = check_inplace ();
+ _mapping_changed = false;
+ }
#if 1
// TODO optimize special case.
@@ -948,6 +953,7 @@ PluginInsert::set_input_map (uint32_t num, ChanMapping m) {
sanitize_maps ();
if (changed) {
PluginMapChanged (); /* EMIT SIGNAL */
+ _mapping_changed = true;
}
}
}
@@ -960,6 +966,7 @@ PluginInsert::set_output_map (uint32_t num, ChanMapping m) {
sanitize_maps ();
if (changed) {
PluginMapChanged (); /* EMIT SIGNAL */
+ _mapping_changed = true;
}
}
}
@@ -1030,6 +1037,24 @@ PluginInsert::is_channelstrip () const {
#endif
bool
+PluginInsert::check_inplace ()
+{
+ // auto-detect if inplace processing is possible
+ bool inplace_ok = true;
+ for (uint32_t pc = 0; pc < get_count() && inplace_ok ; ++pc) {
+ if (!_in_map[pc].is_monotonic ()) {
+ inplace_ok = false;
+ }
+ if (!_out_map[pc].is_monotonic ()) {
+ inplace_ok = false;
+ }
+ }
+ bool no_inplace = !inplace_ok || _plugins.front()->inplace_broken ();
+ DEBUG_TRACE (DEBUG::ChanMapping, string_compose ("%1 %2\n", name(), no_inplace ? "No Inplace Processing" : "In-Place"));
+ return no_inplace;
+}
+
+bool
PluginInsert::sanitize_maps ()
{
bool changed = false;
@@ -1137,6 +1162,7 @@ PluginInsert::reset_map (bool emit)
}
if (emit) {
PluginMapChanged (); /* EMIT SIGNAL */
+ _mapping_changed = true;
}
return true;
}
@@ -1276,17 +1302,9 @@ PluginInsert::configure_io (ChanCount in, ChanCount out)
#endif
}
- // auto-detect if inplace processing is possible
- bool inplace_ok = true;
- for (uint32_t pc = 0; pc < get_count() && inplace_ok ; ++pc) {
- if (!_in_map[pc].is_monotonic ()) {
- inplace_ok = false;
- }
- if (!_out_map[pc].is_monotonic ()) {
- inplace_ok = false;
- }
- }
- _no_inplace = !inplace_ok || _plugins.front()->inplace_broken ();
+ _no_inplace = check_inplace ();
+ _mapping_changed = false;
+ DEBUG_TRACE (DEBUG::ChanMapping, string_compose ("%1 %2\n", name(), _no_inplace ? "No Inplace Processing" : "In-Place"));
if (old_in != in || old_out != out || old_internal != _configured_internal
|| (old_match.method != _match.method && (old_match.method == Split || _match.method == Split))