a sneaky, pesky AUCarbonViewControl bug
a sneaky, pesky AUCarbonViewControl bug
- Subject: a sneaky, pesky AUCarbonViewControl bug
- From: Marc Poirier <email@hidden>
- Date: Wed, 12 Feb 2003 21:50:10 +0100 (CET)
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
P.S. - I'm going to report this through RADAR, too, just telling you in
case anyone else would have.
_______________________________________________
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.