don't use fifoWriter when rendering as we do not have realtime issues here - fixes lockups on various systems when exporting project

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1122 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2008-06-10 22:35:13 +00:00
parent fc810f4af8
commit 0638ec5e55
5 changed files with 58 additions and 22 deletions

View File

@@ -1,5 +1,15 @@
2008-06-10 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* src/core/song.cpp:
fixed loading files in no-GUI mode
* include/mixer.h:
* src/core/audio/audio_device.cpp:
* src/core/mixer.cpp:
* src/core/project_renderer.cpp:
don't use fifoWriter when rendering as we do not have realtime issues
here - fixes lockups on various systems when exporting project
* plugins/sf2_player/sf2_player.cpp:
enabled LCD-Spinboxes for easily switching banks/patches - I know that
this way you can select banks/patches that do not exist but opening

View File

@@ -201,7 +201,8 @@ public:
void setAudioDevice( audioDevice * _dev );
void setAudioDevice( audioDevice * _dev,
const struct qualitySettings & _qs );
const struct qualitySettings & _qs,
bool _needs_fifo );
void restoreAudioDevice( void );
inline audioDevice * audioDev( void )
{
@@ -383,11 +384,15 @@ public:
bool criticalXRuns( void ) const;
const surroundSampleFrame * nextBuffer( void )
inline bool hasFifoWriter( void ) const
{
return( m_fifo->read() );
return( m_fifoWriter != NULL );
}
inline const surroundSampleFrame * nextBuffer( void )
{
return( hasFifoWriter() ? m_fifo->read() : renderNextBuffer() );
}
void changeQuality( const struct qualitySettings & _qs );
@@ -422,7 +427,7 @@ private:
mixer( void );
virtual ~mixer();
void startProcessing( void );
void startProcessing( bool _needs_fifo = TRUE );
void stopProcessing( void );
@@ -485,7 +490,7 @@ private:
fifo * m_fifo;
fifoWriter * m_fifo_writer;
fifoWriter * m_fifoWriter;
friend class engine;

View File

@@ -96,7 +96,7 @@ fpp_t audioDevice::getNextBuffer( surroundSampleFrame * _ab )
// make sure, no other thread is accessing device
lock();
// now were safe to access the device
// resample if neccessary
if( getMixer()->processingSampleRate() != m_sampleRate )
{
resample( b, frames, _ab, getMixer()->processingSampleRate(),
@@ -112,7 +112,10 @@ fpp_t audioDevice::getNextBuffer( surroundSampleFrame * _ab )
// release lock
unlock();
delete[] b;
if( getMixer()->hasFifoWriter() )
{
delete[] b;
}
return( frames );
}
@@ -122,9 +125,12 @@ fpp_t audioDevice::getNextBuffer( surroundSampleFrame * _ab )
void audioDevice::stopProcessing( void )
{
while( m_inProcess )
if( getMixer()->hasFifoWriter() )
{
processNextBuffer();
while( m_inProcess )
{
processNextBuffer();
}
}
}

View File

@@ -344,10 +344,17 @@ void mixer::initDevices( void )
void mixer::startProcessing( void )
void mixer::startProcessing( bool _needs_fifo )
{
m_fifo_writer = new fifoWriter( this, m_fifo );
m_fifo_writer->start();
if( _needs_fifo )
{
m_fifoWriter = new fifoWriter( this, m_fifo );
m_fifoWriter->start();
}
else
{
m_fifoWriter = NULL;
}
m_audioDev->startProcessing();
}
@@ -357,13 +364,19 @@ void mixer::startProcessing( void )
void mixer::stopProcessing( void )
{
m_fifo_writer->finish();
m_audioDev->stopProcessing();
m_fifo_writer->wait( 1000 );
m_fifo_writer->terminate();
delete m_fifo_writer;
if( m_fifoWriter != NULL )
{
m_fifoWriter->finish();
m_audioDev->stopProcessing();
m_fifoWriter->wait( 1000 );
m_fifoWriter->terminate();
delete m_fifoWriter;
m_fifoWriter = NULL;
}
else
{
m_audioDev->stopProcessing();
}
}
@@ -825,7 +838,8 @@ void mixer::setAudioDevice( audioDevice * _dev )
void mixer::setAudioDevice( audioDevice * _dev,
const struct qualitySettings & _qs )
const struct qualitySettings & _qs,
bool _needs_fifo )
{
// don't delete the audio-device
stopProcessing();
@@ -847,7 +861,7 @@ void mixer::setAudioDevice( audioDevice * _dev,
emit qualitySettingsChanged();
emit sampleRateChanged();
startProcessing();
startProcessing( _needs_fifo );
}

View File

@@ -146,7 +146,8 @@ void projectRenderer::startProcessing( void )
// have to do mixer stuff with GUI-thread-affinity in order to make
// slots connected to sampleRateChanged()-signals being called
// immediately
engine::getMixer()->setAudioDevice( m_fileDev, m_qualitySettings );
engine::getMixer()->setAudioDevice( m_fileDev, m_qualitySettings,
FALSE );
start( QThread::HighestPriority );
}