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

1 decade ago by gxxaxx

I am attempting to add more than one music tracks to my game.
Things started to go haywire so I switched to the pong game source and plugged my code into that.

in main.js we have
	init: function() {
		ig.input.bind( ig.KEY.UP_ARROW, 'up' );
		ig.input.bind( ig.KEY.DOWN_ARROW, 'down' );

		ig.music.add( 'media/music/test03.*' );
		ig.music.add( 'media/music/test04.*' );
		ig.music.volume = 0.5;
		ig.music.play();	
		
		this.loadLevel( LevelMain );
	},

Running this game gives me more than one track playing.

Seems like after the first track completes, the first track repeats AND the second track is called. Not sure really

You can listen to it on:
http://www.xxaxxsoft.com/impact/musictest/baked.html

Could be my browser, my computer, the sound files, ????
The ogg and mp3 both indicated "one shot" when I looked at the properties in sound forge.

Any clues welcome

1 decade ago by dominic

Interesting.

It seems you found (yet another) bug with <audio> in Firefox. I wrote a minimal test case and filed a bug report.


Workaround: in lib/impact/sound.js, line 179 for the stop() function in ig.Music, switch the calls to .pause() and .currentTime like so:

stop: function() {
	if( !this.currentTrack ) { return; }
	this.currentTrack.currentTime = 0;
	this.currentTrack.pause();
},

I hope this doesn't produce any other artifacts, such as playing the first few ms of the sound again before it is paused. I wouldn't be surprised :/

Update: apparently <video> had the same problem; my bug report was a dupe. It's already fixed in recent Firefox builds

1 decade ago by gxxaxx

Thanks for the work-around. Much happiness.

I figured it was probably the browser.
Didn't seem likely that no one would have pointed it out if it had been a bug in impact.
Page 1 of 1
« first « previous next › last »