FMOD Event callbacks not firing when Bus has 0 volume

Hello, i encountered a bug when trying this here:

When my buses are set to 0 volume no single callback is fired for event instances.

For debugging i did this:

		MusicEventInstance.Instance->setCallback(MusicFinished, FMOD_STUDIO_EVENT_CALLBACK_ALL);

But i usually do this to track wether a song on my game stopped playing

MusicEventInstance.Instance->setCallback(MusicFinished, FMOD_STUDIO_EVENT_CALLBACK_CREATE_PROGRAMMER_SOUND | FMOD_STUDIO_EVENT_CALLBACK_DESTROYED);

Best regards

Ps. The EventInstance remains valid and also remains in state “FMOD_STUDIO_PLAYBACK_PLAYING” even though the event is clearly finished playing.

Perhaps it is interesting to note this is a Programmer Instrument

FMOD_STUDIO_EVENT_CALLBACK_DESTROYED is only called when the actual Event Instance is destroyed, otherwise FMOD_STUDIO_EVENT_CALLBACK_SOUND_STOPPED will tell you when the programmer sound stops.

I’m not able to reproduce this myself, it appears to be behaving as expected.
What versions of FMOD and Unreal are you using?

Hi cameron,
I am encountering no single callback being called. I assume that using the flag

FMOD_STUDIO_EVENT_CALLBACK_ALL

to register to callbacks allows me to listen to all of them. But none of them is called for me.

I am using UE 5.5 and FMOD 2.03.05 EA

Also, when the callback should fire, I am tabbed out of the game to see wether the whole “muting while the game is not in focus” works (which it does).

If it helps I can give access to the Unreal Engine project on github so you can view the source code.

Hi,

Apologies for the delayed response.

Access to the project would be amazing! Could you please add Connor-FMOD. Thank you

@Connor_FMOD Hi no problem, had family at my house over christmas so had no time anyways.

I invited you to my repo “Tufu”. You just have to put the latest FMOD plugin into the “Plugins” folder and it should work.

When you are in editor simply start the game. When the game is focused and a song is finished playing you will see inside the log that the music stopped. If the game is not in focus you will see no callback is happening

You will find everything inside the class Sound/TUFUSound.

  • MuteOnWindowFocusLost() is called when unreal engine gains/looses focus. I currently have a workaround which somehow doesn’t work correctly yet, where i track start time of a song and check after the game gains focus wether the length of the song has passed already.
  • PlayTUFUTraxSong() starts a song and binds the callback to the EventInstance

Thank you very much for taking a look at it.

1 Like

Thank you for access to the project. It looks super cool!

So I did a simple test by setting a bunch of the buses to volume 0 at the start of the main menu map:



It seems that I am still getting the create sound callback. This is making me think that it may not be related to the volume rather how UE is handling putting the project in the background.

Is the desired behavior for music to continue playing silently in the background or to pause?

Would it be possible to run a profiler session when back grounding the project and upload the session to your profile with the following settings

An option may be calling System::mixerSuspend when entering the background to maintain the positions of all events: FMOD Engine | Core API Reference - System::mixerSuspend.

Thanks again!

1 Like

Sorry, was sick in bed and then had a lot of stuff to do.

The intention is the music continues playing in background and when a song is over it starts the next song. I will run a profiler session now.

1 Like

No worries! I hope you are feeling better. Thank you for the information. I will have another look at the behavior. The profiler session would be great!

Here is a video of the recorded session.

In my project look into:

Game/Stage0StateManager.cpp

Inside the Update() function is a state machine, per state the phone calls you can hear in the video are played back. For a state to progress I track that 8 seconds have passed and the audio is finished playing (CareerSpeech->Stage0IsSpeechDone()).

In this function I simply check wether the UFModAudioComponent for the phone calls exists and if its playing. But after tabbing out the FMOD Audio components is still in the playing state, thus the game logic hangs infinitely.

I am currently uploading the profiler session (its a whopping 800mb in size). Sorry for the massive delay, the profiler didn’t connect to Unreal until i noticed that I have to enable “Live Update” in the Unreal Engine project settings.

Yeah the same problem is with any Event when tabbed out.

1 Like

Thank you for the FMOD project and the information.

I have confirmed in your project that callbacks do not seem to be triggering. However, I cannot reproduce the behavior in a test scene.

Are you able to reproduce the issue outside of the current project??

In the FMODAudioComponent.cpp BeginPlay() function I have muted the master bus

void UFMODAudioComponent::BeginPlay()
{
    UE_LOG(LogTemp, Warning, TEXT("Muting master bus"));
    FMOD::System* coreSystem = nullptr;
    IFMODStudioModule::Get().GetStudioSystem(EFMODSystemContext::Runtime)->getCoreSystem(&coreSystem);

    FMOD::ChannelGroup* mCG = nullptr;
    coreSystem->getMasterChannelGroup(&mCG);

    mCG->setVolume(0);
    UE_LOG(LogTemp, Warning, TEXT("Muted"));

And then I am triggering a programmer sound with a 1 second delay in a blueprint


and the prog instrument was still being triggered while muted and tabbed out.

I can confirm that there is strange behavior happening in your project but I cannot confirm if it is coming from the integration.

The project is still looking amazing, keep up the good work!!

1 Like