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?
initialize(512, FMOD_STUDIO_INIT_NORMAL, FMOD_INIT_NORMAL | FMOD_INIT_3D_RIGHTHANDED | FMOD_INIT_VOL0_BECOMES_VIRTUAL, nullptr);
Seems straight forward using
LoadBankFile() and storing the ptr in a map
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.