Jump to content

PIXI.sound Question - Controlling Layered Sound Instances?


skepticalmartyr
 Share

Recommended Posts

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();
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...