Programmer Sounds Unable to Play in Web GL Build

Hi,

I’m trying to play programmer sounds in Web GL build. However, when the DialogueEventCallback is called and I try to get user data from event instance received, it returns ERR_INVALID_HANDLE.

After having some research, I have found that the event instance received has the following issues:

  • In 1.10.11: instance.hasHandle() is true but instance.isValid() is false
  • In 2.00.02: instance.hasHandle() is false

(Both versions are tested in an stripped project with minimal assets and code.)

I wonder if programmer sound is supported on Web GL.

Kind Regards,
Sunny

Hi FMOD team,

Are you guys able to confirm this problem or are we doing something wrong?

We will need to decide if we should switch to using pure events instead of audio table.

Thanks

It should not be possible for the Event Instance returned by the callback to be invalid.

I would go over the example again to make sure nothing has been missed. I would also check all the FMOD.RESULTs returned from any calls to FMOD.

But the problem does not exist in PC or Android though. (We tested these 2 platforms)
Which is why we were very puzzled when the same code causes this problem in WebGL build

Apologies for the delay, we are currently looking into this.

Hi Cameron,

To help you guys out, here is a sample project.

It contains the following items:

  1. Standalone Windows builds (Built in Mono and IL2CPP)
  2. Web GL builds (Built in Web Assembly and asm.js)
  3. Original Unity project with all assets and source code using minimal code and your example codes

For builds:

  1. After launching the build, press “Load Sound Banks” button to load all required sound banks.
  2. After all sound banks are loaded, press “Play No Audio Table” button to play a sound stored inside a sound bank WITHOUT using audio table.
  3. Press “Play Have Audio Table” button to play a sound stored inside another sound bank WITH using audio table.
  4. See the debug log for information.

You will see that the WebGL build will not work.

Apologies, we are still looking into this. It is just very difficult to debug, we have not forgotten about it.

Just wondering, has this bug been fixed by now?

This appears to be due to us using an apparently unsupported marshaling behavior and we have not found an easy solution for it.

The best solution here is (unfortunately) replacing all the cases of EventInstance in the callback code with IntPtr. This means the you will need to create an instance of our EventInstance wrapper and set the internal handle manually. We currently plan to implement this in FMOD 2.01 as changing it in 2.00 would affect all the current users if they were to update.

Hey, I believe I’m running into the same issue now. Has this been updated in anyway? If not, how does manually setting the internal handle differ from the doc example of creating callbacks: https://www.fmod.com/resources/documentation-unity?version=2.0&page=examples-timeline-callbacks.html

Hi Zeusan,

This has been addressed in version 2.1. The documentation page you have linked is for 2.0. If you have a look at the BeatEventCallback in the 2.1 version - https://www.fmod.com/resources/documentation-unity?version=2.1&page=examples-timeline-callbacks.html - you will notice that it has slightly changed to address this issue.

Thanks so much! Worked great.

1 Like