Distorted sound [ SOLVED! ]

An unusual problem. The game I’m working on needs to run forever in an arcade. However, after around 6 hours or so the sound becomes choppy/distorted. I have no idea why!

I was using OpenAL - but that leaked memory. So I’m using FMOD. That was using ALSA - but I got some funky errors turning up in /var/log/user.log after several hours and the game locked up. So, I removed pulse audio and switched from ALSA to OSS. No more errors in the logs, no more lockup, but I’m still left with the distorted sound after around 6 hours issue.

Has anyone any ideas?

I’ve just made some changes to disable/enable all audio periodically along with calls to stopAllSounds and clearCache. I’m hoping this will help - I’ll know in around 6 hours I guess… but meanwhile, if anyone has seen anything similar, please help! Slowly going insane!

Also - probably related, with FMOD I get errors at the console I did not get with OpenAl. Namely “invalid object handle” and “the specified channel has been reused to play another sound”. It’s all very odd because I’m certain there aren’t many sounds playing!

Cheers,
Gary

Bizarre. If I Ctrl-Alt-F1 to a tty, then CAF7 back to game - the distortion goes away.

Very strange. Very very strange!

Cheers,
Gary

In case anyone encounters similar with a long running game… I solved this one by adding a “process pause” once every few hours, when no one was playing the game (demo mode). Essentially:

        tt = globalClock.getFrameTime()
        if (tt > self.nextBug):
            self.p = subprocess.call([os.getcwd()+'/audio.sh'])
            self.nextBug += (60*60)*5 # 5 hours

With audio.sh containing:

#!/bin/bash
kill -STOP $(pidof ppython)
sleep 0.2
kill -CONT $(pidof ppython)

Problem solved.

Cheers,
Gary