MusicSequenceGetIndTrack() does not work
MusicSequenceGetIndTrack() does not work
- Subject: MusicSequenceGetIndTrack() does not work
- From: Toshi Nagata <email@hidden>
- Date: Sun, 10 Jun 2001 08:48:17 +0900
Hello,
I am trying to write a simple SMF player in Cocoa. I can create a
MusicSequence
from an SMF, but I am stuck there because I cannot get a MusicTrack out of
the
MusicSequence. Specifically, MusicSequenceGetIndTrack() fails with the error
code -10859 (kAudioToolboxErr_TrackIndexError).
Following is my code. Would anyone suggest where I am wrong?
- (BOOL)loadSMFFromFile:(NSString *)fileName {
FSSpec spec;
MusicSequence sequence;
OSStatus sts;
long index;
extern BOOL getFSSpecFromPath(NSString *name, FSSpec *spec);
if (getFSSpecFromPath(fileName, &spec)) {
sts = NewMusicSequence(&sequence);
if (sts == noErr) {
sts = MusicSequenceLoadSMF(sequence, &spec);
if (sts == noErr) {
mySequence = sequence;
sts = MusicSequenceGetTrackCount(sequence, &index);
if (sts == noErr) {
while (--index >= 0) {
MusicTrack track;
/* ***** The following call always fails with sts =
-10859 ***** */
sts = MusicSequenceGetIndTrack(sequence, index, &
track);
/* Do something with track */
}
}
return YES;
} else {
DisposeMusicSequence(sequence);
}
}
}
mySequence = NULL;
return NO;
}
-------------------------------
Toshi Nagata
From Okazaki, Aichi, Japan
-------------------------------