Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/record cc events #262

Merged
merged 11 commits into from
Nov 19, 2018
11 changes: 11 additions & 0 deletions Source/MIKMIDISequencer.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#import "MIKMIDISequence+MIKMIDIPrivate.h"
#import "MIKMIDICommandScheduler.h"
#import "MIKMIDIDestinationEndpoint.h"
#import "MIKMIDIControlChangeCommand.h"
#import "MIKMIDIControlChangeEvent.h"


#if !__has_feature(objc_arc)
Expand Down Expand Up @@ -566,6 +568,15 @@ - (void)recordMIDICommand:(MIKMIDICommand *)command
} else if ([command isKindOfClass:[MIKMIDINoteOffCommand class]]) { // note Off
MIKMIDINoteOffCommand *noteOffCommand = (MIKMIDINoteOffCommand *)command;
event = [self pendingNoteEventWithNoteNumber:@(noteOffCommand.note) channel:noteOffCommand.channel releaseVelocity:noteOffCommand.velocity offTimeStamp:musicTimeStamp];
} else if ([command isKindOfClass:[MIKMIDIControlChangeCommand class]]) // cc command
{
MIKMIDIControlChangeCommand* ccCmd = (MIKMIDIControlChangeCommand*)command;
MIKMutableMIDIControlChangeEvent* ccEvent = [[MIKMutableMIDIControlChangeEvent alloc] init];
ccEvent.controllerNumber = ccCmd.controllerNumber;
ccEvent.controllerValue = ccCmd.controllerValue;
ccEvent.channel = ccCmd.channel;
ccEvent.timeStamp = musicTimeStamp;
event = ccEvent;
}

if (event) [self.recordEnabledTracks makeObjectsPerformSelector:@selector(addEvent:) withObject:event];
Expand Down