Distortion after several hours

Started by Dongalor, September 28, 2010, 15:36:42

Previous topic - Next topic

Dongalor

Hi ,

I'm developing a game using lwgl and I've a issue with sounds. I can load and play perfectly all the sounds, but after several hours playing (6 aprox), all the sounds are played with a big distortion.  Any clues of what is going on here? Why the sounds are played well but always after 6 hours are played with distortion?

Thanks in advance.

Matzon

are you using ALSA by any chance?
There have been some issues with that - after playing between 2 and 4 billion samples :)

Dongalor

Yes, I'm using ALSA. (bad news for me??  ???)

the distortion appears after 6 hours (aprox), not enough time to play 2 bilion samples ( if with a sample you mean a .wav file).  Maybe I'm having some memory leaks after 6 hours and alsa just get crazy :)

Thanks for the reply

Matzon

I was told that there is an integer overflow in alsa - whether or not that is the particular issue you're seeing, I do not know. But I suggest trying OSS for 6 hours too and see if it still happens :)

Dongalor

Hi again,

I've made some test, but now with the "space invaders" source i've found inside lwjgl-source-2.5. I added some new lines in the main loop :


while (Game.gameRunning) {
      // clear screen
      GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
      GL11.glMatrixMode(GL11.GL_MODELVIEW);
      GL11.glLoadIdentity();

      // let subsystem paint
      frameRendering();

      // update window contents
      Display.update();
    if (System.currentTimeMillis() > lastSoundTime+35000) {
        lastSoundTime = System.currentTimeMillis();
        soundManager.playSound(SOUND_TEST);
      }
    }


Adding the sound  with
SOUND_TEST   = soundManager.addSound("test.wav");


The goal of the test is to play a sound via the soundManager of space invaders. After 6 hours..... distortion again :(







Matzon

Unless you have changed to OSS in the mean time, this test doesn't really prove anything new :/

Dongalor

I forgot to post the results  :P

With OSS everithing works fine. Thanks for the advice!

Matzon

ok, so we can conclude:
a) dont use ALSA if playing for more than 6 hours
b) dont play for more than 6 hours :)

thanks for responding back

alepao

Hi,


did you check if the card's alsa hw_params matched with the sound output you set up when initializing the audio.
I had the same problem when I was developing a game for a linux board.
This .asoundrc config file solved the issue for me (I was playing at 44100Hz):

pcm.!default {
type rate
slave {
pcm "plughw:0,0"
rate 44100
}
}

Just put it on your home dir.
There was a sort of growing drift due to unmatched sampling freq between the program and the card's ha_params.
Maybe it's a alsa bug...