Re: Error in AudioUnitRender()
Re: Error in AudioUnitRender()
- Subject: Re: Error in AudioUnitRender()
- From: William Stewart <email@hidden>
- Date: Mon, 12 Dec 2005 15:40:57 -0800
On 12/12/2005, at 1:57 PM, Jeremy Sagan wrote:
Hi Bill,
Well I apologize (again) for this. Sorry. I was not checking the
return setting of kAudioUnitProperty_MaximumFramesPerSlice at a
higher level and it was indeed returning errors.
However AU components like DLSMusicDevice allows the setting of
sample rate while initialized and other AU components do not allow
setting of sample rate while initialized. So I guess the question
is: how do you know which properties are settable while the AU is
initialized and which are not? Is it dependent on the AU? In
general should the host try the setting and if an uninitialized
type error is returned then uninit the AU and try again? This is
what I think deserves some clarification.
In general, changing anything about the AU that might lead to
reallocations should need the AU to be uninitialized. So, format
changes, max frames are the two most common. Other properties like
changing the number of I/O elements is another such example.
We don't provide hard and fast rules for any of these, just
recommended practises. Normally, we base this on what we think is
easiest for the AU to implement, especially if it avoids the need for
an AU to take locks on its render thread for instance.
However, for some AUs we don't have this luxury. For instance, the
output units Apple ships must be able to handle changes to the device
it talks with, so they need to be able to work without this
restriction being placed on the client. Apple's DLSMusicDevice is
used as the synthesis engine for QuickTime's Music API set; which
also has no concept of Init states of its engine, so we decided to
deal with this internally to that AU.
In general (and auval works this way mostly) you can try to do
something. If that action fails because the AU is initialized, you
may see a kAudioUnitErr_Initialised being returned - and can go an un-
initialize the AU. You may see other errors, but this should be the
common/expected one.
You can also see the reverse too; the host tries to do something with
an AU that needs to be initialized - so you can see
kAudioUnitErr_Uninitialized to signify that its current state is un-
initialized, and it must be Initialized to satisfy your request. A
common situation for this is setting a parameter's value for
instance. auval looks for these codes explicitly when validating an
AUs behaviour.
HTH
Bill
Jeremy
On Dec 12, 2005, at 3:29 PM, Jeremy Sagan wrote:
Hello Bill,
I DO check error codes. Why do they return NoErr?
On Dec 12, 2005, at 1:56 PM, William Stewart wrote:
On 10/12/2005, at 10:52 AM, Jeremy Sagan wrote:
Hello,
Perhaps this is due to a mistake I seem to make frequently. This
property is only settable when the AU is uninitialized. I wish
this was made clearer in the documentation!
We return result codes - you should always check them :-)
A really simple macro if the verify_noerr - it does nothing on
Release builds, and gives you a nice print out for non-zero
returns on Debug (have to define DEBUG of course)
Bill
Jeremy
On Dec 10, 2005, at 1:24 PM, Jeremy Sagan wrote:
Hello Doug,
When I do this with 2048 frames as shown below it succeeds with
noErr however when I call AudioUnitRender
I get a kAudioUnitErr_TooManyFramesToProcess error every time.
Is there any explanation for this? Is there anything else that
could cause this?
I have tried this on both the reverb and the DLSMusicDevice.
FYI, it always works fine with 1024 frames.
Jeremy
On Dec 9, 2005, at 9:29 PM, Doug Wyatt wrote:
You can interrogate kAudioUnitProperty_MaximumFramesPerSlice
and respect it -- or you can set it:
UInt32 frames = 2048;
AudioUnitSetProperty(myReverbAUInstance,
kAudioUnitProperty_MaximumFramesPerSlice,
kAudioUnitScope_Global,
0,
&frames,
sizeof(frames));
Doug
On Dec 9, 2005, at 18:17, john wrote:
Hi,
Thanks Philippe, that's what I was looking for!
I implemented this and while using the Matrix Reverb I'm
getting kAudioUnitErr_TooManyFramesToProcess. I'm sure (well,
I hope) I can just reduce the frames (it is 2048 frames with
floating point data), but is there any way to determine the
maximum frame count without trial and error?
Thanks!
-- John
--
Doug Wyatt
Core Audio, Apple
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
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:
email@hidden
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:
40apple.com
This email sent to email@hidden
--
mailto:email@hidden
tel: +1 408 974 4056
____________________________________________________________________
______
"Much human ingenuity has gone into finding the ultimate Before.
The current state of knowledge can be summarized thus:
In the beginning, there was nothing, which exploded" - Terry
Pratchett
____________________________________________________________________
______
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40verizon.net
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:
40verizon.net
This email sent to email@hidden
--
mailto:email@hidden
tel: +1 408 974 4056
________________________________________________________________________
__
"Much human ingenuity has gone into finding the ultimate Before.
The current state of knowledge can be summarized thus:
In the beginning, there was nothing, which exploded" - Terry Pratchett
________________________________________________________________________
__
_______________________________________________
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