我正在尝试将一个非常基本的单音符 MusicSequence ( MusicSequence Reference ) 保存到 MIDI 文件中。该文件现在正在写入,并且音符的持续时间也(如果我输入持续时间 4,则 MIDI 文件持续 2 秒,如果我将其更改为 2,那么它应该持续 1 秒)但是没有声音被再现和如果我在 Logic 中查看 MIDI 文件,也没有任何信息。似乎笔记持续时间被写了,但笔记的笔记没有。
会发生什么?
+ (MusicSequence)getSequence
{
MusicSequence mySequence;
MusicTrack myTrack;
NewMusicSequence(&mySequence);
MusicSequenceNewTrack(mySequence, &myTrack);
MIDINoteMessage noteMessage;
MusicTimeStamp timestamp = 0;
noteMessage.channel = 0;
noteMessage.note = 4;
noteMessage.velocity = 90;
noteMessage.releaseVelocity = 0;
noteMessage.duration = 4;
if (MusicTrackNewMIDINoteEvent(myTrack, timestamp, ¬eMessage) != noErr) NSLog(@"ERROR creating the note");
else NSLog(@"Note added");
return mySequence;
}