Glad its working now. :) One last thing: Since you inherit off of AUEffectBase and not just AUBase, SetParameter will call AUEffectBase's implementation, which is just a wrapper around the Globals->SetParameter() call (check out AUEffectBase.h). I had missed this detail originally, as I no longer use AUEffectBase and had forgotten about it's interface. In AUBase, there is just the 5 parameter virtual SetParameter method. AudioUnits inheriting off of AUBase can override that directly and need to explicitly specify calls to Globals()->SetParameter.
Note: AUEffectBase declares a "using" declaration with respect to AUBase::SetParameter. This is what allows a derived class to call both versions. Without the using declaration, AUEffectBase's override would hide AUBase's function. I think this explains both my initial analysis and the behavior you are seeing. I just wanted to share this with the general audience, in case someone in the future gets confused by the method overloading of SetParameter, though it is probably covered elsewhere in the list history. --Christian On Sat, May 23, 2015 at 7:53 AM, Farhan Mannan <[email protected]> wrote: > Thank you very much Christian. > > Correctly setting kNumberOfParameters to 1 now allows the Audio Unit to > get to the "render” stage of AUVal without crashing - haha. > > Will check out SetParameter - in the example TremoloUnit it is used with > two arguments like so: > > SetParameter ( > kParameter_Frequency, > kDefaultValue_Tremolo_Freq > ); > > SetParameter ( > kParameter_Depth, > kDefaultValue_Tremolo_Depth > ); > > SetParameter ( > kParameter_Waveform, > kDefaultValue_Tremolo_Waveform > ); > > On 23 May 2015, at 04:04, Christian Rober <[email protected]> wrote: > > 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]
