removed obsolete instrument-parallelization support as this is handled much better by worker threads and adds unneccessary complexity

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1718 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2008-09-30 11:14:32 +00:00
parent 396dbbc1b3
commit adf8aed93c
51 changed files with 219 additions and 277 deletions

View File

@@ -50,7 +50,7 @@ instrument::~instrument()
void instrument::play( bool, sampleFrame * )
void instrument::play( sampleFrame * )
{
}

View File

@@ -118,13 +118,13 @@ public:
jobQueueItem() :
type( InvalidJob ),
job( NULL ),
done( FALSE )
done( false )
{
}
jobQueueItem( JobTypes _type, void * _job ) :
type( _type ),
job( _job ),
done( FALSE )
done( false )
{
}
@@ -156,7 +156,7 @@ public:
mixerWorkerThread( mixer * _mixer ) :
QThread( _mixer ),
m_quit( FALSE ),
m_quit( false ),
m_mixer( _mixer ),
m_queueReadySem( &m_mixer->m_queueReadySem ),
m_workersDoneSem( &m_mixer->m_workersDoneSem ),
@@ -176,7 +176,7 @@ public:
virtual void quit( void )
{
m_quit = TRUE;
m_quit = true;
}
private:
@@ -185,7 +185,7 @@ private:
sampleFrame * working_buf = (sampleFrame *) aligned_malloc(
m_mixer->framesPerPeriod() *
sizeof( sampleFrame ) );
while( m_quit == FALSE )
while( m_quit == false )
{
m_queueReadySem->acquire();
for( jobQueueItems::iterator it =
@@ -199,13 +199,13 @@ private:
m_jobQueue->lock.lock();
if( !it->done )
{
it->done = TRUE;
it->done = true;
m_jobQueue->lock.unlock();
#endif
switch( it->type )
{
case PlayHandle:
it->playHandleJob->play( FALSE, working_buf );
it->playHandleJob->play( working_buf );
break;
case AudioPortEffects:
{
@@ -490,7 +490,7 @@ sample_rate_t mixer::processingSampleRate( void ) const
bool mixer::criticalXRuns( void ) const
{
return( ( m_cpuLoad >= 99 &&
engine::getSong()->realTimeTask() == TRUE ) );
engine::getSong()->realTimeTask() == true ) );
}
@@ -534,7 +534,7 @@ const surroundSampleFrame * mixer::renderNextBuffer( void )
song::playPos p = engine::getSong()->getPlayPos(
song::Mode_PlayPattern );
if( engine::getSong()->playMode() == song::Mode_PlayPattern &&
engine::getPianoRoll()->isRecording() == TRUE &&
engine::getPianoRoll()->isRecording() == true &&
p != last_metro_pos && p.getTicks() %
(DefaultTicksPerTact / 4 ) == 0 )
{
@@ -596,37 +596,19 @@ const surroundSampleFrame * mixer::renderNextBuffer( void )
// clear last audio-buffer
clearAudioBuffer( m_writeBuf, m_framesPerPeriod );
//printf("---------------------------next period\n");
// if( criticalXRuns() == FALSE )
// if( criticalXRuns() == false )
{
engine::getFxMixer()->prepareMasterMix();
engine::getSong()->processNextBuffer();
lockPlayHandles();
int idx = 0;
if( m_multiThreaded )
{
playHandleVector par_hndls;
while( idx < m_playHandles.size() )
{
playHandle * n = m_playHandles[idx];
if( !n->done() && n->supportsParallelizing() )
{
n->play( TRUE, m_workingBuf );
par_hndls.push_back( n );
}
++idx;
}
mixerWorkerThread::jobQueue jq;
FILL_JOB_QUEUE(jq,playHandleVector,m_playHandles,
mixerWorkerThread::PlayHandle,
!( *it )->done() &&
!( *it )->supportsParallelizing() );
!( *it )->done());
DISTRIBUTE_JOB_QUEUE(jq);
for( playHandleVector::iterator it = par_hndls.begin();
it != par_hndls.end(); ++it )
{
( *it )->waitForWorkerThread();
}
WAIT_FOR_JOBS();
}
else
@@ -637,8 +619,10 @@ const surroundSampleFrame * mixer::renderNextBuffer( void )
{
if( !( *it )->done() )
{
( *it )->play( FALSE, m_workingBuf );
// play now and don't try to
// parallelize as we're on single-core
// system
( *it )->play( m_workingBuf );
}
}
}
@@ -684,7 +668,7 @@ const surroundSampleFrame * mixer::renderNextBuffer( void )
}
else
{
bool more_effects = FALSE;
bool more_effects = false;
for( QVector<audioPort *>::iterator it =
m_audioPorts.begin();
it != m_audioPorts.end(); ++it )
@@ -1007,7 +991,7 @@ void mixer::removePlayHandles( track * _track )
audioDevice * mixer::tryAudioDevices( void )
{
bool success_ful = FALSE;
bool success_ful = false;
audioDevice * dev = NULL;
QString dev_name = configManager::inst()->value( "mixer", "audiodev" );
@@ -1193,7 +1177,7 @@ midiClient * mixer::tryMidiClients( void )
mixer::fifoWriter::fifoWriter( mixer * _mixer, fifo * _fifo ) :
m_mixer( _mixer ),
m_fifo( _fifo ),
m_writing( TRUE )
m_writing( true )
{
}
@@ -1202,7 +1186,7 @@ mixer::fifoWriter::fifoWriter( mixer * _mixer, fifo * _fifo ) :
void mixer::fifoWriter::finish( void )
{
m_writing = FALSE;
m_writing = false;
}

View File

@@ -2,7 +2,7 @@
/*
* note_play_handle.cpp - implementation of class notePlayHandle, part of
* play-engine
* rendering engine
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
@@ -174,10 +174,9 @@ int notePlayHandle::getMidiVelocity( void ) const
void notePlayHandle::play( bool _try_parallelizing,
sampleFrame * _working_buffer )
void notePlayHandle::play( sampleFrame * _working_buffer )
{
if( m_muted == TRUE )
if( m_muted )
{
return;
}
@@ -195,11 +194,10 @@ void notePlayHandle::play( bool _try_parallelizing,
if( framesLeft() > 0 )
{
// play note!
m_instrumentTrack->playNote( this, _try_parallelizing,
_working_buffer );
m_instrumentTrack->playNote( this, _working_buffer );
}
if( m_released == TRUE )
if( m_released )
{
f_cnt_t todo = engine::getMixer()->framesPerPeriod();
// if this note is base-note for arpeggio, always set
@@ -257,7 +255,7 @@ void notePlayHandle::play( bool _try_parallelizing,
for( notePlayHandleVector::iterator it = m_subNotes.begin();
it != m_subNotes.end(); )
{
( *it )->play( _try_parallelizing, _working_buffer );
( *it )->play( _working_buffer );
if( ( *it )->done() )
{
delete *it;

View File

@@ -129,22 +129,7 @@ plugin * plugin::instantiate( const QString & _plugin_name, model * _parent,
return( new dummyPlugin() );
}
plugin * inst = inst_hook( _parent, _data );
return( inst );
}
bool plugin::supportsParallelizing( void ) const
{
return( FALSE );
}
void plugin::waitForWorkerThread( void )
{
return inst;
}
@@ -202,7 +187,7 @@ pluginView * plugin::createView( QWidget * _parent )
{
pv->setModel( this );
}
return( pv );
return pv;
}
@@ -237,7 +222,7 @@ QDomElement plugin::descriptor::subPluginFeatures::key::saveXML(
a.setAttribute( "value", it.value() );
e.appendChild( a );
}
return( e );
return e;
}

View File

@@ -186,10 +186,9 @@ presetPreviewPlayHandle::~presetPreviewPlayHandle()
void presetPreviewPlayHandle::play( bool _try_parallelizing,
sampleFrame * _working_buffer )
void presetPreviewPlayHandle::play( sampleFrame * _working_buffer )
{
m_previewNote->play( _try_parallelizing, _working_buffer );
m_previewNote->play( _working_buffer );
}

View File

@@ -42,7 +42,6 @@
remotePlugin::remotePlugin( const QString & _plugin_executable,
bool _wait_for_init_done ) :
remotePluginBase( new shmFifo(), new shmFifo() ),
m_initialized( false ),
m_failed( true ),
m_commMutex( QMutex::Recursive ),
m_splitChannels( false ),
@@ -108,7 +107,7 @@ remotePlugin::~remotePlugin()
bool remotePlugin::process( const sampleFrame * _in_buf,
sampleFrame * _out_buf, bool _wait )
sampleFrame * _out_buf )
{
if( m_failed )
{
@@ -133,7 +132,7 @@ bool remotePlugin::process( const sampleFrame * _in_buf,
engine::getMixer()->clearAudioBuffer( _out_buf,
frames );
}
return( false );
return false;
}
memset( m_shm, 0, m_shmSize );
@@ -174,31 +173,15 @@ bool remotePlugin::process( const sampleFrame * _in_buf,
sendMessage( IdStartProcessing );
unlock();
m_initialized = TRUE;
if( _wait )
if( m_failed || _out_buf == NULL || m_outputCount == 0 )
{
waitForProcessingFinished( _out_buf );
}
return( TRUE );
}
bool remotePlugin::waitForProcessingFinished( sampleFrame * _out_buf )
{
if( m_failed || !m_initialized || _out_buf == NULL ||
m_outputCount == 0 )
{
return( false );
return false;
}
lock();
waitForMessage( IdProcessingDone );
unlock();
const fpp_t frames = engine::getMixer()->framesPerPeriod();
const ch_cnt_t outputs = tMin<ch_cnt_t>( m_outputCount,
DEFAULT_CHANNELS );
if( m_splitChannels )
@@ -234,7 +217,7 @@ bool remotePlugin::waitForProcessingFinished( sampleFrame * _out_buf )
}
}
return( TRUE );
return true;
}

View File

@@ -116,8 +116,7 @@ samplePlayHandle::~samplePlayHandle()
void samplePlayHandle::play( bool /* _try_parallelizing */,
sampleFrame * _working_buffer )
void samplePlayHandle::play( sampleFrame * _working_buffer )
{
//play( 0, _try_parallelizing );
if( framesDone() >= totalFrames() )

View File

@@ -68,8 +68,7 @@ sampleRecordHandle::~sampleRecordHandle()
void sampleRecordHandle::play( bool /* _try_parallelizing */,
sampleFrame * _working_buffer )
void sampleRecordHandle::play( sampleFrame * _working_buffer )
{
const sampleFrame * recbuf = engine::getMixer()->inputBuffer();
const fpp_t frames = engine::getMixer()->inputBufferFrames();

View File

@@ -394,7 +394,7 @@ f_cnt_t instrumentTrack::beatLen( notePlayHandle * _n ) const
void instrumentTrack::playNote( notePlayHandle * _n, bool _try_parallelizing,
void instrumentTrack::playNote( notePlayHandle * _n,
sampleFrame * _working_buffer )
{
// arpeggio- and chord-widget has to do its work -> adding sub-notes
@@ -405,8 +405,7 @@ void instrumentTrack::playNote( notePlayHandle * _n, bool _try_parallelizing,
if( !_n->isArpeggioBaseNote() && m_instrument != NULL )
{
// all is done, so now lets play the note!
m_instrument->playNote( _n, _try_parallelizing,
_working_buffer );
m_instrument->playNote( _n, _working_buffer );
}
}