Cloned sounds don't respect any sound settings

Once you clone a sound, none of the settings work on it anymore like volume, spatialSound, maxRange.

Very simple reproduction: https://playground.babylonjs.com/#2AH4YH#52

I just reprod it from the official demo in the docs here Babylon.js Playground on this page Babylon.js Playground by cloning the sound before playing and setting position.

Maybe our resident DJ can have a look? @RaananW

It does seem like it is working - Broken Spatial Audio | Babylon.js Playground (babylonjs.com)

Setting the volume of the cloned sound does work. loop and autoPlay work as well. Or have I misunderstood the bug report?

When standing outside of the sphere, you can still hear the music. In the original demo, you cannot. If you don’t clone it first, and pass the options into the sound constructor, that is not the case.

Thanks!

So, everything does work, but not being initialized correctly. A temporary fixed would be this - Broken Spatial Audio | Babylon.js Playground (babylonjs.com)

Before cloning set the to-be-cloned sound to be spatial. I’ll make sure to solve them in the next version.

1 Like

fix an issue after cloning a sound by RaananW · Pull Request #12062 · BabylonJS/Babylon.js (github.com)

1 Like

Thanks for the fast fix! You’re killing it!

As a side note, in game dev you often build directly against the Engine source to be able to debug, step into, and make changes for upstream submission. I wonder how hard it would be to get that working. I have a bunch of scripts that auto modify the babylon package.jsons to point at the non minified versions to make it more tolerable to work with the engine. Targeting the minified versions is really tough.

1 Like

Out future packages (for 5.0) will all include sourcemaps for developers, including full typescript sources. Should be used only during development, of course, but it will be a change to what we are doing right now, that’s for sure.

1 Like

Even on the current version, if you rely on the es6 packages, source maps are available and should help a lot. I could not as well work without it :slight_smile:

1 Like