Soundengine basics

The more I read about FMOD (and especially FMOD studio), to more I think it will be great for our game. But unless you’re using UE/unity the documentation is somewhat limited and the examples dated or not useful.

So I have some questions on setting up the sound engine. Our 3D space game has a single listener and is moving around in a world with multiple objects (which can be other online players). Each object has its (engine)sound, quite a few identical and of course the usual rockets, explosions etc.

So first the initialisation, after some reading I discovered FMOD_INIT_VOL0_BECOMES_VIRTUAL is pretty important, so I use the code below to initialise. and set FMOD_ADVANCEDSETTINGS.vol0virtualvol to 0.001. Are there any good practices/flags I should add?


Bank loading
Seems straight forward using LoadBankFile() and storing the ptr in a map std::map<std::string, FMOD::Studio::Bank*>

3D sounds
My idea was to work with event instances (a lot of example use channel maps? why?). As multiple instances can use the same event description, storing the ptr and description in a map, doesn’t work. So my idea was to store the event instance ptr created with createInstance() in the object and use this ptr (after checking if it’s still valid) to update the 3D position each tick.

The UE implementation seems to do it the other way round, and store (attach) the object ptr with the instance ptr. Is there a good reason to go for this model?

Playing the sound
We have in cockpit (2D) sounds, one offs (flipping a switch, shooting a laser), sounds while pressed (opening canopy by holding a switch), constant sounds parameter dependent (engine sounds changing with speed) and more or less the same for the external (3D) sounds emitted by the objects.

The one-offs seem simple (play & release, and if short only initial 3D position to be set). But what are the guidelines for especially the looping (while pressed & constant sound)? And how to attenuate eg the engine sound when shooting a laser or receiving a message?

Your help is appreciated
I would be really greateful to get some pointers on the above. And if I missed some essential elements (profiler? buses? vca?), please le me know. I don’t mind sharing the result in a public repo so others can learn from it as well when using FMOD.

Might be a good idea to enable logging as well, it makes it a lot easier to debug your game and liaise with support if necessary. You can do this by calling FMOD::Debug_Initialize, passing in FMOD_DEBUG_LEVEL_LOG as the first argument for maximum logging.

Not sure what you mean by channel maps, are you asking why some examples use channels and others use event instances?

Off the top of my head, depends on whether you think you will have lots of objects with sound managed in the same way, or few objects with sounds managed in different ways. Having a generic sound manager that only requires an object’s transform lends itself better to the former because you will only need to create one sound manager class that can latch onto anything (as the UE integration does), whereas having specialized sound managers local to specific objects lends itself better to the latter because you will be able to have fine-grained control without needing to make many arbitrary sound manager specializations.

Probably a state machine that calls a looping event during the active state, and stops in the inactive state. There was some discussion about this recently using Unity bolt scripting which conveniently illustrate this concept at a high level.

Setting up sidechain compression in FMOD Studio is the usual way to go. Here is a video that explains the concept.

Please let me know if anything needs clarifying!