Pages: [1]
|
|
|
Author
|
Topic: Sound delays with mixsdl (Read 5365 times)
|
TigTigger
Zebranky food
Offline
Posts: 41
|
Hey all,
I am not sure if this is a bug or not, but..
I've normally just run uqm on my Windows machine, but I figured I'd take a stab and getting it running on my Linux machine. It's uqm 0.5 on Fedora Core 4, installed SDL devel packages via yum, but compiled from source since the repos still only have uqm 0.4.
The game works well, except that all of the sound effects are delayed by about 300ms, using mixsdl and ALSA. It's quite irritating. Conversely, speech works just fine- there are no delays at all when skipping back and forth through conversations, for example.
Now, if I switch to OpenAL sound, there is zero delay with the sound effects- although instead the sound is scratchy. Guess it is indeed still "experimental".
All other sound on the machine works fine, too.
The only possible clue is these (possibly normal) messages:
_GetSoundBankData(): loading lbm/menusnd01.wav SoundDecoder_DecodeAll(): WARNING, called with a small buffer (4096) _GetSoundBankData(): loading lbm/menusnd02.wav SoundDecoder_DecodeAll(): WARNING, called with a small buffer (4096) _GetSoundBankData(): loading lbm/menusnd03.wav SoundDecoder_DecodeAll(): WARNING, called with a small buffer (4096) _GetSoundBankData(): loading lbm/menusnd04.wav SoundDecoder_DecodeAll(): WARNING, called with a small buffer (4096)
I've read a couple of threads already on similar issues, but it looks like they were due to arts/esl. I have neither running- and the issue is only present with mixsdl. not with openal.
Should I post a bug report, or is there something I might be doing wrong? Anything else that I could provide?
|
|
|
Logged
|
|
|
|
|
|
fossil
Core Team
Frungy champion
Offline
Gender:
Posts: 94
|
It could be any of a number of things going wrong. What is strange here is that you say that sound effects have latency and speech does not, which is not really possible with mixsdl (unless I am seriously missing something here). Could it merely be a perceptional issue?
I had a similar problem on RedHat 8/9 with OSS. To fix it I played with SDL_PATH_DSP envvar to override the default playback device. It can take values /dev/sound/dsp, /dev/dsp and /dev/audio (from best to worst). I do not really know if ALSA has similar things of if you can use OSS.
Because of the architecture of certain SDL audio drivers, sound latency can sometimes be substantial and quite annoying indeed. Please look at the console output (the very beginning) or the log file (can be created with -l log-file-name) for the lines that look like so:
Opening SDL audio device. using dsound at 44100 Hz 16 bit stereo, 4096 samples audio buffer
and post them here. This may tell us exactly what the problem is.
|
|
|
Logged
|
|
|
|
TigTigger
Zebranky food
Offline
Posts: 41
|
Thanks for your reply,
It could be any of a number of things going wrong. What is strange here is that you say that sound effects have latency and speech does not, which is not really possible with mixsdl (unless I am seriously missing something here). Could it merely be a perceptional issue?
You understood correctly. There are definitely, 100% sure, delays with the sound effects, but not the voices. Using the left and arrow keys with the voices show that the next (or previous) speech immediately starts playing. And, there is also definitely no sound latency at all using OpenAL. The former are .wav files and the latter are .ogg files - not sure if that might matter.
I had a similar problem on RedHat 8/9 with OSS. To fix it I played with SDL_PATH_DSP envvar to override the default playback device. It can take values /dev/sound/dsp, /dev/dsp and /dev/audio (from best to worst). I do not really know if ALSA has similar things of if you can use OSS.
Thanks for the suggestion, but, this doesn't appear to help at all- unless I need to set something else to have it write right to the audio device?
Because of the architecture of certain SDL audio drivers, sound latency can sometimes be substantial and quite annoying indeed. Please look at the console output (the very beginning) or the log file (can be created with -l log-file-name) for the lines that look like so:
Opening SDL audio device. using dsound at 44100 Hz 16 bit stereo, 4096 samples audio buffer
and post them here. This may tell us exactly what the problem is.
Sure thing. Here's the relevant section.
0 joysticks were found. Initializing SDL audio subsystem. SDL audio subsystem initialized. Opening SDL audio device. using alsa at 44100 Hz 16 bit stereo, 940 samples audio buffer Initializing mixer. Mixer initialized. Initializing sound decoders. Sound decoders initialized. 'starcon.lst' -- 12386 bytes 'lbm/scclrtab.ct' -- 104466 bytes We've loaded the Kernel
Oh, I also tried changing the sound quality, to no help.
|
|
|
Logged
|
|
|
|
fossil
Core Team
Frungy champion
Offline
Gender:
Posts: 94
|
I am curious what your hardware is like. The 940-samples audio buffer at 44KHz is actually way small (~21 milliseconds of audio), considering that UQM mixsdl requests 4096-samples buffer. If your system is not too fast, the CPU might not be keeping up and spending a lot of time in the mixer function. With such a small audio buffer, the OS is task-switching more than it should, and if the OS is trying its hardest to schedule the mixer task on time, the mixer will keep preempting other tasks and will keep the locks (mutexes). The sound fx queueing involves many locking operations, and if the queueing has to wait on these locks a lot, the sounds will be delayed. You can tell if that's what is going on by playing Super Melee. If the frame rate stutters a lot, your CPU is not being able to keep up. This is all only an educated guess, however. If it's not the CPU, the only other thing I can suggest is try a different sound system (OSS for example) and/or hardware.
|
|
|
Logged
|
|
|
|
|
Novus
Enlightened
Offline
Gender:
Posts: 1938
Fot or not?
|
The machine is a AMD 2600+, 768MB of RAM. The sound card is the onboard card: $ cat /proc/asound/cards 0 [SI7012 ]: ICH - SiS SI7012 SiS SI7012 with CMI9739 at 0xdc00, irq 17
OK, my laptop has an Intel chipset (ICH4) with the same sound driver (intel8x0), so I may be able to help. The relevant part of the UQM output is just like yours:
Initializing SDL audio subsystem. SDL audio subsystem initialized. Opening SDL audio device. using alsa at 44100 Hz 16 bit stereo, 940 samples audio buffer
However, I don't notice any sound latency anywhere. This is using SuSE 10.1 with SDL-1.2.9-19 and alsa-1.0.11-32. I can think of two possibilities:
- The SDL sound latency issues described on the ALSA wiki page on the intel8x0.
- You have dmix installed and it's introducing additional sound latency. What are the contents of your /etc/asound.conf or /etc/asound.state?
Edit: works for me with dmix enabled, too, although I suppose it is possible to mess up the configuration and cause latency.
|
|
« Last Edit: June 09, 2006, 05:25:46 pm by Novus »
|
Logged
|
|
|
|
|
Novus
Enlightened
Offline
Gender:
Posts: 1938
Fot or not?
|
I can't find anything obviously wrong with your sound card settings that would cause this sort of problem. The only thing I can think of is upgrading ALSA and SDL and seeing if the problem goes away, or trying to find something in UQM that would account for this behaviour.
|
|
|
Logged
|
|
|
|
|
Pages: [1]
|
|
|
|
|