MIDI message timestamps
MIDI message timestamps
- Subject: MIDI message timestamps
- From: Chadwick Wood <email@hidden>
- Date: Wed, 10 Nov 2004 20:53:14 -0600
Hi,
I've searched through the archives, and thought I understood how this
works, but apparently I don't.
I'm trying to build a simple sequencer that will open a virtual MIDI
source and send messages. I've gotten this to work somewhat, but I
can't get the timestamps right. For now, I'm just sending two MIDI
messages, that should be scheduled half a second apart. When I run the
app, both messages are sent, and it looks like they're sent at the same
time. Here's some of my code:
UInt64 startHostTime = AudioGetCurrentHostTime();
UInt64 nextTime =
AudioConvertNanosToHostTime(AudioConvertHostTimeToNanos(startHostTime)+5
00000000);
timeStamp = startHostTime;
nextPacket = MIDIPacketListInit(&pktlist);
nextPacket = MIDIPacketListAdd(&pktlist, sizeof(pktlist), nextPacket,
timeStamp, 3, NoteOn);
timeStamp = nextTime;
nextPacket = MIDIPacketListAdd(&pktlist, sizeof(pktlist), nextPacket,
timeStamp, 3, NoteOff);
This uses 2 3-byte arrays, NoteOn and NoteOff, as the data for the
messages. I figure I must be messing up the calculation of the
timestamp, but I don't see how. Timestamps are in host time, right?
Thanks so much,
Chad Wood
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden