Time signature and meta events in MusicSequence
Time signature and meta events in MusicSequence
- Subject: Time signature and meta events in MusicSequence
- From: "A. Le Flanchec" <email@hidden>
- Date: Tue, 30 Mar 2004 07:31:30 +0000
Hello,
I am currently taking a look at the MusicSequence API. I have some troubles
reading meta events from standard MIDI Files. I don't get any time signature
meta event whatever I do... I checked my SMF in several sequencers and all
time signatures are there... What could I be doing wrong ?
Below is the code I use.
Maybe it is related to the fact that I'm still under 0X 10.2.7 ?
Thank you in advance !
Vincent Le Flanchec
{
MusicSequence sequenceMIDI;
int i = 0;
//Initializing the musicSequence
char *filePath ="/Users/liris/bancal.mid";
OSStatus result = noErr;
FSRef fsRef;
result = FSPathMakeRef ((const UInt8*)filePath, &fsRef, 0);
result = NewMusicSequence(&sequenceMIDI);
FSSpec fsSpec;
result = PathToFSSpec (filePath, &fsSpec);
result = MusicSequenceLoadSMF (sequenceMIDI, &fsSpec);
//preparing for reading events
UInt32 MIDITrackNumber;
MusicSequenceGetTrackCount (sequenceMIDI, &MIDITrackNumber);
BOOL hasCurrentEvent;
MusicTimeStamp myTimeStamp;
MusicEventType myEventType;
const void * myData;
UInt32 MIDIDataSize;
//Reading events
while (i < MIDITrackNumber)
{
NSLog(@"trackNumber = %i", i);
MusicTrack track;
MusicSequenceGetIndTrack(sequenceMIDI, i, &track);
MusicEventIterator iter = 0;
NewMusicEventIterator (track, &iter);
MusicEventIteratorHasCurrentEvent (iter, &hasCurrentEvent);
while (hasCurrentEvent)
{
MusicEventIteratorGetEventInfo(iter,&myTimeStamp,&myEventType,
&myData,
&MIDIDataSize);
MusicEventIteratorNextEvent(iter);
MusicEventIteratorHasCurrentEvent (iter,
&hasCurrentEvent);
NSLog(@"timestamp = %f eventype %i", myTimeStamp,
myEventType);
if (myEventType == kMusicEventType_Meta)
{
NSLog(@" metatype %d",
((MIDIMetaEvent*)myData)->metaEventType);
}
}
if (iter) DisposeMusicEventIterator (iter);
++i;
}
}
_________________________________________________________________
MSN Messenger : discutez en direct avec vos amis !
http://www.msn.fr/msger/default.asp
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.