Re: A simple 'Device Through' app (need some help).
Re: A simple 'Device Through' app (need some help).
- Subject: Re: A simple 'Device Through' app (need some help).
- From: "Mikael Hakman" <email@hidden>
- Date: Tue, 8 Jul 2008 21:02:23 +0200
- Organization: Datakonsulten AB
On Tuesday, July 08, 2008 6:09 AM, Glenn McCord wrote:
Yes, this is happening. Almost all pops I get will be because of an
input or output callback being used twice in a row.
That explains the pops. If you get called at most twice (more than that
would imply different SR for input and output) in a row then your "queue"
needs at most 2 elements - this is what ASIO does too, except that it does
it for you.
I thought
buffering the input AudioBufferLists to a queue would solve this, but
it didn't. What I did was add all input AudioBufferLists to the queue,
then have the output callback pop an AudioBufferList from the front of
the queue. I checked, and there is no situation where there isn't
something in a queue, because the input callback is called about 50
times before the output callback starts. The queue stays at roughly 50
in size, thus the output callback should always have audio to play.
Do you or your queue copy input data when storing your AudioBufferList
elements in the queue? If not then the queue consists of elements pointing
to the same data area all the time and this will be overwritten all the time
and then you get pops again. You need to queue _data_, not pointers. Also, I
don't think data pointer passed to you in your input IOProc is valid (for
you to use) after you return from IOProc.
The other "experiments" aren't needed anymore - we know now the problem -
due to timing uncertainty in the computer and OS, your input callback gets
called sometimes just before and sometimes just after your output callback
(and vice versa), which coincidentally gives 2 calls to the same callback
now and then.
Regards/Mikael
_______________________________________________
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