Jeremy Gillick
Jeremy Gillick

Reputation: 79

How can I change the audio output device in Objective-C?

I'm building a simple Cocoa app and I want to direct the audio output to a specific device, instead of the system selected one. I know some apps, like Skype, let you select where to send the output to. How do they do this?

I tried the MTCoreAudio framework but I can't even compile my app (or their AudioMonitor demo) with it included and the errors aren't helpful (_objc_fatal). Are there any complete examples that I can learn from? So far my searches haven't turned anything up.

Thanks!

Upvotes: 3

Views: 4927

Answers (2)

J. Perkins
J. Perkins

Reputation: 4276

The CAPlayThrough example on the Mac Dev Center Sample Code library shows how to list all of the available input and output devices, and select a default device from a menu.

Upvotes: 2

D.C.
D.C.

Reputation: 15588

Have you looked through the sample code on http://developer.apple.com ?

Look at these projects http://developer.apple.com/mac/library/navigation/index.html?section=Resource+Types&topic=Sample+Code

Namely the DefaultAudioUnit project.

I should say that working with Core Audio is more challenging than Cocoa. Most of the API's are C-based (I find that harder). You should read the Core Audio programming guide as well to get a sense of how the audio system is put together.

Upvotes: 1

Related Questions