kAudioOutputUnitProperty_StartTimestampsAtZero on 10.2.8
kAudioOutputUnitProperty_StartTimestampsAtZero on 10.2.8
- Subject: kAudioOutputUnitProperty_StartTimestampsAtZero on 10.2.8
- From: Steve Checkoway <email@hidden>
- Date: Sun, 18 Jun 2006 02:20:07 -0700
At the suggestions of people on this list, I've started rewriting my
code using the AUHAL. Since I need to know the current sample time
I'm AudioDeviceGetCurrentTime. I need to have that match up with the
time passed in to my Render callback. If I set the
kAudioOutputUnitProperty_StartTimestampsAtZero property to zero, then
this works as expected. However, this constant isn't defined in the
10.2.8 SDK (nor the 10.3.9 SDK) so I assume that it isn't implemented
in earlier systems.
I've tried using AudioDeviceTranslateTime() to translate the time but
that is not working for me. The code I'm using is the following.
OSStatus RageSound_AU::Render( void *inRefCon,
AudioUnitRenderActionFlags *ioActionFlags,
const AudioTimeStamp *inTimeStamp,
UInt32 inBusNumber,
UInt32 inNumberFrames,
AudioBufferList *ioData )
{
RageSound_AU *This = (RageSound_AU *)inRefCon;
AudioTimeStamp time;
time.mFlags = inTimeStamp->mFlags & ~kAudioTimeStampHostTimeValid;
AudioDeviceTranslateTime( This->m_OutputDevice, inTimeStamp, &time );
ASSERT( time.mFlags & kAudioTimeStampHostTimeValid );
AudioBuffer &buf = ioData->mBuffers[0];
int64_t decodePos = int64_t( time.mSampleTime ) + This->m_iOffset;
This->Mix( (int16_t *)buf.mData, inNumberFrames, decodePos, This-
>GetPosition(NULL) );
return noErr;
}
This->m_OutputDevice is set to be the current device of the AU. The
assert is firing. I tried using mHostTime both in my GetPosition()
function and here but it doesn't work well at all. The video is tied
to the audio and when I use mHostTime, the video becomes jerky
whereas if I use mSampleTime, it is very smooth.
One additional question: why does
Float64 latency = 0.0;
size = sizeof(latency);
error = AudioUnitGetProperty( m_OutputUnit,
kAudioUnitProperty_Latency,
kAudioUnitScope_Output,
0,
&latency,
&size );
return 4294956430 for error? I know I can get the latency from the
output device itself and it seems that's what I will have to do but
this looks like it should work to me.
--
Steve Checkoway
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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