diff --git a/src/core/NotePlayHandle.cpp b/src/core/NotePlayHandle.cpp index 934ebc129..bdf4f6181 100644 --- a/src/core/NotePlayHandle.cpp +++ b/src/core/NotePlayHandle.cpp @@ -76,6 +76,7 @@ NotePlayHandle::NotePlayHandle( InstrumentTrack* instrumentTrack, m_midiChannel( midiEventChannel >= 0 ? midiEventChannel : instrumentTrack->midiPort()->realOutputChannel() ), m_origin( origin ) { + qDebug( "offset %d", _offset ); if( hasParent() == false ) { m_baseDetuning = new BaseDetuning( detuning() ); @@ -187,6 +188,13 @@ void NotePlayHandle::play( sampleFrame * _working_buffer ) { return; } + + // if the note offset falls over to next period, then don't start playback yet + if( offset() >= engine::mixer()->framesPerPeriod() ) + { + setOffset( offset() - engine::mixer()->framesPerPeriod() ); + return; + } // number of frames that can be played this period f_cnt_t framesThisPeriod = m_totalFramesPlayed == 0