• 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: William Stewart <email@hidden>
  • Date: Mon, 14 Feb 2005 16:19:12 -0800

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.

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

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

-- mailto:email@hidden
tel: +1 408 974 4056

________________________________________________________________________ __
"Much human ingenuity has gone into finding the ultimate Before.
The current state of knowledge can be summarized thus:
In the beginning, there was nothing, which exploded" - Terry Pratchett
________________________________________________________________________ __

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

  • Prev by Date: Re: coreaudio jaguar version?
  • Next by Date: Re: Tone Generation
  • Previous by thread: AU parameter display flags
  • Next by thread: Re: AU parameter display flags
  • Index(es):
    • Date
    • Thread