Re: Parameter Display Updating
Re: Parameter Display Updating
- Subject: Re: Parameter Display Updating
- From: Aristotel Digenis <email@hidden>
- Date: Mon, 28 Jun 2004 23:35:39 +0100
Yes!! that works...thank you very much...(again!) :-)
William Stewart wrote:
On 28/06/2004, at 4:57 AM, Aristotel Digenis wrote:
Hello everybody,
I am having a problem with updating parameters to updated values.
Lets say I have two parameters on the default GUI, 1 indexed (drop
down menu) and a slider. The drop down menu has values between 1 and
16 and they represent different speakers. The slider value is meant to
be the amplitude of the speaker. So the user can select say Speaker 5
from the drop down parameter and the slider should recall the
amplitude last set for that speaker.
In the SetParameter function I store the value of the drop down
parameter into an integer called speakerInFocus. While still in the
case statement for the drop down parameter, I call
AUBase::SetParameter(amplitude, kAudioUnitScope_Global, 0,
speakerAmplitude[speakerInFocus], 0); to update the amplitude
parameter to the value of that speaker. This did not work(code shown
below).
You need to declare *any* parameters that can have their values changed
by another parameter as a meta parameter... Then it will just work.
SetParameter will then go and set the value of the parameter - but
because you've marked amplitude as a meta parameter, its value will be
checked when any other parameter on the AU changes and the UI will
update appropriately without you having to do anything else
Bill
(Also...what is the difference betweeen AudioUnitSetParameter() and
SetParameter()? None right?)
Thank you
- - - - - - - - - - - - - -
//In the constructor
float speakerAmplitude[16];
int speakerInFocus = 0;
for(int i = 0; i < 16; i++)
{
speakerAmplitude[i] = 0.5;
}
SetParameter(speakerNumber, kAudioUnitScope_Global, 0, speakerInFocus,
0);
SetParameter(amplitude, kAudioUnitScope_Global, 0,
speakerAmplitude[speakerInFocus], 0);
//Later in the program
ComponentResult BDecoder::SetParameter(AudioUnitParameterID iID,
AudioUnitScope iScope, AudioUnitElement iElem, Float32 rValue, UInt32
iSchedule)
{
if (iScope==kAudioUnitScope_Global && iElem==0)
{
switch (iID)
{
case speakerNumber:
speakerInFocus = (int) rValue;
AUBase::SetParameter(amplitude, kAudioUnitScope_Global,
0, speakerAmplitude[speakerInFocus], 0);
break;
case amplitude:
speakerAmplitude[speakerInFocus] = rValue;
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.
--
mailto:email@hidden
tel: +1 408 974 4056
________________________________________________________________________
__
Culture Ship Names:
Ravished By The Sheer Implausibility Of That Last Statement [GSV]
I said, I've Got A Big Stick [OU]
Inappropiate Response [OU]
Far Over The Borders Of Insanity And Still Accelerating [Eccentric]
________________________________________________________________________
__
_______________________________________________
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.
_______________________________________________
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.