InstrumentTrack: new method silenceAllNotes()
Added new method silenceAllNotes() which is a replacement for
invalidateAllMyNPH() and also resets m_runningMidiNotes array.
silenceAllNotes() is now used in destructor as well.
Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
(cherry picked from commit 3c9859da9f)
This commit is contained in:
@@ -75,7 +75,8 @@ public:
|
||||
const midiTime & _time );
|
||||
virtual void processOutEvent( const midiEvent & _me,
|
||||
const midiTime & _time );
|
||||
|
||||
// silence all running notes played by this track
|
||||
void silenceAllNotes();
|
||||
|
||||
f_cnt_t beatLen( notePlayHandle * _n ) const;
|
||||
|
||||
@@ -194,8 +195,6 @@ protected:
|
||||
{
|
||||
return "instrumenttrack";
|
||||
}
|
||||
// invalidates all note-play-handles linked to this instrument
|
||||
void invalidateAllMyNPH( void );
|
||||
|
||||
|
||||
protected slots:
|
||||
|
||||
@@ -134,7 +134,10 @@ instrumentTrack::instrumentTrack( trackContainer * _tc ) :
|
||||
|
||||
instrumentTrack::~instrumentTrack()
|
||||
{
|
||||
engine::getMixer()->removePlayHandles( this );
|
||||
// kill all running notes
|
||||
silenceAllNotes();
|
||||
|
||||
// now we're save deleting the instrument
|
||||
delete m_instrument;
|
||||
}
|
||||
|
||||
@@ -403,6 +406,24 @@ void instrumentTrack::processOutEvent( const midiEvent & _me,
|
||||
|
||||
|
||||
|
||||
void instrumentTrack::silenceAllNotes()
|
||||
{
|
||||
engine::getMixer()->lock();
|
||||
for( int i = 0; i < NumKeys; ++i )
|
||||
{
|
||||
m_notes[i] = NULL;
|
||||
m_runningMidiNotes[i] = 0;
|
||||
}
|
||||
|
||||
// invalidate all NotePlayHandles linked to this track
|
||||
m_processHandles.clear();
|
||||
engine::getMixer()->removePlayHandles( this );
|
||||
engine::getMixer()->unlock();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
f_cnt_t instrumentTrack::beatLen( notePlayHandle * _n ) const
|
||||
{
|
||||
if( m_instrument != NULL )
|
||||
@@ -711,7 +732,7 @@ void instrumentTrack::saveTrackSpecificSettings( QDomDocument & _doc,
|
||||
|
||||
void instrumentTrack::loadTrackSpecificSettings( const QDomElement & _this )
|
||||
{
|
||||
invalidateAllMyNPH();
|
||||
silenceAllNotes();
|
||||
|
||||
engine::getMixer()->lock();
|
||||
|
||||
@@ -818,7 +839,7 @@ void instrumentTrack::loadTrackSpecificSettings( const QDomElement & _this )
|
||||
|
||||
instrument * instrumentTrack::loadInstrument( const QString & _plugin_name )
|
||||
{
|
||||
invalidateAllMyNPH();
|
||||
silenceAllNotes();
|
||||
|
||||
engine::getMixer()->lock();
|
||||
delete m_instrument;
|
||||
@@ -833,23 +854,6 @@ instrument * instrumentTrack::loadInstrument( const QString & _plugin_name )
|
||||
|
||||
|
||||
|
||||
void instrumentTrack::invalidateAllMyNPH( void )
|
||||
{
|
||||
engine::getMixer()->lock();
|
||||
for( int i = 0; i < NumKeys; ++i )
|
||||
{
|
||||
m_notes[i] = NULL;
|
||||
}
|
||||
|
||||
// invalidate all note-play-handles linked to this channel
|
||||
m_processHandles.clear();
|
||||
engine::getMixer()->removePlayHandles( this );
|
||||
engine::getMixer()->unlock();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// #### ITV:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user