Skip to content

Commit

Permalink
Remove note from m_playingNotes before deleting its m_pluginData in s…
Browse files Browse the repository at this point in the history
…f2Instrument::deleteNotePluginData()
  • Loading branch information
midi-pascal committed Oct 22, 2015
1 parent 2fac253 commit a62e775
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion plugins/sf2_player/sf2_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -711,16 +711,20 @@ void sf2Instrument::play( sampleFrame * _working_buffer )
}
else // otherwise remove the handle
{
m_playingNotesMutex.lock();
m_playingNotes.remove( m_playingNotes.indexOf( currentNote ) );
m_playingNotesMutex.unlock();
}
}
else
{
noteOff( currentData );
m_playingNotesMutex.lock();
m_playingNotes.remove( m_playingNotes.indexOf( currentNote ) );
m_playingNotesMutex.unlock();
}
}

if( currentFrame < frames )
{
renderFrames( frames - currentFrame, _working_buffer + currentFrame );
Expand Down Expand Up @@ -780,6 +784,12 @@ void sf2Instrument::deleteNotePluginData( NotePlayHandle * _n )
// do it here
{
noteOff( pluginData );
m_playingNotesMutex.lock();
if( m_playingNotes.indexOf( _n ) >= 0 )
{
m_playingNotes.remove( m_playingNotes.indexOf( _n ) );
}
m_playingNotesMutex.unlock();
}
delete pluginData;
}
Expand Down

0 comments on commit a62e775

Please sign in to comment.