Without testing it, your constructor seems to be throwing an exception
(Open is a dispatched call to your constructor that catches any exceptions
and returns them as normal OSStatus errors, see ComponentBase.cpp). The
exception looks like it wraps an invalid parameter error (10878, seen in
AUComponent.h).
I think this exception is being thrown in your call to SetParameter. My
first thought is that your kNumberOfParameters is set to 0. With no
parameters reserved, trying to set one will throw that exact
error/exception above.
The other part of this is that you are accidentally calling SetParameter on
AUBase/YourClass and not the global scope. Though, from the code you
shared, I don't even know how a 2 parameter SetParameter call to the base
class would even compile.
I imagine the constructor body should look more like this:
Hardgainer::Hardgainer (AudioUnit component) : AUEffectBase (component) {
CreateElements ();
Globals () -> UseIndexedParameters (kNumberOfParameters); // <-- Should
be non-zero
Globals () -> SetParameter (
kParameter_Gain,
kDefaultValue_Gain
); // <-- Need more arguments if calling
AUBase::SetParameter.
….
Note: The indexed parameter gets created in global scope by setting it on
the global element first. Only after this initial global setting can it be
safely used by the AU.
--Christian
On Fri, May 22, 2015 at 7:38 PM, Farhan Mannan <[email protected]> wrote:
> I have used the current audio unit tutorial (1) with a bit of tinkering to
> create an Xcode project (2) that successfully builds a component but I
> can’t get it to validate. AUVal gives me error -10878. (3)
>
> I started in Xcode from the 'OS X > System Plug-in > Generic C++ plugin’
> template and copied all the methods in the tutorial for making the sample
> audio unit (TremoloUnit) as well as a couple of methods that were in the
> downloadable sample audio unit that seemed necessary to get it to build -
> essentially trying to mimic the mythical audio unit template that the guide
> refers to, but which is no longer available in Xcode and has been
> unavailable for some time.
>
> I think I have ended up implementing a version of every method in the
> sample audio unit so I’m now stuck as to why it doesn’t validate. I
> understand that the DSP code may be totally useless (it’s only meant to be
> a gain plugin) but the thing won’t even open.
>
> Any suggestions?
>
> Even if this project isn’t salvageable in its current form, is there
> another way I can go about starting to write audio units?
>
> (1)
> https://developer.apple.com/library/mac/documentation/MusicAudio/Conceptual/AudioUnitProgrammingGuide/TheAudioUnit/TheAudioUnit.html#//apple_ref/doc/uid/TP40003278-CH12-SW1
>
> (2) https://github.com/farhanmannan/hardgainer
>
> (3) https://gist.github.com/farhanmannan/d5a83910d0b2f18840c1
> <https://gist.github.com/farhanmannan/d5a83910d0b2f18840c1>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Coreaudio-api mailing list ([email protected])
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/coreaudio-api/recapitch%40gmail.com
>
> This email sent to [email protected]
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/coreaudio-api/archive%40mail-archive.com
This email sent to [email protected]