• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Writing an AudioUnit (was: Simple VST to AU)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Writing an AudioUnit (was: Simple VST to AU)


  • Subject: Re: Writing an AudioUnit (was: Simple VST to AU)
  • From: Urs Heckmann <email@hidden>
  • Date: Sun, 2 Mar 2003 13:05:44 +0100

schrieb Bill Stewart:

If its not and there are things we can add to make it easier - please let us know.

Hi Bill,

here are some thoughts:

I'd move setting up data structures (like parameters...) from constructor to initialize(), because many hosts instantiate and destroy all available AUs at startup to gather information. This is equivalent to the not-so-well known VST method open(). It simply saves time.

Hmm, to extend this, I'd recommend to implement all methods you'd typically use, like SetParameter() and put in comment fields what you'd typically do there...

If you'd like to address VST people (and I think you should, because the majority of developers will probably come from there), I'd add some simple "how-tos", like how to normalize a parameter easily. If parameters get normalized, VST people have to re-write less code...

Oh yes, and I really like the way Emagic set up AudioUnitParameterInfos in their sample project by a const static array. This is definately the most convenient way I've ever used.

Cheers,

;) Urs


Example SetParameter() for VST developers (the used arrays should be made clear by the rest of the code...):

ComponentResult myAU::SetParameter(AudioUnitParameterID iID, AudioUnitScope iScope, AudioUnitElement iElem, Float32 rValue, UInt32 iSchedule)
{
// Set a new value for a parameter.
if (iScope==kAudioUnitScope_Global && iElem==0)
{
// Store value in a private Array if your process needs it often

au_parameter_array[iID]=rValue;

// If normalized parameters are needed, i.e. if your process comes from a VST project,
// here's how to conveniently normalize (set to ranges 0.0f - 1.0f) an AU parameter where
// ParInfo is an static const array of AudioUnitParameterInfo structs

float normValue = ( rValue - ParInfo[ iID ].minValue ) / ( ParInfo[ iID ].maxValue - ParInfo[ iID ].minValue );

// What about storing VST-like normalized values in their own array?

normalized_parameter_array[ iID] = rValue;

// special cases like precalculating new filter coefficients or putting timestamped changes in a queue:

switch ( iID )
{
case kMySpecialZeroAwareParameter:
if ( rValue == 0.f ) doWhatsNeededWhenThisIsZero();
break;

default:
// whetever you want
break;
}
}
return AUBase::SetParameter(iID, iScope, iElem, rValue, iSchedule);
}
_______________________________________________
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.
References: 
 >Writing an AudioUnit (was: Simple VST to AU) (From: Bill Stewart <email@hidden>)

  • Prev by Date: Re: Writing an AudioUnit (was: Simple VST to AU)
  • Next by Date: AudioXplorer
  • Previous by thread: Re: Writing an AudioUnit (was: Simple VST to AU)
  • Next by thread: Re: Simple AU from VST?
  • Index(es):
    • Date
    • Thread