Add comments about nullptr guard
Add some comments which describe why we need to guard agains nullptr.
This commit is contained in:
@@ -570,6 +570,10 @@ f_cnt_t InstrumentTrack::beatLen( NotePlayHandle * _n ) const
|
||||
|
||||
void InstrumentTrack::playNote( NotePlayHandle* n, sampleFrame* workingBuffer )
|
||||
{
|
||||
// Note: under certain circumstances the working buffer is a nullptr.
|
||||
// These cases are triggered in PlayHandle::doProcessing when the play method is called with a nullptr.
|
||||
// TODO: Find out if we can skip processing at a higher level if the buffer is nullptr.
|
||||
|
||||
// arpeggio- and chord-widget has to do its work -> adding sub-notes
|
||||
// for chords/arpeggios
|
||||
m_noteStacking.processNote( n );
|
||||
@@ -580,6 +584,8 @@ void InstrumentTrack::playNote( NotePlayHandle* n, sampleFrame* workingBuffer )
|
||||
// all is done, so now lets play the note!
|
||||
m_instrument->playNote( n, workingBuffer );
|
||||
|
||||
// Calling processAudioBuffer with a nullptr leads to crashes when checking if the buffer represents silence.
|
||||
// Therefore we must guard against a nullptr here.
|
||||
if (workingBuffer != nullptr)
|
||||
{
|
||||
const fpp_t frames = n->framesLeftForCurrentPeriod();
|
||||
|
||||
Reference in New Issue
Block a user