question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

how can release or destory sounds?

See original GitHub issue

hi.

thanks for developing SoundJS.

We are developing mmorpg with sound.js. I know how can we release loaded mp3 by calling instance.destroy()

but i gave error… i don’t know correct reason yet…

i wanna know how release sounds after registerSound, when every using done…

thx

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
reinierfcommented, Dec 3, 2018

The suggested solution only partly solves the problem. SoundInstance.destroy() does remove references to objects within the sound instance, but not the reference to the SoundInstance itself, which is kept in AbstractPlugin._soundInstances. When you have an event sound which is played often, for instance associated with a button, references keep piling up. Sound.removeSound(src) does remove references to SoundInstance instances, but removing/unloading the source sound is often not desired, as is the case with the button sound.

A bit of a hacky way (because it accesses the ‘private’ property _soundInstances of the plugin) to remove the references is:

var idx = Sound.activePlugin._soundInstances[soundInstance.src].indexOf(soundInstance);
Sound.activePlugin._soundInstances[soundInstance.src].splice(idx,1);

(You still also have to call soundInstance.destroy() though.)

1reaction
SeminYuncommented, Jan 3, 2017

@lannymcnie thx…

i hope it will be fixed asap

thx…

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Sound of Destruction | News | College of Engineering
“Under certain conditions, sound waves cause the formation of small bubbles that rapidly implode and release an intense shock wave that ...
Read more >
Can sound or silence be used to kill? - The Washington Post
Sound is not a practical way to kill someone. You can make a loud sound, but it gets lost in the air. If...
Read more >
Attack, decay, sustain, and release - Apple Support
Release: Sets the time it takes for the sound to decay from the sustain level to an amplitude of 0 when the key...
Read more >
destroy object and play sound? - Unity Answers
You play the sound using an audio source, and you destroy the object holding the audio source. You have multiple solutions : Do...
Read more >
Can a sound wave kill you? - Science | HowStuffWorks
A key factor here is that you'd be in an enclosed space. Outside, sound waves disperse and dissipate too quickly to reach lethal...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found