Stopping all sounds.

I want to be able to stop all the sounds playing in the game, but I don’t want it to stop the music. Currently, I have all effects going through a VCA to control volume and all music going through another VCA (voice will go through a 3rd once that’s implemented).

There doesn’t seem to be a way to stop all sounds in Group, which would be perfect. You also can’t stop all sounds in a VCA. You can stop all sounds in a Bus. Do I need to create Buses for each of my categories to achieve this?

It also mentions on the docs that when stopping all sounds on a Bus, it doesn’t release them, but I’m looking to just kill/end the sounds.

What is the best way to do this?

Hello Ron,

There currently isn’t a way to get a list of events routed into a VCA. The VCA is used only for volume purposes.

Instead I would recommend routing all events you wish to stop into a group bus and using Studio::bus::stopAllEvents(). You can route any existing buses you wish to stop into this bus.

https://www.fmod.com/resources/documentation-api?page=content/generated/FMOD_Studio_Bus_StopAllEvents.html#/

Please keep in mind that this won’t call release on these events, you will need to do this yourself if needed.

Thanks,
Richard

1 Like

Please keep in mind that this won’t call release on these events, you will need to do this yourself if needed.

And that is what is confusing me. How do I know what events were stopped? If I knew all the events playing, I could just stop them myself. When a sound ends normally, FMOD releases it, correct?

I am using FMOD_Studio_EventDescription_SetCallback(…FMOD_STUDIO_EVENT_CALLBACK_DESTROYED) for other reasons, do I catch them in there and then release them?

Hi Ron,

I’ll answer both of your questions in this comment:

  1. Your event playing function looks fine. Playing then releasing an event will remove the instance once it has naturally finished. Using the Bus::stopAllEvents() function will then release all events started with this function.

  2. There are some scenarios where a user would desire to keep an event instance. Starting an event already instantiated is slightly quicker and requires less resources than creating, starting, and releasing a new event instance each time. The trade off being more memory in use for idle instances. An example may be a time-sensitive rhythm game needing to start a small pool of events in very quick succession.

  3. If you need to know which events are stopped you can use FMOD_STUDIO_EVENT_CALLBACK_STOPPED, and FMOD_STUDIO_EVENT_CALLBACK_DESTROYED to check which events are released. Since your event playing function releases the events after starting, you can use either callbacks (you mentioned you’re already using DESTROYED which will do to catch them).

I hope this helped. Let me know if you need more information.

Thanks,
Richard

1 Like

My play functions looks like this:

void GGSoundFMOD::playEvent(const char name)
{
FMOD_STUDIO_EVENTDESCRIPTION
event_desc = NULL;
FMOD_STUDIO_EVENTINSTANCE* event_instance = NULL;

if (FMOD_ERROR(FMOD_Studio_System_GetEvent(_fmod_studio_system, name, &event_desc))) {
	return;
}
if (FMOD_ERROR(FMOD_Studio_EventDescription_CreateInstance(event_desc, &event_instance))) {
	return;
}
if (FMOD_ERROR(FMOD_Studio_EventInstance_Start(event_instance))) {
	return;
}
if (FMOD_ERROR(FMOD_Studio_EventInstance_Release(event_instance))) {
	return;
}

}

The instance is released after start, which should mean when it stops it will be destroyed. Monitoring my callbacks, this seems to be true. Does this mean when all the bus sounds are stopped, I don’t need to do anything special (seems to be the case).

Why would you not release an instance? What is the use-case for that?