CreateJS / SoundJS

A Javascript library for working with Audio. It provides a consistent API for loading and playing audio on different browsers and devices. Currently supports WebAudio, HTML5 Audio, Cordova / PhoneGap, and a Flash fallback.
http://createjs.com/
MIT License
4.44k stars 835 forks source link

Increasing instance by createjs.Sound.play #260

Open SeminYun opened 7 years ago

SeminYun commented 7 years ago

hi.

our game play many sound clips. they have played many times(hundred times) during 1 min and clipped sounds's type are simular. they have 4-10 types and play. So if "fool_left.mp3" play during 1 min. it call 10-100.

i set option like following code

createjs.Sound.registerSound(property.src, property.id, {channels:3}, property.basePath, null);

and play sound like following code:

createjs.Sound.play(id);

it is to reduce play many same sound at same time and it called only 3 times for playing sound that play same time, but instance is created and stacked and it gave me memory leak or like memory leak. memory is growing up calling createjs.Sound.play

so how can i control this?

thx

lannymcnie commented 7 years ago

This is behaving as-designed, since instances need to be able to be controlled later on if you store a reference to them -- so they never leave the internal reference lists.

We have considered some approaches to solve this, including:

We are hoping to put some time into SoundJS over the next month, and this is definitely on the list.