Re: kMusicDeviceProperty_InstrumentCount
Re: kMusicDeviceProperty_InstrumentCount
- Subject: Re: kMusicDeviceProperty_InstrumentCount
- From: Marc Poirier <email@hidden>
- Date: Thu, 30 Oct 2003 10:17:42 -0600 (CST)
>
I am using this code to get the instrument count with a -50.
>
>
-(NSArray *)instrumentArray
>
{
>
AUNode synthNode;
>
AudioUnit theSynth;
>
UInt32 count =0;
>
UInt32 size = 0;
>
>
OSStatus err;
>
AUGraphGetIndNode(graph, 0, &synthNode);
>
err = AUGraphGetNodeInfo(graph, synthNode, NULL, NULL, NULL,
>
&theSynth);
>
err = AudioUnitGetProperty(theSynth,
>
kMusicDeviceProperty_InstrumentCount, kAudioUnitScope_Output, 2,
>
&count, &size);
>
NSLog(@"%d", err);
>
>
return blahblah...
>
}
I see 1 definite mistake. You should have
UInt32 size = sizeof(count);
not:
UInt32 size = 0;
The ioDataSize argument of AudioUnitGetProperty is an input/output
argument. On entry, it lets you say how large the the data buffer you are
passing is. On return, the value may be changed to the size of the data
actually gotten, if that differs from the entry value. So what you are
saying is, "Here's a data buffer that has space for 0 bytes of data.
Please put the data in there," which won't work.
The other possible problem is specifying 2 as the element in
AudioUnitGetProperty. The DLS MD doesn't have 3 elements, does it? I
think that you want to pass 0 for element 1, since instrument count is
element-global, isn't it? Anyway, this point I'm not so sure about, but
the size thing I know will not work and needs to change.
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.