• 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: AU parameter display flags
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AU parameter display flags


  • Subject: Re: AU parameter display flags
  • From: Marc Poirier <email@hidden>
  • Date: Tue, 15 Feb 2005 15:14:31 -0500

On Feb 14, 2005, at 7:19 PM, William Stewart wrote:

This is consistent with the way we use Log/Exp...

So, the idea here is that the parameter value is squared to a linear value with the Display Squared flag

"Display the parameter's value by TRANSFORM_IT function on that value" kind of thing.

In which case, "the parameter's value" is the "linear value" or the literal value? In other words, is it done in AUParameterValueFromLinear() and undone in AUParameterValueToLinear(), or done in AUParameterValueToLinear() and undone in AUParameterValueFromLinear()? That's what the difference here is. You can't directly scale the literal value since it could range anywhere, you would at least need to normalize it, and so anyway, I had thought the idea was apply TRANSFORM_IT to the linear value and then mapping it to the literal range/limits. That's what gives the response's feel to a general control (e.g. slider on a GUI, lines in automation drawing, etc.).

This is how DisplayLog has always been interpreted, so we wanted to be consistent with that.

So far as I can tell, that's not the case. Unless I am just getting mixed up here, the behavior that I see is that DisplayLog is transforming in AUParameterValueFromLinear() and un-transforming in AUParameterValueToLinear(), whereas the rest are transforming in AUParameterValueToLinear() and un-transforming in AUParameterValueFromLinear(). That's why I brought this up. But maybe I am just getting lost...

thanks,
Marc



Bill

On 14/02/2005, at 12:38 PM, Marc Poirier wrote:

So I've just been working on an AU that provides no custom view and using the display AU parameter flags for a few parameters, a feature which was added due to my ceaseless nagging ;-), and now I notice that a few of them have actually been implemented in the inverse fashion. Or at least the inverse of what I had suggested. I'm not sure if this is just a straight-up bug in the AudioUnitToolbox code, or intentional (and just different than what I would have thought would be intended), so I was wondering if anyone knows which is the case.

Specifically, I am talking about these display options:
kAudioUnitParameterFlag_DisplaySquareRoot
kAudioUnitParameterFlag_DisplaySquared
kAudioUnitParameterFlag_DisplayCubed
kAudioUnitParameterFlag_DisplayCubeRoot

Rather than try to explain what I expect, I will just show what I would have thought the math might look like:


Float32 AUParameterValueFromLinear(Float32 inLinearValue, const AudioUnitParameter * inParameter)
{
Float32 minValue = inParameter->minValue;
Float32 valueRange = inParameter->maxValue - minValue;

switch (inParameter->flags & kAudioUnitParameterFlag_DisplayMask)
{
case kAudioUnitParameterFlag_DisplaySquareRoot:
return (sqrtf(inLinearValue) * valueRange) + minValue;

case kAudioUnitParameterFlag_DisplaySquared:
return (inLinearValue*inLinearValue * valueRange) + minValue;

case kAudioUnitParameterFlag_DisplayCubed:
return (inLinearValue*inLinearValue*inLinearValue * valueRange) + minValue;

case kAudioUnitParameterFlag_DisplayCubeRoot:
return (inLinearValue*inLinearValue*inLinearValue * valueRange) + minValue;

default:
return (inLinearValue * valueRange) + minValue;
}
}


Float32 AUParameterValueToLinear(Float32 inParameterValue, const AudioUnitParameter * inParameter)
{
Float32 minValue = inParameter->minValue;
Float32 valueRange = inParameter->maxValue - minValue;

switch (inParameter->flags & kAudioUnitParameterFlag_DisplayMask)
{
case kAudioUnitParameterFlag_DisplaySquareRoot:
return (sqrtf(inParameterValue) * valueRange) + minValue;

case kAudioUnitParameterFlag_DisplaySquared:
return sqrtf((inParameterValue-minValue) / valueRange);

case kAudioUnitParameterFlag_DisplayCubed:
return powf( (inParameterValue-minValue) / valueRange, 1.0f/3.0f );

case kAudioUnitParameterFlag_DisplayCubeRoot:
return powf( (inParameterValue-minValue) / valueRange, 1.0f/3.0f );

default:
return (inParameterValue-minValue) / valueRange;
}
}


This is what I would expect, but the behavior that I am getting has kAudioUnitParameterFlag_DisplaySquareRoot switched with kAudioUnitParameterFlag_DisplaySquared, and kAudioUnitParameterFlag_DisplayCubed switched with kAudioUnitParameterFlag_DisplayCubeRoot.


thanks,
Marc

_______________________________________________
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
References: 
 >AU parameter display flags (From: Marc Poirier <email@hidden>)
 >Re: AU parameter display flags (From: William Stewart <email@hidden>)

  • Prev by Date: Re: in & out Callbacks
  • Next by Date: Re: More Glitches
  • Previous by thread: Re: AU parameter display flags
  • Next by thread: Re: AU parameter display flags
  • Index(es):
    • Date
    • Thread