Re: Getting exact playout time of audio buffers in GarageBand
Re: Getting exact playout time of audio buffers in GarageBand
- Subject: Re: Getting exact playout time of audio buffers in GarageBand
- From: Jeff Moore <email@hidden>
- Date: Thu, 7 Jul 2005 14:32:14 -0700
The reason is what Chris said about the thread context of the call to
your AU's Render method.
In a typical AUGraph, the source of the pull is typically going to be
an output AU that is talking to an audio device. In fact, the pull is
going to happen on the IO thread of the device. In such a context,
the host time can be passed on and it can be considered accurate.
Note that in an AUGraph that doesn't have an output AU attached to a
real device will also potentially not be passing along host time values.
Quite often in more complicated applications, the AU is being asked
to render well ahead of when the data is going to be used or from a
secondary work thread (or both even). Quite often apps don't make use
of AUGraph to do their rendering. As such, the host time value for a
given pull cannot be provided since it is potentially unknown or
difficult for the host to compute. GarageBand and many other apps
fall into this category.
On Jul 7, 2005, at 2:05 PM, Christian Buchner wrote:
The context in which your AudioUnit is called can vary. It might be
called in
the realtime audio I/O thread, a secondary "feeder" thread, or in an
offline
context, so your AudioUnit should not try to hack around with the
timestamps and
instead should just honor the sample offsets.
The real issue is that I cannot instruct an external hardware MIDI
synthesizer
to start playing at a specific sample offset. I need to know the
exact time
when
that sample will actually be played out so that I can send the MIDI
event at
exactly the right time. Right now I am using the time of the last
Render()
call as
a reference timestamp - but that is dependent on CPU load and other
random
factors and thus I get a clock skew of up to the duration of an audio
buffer.
An AUGraph seems to give me that very playout timestamp I am
looking for (I
verified
this with the PlaySoftMIDI example from the CoreAudio SDK) – I just
do not
understand
why GarageBand won't - therefore I will have to come up with some
sort of
hack
because my plugin is really intended to be used in this
application. I agree
that
hacks are ugly but it seems to be necessary here.
Christian
_______________________________________________
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
--
Jeff Moore
Core Audio
Apple
_______________________________________________
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