1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-20 01:14:20 +00:00

AU Client: Ensure processBlock receives AudioBuffer of correct size

fc378aaf9a introduced a regression where
plugins with no audio channels (such as MIDI FX plugins) would receive
an audio buffer with a length-in-samples of '0', rather than the actual
block length.
This commit is contained in:
reuk 2022-03-03 17:18:45 +00:00
parent 88b5f0dc95
commit 5b3aa7fc2d
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C

View file

@ -157,13 +157,10 @@ struct AudioUnitHelpers
AudioBuffer<float>& getBuffer (UInt32 frames) noexcept
{
#if JUCE_DEBUG
for (int i = 0; i < (int) channels.size(); ++i)
jassert (channels[(size_t) i] != nullptr);
#endif
jassert (std::none_of (channels.begin(), channels.end(), [] (auto* x) { return x == nullptr; }));
if (! channels.empty())
mutableBuffer.setDataToReferTo (channels.data(), (int) channels.size(), static_cast<int> (frames));
const auto channelPtr = channels.empty() ? scratch.getArrayOfWritePointers() : channels.data();
mutableBuffer.setDataToReferTo (channelPtr, (int) channels.size(), static_cast<int> (frames));
return mutableBuffer;
}