I am currently implementing a new sound system using Fmod designer and I was just wondering if there were any issues (performance or memory) if I get an event out of a group, start it but then forget about it and never release it from a group until the end of the game.
ERRCHECK( m_eventSystem->getGroup(group, false, &eventGroup) );
int loadFlags = loadAsync ? FMOD_EVENT_NONBLOCKING : FMOD_EVENT_DEFAULT;
ERRCHECK( eventGroup->getEvent( name, loadFlags, &soundEvent) );
ERRCHECK( m_event->start() );
Will using this code above and just passing in the name of the sound that I want to play have any side effects?
Not, the same event will be played many times before the end of the game.
- DanielGuy asked 8 years ago
The way I understand it is if you have an event, with say maxPlaybacks set to 12, you can never have more than 12 of the event playing at once (it will reuse the event depending on what you specified in Designer), but you will only have one copy of the event in memory (and all 12 instances will use the same data). So in this case, could I just play and forget about the sound and let Fmod deal with the rest ?
Depends what kind of memory you are talking about. For an event, FMOD needs to store 1 event definition, N instances, and then memory for whatever wav data you have associated with it. As far as loading, goes, FMOD will automatically load everything for you. However, it won’t unload anything. If you have enough memory to have everything loaded all the time, then awesome. If not, you’ll need to know when to call freeEventData.
FMOD won’t free any audio data until you call freeEventData. In our games, we auto-call freeEventData whenever a streaming sound completes (to free up the stream memory) and have a ref counting system that sits about freeEventData for use w/ EventGroups and actually does the free when the ref count drops to 0 (count is incremented when loadEventData is called).
Please login first to submit.