do not lock mixer and call notePlayHandle::noteOff() in instrumentTrack::processInEvent() when processing monophonic instruments in playNote() - fixes lockups in LB302 in multithreaded mode
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@753 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
@@ -74,7 +74,8 @@ public:
|
||||
notePlayHandle * _n );
|
||||
|
||||
virtual void processInEvent( const midiEvent & _me,
|
||||
const midiTime & _time );
|
||||
const midiTime & _time,
|
||||
bool _lock = TRUE );
|
||||
virtual void processOutEvent( const midiEvent & _me,
|
||||
const midiTime & _time );
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* midi_event_processor.h - base-class for midi-processing classes
|
||||
*
|
||||
* Copyright (c) 2005-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2005-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -49,7 +49,8 @@ public:
|
||||
|
||||
// to be implemented by inheriting classes
|
||||
virtual void FASTCALL processInEvent( const midiEvent & _me,
|
||||
const midiTime & _time ) = 0;
|
||||
const midiTime & _time,
|
||||
bool _lock = TRUE ) = 0;
|
||||
virtual void FASTCALL processOutEvent( const midiEvent & _me,
|
||||
const midiTime & _time ) = 0;
|
||||
|
||||
|
||||
@@ -204,7 +204,7 @@ void instrumentTrack::processAudioBuffer( sampleFrame * _buf,
|
||||
|
||||
|
||||
void instrumentTrack::processInEvent( const midiEvent & _me,
|
||||
const midiTime & _time )
|
||||
const midiTime & _time, bool _lock )
|
||||
{
|
||||
switch( _me.m_type )
|
||||
{
|
||||
@@ -257,13 +257,16 @@ void instrumentTrack::processInEvent( const midiEvent & _me,
|
||||
engine::framesPerTact64th() ) ),
|
||||
0, n->tone(), n->octave(),
|
||||
n->getVolume(), n->getPanning() );
|
||||
// lock our play-handle while calling noteOff()
|
||||
// for not modifying it's member variables
|
||||
// asynchronously (while rendering!)
|
||||
// which can result in segfaults
|
||||
engine::getMixer()->lock();
|
||||
n->noteOff();
|
||||
engine::getMixer()->unlock();
|
||||
if( _lock )
|
||||
{
|
||||
// lock our play-handle while calling noteOff()
|
||||
// for not modifying it's member variables
|
||||
// asynchronously (while rendering!)
|
||||
// which can result in segfaults
|
||||
engine::getMixer()->lock();
|
||||
n->noteOff();
|
||||
engine::getMixer()->unlock();
|
||||
}
|
||||
m_notes[_me.key()] = NULL;
|
||||
emit noteDone( done_note );
|
||||
}
|
||||
@@ -380,7 +383,8 @@ void instrumentTrack::playNote( notePlayHandle * _n, bool _try_parallelizing )
|
||||
!_n->released() )
|
||||
{
|
||||
processInEvent( midiEvent( NOTE_OFF, 0,
|
||||
_n->key(), 0 ), midiTime() );
|
||||
_n->key(), 0 ), midiTime(),
|
||||
FALSE );
|
||||
if( ( *youngest_note )->offset() >
|
||||
_n->offset() )
|
||||
{
|
||||
@@ -404,13 +408,6 @@ void instrumentTrack::playNote( notePlayHandle * _n, bool _try_parallelizing )
|
||||
return;
|
||||
}
|
||||
}
|
||||
// we do not play previously released notes
|
||||
// anymore
|
||||
else if( *youngest_note != _n &&
|
||||
_n->released() )
|
||||
{
|
||||
//return;
|
||||
}
|
||||
}
|
||||
}
|
||||
// all is done, so now lets play the note!
|
||||
|
||||
Reference in New Issue
Block a user