Skip to content

Commit

Permalink
Issue #316: MIDI To Audio example fails after choosing Midi file
Browse files Browse the repository at this point in the history
  • Loading branch information
jupdike authored and armadsen committed Jun 19, 2022
1 parent 876865b commit cca5049
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ - (void)exportToAudioFileWithCompletionHandler:(MIKStudioMIDIToAudioExporterComp
MIKMIDISequence *sequence = [MIKMIDISequence sequenceWithFileAtURL:self.midiFileURL error:&error];
if (!sequence) return [self finishWithError:error];

self.synthesizer = [[MIKOfflineMIDISynthesizer alloc] init];
self.synthesizer = [[MIKOfflineMIDISynthesizer alloc] initWithError:&error];
self.synthesizer.tracks = sequence.tracks;
self.synthesizer.tempo = [sequence tempoAtTimeStamp:0];

Expand Down
11 changes: 10 additions & 1 deletion Examples/macOS/MIDI To Audio/Sources/MIKOfflineMIDISynthesizer.m
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,16 @@ - (instancetype)initWithAudioUnitDescription:(AudioComponentDescription)componen
return self;
}

- (BOOL)setupAUGraph
- (instancetype)initWithError:(NSError *__autoreleasing _Nullable *)error
{
self = [super initWithError:error];
if (self) {
_midiClock = [MIKMIDIClock clock];
}
return self;
}

- (BOOL)setupAUGraphWithError:(NSError **)error
{
AUGraph graph;
OSStatus err = 0;
Expand Down

0 comments on commit cca5049

Please sign in to comment.