We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 851 - Audio broken in latest snapshot
Summary: Audio broken in latest snapshot
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: audio (show other bugs)
Version: HG 1.2
Hardware: Other Linux
: P2 major
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-16 13:29 UTC by Sam Lantinga
Modified: 2009-10-16 23:59 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sam Lantinga 2009-10-16 13:29:32 UTC
Oh behalf of Roman Tetelman (kevlarman@gmail.com), who can also be
found in #ioquake3 on freenode:

 <@kevlarman> oh god
 <@kevlarman> wow
 <@kevlarman> sound sucks with this sdl
 <@kevlarman> zakk: ^
 <@kevlarman> on an hdaudio card
 <Timbo> with SDL svn?
 <@kevlarman> yeah
 <@kevlarman> well, the snapshot
 <@kevlarman> not svn
 <Timbo> so no then?
 <Timbo> give it a shot with SDL svn
 <Timbo> i'm not sure if the snapshot is late enough
 <@kevlarman>  /branches/SDL-1.2/ right?
 <Timbo> yup
 <@kevlarman> slightly better
 <@kevlarman> but still bad
 <@kevlarman> now instead of crackling sounds are just getting cut off
Comment 1 Roman Tetelman 2009-10-16 19:19:48 UTC
the same thing happens just running loopwave with the alsa driver. uncommenting #define SET_PERIOD_SIZE in SDL_alsa_audio.c seems to fix it.
Comment 2 Sam Lantinga 2009-10-16 20:25:10 UTC
Can you post the version of ALSA you're using, along with the card that you have?

Also, can you post the output with DEBUG_PERIOD_SIZE enabled with and without SET_PERIOD_SIZE enabled?

Thanks!
Comment 3 Roman Tetelman 2009-10-16 22:42:17 UTC
$ pacman -Si alsa-lib|grep Version
Version        : 1.0.21.a-1

without SET_PERIOD_SIZE defined:
ALSA: period size = 470, periods = 0, buffer size = 3763

with it:
ALSA: period size = 470, periods = 2, buffer size = 1411

it's a little more difficult to tell the difference with loopwave, but it's pretty blatant with (for example) firing plasma gun in ioq3 with the background music of q3dm6
(running ioq3 without SET_PERIOD_SIZE results in:
ALSA: period size = 470, periods = 1, buffer size = 940
and with:
ALSA: period size = 470, periods = 2, buffer size = 1411)
Comment 4 Roman Tetelman 2009-10-16 23:45:14 UTC
$ uname -a
Linux IfYouCanReadThisYoureTooClose 2.6.30-ARCH #1 SMP PREEMPT Wed Sep 9 14:16:44 CEST 2009 x86_64 Intel(R) Core(TM)2 Duo CPU E7400 @ 2.80GHz GenuineIntel GNU/Linux
$ lspci |grep Audio
00:1b.0 Audio device: Intel Corporation 82801JI (ICH10 Family) HD Audio Controller
01:00.1 Audio device: ATI Technologies Inc R700 Audio Device [Radeon HD 4000 Series]

(the second card is for hdmi output, and isn't actually used)
Comment 5 Sam Lantinga 2009-10-16 23:59:11 UTC
It looks like your audio driver is broken or really oddly configured.  You should never have 0 periods, and generally the buffer size should be a multiple of the period size.

I'm going to go ahead and leave it setting the buffer size by default, since that seems to work as well or better for most people.  However, I added an environment variable SDL_AUDIO_ALSA_SET_PERIOD_SIZE to get the old behavior for people who need it.

Thanks!