Re: hardcoded microphone buffering in iPhone?
Re: hardcoded microphone buffering in iPhone?
- Subject: Re: hardcoded microphone buffering in iPhone?
- From: William Stewart <email@hidden>
- Date: Mon, 24 Nov 2008 15:28:03 -0800
On Nov 24, 2008, at 1:13 PM, Inca Rose wrote:
Hi Bill;
What are you propose here is to:
1- Initialize AudioSession ( set interrupt callback, etc )
2- Set preferred values
3- Make the Audio Session Active
4- Check the current values.
5- Set and Initialize AU remoteIO
This is preferred - using this ordering everything is explicit and you
aren't relying on reconfiguring previously configured systems. To my
mind, this is always a more reliable option to take if you can.
It will be also correct to do this ?:
1- Initialize AudioSession ( set interrupt callback, etc )
2- Make the Audio Session Active
3- Set preferred values
4- Check the current values.
5- Set and Initialize AU remoteIO
This should be fine - in some cases you have no real alternative but
to do things this way.
Thanks
Bill
Regards
Inca
On Nov 24, 2008, at 11:03 PM, William Stewart wrote:
On Nov 24, 2008, at 2:13 AM, Inca Rose wrote:
Hi;
I know, I got really crazy trying to figure out how things work.
There is now a sample code from WWDC08 in the net that you can
check. Its name is aurio and
provides a good example ( not complete and not documented ) on how
to use AU remoteIO.
REgarding the buffer size, you can set a parameter to your Audio
Session
The parameter is in seconds, and the buffer size will depend on
the audio format you are using, so
you have to do your maths :)
Float32 preferredBufferSize = 0.005; // 5 millis buffer
UInt32 size = sizeof(preferredBufferSize);
AudioSessionSetProperty
(kAudioSessionProperty_PreferredHardwareIOBufferDuration, size,
&preferredBufferSize);
AudioSessionSetActive(true);
It is better to set the requests for your preferences on audio
session before you are active. (If you can't that's probably ok in
most situations, but we'd prefer to see you do it this way)
You don't know what you will get though, until you are active, so
the next call will return an "undefined" value if you are not active.
Bill
AudioSessionGetProperty
(kAudioSessionProperty_CurrentHardwareIOBufferDuration, &size,
&preferredBufferSize);
Regards
Inca R
On Nov 24, 2008, at 11:36 AM, Nate wrote:
Hi Inca,
Thanks for the AU RemoteIO tip! It seems to be notifying properly
and not buffering internally, however there doesn't appear to be
a mechanism for setting the buffer size. Is this right? The
default buffer size is small enough for my needs so this is ok,
but I would like to set it explicitly. If it is ever larger than
the size I need then my app will not work properly.
Am I missing something or is AU RemoteIO completely undocumented?
I had to cobble it together from the one or two code snippets
scattered across the internet. That this isn't documented and
that the 8kb hardcoded buffering of AQS isn't documented wasted a
significant amount of my time, as the chew marks on my monitor
can attest. I certainly hope that not all iPhone programming is
this fun.
-Nate
_______________________________________________
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
_______________________________________________
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