Skip to content

Commit 6693649

Browse files
Implemented global play method to enable playing sounds on the fly
1 parent 70b31c7 commit 6693649

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

v3/src/sound/BaseSoundManager.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ var BaseSoundManager = new Class({
3737
*/
3838
this.volume = 1;
3939
/**
40-
* Global playback rate at which all the audio assets will be played.
40+
* Global playback rate at which all the sounds will be played.
4141
* Value of 1.0 plays the audio at full speed, 0.5 plays the audio at half speed
4242
* and 2.0 doubles the audio's playback speed.
4343
*
@@ -113,7 +113,11 @@ var BaseSoundManager = new Class({
113113
}
114114
return sound;
115115
},
116-
play: NOOP,
116+
play: function (key, config) {
117+
var sound = this.add(key);
118+
sound.events.once('SOUND_ENDED', sound.destroy.bind(sound));
119+
sound.play(config);
120+
},
117121
playAudioSprite: NOOP,
118122
remove: NOOP,
119123
removeByKey: NOOP,

0 commit comments

Comments
 (0)