From 579d132b8a3978c5a0e08534bbbce30b167bd129 Mon Sep 17 00:00:00 2001 From: Oskar Wallgren Date: Thu, 5 Oct 2023 16:51:52 +0200 Subject: [PATCH] SetupDialog - message on buffer size larger than 256 (#6906) LMMS supports the Lv2 feature powerOf2BlockLength. Plugins that need to be a power of two (32, 64, 128...) are not loaded if the buffer size setting is set to something else. However this logic breaks down on buffer sizes larger than 256. On larger sizes, LMMS works with chunks of 256 and plugins are still presented with a value of 256. So anything larger than 256 is a valid size as powerOf2BlockLength is concerned. LMMS supported powerOf2BlockLength correctly since 9c46370 but setup manager messages and comments are wrong in too strictly demanding an actual power of two value. 768 is not a power of two, but three chunks of 256 which are power of two values. Co-authored-by: Johannes Lorenz <1042576+JohannesLorenz@users.noreply.github.com> --- src/core/AudioEngine.cpp | 3 +++ src/gui/modals/SetupDialog.cpp | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/core/AudioEngine.cpp b/src/core/AudioEngine.cpp index 29c54647c..2f4459748 100644 --- a/src/core/AudioEngine.cpp +++ b/src/core/AudioEngine.cpp @@ -126,6 +126,9 @@ AudioEngine::AudioEngine( bool renderOnly ) : m_framesPerPeriod = DEFAULT_BUFFER_SIZE; } + // lmms works with chunks of size DEFAULT_BUFFER_SIZE (256) and only the final mix will use the actual + // buffer size. Plugins don't see a larger buffer size than 256. If m_framesPerPeriod is larger than + // DEFAULT_BUFFER_SIZE, it's set to DEFAULT_BUFFER_SIZE and the rest is handled by an increased fifoSize. else if( m_framesPerPeriod > DEFAULT_BUFFER_SIZE ) { fifoSize = m_framesPerPeriod / DEFAULT_BUFFER_SIZE; diff --git a/src/gui/modals/SetupDialog.cpp b/src/gui/modals/SetupDialog.cpp index e64d1c572..209422563 100644 --- a/src/gui/modals/SetupDialog.cpp +++ b/src/gui/modals/SetupDialog.cpp @@ -1166,10 +1166,14 @@ void SetupDialog::audioInterfaceChanged(const QString & iface) void SetupDialog::updateBufferSizeWarning(int value) { QString text = "