Midi timing issues
Midi timing issues
- Subject: Midi timing issues
- From: Pascal Goguey <email@hidden>
- Date: Sun, 28 Apr 2002 21:41:35 +0900
Hello everybody!
I could manage to play a few notes from the mac
to my digital piano. I found some code in a PDF file on
apple's site. In this example, I didn't bother ending notes.
Byte Buffer[1024];
memset(Buffer, 0, 1024);
MyPacketList = (MIDIPacketList *)Buffer;
MyPacket = MIDIPacketListInit(MyPacketList);
Byte Note[] = {0x90, 0 , 64};
i = 0;
MIDITimeStamp t;
t = (MIDITimeStamp)AudioGetCurrentHostTime();
for(int note = 0x57 ; note >= 0x3b ; note--) {
Note[1] = note;
MyPacket = MIDIPacketListAdd(MyPacketList, sizeof(Buffer),
MyPacket, t+i*100000, 3, Note);
i++;
}
PrintPacketList(MyPacketList);
MIDISend(gOutPort, gDest, MyPacketList);
The problem I have here is that I can never play the notes in a sequence.
I have tried several values for the tmestamp multiplier (100000 in this
example),
but it doesn't matter. What I get is two packets of simultaeous notes as
if I would
play with my ass. The two packets of simultaneous notes are separated by
about
half a second.
1. About timing:
Does anybody know how to send play requests in a sequence?
Is it right to use time stamps? Do I ues the right time function ?
I use AudioGetCurrentHostTime because there is apparently no time
function in the midi framework itself, but... just wondering.
By the way, what is the unit for timestamp? I tried mulyipliers from
1 to 1.000.000, but it doesn't matter.
2. About the packet list:
What is the maximum number I can add to a packet list?
Is it limited by the computer's memory?
Thanks for any hint!
Pascal
_______________________________________________
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.