In order to enable this kind of control, I have exposed to Javascript the sound source object of the music currently playing. So, once we have access to that object, we can work with it like we do with any other sound source. The new function that does it is part of the Sound JS class and is called
musicSoundSource
. More specifically, if I want to adjust on the fly, say, the volume of the music currently playing, what I would do is something like this:
Code: Select all
myMusicSoundSource = Sound.musicSoundSource();
myMusicSoundSource.volume = 0.4;
Code: Select all
myMusicSoundSource.position = [-1,0,0]; // throw the currently playing music to the left channel