Re: iPhone audio hardware changing during my app's run
Re: iPhone audio hardware changing during my app's run
- Subject: Re: iPhone audio hardware changing during my app's run
- From: Doug Wyatt <email@hidden>
- Date: Mon, 9 Mar 2009 12:02:41 -0700
On Mar 9, 2009, at 11:11 , Evan Olcott wrote:
I have noticed something very strange happening with RemoteIO on the
iPhone, and I wanted to know if this is worthy of a bug report of if
there's something I'm missing:
My application senses whether it's getting mono or stereo input from
RemoteIO's 2-channel stream (via AudioUnitRender) by checking to see
if the samples in the right channel are not 0 and different from the
left channel. I build an AudioBufferList that reflects and wraps
this, then passes it on to the rest of the app. This makes it
dynamic, even though AudioUnitRender always wants an AudioBufferList
that has 2 channels in it (RemoteIO doesn't like to be configured,
it seems, and even with the mono microphone source, the AudioSession
says there's 2 channels, and AudioUnitRender requires that I request
2 channels from RemoteIO).
Anyhow - before the app run, I plug the iPhone into a device that
feeds it 2 channels of different data - a true stereo device (we've
been testing with the Alesis ProTrack). I run the app, and indeed I
see two channels worth of data.
Then I unplug the iPhone from the device, which changes the route to
it's built-in audio input (ReceiverAndMicrophone /
SpeakerAndMicrophone). My input stream stops, some rudimentary route
checks happen, then the input stream starts up again. The data that
I get from RemoteIO is *still stereo*. And this isn't any fake
stereo - this is "both channels have different non-zero data" in them.
What does this stereo data sound like? played at double speed,
possibly interleaved with big chunks of silence? (which would be mono
data being incorrectly presented as stereo)
I would expect to get a stream that is the same as what I got if I
had started up the app *outside* of the stereo device I plugged it
into - a mono stream coming through a stereo AudioBufferList (one
empty channel).
Is there something I'm missing in here? Do I need to call
AudioUnitReset() on the RemoteIO? Is this a legitimate bug?
quite possibly.
The easy workaround is, of course, to tell users: "don't change
audio hardware while the app runs".
This is also one of the toughest things to debug, as you can't have
the audio hardware plugged in and have the iPhone plugged in to
XCode. Not only that, it seems like NSLog messages are throttled to
1 per second, so you miss a lot when doing things "in the stream"
like this - are there any tips anyone has for this?
_______________________________________________
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