Results 1 to 6 of 6

Thread: Help With LUA And OGGs

                  
   
  1. #1

    Default Help With LUA And OGGs

    Ok, here's the deal...

    I have a menu before my game starts with a song playing. Then I have my game with a different song playing (with gamestates seperating the two).

    When you select "Start Game" in the menu, it stops the title song and loads one for the game before changing gamestates. If you're in the game and press start to select "Return To Menu", it stops the game song and reloads the title music... Then changes gamestates again.

    My problem is around 50% of the time, it freezes when changing between gamestates that load music. The "Paused" gamestate works perfectly fine because it plays the same music as the game (untill you tell it to return to the menu).

    I took out every function that has to do with playing/loading OGG files, and I didn't have any problems what-so-ever. So I know the issue is with playing or loading the music.

    Any help would be appreciated!!!

  2. #2
    GP2X Coder/Moderator
    Join Date
    Jan 2006
    Posts
    1,678
    Rep Power
    84

    Default

    Are you streaming the music or loading it into memory first?

  3. #3

    Default

    Well, I do Ogg.load() to load it, then Ogg.play() when I want to play it... But it seems like it's streaming it anyway. There's no load time and the memory card light is constantly flashing.

  4. #4
    DCEmu Pro dangee's Avatar
    Join Date
    Feb 2007
    Posts
    531
    Rep Power
    66

    Arrow

    if you have enough free memory , try loading both Oggs during initialisation
    rather than during gameplay.
    Otherwise, making the garbage collector more aggressive may help.

  5. #5

    Default

    I don't load them during gameplay at all. I load the song for the actual game right after you press X on "Start Game" in the menu.

    It wouldn't matter either way though, because it's aparently streaming them. I could put Ogg.load() in the game code 20 times and it wouldn't slow down at all.

    It's working perfectly with .XM files, but I'd much rather use .OGG if it's possible.

  6. #6
    DCEmu Pro dangee's Avatar
    Join Date
    Feb 2007
    Posts
    531
    Rep Power
    66

    Default

    well, it looks like the streaming ogg's overloading lua then.
    theres a few things you can try:

    song = song or ogg:load(songFile) --to avoid memory leak
    Change all locals to globals to reduce pressure on the stack.
    When gamestate changes, song = nil , immediately followed by a full garbage collection cycle
    Reduce the framerate
    Add a System.sleep() into your main loop to give the streaming more CPU.
    Increase CPU speed

    Ultimately tho, you'll avoid no end of hassles by using a non-streaming format.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •