Skip to content

Commit

Permalink
Fixed crash in -[MIKMIDISequencer recordAllPendingNoteEventsWithOffTi…
Browse files Browse the repository at this point in the history
…meStamp:].
  • Loading branch information
Andrew Madsen committed Mar 10, 2016
1 parent 2312e4d commit 4c0ce02
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Source/MIKMIDISequencer.m
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ - (void)recordMIDICommand:(MIKMIDICommand *)command
- (void)recordAllPendingNoteEventsWithOffTimeStamp:(MusicTimeStamp)offTimeStamp
{
NSMutableSet *events = [NSMutableSet set];

NSMutableDictionary *pendingRecordedNoteEvents = self.pendingRecordedNoteEvents;
for (NSNumber *noteNumber in pendingRecordedNoteEvents) {
for (MIKMutableMIDINoteEvent *event in pendingRecordedNoteEvents[noteNumber]) {
Expand All @@ -577,8 +577,12 @@ - (void)recordAllPendingNoteEventsWithOffTimeStamp:(MusicTimeStamp)offTimeStamp
}
}
self.pendingRecordedNoteEvents = [NSMutableDictionary dictionary];

if ([events count]) [self.recordEnabledTracks makeObjectsPerformSelector:@selector(addEvents:) withObject:events];

if ([events count]) {
for (MIKMIDITrack *track in self.recordEnabledTracks) {
[track addEvents:[events allObjects]];
}
}
}

- (MIKMIDINoteEvent *)pendingNoteEventWithNoteNumber:(NSNumber *)noteNumber channel:(UInt8)channel releaseVelocity:(UInt8)releaseVelocity offTimeStamp:(MusicTimeStamp)offTimeStamp
Expand Down

0 comments on commit 4c0ce02

Please sign in to comment.