gearmulator

Emulation of classic VA synths of the late 90s/2000s that are based on Motorola 56300 family DSPs
Log | Files | Refs | Submodules | README | LICENSE

commit 3fb9d2ddb93ea83549b8b96eefdc9a6ece477590
parent 524325ff381d194630575d5aa1589fd071b861c2
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date:   Thu, 22 Jul 2021 20:58:07 +0200

fix broken AU validation

Diffstat:
Msource/synthLib/device.cpp | 32++++++++++++++++++++++++++++----
1 file changed, 28 insertions(+), 4 deletions(-)

diff --git a/source/synthLib/device.cpp b/source/synthLib/device.cpp @@ -62,12 +62,36 @@ namespace synthLib void Device::process(float** _inputs, float** _outputs, const size_t _size, const std::vector<SMidiEvent>& _midiIn, std::vector<SMidiEvent>& _midiOut) { - for(size_t i=0; i<_midiIn.size(); ++i) - sendMidi(_midiIn[i], _midiOut); + for (const auto& ev : _midiIn) + sendMidi(ev, _midiOut); - m_periph.getEsai().processAudioInterleaved(_inputs, _outputs, _size, 2, 2, m_latency); + const auto maxSize = getPeriph().getEsai().getAudioInputs()[0].capacity() >> 2; - readMidiOut(_midiOut); + if(_size <= maxSize) + { + m_periph.getEsai().processAudioInterleaved(_inputs, _outputs, _size, 2, 2, m_latency); + + readMidiOut(_midiOut); + } + else + { + // The only real "host" doing stuff like this is the AU validation tool which comes with 4096 samples at 11025 Hz. We do not want to increase the ring buffer sizes of ESAI even more + size_t remaining = _size; + + while(remaining >= maxSize) + { + const size_t size = std::min(maxSize, remaining); + m_periph.getEsai().processAudioInterleaved(_inputs, _outputs, size, 2, 2, m_latency); + readMidiOut(_midiOut); + + _inputs[0] += size; + _inputs[1] += size; + _outputs[0] += size; + _outputs[1] += size; + + remaining -= size; + } + } } void Device::setLatencySamples(const uint32_t _size)