AudioDeviceRead and timestamps
AudioDeviceRead and timestamps
- Subject: AudioDeviceRead and timestamps
- From: Andrew Kimpton <email@hidden>
- Date: Thu, 19 Jun 2003 17:04:56 -0700
I'm using AudioDeviceRead() during an output callback to also read the
audio from the input device (this is USB Audio - so the input and
output devices are different).
I've setup my BufferList and everything just fine - I get audio into my
buffers without any problems. However there appears to be a +/- 1
sample 'wobble' in the acquired data.
I'm playing a generated 750Hz sine wave into the USB Audio Device (an
EMI 2|6) through the SPDIF inputs. I can see (and hear) that on almost
every buffer 'edge' a sample is either being repeated or dropped (so I
don't hear a pure tone).
I create my startTime timestamp using the following code
AudioStampTime startTime;
memcpy(&startTime, inNow /* now as passed to the callback function*/,
sizeof(AudioTimeStamp);
startTime.mSampleTime = startTime.mSampleTime - (Float64)
mInputSafetyOffset - (Float64) mNumberFrames;
mInputSafetyOffset is retrieved at start time by querying the device
and is the same as Daisy reports for the device in question.
mNumberFrames is 512 in this case.
I've logged the startTime values and can see that the values I'm
getting for sampleTime 'move' relative to each other between successive
callbacks by small amounts (typically 0.2 - 0.5) so I may get
difference in sample times between callbacks that looks like :
511.60823805
511.03020467
512.03594040
511.73845436
512.88922777
Am I supposed to be doing some sort of rounding to the sample time
value ? It seems like perhaps I'm suffering from someone elses rounding
?
I've tried using AudioDeviceGetCurrentTime() to initalize my startTime
instead of the now value the callback is given but that actually seemed
to make things worse !
Has anyone else used AudioDeviceRead() in such a manner ?
Andrew 8-)
_______________________________________________
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.