Re: Temporarily Stopping IOAudioEngine From Inside
Re: Temporarily Stopping IOAudioEngine From Inside
- Subject: Re: Temporarily Stopping IOAudioEngine From Inside
- From: "B.J. Buchalter" <email@hidden>
- Date: Sat, 20 Mar 2004 22:22:00 -0500
on 3/20/04 8:31 PM, Kurt Bigler at email@hidden wrote:
>
on 3/17/04 9:37 AM, Dirk Musfeldt <email@hidden> wrote:
>
>
> Hi all,
>
>
>
> I want to temporarily stop my IOAudioEngine from inside when I know that
>
> there's some setup going on and the hardware is unable to deliver any
>
> samples. The setup is due to external reasons, so the IOAudioEngine is not
>
> stopped from CoreAudio.
>
>
>
> How is that possible?
>
>
I think you're saying you want to stop audio on the driver side, because I
>
don't know what you might otherwise mean by "from inside". If so, how would
>
host applications ever deal with this? It seems to me you are talking about
>
a hardware situation that the host app would not normally expect to see
>
after they started audio transport, which means that as far as the app is
>
concerned, this is a failure condition.
>
>
So, if I am understanding you correctly, you might as well deliver zeroed
>
buffers (for input) and simply ignore output, because compared to stoping
>
audio engines behind the back of applications, that would be the lesser
>
evil.
>
>
Not an expert in this, but replying anyway since you've gotten no other
>
response so far.
>
Kurt - Actually, this can happen even if the driver does not explicitly try
to stop the engine. For example if another app (or the user) changes the
sample rate of the device while it is running, the engine will be stopped
and automatically restarted. This is the mechanism by which the MIO driver
reports sample rate changes, for example. So, in the CA environment, Apps
really do need to be able to deal with this condition. I think that except
for the fact that your synchronization code needs to be aware that this can
happen, it is pretty invisible to your app. I think that there is a
notification that you will get if you are registered for the right
notifications, and you can use that to note that you need to resync the next
time your IOProc gets called.
Dirk - there are pause and resume member functions in the AudioEngine class
that can be used to stop and restart the engine while external configuration
changes are taking place. Check out the implementation of
IOAudioEngine::hardwareSampleRateChanged in the IOAudioFamily subproject of
Darwin. This shows how the family deals with stopping and restarting the
engine in the case of an external sample rate change. The basic idea can be
propagated to dealing with your situation.
Best regards,
B.J. Buchalter
Metric Halo
5 Donovan Drive
Hopewell Junction, NY 12533 USA
tel +1 845 223-6112
fax +1 603 250-2451
_______________________________________________
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.