Fixed bug where new sound instances aren't kept (#2618)
Fixed bug where new sound instances aren't kept (#2618)

* Fixed bug where new sound instances aren't kept

When `sound.positional` is set by the developer, the new instances created are no longer kept in slot.instances. This means that the sound is audible but the slot.isPlaying property is false because it has no instances and the developer can no longer stop the sound.

Reproduced in: https://playcanvas.com/project/747427/overview/sound-positional-issues

Open up dev console in the browser

Press 1 to play the sound, 4 to toggle positional property.

Noticed that isPlaying is false in the console (press 3) and that pressing 2 to stop the sound doesn't stop the sound.

* Avoided an array allocation

Co-authored-by: Steven Yau <c4e01c0f87a9d4bf034f0f681553ace272d52b0f@snaphcat.com>
MicroWorldwide/PlayCanvas,playcanvas/engine,MicroWorldwide/PlayCanvas,playcanvas/engine