comparison audio/ClipMixer.cpp @ 596:c99892f0c5c3

Proper handling for notes that end at the same frame as a subsequent note of the same pitch begins. The note-off needs to be associated with the prior note, not a spurious zero-duration version of the subsequent note.
author Chris Cannam
date Wed, 18 Apr 2018 15:19:09 +0100
parents b23bebfdfaba
children e2715204feaa
comparison
equal deleted inserted replaced
595:b23bebfdfaba 596:c99892f0c5c3
157 if (start > 0) durationHere = m_blockSize - start; 157 if (start > 0) durationHere = m_blockSize - start;
158 158
159 bool ending = false; 159 bool ending = false;
160 160
161 foreach (NoteEnd end, endingNotes) { 161 foreach (NoteEnd end, endingNotes) {
162 if (end.frequency == note.frequency && 162 if (end.frequency == note.frequency &&
163 end.frameOffset >= start && 163 // This is > rather than >= because if we have a
164 // note-off and a note-on at the same time, the
165 // note-off must be switching off an earlier note-on,
166 // not the current one (zero-duration notes are
167 // forbidden earlier in the pipeline)
168 end.frameOffset > start &&
164 end.frameOffset <= m_blockSize) { 169 end.frameOffset <= m_blockSize) {
165 ending = true; 170 ending = true;
166 durationHere = end.frameOffset; 171 durationHere = end.frameOffset;
167 if (start > 0) durationHere = end.frameOffset - start; 172 if (start > 0) durationHere = end.frameOffset - start;
168 break; 173 break;