Re: AU2 - questions about presets and ClassInfo
Re: AU2 - questions about presets and ClassInfo
- Subject: Re: AU2 - questions about presets and ClassInfo
- From: Bill Stewart <email@hidden>
- Date: Thu, 03 Oct 2002 11:11:29 -0700
That9s fine
(and improves what I posted last night because it catches the result of
NewFactoryPresetSet
(This is what AUBase has now been changed to)
Bill
on 3/10/02 5:29 AM, Marc Poirier wrote:
>
>> I would also think that, in the case of choosing a factory preset as the
>
>> CurrentPreset, it also shouldn't matter if a name is supplied. But in
>
>> DispatchSetProperty, a name is required:
>
>>
>
>> case kAudioUnitProperty_CurrentPreset:
>
>> <snip>
>
>> if (newPreset.presetName) {
>
>> if (newPreset.presetNumber < 0 || NewFactoryPresetSet(newPreset) == noErr) {
>
>> <snip>
>
>> } else
>
>> result = kAudioUnitErr_InvalidPropertyValue;
>
>> } else
>
>> result = kAudioUnitErr_InvalidPropertyValue;
>
>>
>
>> Shouldn't that be something more like:
>
>>
>
>> if ( newPreset.presetName && (newPreset.presetNumber < 0) )
>
>> // ...store the new name and set the preset number...
>
>> else if ( (newPreset.presetNumber >= 0) && (NewFactoryPresetSet(newPreset)
>
>> == noErr) )
>
>> // ...only set the preset number...
>
>> else
>
>> result = kAudioUnitErr_InvalidPropertyValue;
>
>>
>
>> Maybe I'm wrong about this, though...
>
>
>
>
>
> No - you're right - with a slight tweak:
>
>
>
> if (newPreset.presetName && newPreset.presetNumber < 0)
>
> {
>
> CFRelease (mCurrentPreset.presetName);
>
> mCurrentPreset = newPreset;
>
> CFRetain (mCurrentPreset.presetName);
>
> }
>
> else if (newPreset.presetNumber >= 0 && NewFactoryPresetSet(newPreset) ==
>
> noErr)
>
> {
>
> // NewFactoryPreset SHOULD call SetAFactoryPreset if the preset is valid
>
> // from its own list of preset number->name
>
> }
>
> else
>
> result = kAudioUnitErr_InvalidPropertyValue;
>
>
>
Okay, I changed my AUBase.cpp to be like this in DispatchSetProperty and
>
am leaving it up to my plugin's implementation of NewFactoryPresetSet to
>
decide whether or not the preset ID is valid:
>
>
case kAudioUnitProperty_CurrentPreset:
>
{
>
require(inScope == kAudioUnitScope_Global, InvalidScope);
>
AUPreset & newPreset = *(AUPreset *)inData;
>
>
if (newPreset.presetNumber >= 0)
>
result = NewFactoryPresetSet(newPreset);
>
else if (newPreset.presetName) {
>
CFRelease (mCurrentPreset.presetName);
>
mCurrentPreset = newPreset;
>
CFRetain (mCurrentPreset.presetName);
>
} else
>
result = kAudioUnitErr_InvalidPropertyValue;
>
}
>
break;
>
>
Does that seem like a good fix to apply to AUBase.cpp, or is it incorrect
>
in any way?
>
>
Thanks,
>
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.
--
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
__________________________________________________________________________
_______________________________________________
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.