From 140a3f4a1091728d29fbd56d07bdbb652937d621 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Fri, 6 Mar 2020 05:51:01 +0100 Subject: [PATCH] Fix Coreaudio buffersize changes --- libs/backends/coreaudio/coreaudio_backend.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libs/backends/coreaudio/coreaudio_backend.cc b/libs/backends/coreaudio/coreaudio_backend.cc index 5d5f20844d..c7d2754b2d 100644 --- a/libs/backends/coreaudio/coreaudio_backend.cc +++ b/libs/backends/coreaudio/coreaudio_backend.cc @@ -332,15 +332,17 @@ CoreAudioBackend::set_buffer_size (uint32_t bs) if (bs <= 0 || bs >= _max_buffer_size) { return -1; } - _samples_per_period = bs; + if (!_run) { + _samples_per_period = bs; + engine.buffer_size_change (bs); + } _pcmio->set_samples_per_period(bs); if (_run) { - pbd_mach_set_realtime_policy (_main_thread, 1e9 * _samples_per_period / _samplerate); + pbd_mach_set_realtime_policy (_main_thread, 1e9 * bs / _samplerate); } for (std::vector::const_iterator i = _threads.begin (); i != _threads.end (); ++i) { - pbd_mach_set_realtime_policy (*i, 1e9 * _samples_per_period / _samplerate); + pbd_mach_set_realtime_policy (*i, 1e9 * bs / _samplerate); } - //engine.buffer_size_change (bs); return 0; }