Routing all audio from an app via hdmi

Hi all,

How would I go about routing all audio in my application through a specific hdmi channel?

My app will have video playback as well as UI sounds, so I assume I’ll be using

ofSoundPlayer
ofVideoPlayer

To route the audio, I’ve been looking into ofSoundStream, which seems like it should do the trick, but the audio embedded in the video still plays through my laptop.

Here is my ofApp.h

and ofApp.cpp

any help would be appreciated.

Should I assume that this cannot be done?

Just set your computers audio output to hdmi in the audio prefrences. If you want to use the HDMI audio as well as your laptop audio output you may need to use a virtual audio router like sound siphon or vb cable virtual audio.

Hey @fresla,

setting the computer’s audio to output to hdmi won’t work since I’m running several apps on one machine, each app with its own screen.

I’ve looked into ofxSoundObjects and that might do the trick if I can get it to work on windows. Worked well on OSX though.

Is this the Cable Virtual Audio you meant?

Ok, so you want to route different applications audio ouputs through different HDMI outputs? Your first question was not very clear (maybe why there was no fast response), and the sound source is a video file. The audio from the video will always play through the default system audio output device. If you want to use soundstream (where you can set the output device you will need to fill the audio buffer yourself, from an audio file (so not the audio embedded in the video).

The code you have posted above has 3 different objects and only the soundstream object will be routed to the device you choose in soundstream.setup, the rest are going to use the default audio output.

Rather than having to make a very complex setup, I would suggest another option, use a sound card with multiple outputs configured as a 7.1 device in windows. Create AVi files with mulichannel audio, you can use 7.1 and that will give you 4 stereo pairs, and cascade the pairs, so the video for screen 1 has the mixed audio on channel 1 and 2 and the rest of the channels present but silent, screen to has the mixed audio on 3 and 4 and the rest of the channles silent and so on. If you create these multichannel tracks properly and make an AVI and then use a direct show based video player (like this https://github.com/secondstory/ofxDSHapVideoPlayer) each video will play its audio out of a different pair of outputs from a 7.1 capable and setup device. You can then send the analogue lines to whereever you want.

I have a feeling that doing the kind of routing you want to do will be a lot of work that may be out of reach.

I had a similar issue and ended up using SoundFlower app to have a virtual sound card on the mac and ofxAudioUnit in my app.
First set the system audio output to the SoundFlower port in “Audio + Midi Setup”, this is the only way I know to get the sound of the video players (be aware that anything playing on the mac system will go to this virtual sound card eg iTunes etc …).
Retrieve the sound in a ofxAudioUnitInput set to the Soundflower port, make your stuff in the audio unit chain, output the sound with a ofxAudioUnitOutput set to the hdmi port which should appear and be available only when the hdmi cable is plugged.
Sound flower can have up to 64 channels in/out. If you want to redirect the sound of your different app you must somehow have an option in those app to choose a sound card and channel number for the output otherwise it will definitely go to the system output you chose in the “audio & midi setup” options.