FMOD newb here, not a musician by any stretch of the imagination, but responsible for implementing the sound of a 3D physics game (ogre, newt, fmod etc). Even though I was hugely impressed by the quality of documentation, examples and indeed the API itself, I’m finding it difficult to grasp the… "usage" of FMOD.
I’ve built a SoundManager much inspired by [url=http://www.koders.com/cpp/fid4D06AF852F272C177F105210250A69784971D829.aspx:lhy3dy5c]this one[/url:lhy3dy5c], but then "converted" it to use the Event-system instead.
I was hoping by asking you guys about implementation "techniques", I can pick the idea up. I’d appreciate your help greatly.
[b:lhy3dy5c]Question 1: pausing all sounds. [/b:lhy3dy5c]
How would you implement a proper systemwide pause? My soundmanager allows Entities to register themselves with any Event they need – to have their position updated, cleanup handled and so on. But oneshots like explosions or collision sounds are not "managed" – I just throw them out there and trust the event will clean itself up.
Thus, of course, only loops and music are paused. If we pause at an explosion, the sound will play through and then when we unpause the animation will play silently. :/
How do you handle this?
- ulfben asked 10 years ago
Thanks! That little insight caused a massive refactoring of my code today; it’s so much simpler now and it works perfectly.
[b:2cnrfq6x]Question 2: event grouping[/b:2cnrfq6x]
I know grouping is meant to simplify memory management and the handling of events, but I feel uncertain as to what’s the best way to structure our project.
Are there common structures or "patterns" for games?
I’m finding it diffucult to come up with any example of what I’m after, so please feel free to share whatever grouping strategy you guys use.
(So far I’m just loading single events straight up, which makes cleanup difficult.)
- ulfben answered 10 years ago
Sorry that I can’t be of any help, I just reply to express my empathy…
because I’m right there with you on this one!
I’m also exactly at this stage of: trying to grasp this software,
trying to figure out how to create a useful structure for all the sounds in our game. Per level? Per character? Per type (music, sfx, ambient…)
So I’ll be closely following your post:)
Hope we’ll see the Light soon,
There’s no one true solution. It depends a lot on the type of game you’re making. The one general rule is that Groups are most important for unloading audio, so think about how you’ll want to unload your data and the rest will follow.
I’m currently working on an open world game, so we use Groups for different areas of the world, the sounds associated with a given npc, a shot in a cutscene, etc. Our sounds, music, and ambiences are organized into Groups, but we manage the memory on a per-Event basis, simply unloading when the music or voice is complete. If we had levels I’d probably have a Group for level specific audio. If we were making an FPS I’d probably have groups for the various player weapons. Like I said, it depends a lot on the game.
I should also mention that we’re large enough that we have about 20 different projects (though we started with just one).
Thank you very much for your reply.
Indeed, it seems there are many ways to create structures.
Or how freedom of choice can be paralyzing at first.
It’s clear to me now that the way I’ll organize my sounds needs to be discussed thoroughly with the rest of the team.
for another example here is how our structures worked on a recent xbox/ps3 project:
- all groups map 1 to 1 with an .fsb
- 6 project files, one for all non-localized audio, rest for localized EFIGS(basically just dialogue.) we ended up doing it this way instead of using the internal localization features due to the way our memory loading worked. on console we end up having to do a bit more management of files because everything has to fit into a fixed block that never gets any bigger, so it wasnt that necessary load or unload stuff on the fly since we already could know pretty much what needed to be loaded ahead of time… since our game has specific levels this made it pretty easy to organize what would be needed at any point.
- banks and groups basically setup like this:
a. bank for each level in the game with sounds specific to that level only, only loads on that level
b. bank for main character, ui, hud, menus which are pretty much loading all the time
c. "faction" banks for different groups of enemies. only specific factions load depending on which level. they aren’t included in the level banks since factions can appear across different levels.
d. in the localized files, a dialogue bank for each level. at runtime it determines which language is used and only loads the one bank for that level and language. we split out the dialogue banks into separate projects because the fmod designer tool scales poorly with 1000’s of events, it uses like an o(n^2) algorithm when you add a new file to it or something. in the future we are just going to use programmer sounds for this instead of having thousands of events for dialogue.
e. we also had streaming banks for ambience and music that load globally, since they don’t allocate much ram.
like audiodev said..categories are very important and useful, particularly on console the music bank automatically handles xbox360 trc stuff like letting the user play their own music instead. we also used them for allowing the user to adjust volumes by category, pausing, and also for a submixed ducking system which would turn down our fx and music categories while dialogue is spoken, and also for certain special moves the character can do which makes for a nice dramatic transition while all the background sounds fade for a moment and the current action takes the spotlight. the ducking was controlled by an envelope and setup through the "user properties" for a sound which then our programmer would parse and control category mixer levels in code.
- acrosby answered 10 years ago
Acrosby – thanks for the insight. I’m rebuilding our sound project (… due to an… accident) and will definetly take your advice: using several fsb’s, streaming music and so on.
Now, I wanted to update this thread with a few links that has provided me with valuable insight to the practical use of FMOD.
[b:12t1uxkw][url=http://www.fmod.org/forum/viewtopic.php?t=10117:12t1uxkw]Managing events and groups[/url:12t1uxkw] [/b:12t1uxkw](discusses one-shots, loading, system cleanup and so on)
[b:12t1uxkw][url=http://www.fmod.org/forum/viewtopic.php?t=9745:12t1uxkw]Category vs Group[/url:12t1uxkw][/b:12t1uxkw] (Categories are for mixing, Groups are for data management.)
- ulfben answered 9 years ago
Please login first to submit.