Re: MIDI TimeCode generator
Re: MIDI TimeCode generator
- Subject: Re: MIDI TimeCode generator
- From: Kurt Revis <email@hidden>
- Date: Sun, 18 Aug 2002 14:10:13 -0700
On Sunday, August 18, 2002, at 11:50 AM, Peter Krajcik wrote:
I have to generate MTC from witihin my app - freerun Generator with some
initial SMPTE time.
I would like know what is the recommended way to send out quarter
messages
under OS X:
- to make a packet list of all 8 quarterframes, every packet's got a
timestamp, the gap between packets is 1/fps sec. It will be MIDIserver
job
to send them out in particular times
- to make a CarbonTimer in separate thread and send out a quarter frames
every 1/fps sec ?
Well, you probably need to do both. Since sending MTC is an ongoing
process, you need to have a thread which wakes up periodically and sends
a packet list containing a number of events, each with a timestamp. But
you should let CoreMIDI do the scheduling for sending each individual
event at the proper time.
Note that you can batch up the packets any way you like--they don't
necessarily have to be in groups of 8. You could even send a whole
second's worth of events at once (or a minute, or an hour...).
Therefore, you can decide how often your thread should wake up.
You don't have to worry about waking up exactly when a packet needs to
be sent--the MIDIServer handles that. You just need to wake up early
enough to send the next packet list before its first event needs to go
out.
If you are sending out 8 quarter-frame packets, you will need to wake up
each 8 / (4 * fps). At 30 fps, that's every 66 milliseconds, or 15 times
per second. This is probably achievable, but you might find it easier
and more reliable to use bigger packet lists and to wake up less often.
It really depends on your application... do some experimenting and see
how accurate your timers are at waking you up.
(how does it work if I send them to virtual endpoint ?)
Scheduling works correctly for events sent to virtual endpoints. You
don't need to do anything special.
--
Kurt Revis
email@hidden
_______________________________________________
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.