Re: Synchronization problem in 10.2
Re: Synchronization problem in 10.2
- Subject: Re: Synchronization problem in 10.2
- From: Laurent Humbert <email@hidden>
- Date: Thu, 3 Oct 2002 08:55:05 +0200
At 3:00 PM -0700 9/30/02, Mark Cookson wrote:
What we've noticed is that at certain combinations of buffer sizes
in the application and driver the HAL's IOProc thread beats against
the driver's USB completion routines, causing the USB completion
routine to be preempted or held off. If your driver is anything
like the AppleUSBAudio driver, then you queue up more frame lists to
write from the completion routine of the previous routines, and this
means that you are delayed from queuing up more writes. I've tried
to mitigate this problem in two ways.
My (FireWire) audio driver would not work properly until I passed a
fixed interval to the takeTimeStamp routine. For example, it it
theoratically takes 2.321955 seconds to fill the input buffer, the
code looks like this.
UInt64 nanos;
AbsoluteTime wraptime;
nanos = ((UInt64) 2321955) * 1000;
nanoseconds_to_absolutetime(nanos, &wraptime);
ADD_ABSOLUTETIME(&wraptime, &theAudioEngine->status->fLastLoopTime);
theAudioEngine->takeTimeStamp(true, &wraptime);
If I did thing by the book and simply called
theAudioEngine->takeTimeStamp()
then a drift would occur and the sound deteriorate gradually. The log
would fill with
>!!! firstSampleFrame->audioEngine->numSampleFramesPerBuffer (XXXXX > YYYYY)
I wish I hadn't lost so much time trying to figure that one out.
Eventually DTS put an end to my misery.
Laurent
_______________________________________________
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.