Re: kMusicDeviceProperty_InstrumentCount
Re: kMusicDeviceProperty_InstrumentCount
- Subject: Re: kMusicDeviceProperty_InstrumentCount
- From: Craig Bakalian <email@hidden>
- Date: Thu, 30 Oct 2003 14:17:38 -0500
Hi,
Yes, Okay. I got it. I was guessing at the parameters for the
AudioUnitGetProperty call. I didn't understand the scope and element
bit yet, now I do. Thanks for the help. And for future reference,
how does one know the kAudioUnitScope_ type based upon the AudioUnit.
Where would I find this information? The same for the element
parameter.
Craig Bakalian
On Thursday, October 30, 2003, at 11:17 AM, Marc Poirier wrote:
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
Craig Bakalian
www.eThinkingCap.com
_______________________________________________
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.