Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

looping music 1

Status
Not open for further replies.

FrankyTheFish

Programmer
Sep 7, 2002
14
0
0
CA
I have an odd problem.

We're making a game. When we started the music would loop no problem. So we're almost done with the game and I decide to make better music for the game. It loops perfectly when you play it on any player but in the game it doesn't loop anymore like it did before, there's a short pause less then a second but makes it sound like poo. I'm, at a loss as to why this is happening.

bgmusic=new Sound(Background1);
bgmusic.attachSound("music");
bgmusic.start();

bgmusic.onSoundComplete = function ()
{
bgmusic.start();
}

This is what we use to call the music. When the music is done

Any help on this would be appreciated.

Thanks for taking the time to read and to help if you know anything that could help this.

Frank
 
Well you don't really need (I think!) the onSoundComplete call (unless you do... can't really remember in the case of an attached "event" soundObject), but in any case, you could either add the following on the first start, and it that doesn't work, then add to the onSoundComplete's function...

start(0,999); // which should loop it for 999 times at least...

That said, if this is a mp3, be aware that mp3 loops are never as good as .wav loops, and are usually not as seamless. You can always play around with the secondOffset parameter, sometimes it works, sometimes not...

start(.5, 999);

Would start the sound .5 second into the track, and might help reducing the silent gap. It usually is in full seconds, but you can try shorther or longer offsets than 1 second.

Regards. Affiliate Program - Web Hosting - Web Design
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top