diff --git a/include/mixer.h b/include/mixer.h index a46684492..42fa549c5 100644 --- a/include/mixer.h +++ b/include/mixer.h @@ -232,7 +232,8 @@ public: return m_playHandles; } - void removePlayHandles( track * _track ); + void removePlayHandles( track * _track, + playHandle::Type _type = playHandle::NumPlayHandleTypes ); inline bool hasPlayHandles( void ) const { diff --git a/include/play_handle.h b/include/play_handle.h index 27aa27573..365da3f19 100644 --- a/include/play_handle.h +++ b/include/play_handle.h @@ -36,15 +36,16 @@ class track; class playHandle { public: - enum types + enum Types { NotePlayHandle, InstrumentPlayHandle, SamplePlayHandle, - PresetPreviewHandle + NumPlayHandleTypes } ; + typedef Types Type; - playHandle( const types _type, f_cnt_t _offset = 0 ) : + playHandle( const Type _type, f_cnt_t _offset = 0 ) : m_type( _type ), m_offset( _offset ), m_affinity( QThread::currentThread() ) @@ -55,27 +56,27 @@ public: { } - virtual inline bool affinityMatters( void ) const + virtual inline bool affinityMatters() const { return false; } - const QThread * affinity( void ) const + const QThread * affinity() const { return m_affinity; } - inline types type( void ) const + inline Type type() const { return m_type; } virtual void play( sampleFrame * _working_buffer ) = 0; - virtual bool done( void ) const = 0; + virtual bool done() const = 0; // returns how many frames this play-handle is aligned ahead, i.e. // at which position it is inserted in the according buffer - inline f_cnt_t offset( void ) const + inline f_cnt_t offset() const { return m_offset; } @@ -90,7 +91,7 @@ public: private: - types m_type; + Type m_type; f_cnt_t m_offset; const QThread * m_affinity; diff --git a/src/core/mixer.cpp b/src/core/mixer.cpp index 5936be6fc..42ef1e76c 100644 --- a/src/core/mixer.cpp +++ b/src/core/mixer.cpp @@ -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 ); diff --git a/src/tracks/instrument_track.cpp b/src/tracks/instrument_track.cpp index 2cd4b1e5d..4f7861a2b 100644 --- a/src/tracks/instrument_track.cpp +++ b/src/tracks/instrument_track.cpp @@ -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(); }