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.

Audio > Krawall help:

#19214 - rossjp - Wed Apr 14, 2004 3:18 am

I'm having a small problem using krawall with my project:

At the start of my game there is a main menu screen, which is created from the main while loop in main.cpp, and then run using main_menu.run();

Inside the run function is a while loop that polls for user input, and changes the game state when needed. The run function worked perfectly before I started integrating Krawall, so the problem doesn't lie there.

The problem I'm having is this: at the start of the main_menu.run() function I call krapPlay(myMod, KRAP LOOP MODE (or whatever), 1) and the song plays just fine. Immediately when the game state changes (i.e. the user selects to start the game), I make a call to krapStop() to stop playing the music, but it doesn't exactly stop. Instead, my game goes to the first level, and the music is still "skipping" in the background. Has anyone had a similar problem, and/or have any suggestions for solving this?

By the way, I've initialized Krawall in stereo mode and tied the kradInterrupt to Timer1 before any of that happens. The kramWorker() function is called in a VBL interrupt which is also where objects are copied into OAM. It seems weird that the game plays the music but has trouble stopping it.

Ross

#19215 - tepples - Wed Apr 14, 2004 3:47 am

If Krawall is anything like my own sound engine, you have to always call the worker function, no matter whether you're playing music or not.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#19218 - rossjp - Wed Apr 14, 2004 5:11 am

Well the place where the worker function is called is the same, whether music is playing or not. The music does play when I want it to, so clearly the worker function is doing some of the work. It just seems to take a break when I make a call to the stop function.

Ross

#19227 - Miked0801 - Wed Apr 14, 2004 4:51 pm

That's pretty strange. Are you sure you aren't doing something like KrapPlay()
....
KrapStop()

in your main loop? As you got it working I doubt you made so simple of a mistake, but it's possible. I've been using Krawall for at least a year now and haven't experienced this problem yet.

#19231 - rossjp - Wed Apr 14, 2004 7:54 pm

Yeah that is very weird. I've seen some of your other posts and know that you've done some pretty big projects with krawall and yet you've never had a problem like this. I was kinda hoping you would be the one to help with this (ahhh!).

Could it have something to do with the size of the xm file, or the fact that it is pretty complex (it was once a wav file). Is there a way to clear the buffers that krawall uses? If I could do that I could probably stop the skipping sound, though that's probably not the best way to fix it.

Thanks in advance for any help/suggestions.

Ross

#19232 - poslundc - Wed Apr 14, 2004 9:08 pm

rossjp wrote:
Could it have something to do with the size of the xm file, or the fact that it is pretty complex (it was once a wav file).


I don't know a thing about Krawall, but if you've taken a wav file and just converted it to an XM file without actually remastering it from the samples into a music format (as opposed to a sound format), then you are probably much better off using a simple sound codec player such as tepples' 8ad or GSM players.

Dan.

#19234 - Miked0801 - Wed Apr 14, 2004 9:51 pm

Trust me, the stuff we pass into Krawall is plently complex - 16-channels all doing indpendant things with panning and such - it sounds great but eats the CPU :(

You are sure that you haven't accidently used RAM (EW or IW) tha Krawall needs? It's really finicky about its RAM and we've had some weirdness when we accidently place a var in its space. Alos, make sure that you aren't using DMA1 or DMA2 for anything as Krawall uses these for music. Finally, make sure than Timer 1 and (I believe 0 as well) are set aside for its use. As it sets up uts own interrupt routines off those timers, that could be your problem as well. Just some random thoughts.

#19236 - rossjp - Thu Apr 15, 2004 12:01 am

Thanks for the input. I'll look into the DMA and timer stuff as I'm not exactly sure if my partners in crime are using that or not. Much appreciated help on where to look for errors.

Ross

#19244 - Miked0801 - Thu Apr 15, 2004 5:53 am

Man I type bad when I'm in a hurry - my apologies...

#19246 - rossjp - Thu Apr 15, 2004 6:27 am

I got it. Turns out one of my partners was resetting the VBL interrupt to call another function than the one I was using for kramWorker(). Thanks to those that helped, kind of a hard problem to debug.

Ross