From 9a0b1cce075f32768197d001f269a191869cc4e6 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 5 Jun 2012 04:25:53 +0000 Subject: [PATCH] when selecting one of a set of variable I/O configs for an AudioUnit so that its output matches its input, be sure to define the output configuration before returning to continue with configuration of subsequent processors. Fixes crash when loading various non-apple AU's as the first pre-fader plugin (#4909) git-svn-id: svn://localhost/ardour2/branches/3.0@12566 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/audio_unit.cc | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/libs/ardour/audio_unit.cc b/libs/ardour/audio_unit.cc index 6b6d7ae317..9151e76bec 100644 --- a/libs/ardour/audio_unit.cc +++ b/libs/ardour/audio_unit.cc @@ -1019,7 +1019,8 @@ AUPlugin::can_support_io_configuration (const ChanCount& in, ChanCount& out) con vector >& io_configs = pinfo->cache.io_configs; - DEBUG_TRACE (DEBUG::AudioUnits, string_compose ("%1 has %2 IO configurations\n", name(), io_configs.size())); + DEBUG_TRACE (DEBUG::AudioUnits, string_compose ("%1 has %2 IO configurations, looking for %3 in, %4 out\n", + name(), io_configs.size(), in, out)); //Ardour expects the plugin to tell it the output //configuration but AU plugins can have multiple I/O @@ -1034,7 +1035,13 @@ AUPlugin::can_support_io_configuration (const ChanCount& in, ChanCount& out) con int32_t possible_out = i->second; if ((possible_in == audio_in) && (possible_out == audio_out)) { - DEBUG_TRACE (DEBUG::AudioUnits, string_compose ("\tCHOSEN: in %1 out %2\n", in, out)); + DEBUG_TRACE (DEBUG::AudioUnits, string_compose ("\tCHOSEN: %1 in %2 out to match in %3 out %4\n", + possible_in, possible_out, + in, out)); + + out.set (DataType::MIDI, 0); + out.set (DataType::AUDIO, audio_out); + return 1; } } @@ -1300,9 +1307,14 @@ 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", + name(), input_channels, output_channels, _has_midi_input, + bufs.count(), bufs.available())); + /* the apparent number of buffers matches our input configuration, but we know that the bufferset has the capacity to handle our outputs. */ + assert (bufs.available() >= ChanCount (DataType::AUDIO, output_channels)); input_buffers = &bufs; @@ -1310,10 +1322,6 @@ AUPlugin::connect_and_run (BufferSet& bufs, ChanMapping in_map, ChanMapping out_ input_offset = offset; cb_offset = 0; - DEBUG_TRACE (DEBUG::AudioUnits, string_compose ("%1 in %2 out %3 MIDI %4 bufs %5 (available %6)\n", - name(), input_channels, output_channels, _has_midi_input, - bufs.count(), bufs.available())); - buffers->mNumberBuffers = output_channels; for (int32_t i = 0; i < output_channels; ++i) {