Music doesn't work as it should

2 posts (showing 1-2)
WaldeMar1321

Market Level 0Community Level 0
0 posts

Helo there! I've got a problem. I have a placed in my code stuff like:

if(this.MuzCh.position == 27213.786848072563)
   this.MuzCh = this.MainM.play(0,1,this.MuzTr);

If I will not use this, the fade between repeations might be heard. That's not what I want. But when I launch my game on this site, music playes with glitches, or does not play att all, after first time playing.(((

FYI, this fade I could not hear on most popular players. Loop works fine.

Can anyone help me please? What's wrong?

P.S. Sorry for my english.

posted 2015-11-12T18:46:12-08:00
pjbaron

Market Level 8Community Level 13
4001 posts

Checking for an exact value... what happens if it goes past that value between your checks?  The music will continue to the end and then may stop.  This is probably what is happening when your music doesn't play after the first time.

You could fix that by using >= instead of == for the check.

Better would be to use an audio editor and change your music into a 'perfect loop' by cutting off the fade entirely.  Then you could tell the player to loop it and it should work quite well.  If you need the fade for another time, you can save just the fade as another music file, and use the SOUND_COMPLETE event to trigger it playing when you stop the loop.

Note: flash player has always had some bugs and glitches with looping audio, some are due to the format you encode in, so it might be worth trying a different format or compression ratio if the glitches continue.

posted 2015-12-07T09:45:20-08:00