Re: ChannelMap and SampleRate change weirdness
Re: ChannelMap and SampleRate change weirdness
- Subject: Re: ChannelMap and SampleRate change weirdness
- From: William Stewart <email@hidden>
- Date: Thu, 17 Jun 2004 18:08:50 -0700
You don't know that the sample rate of the device has changed until the
AudioDevice (HAL) gives you back a notification...
Basically - you need to do this as if you were an external client.
Attach a sample rate listener (remember, you aren't the only one in
control of the device - some devices have ui's that allow their sample
rates to be changed)
When your sample rate listener changes then:
(1) Check that the sample rate is different than what it was. if not,
return (you can get multiple notifications)
(2) Stop your processing
(3) Uninitialize all of your current AU's (AUGraph helps alot with
this) (You are about to change formats, so you have to do this)
(4) Set your new sample rate on all of the AU's you have
(5) Reinitialize all your AU's
(6) Restart your processing...
So - if you are presenting UI to do this (and really there is no need,
users can go to AMS to do that just fine, and in fact I think that is
the preferred option)...but, if you have UI, then you would just set
the new sample rate on the device, then your listener will take care of
the details
Bill
On 17/06/2004, at 12:40 PM, Robert Grant wrote:
>
Hi Doug - thanks for responding.
>
>
On Jun 17, 2004, at 2:37 PM, Doug Wyatt wrote:
>
>
>> No matter how many channels I ask for when configuring my input
>
>> AUHAL AudioUnitRender tells me that it has just two channels (this
>
>> used to work before I'm sure of it.??? !!!)
>
>
>
> How many channels does the device have?
>
>
Airy has 4 channels of input on his Tascam device.
>
>
> Are you speaking of the number of buffers in the buffer list returned
>
> by AudioUnitRender?
>
Yeah - because in de-interleaved format buffers = channels no?
>
>
> What are the input and output stream descriptions for bus 1?
>
>
Unsure but as I want everything to be canonical I haven't messed with
>
them. Doesn't the AUHAL present input in canonical form by default?
>
>
>> After changing the sample rate from 44.1 to something else (and
>
>> reinitializing everything) AudioUnitRender tells me -10863
>
>> CannotDoInCurrentContext.
>
>>
>
>> What are the possible reasons an AUHAL would return this error? The
>
>> only thing I can think of is that it is being asked to do a sample
>
>> rate conversion - but I've set the device to be the new sample rate
>
>> before initializing the AUHAL Or perhaps it thinks it's being called
>
>> from the wrong thread? But it's on the main graph render thread.
>
>
>
> It has to be getting called on the device's IOProc thread for the
>
> exact same number of samples that were supplied by the IOProc. If
>
> element 1's input and output sample rates do not match, you will get
>
> a sample rate conversion and this will result in the -10863 error.
>
>
>
So you're saying that I should pass the inNumberFrames from the
>
callback to the AudioUnitRender? I'm doing that already.
>
>
What steps would you take to change the SampleRate of a device when
>
using AUHAL?
>
>
I stop and tear down the old AUHAL. Set the sample rate on the device.
>
Build a new AUHAL and start it - where upon I get the -10863 error. I
>
don't see where the mismatch could come in?
>
>
Thanks,
>
>
Robert.
>
_______________________________________________
>
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.
>
>
--
mailto:email@hidden
tel: +1 408 974 4056
________________________________________________________________________
__
Culture Ship Names:
Ravished By The Sheer Implausibility Of That Last Statement [GSV]
I said, I've Got A Big Stick [OU]
Inappropiate Response [OU]
Far Over The Borders Of Insanity And Still Accelerating [Eccentric]
________________________________________________________________________
__
_______________________________________________
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.