1

Some OS X app's can display a list of possible output devices for playing music, such as build in output/soundcard or attached USB DAC. How can I list all such devices and select one of them for my audio playback?

This link describes it some how I think, but I can not figure out how to use it exactly. I have tried with the following code:

AudioComponentDescription ioUnitDescription;
ioUnitDescription.componentType          = kAudioUnitType_Output;
ioUnitDescription.componentSubType       = 0;
ioUnitDescription.componentManufacturer  = kAudioUnitManufacturer_Apple;
ioUnitDescription.componentFlags         = 0;
ioUnitDescription.componentFlagsMask     = 0;
AudioComponent foundIoUnitReference = NULL;
while ((foundIoUnitReference = AudioComponentFindNext(foundIoUnitReference, &ioUnitDescription))) {
    AudioUnit ioUnitInstance;
    AudioComponentInstanceNew (foundIoUnitReference, &ioUnitInstance);
    //NSLog (@"Audio Unit: %@", ioUnitInstance);
}

It loops 5 times so I guess this does give me a list of some audio units, but I have two problems with this:

1) 5 is to many as I only have the build in output/soundboard at the time. Should I use some kind of componentSubType to filter this and which one?

2) How do I get any useful information out from this ioUnitInstance? Can I get a name that will be meaningful to show to the user?

Next up will be using this output audio unit for output, but first things first.

Thank you
Søren

Neigaard
  • 3,726
  • 9
  • 49
  • 85
  • http://stackoverflow.com/questions/4575408/audioobjectgetpropertydata-to-get-a-list-of-input-devices/4577271 might help – sbooth Nov 07 '13 at 14:38

0 Answers0