Skip to content

Commit

Permalink
Issue #75: Disabled MIKMIDISequencer's use of MIKMIDIMetronome when d…
Browse files Browse the repository at this point in the history
…eployment target is < iOS 8.
  • Loading branch information
armadsen committed Apr 8, 2015
1 parent 66efd41 commit ccd0553
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 2 additions & 4 deletions Source/MIKMIDIMetronome.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,16 @@ - (BOOL)sendBankSelectAndProgramChangeForInstrumentID:(MusicDeviceInstrumentID)i

@implementation MIKMIDIMetronome

#if TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_8_0
+ (AudioComponentDescription)appleSynthComponentDescription
{
AudioComponentDescription instrumentcd = (AudioComponentDescription){0};
instrumentcd.componentManufacturer = kAudioUnitManufacturer_Apple;
instrumentcd.componentType = kAudioUnitType_MusicDevice;
#if TARGET_OS_IPHONE
instrumentcd.componentSubType = kAudioUnitSubType_MIDISynth;
#else
instrumentcd.componentSubType = kAudioUnitSubType_DLSSynth;
#endif
return instrumentcd;
}
#endif

- (BOOL)setupMetronome
{
Expand Down
4 changes: 4 additions & 0 deletions Source/MIKMIDISequencer.m
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,8 @@ - (MIKMIDIDestinationEndpoint *)destinationEndpointForTrack:(MIKMIDITrack *)trac

- (NSMutableArray *)clickTrackEventsFromTimeStamp:(MusicTimeStamp)fromTimeStamp toTimeStamp:(MusicTimeStamp)toTimeStamp
{
if (!self.metronome) return [NSMutableArray array];

MIKMIDISequencerClickTrackStatus clickTrackStatus = self.clickTrackStatus;
if (clickTrackStatus == MIKMIDISequencerClickTrackStatusDisabled) return nil;
if (!self.isRecording && clickTrackStatus != MIKMIDISequencerClickTrackStatusAlwaysEnabled) return nil;
Expand Down Expand Up @@ -623,8 +625,10 @@ - (MIKMIDIClientDestinationEndpoint *)metronomeEndpoint
@synthesize metronome = _metronome;
- (MIKMIDIMetronome *)metronome
{
#if TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_8_0
if (!_metronome) _metronome = [[MIKMIDIMetronome alloc] initWithClientDestinationEndpoint:self.metronomeEndpoint];
return _metronome;
#endif
}

- (void)setMetronome:(MIKMIDIMetronome *)metronome
Expand Down

0 comments on commit ccd0553

Please sign in to comment.