Mixer: selectively remove PlayHandles in removePlayHandles()
This commit allows finer control of which kind of PlayHandles get removed in Mixer::removePlayHandles(). This is now used by InstrumentTrack which only removes NotePlayHandles in InstrumentTrack::silenceAllNotes(). Fixes broken preview of resources loaded by IPH-based instruments. Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
This commit is contained in:
@@ -914,13 +914,15 @@ void mixer::removePlayHandle( playHandle * _ph )
|
||||
|
||||
|
||||
|
||||
void mixer::removePlayHandles( track * _track )
|
||||
void mixer::removePlayHandles( track * _track, playHandle::Type _type )
|
||||
{
|
||||
lock();
|
||||
PlayHandleList::Iterator it = m_playHandles.begin();
|
||||
while( it != m_playHandles.end() )
|
||||
{
|
||||
if( ( *it )->isFromTrack( _track ) )
|
||||
if( ( _type == playHandle::NumPlayHandleTypes ||
|
||||
( *it )->type() == _type ) &&
|
||||
( *it )->isFromTrack( _track ) )
|
||||
{
|
||||
delete *it;
|
||||
it = m_playHandles.erase( it );
|
||||
|
||||
@@ -419,7 +419,8 @@ void instrumentTrack::silenceAllNotes()
|
||||
|
||||
// invalidate all NotePlayHandles linked to this track
|
||||
m_processHandles.clear();
|
||||
engine::getMixer()->removePlayHandles( this );
|
||||
engine::getMixer()->removePlayHandles( this,
|
||||
playHandle::NotePlayHandle );
|
||||
engine::getMixer()->unlock();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user