Re: Problem with GetParameterValueStrings
Re: Problem with GetParameterValueStrings
- Subject: Re: Problem with GetParameterValueStrings
- From: Marc Poirier <email@hidden>
- Date: Sun, 18 Jan 2004 00:47:08 -0600 (CST)
You need to check if tArrayRef is null and then not actually create your
CFArray and dereference tArrayRef if it is null. But still return noErr
for the valid parameters, the ones that would succeed if tArrayRef wasn't
used. If you look at the AUBase implementation of
DispatchGetPropertyInfo, you'll see that GetParameterValueStrings is
called with null for that argument just a check to see if a given
parameter supports that property or not. So expect null, it's a valid way
to call the function (same goes with the GetFactoryPresets method, and
maybe others that I'm not remembering right now).
Marc
On Sat, 17 Jan 2004, John Mullins wrote:
>
Hey,
>
I'm running XCode in Panther 10.3.2.
>
>
Every time I try to register strings in GetParameterValueStrings the
>
program crashes.
>
>
UInt32 rw_flag = kAudioUnitParameterFlag_IsReadable |
>
kAudioUnitParameterFlag_IsWritable;
>
>
const AudioUnitParameterInfo CSynth::s_asParInfo[]= {
>
// Name CFStr Unit Min Max
>
Default Flags
>
{ "Attack", 0, CFSTR("Attack"), kGeneric, 0.1f, 100.0f,
>
10.0f, rw_flag},
>
{ "Decay", 0, CFSTR("Decay"), kGeneric, 0.0f, 100.0f,
>
70.0f, rw_flag},
>
{ "Sustain", 0, CFSTR("Sustain"), kGeneric, 0.0f, 100.0f,
>
100.0f, rw_flag},
>
{ "Release", 0, CFSTR("Release"), kGeneric, 0.0f, 100.0f,
>
1.0f, rw_flag},
>
{ "Octave", 0, CFSTR("Octave"), kGeneric, -4.0f, 4.0f,
>
0.0f, rw_flag},
>
{ "Cent", 0, CFSTR("Cent"), kGeneric, 0.0f, 100.0f,
>
0.0f, rw_flag},
>
{ "Wave", 0, CFSTR("Wave"), kIndexed, 0, 4,
>
0, rw_flag},
>
{ "Phase", 0, CFSTR("Phase"), kGeneric, -1.0f, 1.0f,
>
0.0f, rw_flag},
>
{ "Poly", 0, CFSTR("Poly"), kIndexed, 1, 3, 1,
>
rw_flag | kAudioUnitParameterFlag_HasCFNameString },
>
{ "Voices", 0, CFSTR("Voices"), kIndexed, 1, 4, 1,
>
rw_flag | kAudioUnitParameterFlag_HasCFNameString },
>
{ "Param", 0, CFSTR("Param"), kGeneric, 0.0f, 100.0f,
>
0.0f, rw_flag}
>
};
>
const UInt32
>
CSynth::s_nbPar=sizeof(CSynth::s_asParInfo)/
>
sizeof(AudioUnitParameterInfo);
>
>
if (iScope==kAudioUnitScope_Global)
>
{
>
if( iID == kParam_Voices)
>
{
>
static const void* ppVal[]={
>
CFSTR("4"),
>
CFSTR("8"),
>
CFSTR("16"),
>
CFSTR("24")};
>
crashes here *tArrayRef=CFArrayCreate(NULL, ppVal, 4, NULL);
>
return noErr;
>
}
>
else if(iID == kParam_Poly)
>
{
>
static const void* ppVal[]={
>
CFSTR("poly"),
>
CFSTR("retrig"),
>
CFSTR("legato")};
>
crashes here *tArrayRef=CFArrayCreate(NULL, ppVal, 3, NULL);
>
return noErr;
>
}
>
}
>
return AUBase::GetParameterValueStrings(iScope, iID, tArrayRef);
>
>
Everything seems to be put in just right and I've tried a lot of
>
different combinations with the flags.
>
When the program crashes in the report it says...
>
>
0 com.crap.demo.synth 0x048ad324
>
CSynth::GetParameterValueStrings(unsigned long, unsigned long,
>
__CFArray const**) + 0xb0 (Parameters.cpp:174)
>
1 com.crap.demo.synth 0x048aee30
>
AUBase::DispatchGetPropertyInfo(unsigned long, unsigned long, unsigned
>
long, unsigned long&, unsigned char&) + 0x414 (AUBase.cpp:332)
>
>
I can't figure this out for the life of me.
>
>
Thanks,
>
John Mullins
_______________________________________________
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.