• Welcome to The Wyrmkeep Entertainment Co. Forum.
 

News:

The forum returns! Still working on tweaks.
Please contact techsupport@wyrmkeep.com to get a forum account.

Main Menu

linux sound output choppy (demo)

Started by simcop2387, Sep 30, 2004, 08:57 PM

Previous topic - Next topic

simcop2387

playing the demo it seems that the audio is choppy, the gameplay seems to be fine, no other game/app does this, if possible i'd like some details about how your doing sound, (straight SDL, ALSA, or something else) so that i know what to check, i'm about to do a kernel recompile to try to get MIDI output and see if that will help (i need to upgrade the kernel anyway).  any hints would be helpful, or even how to get a debug output to help you guys

WyrmMaster

Straight SDL, although we did recompile libSDL 1.2.7 under an older glibc (3.1). I don't know if our compile supports ALSA. You might want to remove the libSDL we provided and see (hear) what happens.

What are your system's specs?

The Linux version doesn't use MIDI, it's all digital audio.

eriktorbjorn

#2
Wild speculation mode on; please bear with me.

Some time ago there was a ScummVM bug report about choppy audio in the Linux version when playing Broken Sword 2, albeit only when the player moves in such a way that the "camera" has to move to follow him. Ordinarily, BS2 outputs 12 frames per second. Most of the rest of the time it "sleeps", that is to say it calls SDL_Delay(). The result is that most of the time, CPU usage stays fairly low. When the camera moves, on the other hand, it would output frames as fast as it could to make the screen scroll more smoothly. At these times ScummVM would use up pretty much all available CPU time.

What I eventually did was to add a brief delay (~ 10 ms, since that's the granularity the SDL documentation says is the most common) between the frames even in this case. The bug reporter said this caused the choppiness to go away, and since the scrolling still looked smooth to me I left it that way. My guess is that while the main thread was hogging the CPU, the OS scheduler didn't give enough time to the audio thread, causing it to run out of audio samples to play. But that's just speculation. I was never able to reproduce the bug myself, neither under Linux nor Windows, however.

Just like with ScummVM, I don't hear any choppiness in the audio with the Linux ITE demo. I haven't yet had the time to try the full version since it only arrived yesterday and I was dead tired, but I assume it's the same in that respect. I did notice that it does appear to use all available CPU at all times, so it could be the same problem, I guess.

simcop2387

#3
yea removing your libsdl was one of the first things i did, i figured that well maybe their libsdl was causing problems, no change.  here's my system specs.

CPU: AMD Athlon XP 1800+ (1.5ghz)
Mem: 512mb ram
Audio: Trident 4D wave DX
GFX: Geforce 3 TI 200 (64mb ram)
Distro: Gentoo

i think thats all that would be relavent in this case, i doubt you've seen my audio card before.  It works rather well, full duplex, i can easily have artsd and esd running at the same time, all while playing music with XMMS, so its a decent card.

EDIT: Making SDL go through ESD/Artsd rather than straight alsa seems to fix the problem, i halfway wonder if its some sort of buffering issue because i've never seen that happen before (even in a perl script i wrote that dials my phone that has a crappy speed dial)

in case anyone else has a similar problem, here's how to fix it

$ SDL_AUDIODRIVER="esd" ./itedemo
for esd,

$ SDL_AUDIODRIVER="artsc" ./itedemo
for arts (and yes that is supposed to be artsc, i don't know why really but thats what makes SDL use arts)

WyrmMaster

We will have to digest all the information you have provided.

If we come up with some test compiles of the game, would you be willing to give them a try?

For the suggested fix of changing the SDL audio driver, was that with our compile of SDL?

simcop2387

that was with mine, but it should work with any SDL that has the other audio drivers built into them

WyrmMaster

simcop2387, I would like to send you a test version of the demo with an SDL_Delay(10) added. Can you give me your e-mail address? You can use the forum e-mail -- click the E-Mail button below this message. Or send it to techsupport@wyrmkeep.com.

Thanks in advance.

eriktorbjorn

Just out of curiosity, was a solution ever found to this? It doesn't matter much to me personally, since I never saw the bug in action, but still...

WyrmMaster

We were unable to reproduce the problem here. We took a wild shot at a fix by adding some SDL_Delay calls. Also, we try to use any existing copy of libSDL 1.2 that might be on a system instead of our compile. The current version of the demo has these changes.

Another person reported that the configuration screen plays sounds and music correctly, but the main demo just plays high frequency beeps. This is odd because the Linux demo using the same code and data for both purposes. (This isn't true of the Windows and Mac OS X demos, which use alternate data files).


:blink:  

WyrmMaster

With the assistance of a couple of Linux users, we appear to have resolved the choppy audio playback on some systems. An updated demo has been posted in the downloads area.

Thanks for everyone's help!

eriktorbjorn

QuoteWith the assistance of a couple of Linux users, we appear to have resolved the choppy audio playback on some systems. An updated demo has been posted in the downloads area.

Great! I assume that once things have settled down a bit, there will be a similar update for the full game as well. (No need to hurry on my account, though. It's worked fine for me so far.)