Re: iPhone - AudioUnitRender() on 3DMixer
Re: iPhone - AudioUnitRender() on 3DMixer
- Subject: Re: iPhone - AudioUnitRender() on 3DMixer
- From: William Stewart <email@hidden>
- Date: Fri, 11 Sep 2009 11:45:33 -0700
On Sep 10, 2009, at 10:19 PM, ROBB A MANIA wrote:
> you can't use the buffer pointer that is provided for you to get
input from the rioUnit, to
> call for output of the mixer.
actually, this is my bad. I should have been clearer.
the rioUnit has 2 callbacks - one that is issued when you have input
data to collect, and one that is issued when you need to provide
output data.
In the input case, you can't use the buffer list for this use (which
you probably aren't anyway, and this was my confusion! sorry)
In the output case, then of course, you have to use the buffer list as
that is what you want to fill.
So, you have to make sure that the format on the input bus (0) of the
rioUnit is exactly the same as the format of the output bus (0) of the
3DMixer. If those formats don't match, then the buffer list you are
getting from the rioUnit is not going to be correct to use as you are.
The easiest way to do this is to just get the format from the output
of the mixer, and set it as the format for the input bus(0) of the
rioUnit - you need to do this before you start the rioUnit.
I think this is where I've been thrown off. Basically I want to
apply a master effect to the mixed down signals output from the
3DMixer. I am attempting to do this in the callback of the
rioUnit. I've shown a simplified callback with no effects here to
illustrate my problem. I'm not sure why I wouldn't be able to use
this buffer pointer to call output from the mixer. My understanding
is that the rioUnit will call this callback with a pointer to the
buffer it would like filled with audio data. Also, AudioUnitRender
() fills the last parameter with audio data rendered from the input
unit. Why wouldn't this be a valid input?
Yep, so I suspect its a format mismatch.
Now, of course the other thing is that I don't understand why you
would use an AUGraph - you are manually inserting your code and
managing the signal chain between the rioUnit and the mixer, so the
graph really isn't doing much to help you here - you might as well
just find and open the audio units directly (see <AudioUnit/
AudioComponent.h>)
Bill
--- On Thu, 9/10/09, William Stewart <email@hidden> wrote:
From: William Stewart <email@hidden>
Subject: Re: iPhone - AudioUnitRender() on 3DMixer
To: "ROBB A MANIA" <email@hidden>
Cc: "CoreAudio API" <email@hidden>
Date: Thursday, September 10, 2009, 8:46 PM
On Sep 10, 2009, at 5:01 PM, ROBB A MANIA wrote:
> Hello All,
> I am experiencing an issue with AudioUnitRender() on the iPhone.
I have an AUGraph with containing a 3DMixer with mono 44.1 kHz PCM
inputs and stereo output.
ok
> This feeds into the AURIO unit. When I directly connect the
3DMixer to the AURIO unit using AUGraphConnectNodeInput(),
everything runs perfectly.
natch :)
> However, I don't want to use the node connection. I want to use a
callback in the AURIO unit which renders the 3DMixer.
ok
> When I attempt to do this, I am unable to successfully render the
3DMixer using AudioUnitRender() inside the AURIO callback. I get a
-50 error from the AudioUnitRender command. The callback is very
simple:
>
> static OSStatus rioCallback(void *inRefCon,
AudioUnitRenderActionFlags*ioActionFlags, const AudioTimeStamp
*inTimeStamp, UInt32 inBusNumber, UInt32inNumberFrames,
AudioBufferList *ioData) {
>
> RSplayer *player = (RSplayer *)inRefCon;
> OSStatus err = 0;
>
> err = AudioUnitRender(player.masterMixer, ioActionFlags,
inTimeStamp, inBusNumber, inNumberFrames, ioData);
>
> return err;
> }
one of the parameters you are passing to AudioUnitRender is wrong.
Probably the ioData buffer list is not set up correctly?
>
> Is there a flag I should be setting other than what is supplied by
the callback input?
you can't use the buffer pointer that is provided for you to get
input from the rioUnit, to call for output of the mixer.
Its really not clear to me what you want to do, so perhaps you can
just describe that (draw a quick signal flow diagram)
> I feel the issue may be something to do with mono inputs to the
3DMixer or a general peculiarity with rendering the 3DMixer. I was
able to find a work around to this issue by inserting a
MultiChannelMixer between the 3DMixer and the AURIO unit. Then I
directly connect the3DMixer output to the MultiChannelMixer input. I
am then able to successfully render the MultiChannelMixer using a
similar version of this callback (replacing the audio unit that gets
rendered obviously).
>
> Can anyone offer insight into this issue? Is it possible to
render the 3DMixer here without the buffer MultiChannelMixer? Is
there an additional setting or flag that I need to apply? I
appreciate all help.
_______________________________________________
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