Multi-device targeting with fmod

I thought I’d post this code that I just got working in case anyone else needs something like it. Basically it’s a version of ofSoundPlayer that can target different output devices (like if you have a m-audo firewire device that can output on multiple channels for instance):

it sets up a lot like ofSoundPlayer except that when you call loadSound you need to specify a path and the number of the device you want to connect it to. It also lists the devices in the console as soon as you load any sound (I know this is clunky, but it made more sense than opening an fmod system and then closing it again just to get the device list… basically just call it once with device 0 to get the list)

so yeah, its a little clunky but it’s been working great for me so I figured i’d post


wow, super helpful! thank you! i was looking for something like that for a while.
i gotta try it the next time i get a grip on a multichannel soundcard.

do you know anything about soundspatialization? positional 3d sound?
i mean it is possible to program 3d sound via fmod or openal and all.
but is this only for typical 5.1 /7.1 surround soundcards with this predefined speaker setup?
or can i define a speaker setup for my m-audio multichannel soundcard
and the driver calculates where to and with what percentage to route the signal?

any thoughts and hints appreciated …

Both FMOD and OpenAL do 3d spatialization and I think you can still get 3D surround on a (non 5.1) multichannel sound card, although perhaps it might only be quad surround (4.0). If it does work, for 5.1 you would need at least 6 channels on your sound card.

If the FMOD SDK there is an example application called “multispeakeroutput”…try that and see how you go!


I have been using FMOD for sometime to do this but coded from bottom up. I have recently been working on developing the ofSoundPlayer to add 3D control for headphones.

I posted in wrong forum (read it to see why)

Oh hang on Didito you been there… :slight_smile:

FMOD can use Hardware acceleration mainly on PC if I remember right - check the docs for the settings.

Though I agree with you really as I have always ended up using SuperCollider for multi-channel rendering as there are some nice objects for this and I needed to save on GUI processing power, plus it ends up easier it seems. You could also build something similar in Pd or Max. Controlled by OSC.

But yes would be nice to have objects in OF.

1 Like

Hi Zach Cage

i’ve tried your ofMultipleDeviceSoundDevicePlayer in OF 0.61 under Xcode (OSX 10.6.4) and i’ve got a message i can’t solve … it says :

"FMOD_System_GetDriverName' was not declared in this scope  

Any ideas about it ? Is there a way to update whatever it need to make it work or it’s just too old for being used under 0.61 ?

Actually what i’m trying to do is a 5.1 setup for an interactive show. Maybe there’s a better solution but this little addon from Zach seems usefull as i can load each sound into a channel of the soundcard and it should go … or i’m wrong and there’s an easy way to play a 5.1 with OF ? maybe using straighton ACE or WAV with multichannel support ?


Thank you for this very nice addon!

I made a quadrophonic performance with it, it worked perfectly!

Just one little thing made me a little trouble: the display of the audio devices. So I first had to comment out that code :

for(int i=0; i<gDeviceNum; i++)  
    char name[256];  
    FMOD_System_GetDriverName(sys_Array[deviceIndex], i, name, 256);  
    printf("%d : %s\n", i, name);  

and trying to find the device numbers by hand.

Later I could made it work too by installing the new version of fmod and just replacing

FMOD_System_GetDriverName(sys_Array[deviceIndex],  i, name, 256);  


FMOD_System_GetDriverInfo(sys_Array[deviceIndex], i, name, 256, 0);  

Now I want to try to use it with the 6 output channels of the Mbox2 Pro that uses 3 different drivers (1/2, 3/4, 5/6)

I’m trying to wrap my head around the usefulness of FMOD Studio as a sound designer who uses openframeworks for interactive installation work. Is it like using Logic or Pro Tools but with the ability to directly access with a program I’ve written? That is to say, without the use of sending midi or osc messages. I’m especially interested in using 3D panning plugins. Appreciate any feedback.

1 Like

Hi is there any new versión of this library? Im getting this errors :

||=== Build: Debug in fafafa (compiler: GNU GCC Compiler) ===|
…/…/…/libs/fmodex/include/fmod_errors.h||In function ‘const char* FMOD_ErrorString(FMOD_RESULT)’:expressionless:
…/…/…/libs/fmodex/include/fmod_errors.h|49|error: ‘FMOD_ERR_EVENT_NEEDSSIMPLE’ was not declared in this scope|
…/…/…/libs/fmodex/include/fmod_errors.h|71|error: ‘FMOD_ERR_INVALID_SYNCPOINT’ was not declared in this scope|
…/…/…/libs/fmodex/include/fmod_errors.h|79|error: ‘FMOD_ERR_MUSIC_UNINITIALIZED’ was not declared in this scope|
…/…/…/libs/fmodex/include/fmod_errors.h|92|error: ‘FMOD_ERR_OUTPUT_ENUMERATION’ was not declared in this scope|
…/…/…/libs/fmodex/include/fmod_errors.h|106|error: ‘FMOD_ERR_SUBSOUND_CANTMOVE’ was not declared in this scope|
…/…/…/libs/fmodex/include/fmod_errors.h|107|error: ‘FMOD_ERR_SUBSOUND_MODE’ was not declared in this scope|
||=== Build failed: 6 error(s), 0 warning(s) (0 minute(s), 6 second(s)) ===|