skepticalmartyr Posted August 8, 2018 Share Posted August 8, 2018 Quick question about to control a specific instance of a sound (changing the volume, speed, stopping the sound, etc.) when there are layered instances of that sound. How would I do this? I scoured the forum and API Docs for an answers but I did not find anything. Is it possible to do that with this library? Here's a snippet below of what I am trying to achieve as there could be multiple instances of a sound playing but I only need to stop one of them. Any guidance on this would be appreciated! Thank you. //create the sound var sound = PIXI.sound.Sound.from({ url: "/sound/sfx/woosh_high.ogg", preload: true, loop: true }); //play the sound var instance1 = sound.play(); //play another instance of the sound var instance2 = sound.play(); //stop the first instance of the sound //instance2 will keep playing instance1.stop(); Quote Link to comment Share on other sites More sharing options...
bigtimebuddy Posted August 13, 2018 Share Posted August 13, 2018 Please make sure you preload your sound first or else `sound.play` will return a Promise instead of the instance. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.