I am migrating my audio v1 code to the new v2 engine and noticed that using setVolume in quick successions now throws errors:
My use case is to toggle a music by clicking a button: click to fade-in, click again to fade-out. This means the second click can happen before the end of the fade-in ramp, thus throwing the error like in the PG.
What is the V2-friendly way to override the ramp in this case?
I have been using the setVolume(targetVolume, duration) method of v1 Sound instances. Calling it when a ramp was not finished simply stopped the ramp and started the new one.
Firefox supports canceling audio ramps, now, and the latest version of Babylon.js has been updated to cancel old ramps when new ones are created with setVolume.