Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

4 years ago by stahlmanDesign

I checked the docs but can't seem to figure out if this is possible.

I have an musicSource entity that has a radius. If the player is a certain distance away, the music volume fades. However, if another musicSource radius is encountered, overlapping the first one, I want the new music to also play. The effect is that the first music fades out as I go away from it, and the new one fades in as I approach.

From what I can tell, it is not possible to have two songs playing at the same time (the volume ig.music.volume affecting the currently playing song, and individual songs don't have individual volume params)

4 years ago by Joncom

I believe the music player was designed to play a single song at a time, and could transition between different songs, but not play two songs simultaneously. In order to have two songs plays at the same time, you may need to create another instance of ig.Music...

4 years ago by alexandre

Indeed ig.main -- defined in impact.js -- creates a single instance of ig.Music, named ig.music. Creating additional instances probably won't work out of the box because of the way ig.Music.play is defined (see audio.js).

An easier solution exists though, one that supports simultaneous playback of audio files, each w. its own volume settings, plus fade in and out functionality. Also, it supports audio sprites. See Howler.js.

4 years ago by Joncom

Quote from alexandre
Creating additional instances probably won't work out of the box because of the way ig.Music.play is defined (see audio.js).
What about the way play is defined suggests it won't work?
Page 1 of 1
« first « previous next › last »