Fix #1878
This commit is contained in:
@@ -46,7 +46,7 @@ class EXPORT Engine : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static void init();
|
||||
static void init( bool renderOnly );
|
||||
static void destroy();
|
||||
|
||||
// core
|
||||
|
||||
@@ -382,7 +382,7 @@ private:
|
||||
} ;
|
||||
|
||||
|
||||
Mixer();
|
||||
Mixer( bool renderOnly );
|
||||
virtual ~Mixer();
|
||||
|
||||
void startProcessing( bool _needs_fifo = true );
|
||||
|
||||
@@ -50,7 +50,7 @@ DummyTrackContainer * Engine::s_dummyTC = NULL;
|
||||
|
||||
|
||||
|
||||
void Engine::init()
|
||||
void Engine::init( bool renderOnly )
|
||||
{
|
||||
Engine *engine = inst();
|
||||
|
||||
@@ -60,7 +60,7 @@ void Engine::init()
|
||||
|
||||
emit engine->initProgress(tr("Initializing data structures"));
|
||||
s_projectJournal = new ProjectJournal;
|
||||
s_mixer = new Mixer;
|
||||
s_mixer = new Mixer( renderOnly );
|
||||
s_song = new Song;
|
||||
s_fxMixer = new FxMixer;
|
||||
s_bbTrackContainer = new BBTrackContainer;
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
|
||||
|
||||
|
||||
Mixer::Mixer() :
|
||||
Mixer::Mixer( bool renderOnly ) :
|
||||
m_framesPerPeriod( DEFAULT_BUFFER_SIZE ),
|
||||
m_workingBuf( NULL ),
|
||||
m_inputBufferRead( 0 ),
|
||||
@@ -82,38 +82,34 @@ Mixer::Mixer() :
|
||||
clearAudioBuffer( m_inputBuffer[i], m_inputBufferSize[i] );
|
||||
}
|
||||
|
||||
// just rendering?
|
||||
if( !gui )
|
||||
// determine FIFO size and number of frames per period
|
||||
int fifoSize = 1;
|
||||
|
||||
if (!renderOnly)
|
||||
{
|
||||
m_framesPerPeriod = DEFAULT_BUFFER_SIZE;
|
||||
m_fifo = new fifo( 1 );
|
||||
}
|
||||
else if( ConfigManager::inst()->value( "mixer", "framesperaudiobuffer"
|
||||
).toInt() >= 32 )
|
||||
{
|
||||
m_framesPerPeriod =
|
||||
(fpp_t) ConfigManager::inst()->value( "mixer",
|
||||
"framesperaudiobuffer" ).toInt();
|
||||
m_framesPerPeriod =
|
||||
( fpp_t ) ConfigManager::inst()->
|
||||
value( "mixer", "framesperaudiobuffer" ).toInt();
|
||||
|
||||
if (m_framesPerPeriod < 32)
|
||||
{
|
||||
ConfigManager::inst()->setValue( "mixer",
|
||||
"framesperaudiobuffer",
|
||||
QString::number( DEFAULT_BUFFER_SIZE ) );
|
||||
|
||||
m_framesPerPeriod = DEFAULT_BUFFER_SIZE;
|
||||
}
|
||||
|
||||
if( m_framesPerPeriod > DEFAULT_BUFFER_SIZE )
|
||||
{
|
||||
m_fifo = new fifo( m_framesPerPeriod
|
||||
/ DEFAULT_BUFFER_SIZE );
|
||||
fifoSize = m_framesPerPeriod / DEFAULT_BUFFER_SIZE;
|
||||
m_framesPerPeriod = DEFAULT_BUFFER_SIZE;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_fifo = new fifo( 1 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ConfigManager::inst()->setValue( "mixer",
|
||||
"framesperaudiobuffer",
|
||||
QString::number( m_framesPerPeriod ) );
|
||||
m_fifo = new fifo( 1 );
|
||||
}
|
||||
|
||||
// allocte the FIFO from the determined size
|
||||
m_fifo = new fifo( fifoSize );
|
||||
|
||||
// now that framesPerPeriod is fixed initialize global BufferManager
|
||||
BufferManager::init( m_framesPerPeriod );
|
||||
|
||||
|
||||
@@ -509,7 +509,7 @@ int main( int argc, char * * argv )
|
||||
else
|
||||
{
|
||||
// we're going to render our song
|
||||
Engine::init();
|
||||
Engine::init( true );
|
||||
|
||||
printf( "loading project...\n" );
|
||||
Engine::getSong()->loadProject( file_to_load );
|
||||
|
||||
@@ -90,7 +90,7 @@ GuiApplication::GuiApplication()
|
||||
this, SLOT(displayInitProgress(const QString&)));
|
||||
|
||||
// Init central engine which handles all components of LMMS
|
||||
Engine::init();
|
||||
Engine::init(false);
|
||||
|
||||
s_instance = this;
|
||||
|
||||
@@ -188,4 +188,4 @@ void GuiApplication::childDestroyed(QObject *obj)
|
||||
{
|
||||
m_controllerRackView = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user