Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Route audio to specific device output on OS X

Am looking to add a preview channel to an AV project, so that a video or audio file can be playing on the master output channel but the user can preview a separate audio or video file on a different channel.

Naturally the prerequisite is that the user has a sound device capable of multiple channels or a separate device for master output than for preview. For example, the output could go to a USB audio device which provides balanced audio output but the preview could be via the standard headphone jack.

I am struggling to find the right documentation on enumerating sound devices connected to the mac and then linking either AVAudioPlayer or AVPlayer/AVPlayerLayer or an underlying API.

Anyone know where I should be looking?

Is this a case of discovering the sound devices, selecting the appropriate one then using something like NSSound to set the device before I start playing the file? What happens with files already playing?

Thanks

like image 935
JamesB Avatar asked Jul 30 '13 09:07

JamesB


1 Answers

Note that AVAudioSession is iOS-only.

like image 152
pawneebill Avatar answered Nov 15 '22 12:11

pawneebill