Skip to content

Commit

Permalink
Set 32 for buffersize min value in gui (LMMS#4336)
Browse files Browse the repository at this point in the history
This is a bit too low resolution as some values cannot be reached by dragging the slider so we also reduce the maximum buffer size to 4096.
  • Loading branch information
bth authored and zonkmachine committed Jan 13, 2019
1 parent 83e2104 commit df36333
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/gui/SetupDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
#include "MidiApple.h"
#include "MidiDummy.h"

constexpr int BUFFERSIZE_RESOLUTION = 32;

inline void labelWidget( QWidget * _w, const QString & _txt )
{
QLabel * title = new QLabel( _txt, _w );
Expand Down Expand Up @@ -176,12 +178,12 @@ SetupDialog::SetupDialog( ConfigTabs _tab_to_open ) :
bufsize_tw->setFixedHeight( 80 );

m_bufSizeSlider = new QSlider( Qt::Horizontal, bufsize_tw );
m_bufSizeSlider->setRange( 1, 256 );
m_bufSizeSlider->setRange( 1, 128 );
m_bufSizeSlider->setTickPosition( QSlider::TicksBelow );
m_bufSizeSlider->setPageStep( 8 );
m_bufSizeSlider->setTickInterval( 8 );
m_bufSizeSlider->setGeometry( 10, 16, 340, 18 );
m_bufSizeSlider->setValue( m_bufferSize / 64 );
m_bufSizeSlider->setValue( m_bufferSize / BUFFERSIZE_RESOLUTION );

connect( m_bufSizeSlider, SIGNAL( valueChanged( int ) ), this,
SLOT( setBufferSize( int ) ) );
Expand Down Expand Up @@ -877,7 +879,7 @@ void SetupDialog::accept()

void SetupDialog::setBufferSize( int _value )
{
const int step = DEFAULT_BUFFER_SIZE / 64;
const int step = DEFAULT_BUFFER_SIZE / BUFFERSIZE_RESOLUTION;
if( _value > step && _value % step )
{
int mod_value = _value % step;
Expand All @@ -897,7 +899,7 @@ void SetupDialog::setBufferSize( int _value )
m_bufSizeSlider->setValue( _value );
}

m_bufferSize = _value * 64;
m_bufferSize = _value * BUFFERSIZE_RESOLUTION;
m_bufSizeLbl->setText( tr( "Frames: %1\nLatency: %2 ms" ).arg(
m_bufferSize ).arg(
1000.0f * m_bufferSize /
Expand All @@ -910,7 +912,7 @@ void SetupDialog::setBufferSize( int _value )

void SetupDialog::resetBufSize()
{
setBufferSize( DEFAULT_BUFFER_SIZE / 64 );
setBufferSize( DEFAULT_BUFFER_SIZE / BUFFERSIZE_RESOLUTION );
}


Expand Down

0 comments on commit df36333

Please sign in to comment.