gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Coding > strange sound issue

#43396 - revengero - Mon May 23, 2005 1:39 am

Hi, im currently working on a game engine and was starting to put some sound in. Ive used the tutorial here: http://www.gamedev.net/reference/articles/article1823.asp to do sound. I modified the code so as it could run while everything else is happening (characters running jumping etc.) The problem is that the sound sample i am using to test the code, starts running one loop in. So the sample goes for 8 seconds and for the first 8 seconds of the game, its silent, then it kicks in and loops normally. Has anyone had a problem like this before?

thanks in advance

#43398 - strager - Mon May 23, 2005 1:50 am

Are you using a timer ot count the 8 seconds? If so, you probably forgot that once you start a timer, it only interrupts after the 8 seconds have gone bye. I think you can fix this by either doing an IF |= TMx, or by executing the copy function at the start of the sound loop.

Yes, I've done this too. :-)

#43408 - revengero - Mon May 23, 2005 3:20 am

Ended up just initialising my sound counter to the end of the sample so it ticks over to a new sample straight away, but thanks for the help, cleared up some stuff ;)