Re: Rationale of AudioTimeStamp
Re: Rationale of AudioTimeStamp
- Subject: Re: Rationale of AudioTimeStamp
- From: Bill Stewart <email@hidden>
- Date: Thu, 20 Feb 2003 16:35:56 -0800
With the output unit we don't quite do the time stamp correctly (we've
since fixed this). The fix we've put into place which will be available
in the next OS release, is to provide the complete time stamp that the
device gives us...
We were passing the host time value through but NOT the rate scalar
(which describes the relationship at "now" of the host time value and
the nominal (44100) to real (say 44101) sample rate of the device) -
with the rate scalar you can do interpolations between the sample time
(counting samples and converting to time via the sample rate) and the
corresponding host time as it is provided to you by a particular audio
device...
Now for audio units the one time that you can always rely on is the
sample count. If you were writing out to a file and thus pulling on an
audio unit to render - you no longer have a real time operation - so
the host time field will probably NOT be valid at that point - but the
sample count will be.
When an output unit is started, we reset the sample count field of the
time stamp to zero and just count up from there... But!, you should
always look at this as a relative field (ie. first time you are asked
to render, take the start count of the sample number, then that is your
zero point) - as you never know as an audio unit when you have been
connected into a running situation (so DON'T rely on getting a value of
zero here the first time you are called to render)
Bill
On Thursday, February 20, 2003, at 11:33 AM, Jeff Moore wrote:
The device driver provides a series of time stamps that map out the
sample time's relationship to host time. The HAL has code that takes
that information and can project values between the two time bases.
This is embodied in the API as AudioDeviceTranslateTime(). The HAL
uses this facility to fill out the AudioTimeStamps it passes to each
IOProc it calls. At that level, you will always see the sample time,
the host time, and starting in 10.2, the rate scalar as valid.
It is the intent of the Audio Units to preserve the integrity of the
time stamps they are pulled with when calling their inputs, but I know
that there have been some issues there in the past that I don't know
have been resolved (Bill or Doug might be able to comment more on
that). For other APIs that sit on the HAL, you'll have to consult with
their maintainers as to what the policy is.
On Thursday, February 20, 2003, at 12:14 AM, Andrea Gozzi wrote:
----- Original Message -----
From: "Jeff Moore" <email@hidden>
For instance, the HAL provides both the sample time and the host time
when it calls IOProcs. This reflects the HAL's ability to easily
convert between the two and can be exploited to provide good synch
primitives.
Just curious. Is that an audio device driver task (to provide the
host time
in the IOProc call?), or an OS task?
I found at least one situation where the host time was not provided,
only
sample time....
Andrea
_______________________________________________
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.
--
Jeff Moore
Core Audio
Apple
_______________________________________________
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.
--
mailto:email@hidden
tel: +1 408 974 4056
________________________________________________________________________
__
"Much human ingenuity has gone into finding the ultimate Before.
The current state of knowledge can be summarized thus:
In the beginning, there was nothing, which exploded" - Terry Pratchett
________________________________________________________________________
__
_______________________________________________
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.