From 426e2f2a194c8daf70da2552a2ad03cfef316efd Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Fri, 15 Apr 2016 13:36:02 +0200 Subject: [PATCH] AU synth inplace processing --- libs/ardour/audio_unit.cc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/libs/ardour/audio_unit.cc b/libs/ardour/audio_unit.cc index cab6a56c92..2ded196f52 100644 --- a/libs/ardour/audio_unit.cc +++ b/libs/ardour/audio_unit.cc @@ -1471,9 +1471,18 @@ AUPlugin::connect_and_run (BufferSet& bufs, ChanMapping in_map, ChanMapping out_ _last_nframes = nframes; } - DEBUG_TRACE (DEBUG::AudioUnits, string_compose ("%1 in %2 out %3 MIDI %4 bufs %5 (available %6)\n", + /* test if we can run in-place; only compare audio buffers */ + bool inplace = true; + ChanMapping::Mappings inmap (in_map.mappings ()); + ChanMapping::Mappings outmap (out_map.mappings ()); + assert (outmap[DataType::AUDIO].size () > 0); + if (inmap[DataType::AUDIO].size() > 0 && inmap != outmap) { + inplace = false; + } + + DEBUG_TRACE (DEBUG::AudioUnits, string_compose ("%1 in %2 out %3 MIDI %4 bufs %5 (available %6) Inplace: %7\n", name(), input_channels, output_channels, _has_midi_input, - bufs.count(), bufs.available())); + bufs.count(), bufs.available(), inplace)); /* the apparent number of buffers matches our input configuration, but we know that the bufferset * has the capacity to handle our outputs. @@ -1488,7 +1497,6 @@ AUPlugin::connect_and_run (BufferSet& bufs, ChanMapping in_map, ChanMapping out_ cb_offset = 0; buffers->mNumberBuffers = output_channels; - bool inplace = in_map == out_map; ChanCount bufs_count (DataType::AUDIO, 1); BufferSet& scratch_bufs = _session.get_scratch_buffers(bufs_count);