Re: a sneaky, pesky AUCarbonViewControl bug
Re: a sneaky, pesky AUCarbonViewControl bug
- Subject: Re: a sneaky, pesky AUCarbonViewControl bug
- From: Marc Poirier <email@hidden>
- Date: Thu, 27 Feb 2003 00:37:06 +0100 (CET)
Hello again. Well, I was thinking about this problem again and I think
that doing this:
ControlKind ctrlKind;
if ( (GetControlKind(mControl, &ctrlKind) == noErr) &&
(ctrlKind.kind == kControlKindPopupButton) )
instead of this:
if (mParam.HasNamedParams())
would be a good way to solve it. So that's my suggestion.
Thanks for listening,
Marc
On Wed, 12 Feb 2003, Marc Poirier wrote:
>
Ah ha! This sneaky, pesky bug had me scouring around for hours before I
>
found it, but now I've got it (note added comments from me)...
>
>
>
void AUCarbonViewControl::ParameterToControl(Float32 paramValue)
>
{
>
switch (mType) {
>
case kTypeDiscrete:
>
{
>
long value = long(paramValue);
>
// if we're dealing with menus they behave differently!
>
// becaue setting min and max doesn't work correctly for the control value
>
// first menu item always reports a control value of 1
>
// Marc -> That's fine, but how do you know that the control is a menu?
>
if (mParam.HasNamedParams())
>
value = value - long(mParam.ParamInfo().minValue) + 1;
>
>
SetValue (value);
>
}
>
break;
>
}
>
}
>
>
>
void AUCarbonViewControl::ControlToParameter()
>
{
>
const AudioUnitParameterInfo ¶mInfo = ParamInfo();
>
>
switch (mType) {
>
case kTypeDiscrete:
>
{
>
// if we're dealing with menus they behave differently!
>
// becaue setting min and max doesn't work correctly for the control value
>
// first menu item always reports a control value of 1
>
long value = GetValue();
>
// Marc -> BZZZT! No! Don't assume that it's a menu!
>
if (mParam.HasNamedParams())
>
value = value + long(mParam.ParamInfo().minValue) - 1;
>
>
mParam.SetValue (mListener, this, value);
>
}
>
break;
>
}
>
}
>
>
>
That if(mParamHasNamedParams()) thing is NOT a valid way to check that the
>
control is a menu! I am using push buttons that toggle through the
>
various values for one of my indexed parameters. Yes, it is indexed and
>
yes it has ValueStrings for generic value display, but my custom UI
>
doesn't use those value strings and doesn't use a menu.
>
>
Anyway, I don't know what a good proposal is for checking on whether a
>
menu is being used, but it's definitely wrong to assume that an indexed
>
parameter with value strings will only be controlled by menus. For now,
>
I've just commented those parts out since I don't use any menus in any of
>
my custom UIs, at least not yet...
>
>
Marc
_______________________________________________
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.