Re: Creating a Discrete Parameter
Re: Creating a Discrete Parameter
- Subject: Re: Creating a Discrete Parameter
- From: William Stewart <email@hidden>
- Date: Thu, 14 Aug 2008 15:57:13 -0700
Why can't you implement this in the SetParameter method... All that
you need to do I think is:
(1) Overide SetParameter, truncating the value
(2) Call SuperClass::SetParameter with the truncated value
Then, anytime someone tries to get the parameter it will be the
truncated one..
However, we also have a notion of indexed parameters which are
probably more suitable for what you are trying to do - as in this case
you are telling hosts (including generic views) that your parameter is
a set of fairly course discrete steps (rather than a continuous value
range)
So, in the example you give below, you could declare your parameter as:
0 < x <= 16
and indexed
Then you'd have a slider drawn for you that would range from
Min - - - - - Max
with the slider values knotched to integer values
You can also provide names for the different parameter values - so
you'd either get a menu for your discrete values, or using the
ParameterValueNames stuff we'd just draw a different value for each
parameter value...
Bill
On Aug 14, 2008, at 8:48 AM, Adam Stark wrote:
Hi,
I am trying to create a parameter that takes 'discrete' values. I
want it to take values between 0 and 4 at intervals of 0.25 so that
the values would be...
0, 0.25, 0.5, 0.75, 1, 1.25, ..... , 3.5, 3.75, 4
I want the slider to snap to these values when I change it. I have
done this before for a VST plug-in and I did something like...
newparamvalue = round(paramvalue*4)/4
where paramvalue ranges from 0 to 4. I implemented this in the
SetParameter method.
The problem I have with the audio units is I don't know where to put
this code. I have tried overloading the SetParameter method but that
does not work. Can anyone tell me either:
a) how can I implement this in an audio unit?
or
b) is there an existing parameter profile that will let me do this?
Many Thanks in advance,
Adam
_______________________________________________
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
_______________________________________________
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