Re: Input callback timestamp reset and current sample time
Re: Input callback timestamp reset and current sample time
- Subject: Re: Input callback timestamp reset and current sample time
- From: Jeff Moore <email@hidden>
- Date: Thu, 29 Sep 2005 16:01:32 -0700
On Sep 29, 2005, at 3:37 PM, email@hidden wrote:
It's quite likely that I'm just confused about the way CoreAudio
works. I'm very new to it (last week was the first time I've ever
looked at CoreAudio). Here's an example of the input callback:
<code sample snipped>
Your first problem is that you are calling AudioDeviceTranslateTime()
incorrectly to translate a host time into a sample time. Instead of:
deviceTime.mFlags = kAudioTimeStampSampleTimeValid;
err = AudioDeviceTranslateTime( deviceID, inTimeStamp,
&deviceTime );
you need to do:
AudioTimeStamp theTimeToTranslate = *inTimeStamp;
theTimeToTranslate.mFlags = kAudioTimeStampHostTimeValid;
deviceTime.mFlags = kAudioTimeStampSampleTimeValid;
err = AudioDeviceTranslateTime( deviceID, &theTimeToTranslate,
&deviceTime );
The reason why is that the inTimeStamp has both a valid sample time
and valid host time and AudioDeviceTranslateTime will just copy the
sample time over from the input time stamp to the output time stamp.
Now I know you're confused because the input time stamps are always
in the past.
I forgot to add "passed to IOProcs" in between "time stamps" and "are
always" in this statement. Obviously, with AUHAL involved there are a
few wrinkles, but this statement will still always be true.
Here's an example of where I see the input timestamp in the future:
Bill and I were talking about this and we're confused (well I'm
confused at any rate). Everything you've said so far made me think
that you were talking about getting the input data captured from a
given hardware device using AUHAL. Conversely, Bill thought that you
were talking about sending output data to the device for it to put
out the speaker.
If you are talking about input, I'm not sure how you are getting the
time stamp you are getting. I traced through AUHAL's code and it is
basically passing the HAL's time stamp to the input callback. We're
going to need still more info about what you are doing to track down
why the time stamp would be so odd.
However, if you are talking about output, then what you are seeing is
expected. The output time stamp is always in the future. Bill's last
email about the time stamps is a pretty good explanation for what's
going on.
--
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