All,
I'm seeing a discrepency between audio component counts when I use auval and my code when using AudioComponentFindNext. I'm hoping someone can enlighten me in regards to some misunderstanding illustrated by my code.
Here is the auval
output for music devices on my machine. We can see that there are 8 music devices
Initial-Installers-Mac-Pro:/ ajames$ auval -s aumu
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
AU Validation Tool
Version: 1.6.1a1
Copyright 2003-2007, Apple, Inc. All Rights Reserved.
Specify -h (-help) for command options
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
aumu Clm5 -NI- - Native Instruments: Absynth 5
aumu NBa3 -NI- - Native Instruments: Battery 3
aumu NiKP -NI- - Native Instruments: Kore Player
aumu NiMa -NI- - Native Instruments: Massive
aumu NiR5 -NI- - Native Instruments: Reaktor5
aumu Nif8 -NI- - Native Instruments: FM8
aumu Nik4 -NI- - Native Instruments: Kontakt 4
aumu dls appl
- Apple: DLSMusicDevice
I call my code in the following way to get all music devices and only receive 3 for Battery, Kontakt, and DLSMusicDevice
// populate pop up with specific types
[ self _populateMenuForType: kAudioUnitType_MusicDevice ];
Below is the implementation
of the _populateMenuForType method:
- ( void ) _populateMenuForType: ( OSType ) compType
{
AudioComponentDescription acDescription;
AudioComponent ac = NULL;
// zero out and look for music devices from any manufacturer
memset( &acDescription, 0, sizeof( AudioComponentDescription ) );
acDescription.componentType = compType;
NSLog( @"DEBUG: Looking for %d audio
components", AudioComponentCount( &acDescription ) );
// add matching audio components
while( ( ac = AudioComponentFindNext( ac, &acDescription ) ) != NULL )
{
CFStringRef acName = NULL;
if( AudioComponentCopyName( ac, &acName ) == noErr )
{
NSString *tempName = [ ((NSString *)acName) autorelease
];
// store name as title
[ _instrComponents addItemWithTitle: tempName ];
// store audio component as represented object
[ [ _instrComponents lastItem ] setRepresentedObject: [ NSValue valueWithPointer: ac ] ];
}
else
{
NSLog( @"ERROR: Unable to get name for audio component" );
}
}
}