ofSoundPlayer and setDevice

i know with ofSoundStream it is possible to select the input/output device.
is this also possible with ofSoundPlayer and if how?


I might be wrong but I think you can do this with the ofALSoundPlayer, if you extend it so that you’re handling the call to alcOpenDevice(). Check this thread here: http://devmaster.net/forums/topic/697-changing-the-output-device-with-openal/ for info on how to extend OpenAL

I don’t think the FMOD system allows you to select input devices. What kind of device are you looking to input/output to?

i have 3 maudio usb fast-track device connected to my laptop.
then i combine all 3 in Audio MIDI Setup to one aggregated device with a total of 6 outputs.

i tried the loadsample example that floats around the forum and it does work. but only with up to 4 outputs.


I would say take a look at ofOpenALSoundPlayer.cpp and you’ll see this:

alDevice = alcOpenDevice(NULL);  

which just opens the default device. I’d imagine that if you had a list of devices, you should be able to set whichever one you want.

i’m trying to find ofOpenALSoundPlayer and only found it in the OF0073 for ios.
do i just copy it over in to my addon folder. i tried making any addon with it. similiar to ofxOpenALSoundPlayer by stfj.
but i get way too many error.

It’s in the OF for OSX 0073 release, check in libs/openFrameworks/sound.

You should be able to just do:


and be using the OpenAL soundplayer. I know that it can be done on OSX.

ok that got me a bit further. thank you.

in ofSoundPlayer.cpp i found the line you mentioned above. simply putting a different number in to alDevice = alcOpenDevice(7); did not do the trick. but i keep on trying things.

what did work was going to system preferences and selecting my aggregated device as output. but only 2 channels.

the question now would be how to send things to each channel.
i know how to do it with ofsoundstream but not with the player.

thanks for your time.

in order for soundplayer to consider ofOpenALSoundPlayer i had to add this #define OF_SOUND_PLAYER_OPENAL to ofSoundPlayer.h

now i am getting errors because these files are not found:
#include “kiss_fft.h”
#include “kiss_fftr.h”
#include <sndfile.h>

I’m at work right now but I’ll give this a look as soon as I get home and update this post.

hey joshua did you get a chance to look in to the missing kiss stuff?

Yes, I did. Sorry I forgot to get back to you.

So, you’re going to need to recompile OF to get this to work on OSX.

  1. go get ofxFft from https://github.com/kylemcdonald/ofxFft

  2. Then, if you don’t have macports, get Macports.

  3. Then install libsndfile:

sudo port install libsndfile  

  1. Next, change the Header Include Paths in OF and add the following two lines:

  1. Now rebuild OF

  2. Now in your own project add the following to Other Linker Flags:


Off you go. I think this is a bit of headache so there might be an easier way to go about this.

thanks for taking the time.

macports eh? i guess it’s something i should learn any way.


It’s very simple to use and is a great way to easily install and uninstall things quickly on OSX. I highly recommend it.

I know this was a bit ago, but I am curious whether this approach worked and if there is indeed an easier way?
Perhaps is there a way to use ofSoundStream in conjunction with ofSoundPlayer, so it would be possible to use the setDevice and the sound player?

I have an installation up that uses an HDMI monitor as the output for the sound. However sometimes the application doesn’t connect to this for some reason when the computer turns on and when I use logmein to control it remotely this messes up my default sound outputs.

My hacky solution is to install a command line tool to control the sound output and then call it from within OF

string bp = ofSystem("/usr/local/bin/SwitchAudioSource -s 'hdmi output'");