• 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
Audio Units: Reset() and parameter smoothing, please help
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Audio Units: Reset() and parameter smoothing, please help


  • Subject: Audio Units: Reset() and parameter smoothing, please help
  • From: Artemiy Pavlov <email@hidden>
  • Date: Fri, 30 Jun 2006 19:38:32 +0300

Hello everybody!

I would like to ask you guys help me a bit with a weird problem. What I need to do is realtime parameter smoothing. I do it like this: I have a parameter variable and a private state variable. Before the while() cycle in Process(), I calculate the smoothing step as (parameter - state variable) / number of frames. Then in the while() cycle I advance by 1 step, and also set the state variable to last parameter value after while(). I also set this state variable to 0 in Reset(). This always worked fine in other plugin format.

However, sometimes in the Wave Editor host I get random values for the state variable, like -inf or +inf or 534 etc. when it's from 0 to 1 by definition... No memleaks in my plugin, I tested in auval and Garage Band (though quite a lot of leaks in WE: http://artemio.net/ tmp/Leaks.txt).

But what is weird is I can't blame WE at all as it seems to only happen it my plugin!

To track everything down I started a new clean AU project, added just a few lines and this still happens. The complete code snippets are below (also note I do not do sanity checks for variables (e.g. see if they are in the 0..1 range etc.) but this does not work anyway if the variable is -inf or +inf):

In the AUEffectBase class, I added:

------------------------------------------------------------------------ ---------------------
public:
float mLastParam_One;
------------------------------------------------------------------------ ---------------------



Then, in Reset() I do:

------------------------------------------------------------------------ ---------------------
mLastParam_One = 0.0;
------------------------------------------------------------------------ ---------------------


Then, in Process():

------------------------------------------------------------------------ ---------------------
Float32 Param_One = GetParameter( kParam_One );
float mStepParam_One;
mStepParam_One = ( Param_One - mLastParam_One ) / nSampleFrames;
Param_One = mLastParam_One;
------------------------------------------------------------------------ ---------------------


Inside the while (nSampleFrames-- > 0) cycle:

------------------------------------------------------------------------ ---------------------
Param_One += mStepParam_One;
outputSample = inputSample * Param_One;
------------------------------------------------------------------------ ---------------------


And after the cycle ends:

------------------------------------------------------------------------ ---------------------
mLastParam_One = Param_One;
------------------------------------------------------------------------ ---------------------



Artemiy Pavlov Sineshine http://sineshine.com



_______________________________________________
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


  • Prev by Date: Re: Virtual Device Questions
  • Next by Date: Oxford OXFW971
  • Previous by thread: Re: ProductID read from the USB descriptors for an audio device
  • Next by thread: Oxford OXFW971
  • Index(es):
    • Date
    • Thread