Open JasXSL opened 7 years ago
Can you provide an example of what you mean?
For an instance
// Create two channels, one for music and one for SFX MyApp.channelVolumes = { music: 0.5, sfx: 0.5 }; // Create functions to return the volumes. These could also have custom logic. MyApp.getMusicVol = function(){ return MyApp.channelVolumes.music; }; MyApp.getSfxVol = function(){ return MyApp.channelVolumes.sfx; }; // Play a music piece or a few createjs.Sound.play("musicPiece.ogg", { volume: MyApp.getMusicVol; }); // When a sound effect is received, duck the volume of the music channel createjs.Sound.play("boom.ogg", { volume: MyApp.getSfxVol; }); MyApp.channelVolumes.music = 0.25;
If soundjs has something built in to create different audio channels like this, that's better. But I haven't seen anything in the docs about it. Grabbing the volume from a function seems like an easy solution.
Edit: Accidentally added (); to the functions
I think it would be a good idea to add the ability to set sound volume to a function that returns a number. That would make it easier to add different channels of sound. Such as adding different volume functions for music and sound effects.