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>
This commit is contained in:
Oskar Wallgren
2023-10-05 16:51:52 +02:00
committed by GitHub
parent 8b94bd8e65
commit 579d132b8a
2 changed files with 9 additions and 2 deletions

View File

@@ -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;

View File

@@ -1166,10 +1166,14 @@ void SetupDialog::audioInterfaceChanged(const QString & iface)
void SetupDialog::updateBufferSizeWarning(int value)
{
QString text = "<ul>";
if((value & (value - 1)) != 0) // <=> value is not a power of 2 (for value > 0)
// 'value' is not a power of 2 (for value > 0) and under 256. On buffer sizes larger than 256
// lmms works with chunks of size 256 and only the final mix will use the actual buffer size.
// Plugins don't see a larger buffer size than 256 so anything larger than this is functionally
// a 'power of 2' value.
if(((value & (value - 1)) != 0) && value < 256)
{
text += "<li>" + tr("The currently selected value is not a power of 2 "
"(32, 64, 128, 256, 512, 1024, ...). Some plugins may not be available.") + "</li>";
"(32, 64, 128, 256). Some plugins may not be available.") + "</li>";
}
if(value <= 32)
{