Skip to content

Commit eec7f63

Browse files
committed
Update two NotePlayHandle methods to ignore child NotePlayHandles
The methods NotePlayHandle::index and NotePlayHandle::nphsOfInstrumentTrack had not yet been brought up-to-date with the new system of attaching child NotePlayHandles directly to the mixer. This caused strange glitches when arpeggio was used in sort mode.
1 parent 8d91dd6 commit eec7f63

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

include/NotePlayHandle.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,11 +206,13 @@ class EXPORT NotePlayHandle : public PlayHandle, public Note
206206
void mute();
207207

208208
/*! Returns index of NotePlayHandle in vector of note-play-handles
209-
belonging to this instrument track - used by arpeggiator */
209+
belonging to this instrument track - used by arpeggiator.
210+
Ignores child note-play-handles, returns -1 when called on one */
210211
int index() const;
211212

212-
/*! returns list of note-play-handles belonging to given instrument track,
213-
if allPlayHandles = true, also released note-play-handles are returned */
213+
/*! Returns list of note-play-handles belonging to given instrument track.
214+
If allPlayHandles = true, also released note-play-handles and children
215+
are returned */
214216
static ConstNotePlayHandleList nphsOfInstrumentTrack( const InstrumentTrack* Track, bool allPlayHandles = false );
215217

216218
/*! Returns whether given NotePlayHandle instance is equal to *this */

src/core/NotePlayHandle.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -449,17 +449,17 @@ int NotePlayHandle::index() const
449449
for( PlayHandleList::ConstIterator it = playHandles.begin(); it != playHandles.end(); ++it )
450450
{
451451
const NotePlayHandle * nph = dynamic_cast<const NotePlayHandle *>( *it );
452-
if( nph == NULL || nph->m_instrumentTrack != m_instrumentTrack || nph->isReleased() )
452+
if( nph == NULL || nph->m_instrumentTrack != m_instrumentTrack || nph->isReleased() || nph->hasParent() )
453453
{
454454
continue;
455455
}
456456
if( nph == this )
457457
{
458-
break;
458+
return idx;
459459
}
460460
++idx;
461461
}
462-
return idx;
462+
return -1;
463463
}
464464

465465

@@ -473,7 +473,7 @@ ConstNotePlayHandleList NotePlayHandle::nphsOfInstrumentTrack( const InstrumentT
473473
for( PlayHandleList::ConstIterator it = playHandles.begin(); it != playHandles.end(); ++it )
474474
{
475475
const NotePlayHandle * nph = dynamic_cast<const NotePlayHandle *>( *it );
476-
if( nph != NULL && nph->m_instrumentTrack == _it && ( nph->isReleased() == false || _all_ph == true ) )
476+
if( nph != NULL && nph->m_instrumentTrack == _it && ( ( nph->isReleased() == false && nph->hasParent() == false ) || _all_ph == true ) )
477477
{
478478
cnphv.push_back( nph );
479479
}

0 commit comments

Comments
 (0)