Commit 69789889 authored by Sam Lantinga's avatar Sam Lantinga

Fixed bug #572

Please merge this patch for the PA driver in SDL.

http://0pointer.de/public/sdl-pulse-rework.patch

This patch:
- fixes buffering (i.e. reduces number of "fragments" to 2, doesn't defer
filling up of the buffer until the entire buffer ran completely empty.)
- drops $PASERVER and $PADEVICE env var support, since this is a duplication of
$PULSE_SERVER and $PULSE_SINK which the PA libs honor anyway.

This fixes the sound issues in all games I tested.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%403846
parent 6bae66b5
/* -*- Mode: C; c-basic-offset: 8; indent-tabs-mode: t -*- */
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 Sam Lantinga
......@@ -164,10 +165,10 @@ static int Audio_Available(void)
paspec.rate = 11025;
paspec.channels = 1;
connection = SDL_NAME(pa_simple_new)(
SDL_getenv("PASERVER"), /* server */
NULL, /* server */
"Test stream", /* application name */
PA_STREAM_PLAYBACK, /* playback mode */
SDL_getenv("PADEVICE"), /* device on the server */
NULL, /* device on the server */
"Simple DirectMedia Layer", /* stream description */
&paspec, /* sample format spec */
NULL, /* channel map */
......@@ -340,11 +341,10 @@ static int PULSE_OpenAudio(_THIS, SDL_AudioSpec *spec)
SDL_memset(mixbuf, spec->silence, spec->size);
/* Reduced prebuffering compared to the defaults. */
paattr.tlength = mixlen;
paattr.tlength = mixlen*2;
paattr.minreq = mixlen;
paattr.fragsize = mixlen;
paattr.prebuf = mixlen;
paattr.maxlength = mixlen * 4;
paattr.prebuf = mixlen*2;
paattr.maxlength = mixlen*2;
/* The SDL ALSA output hints us that we use Windows' channel mapping */
/* http://bugzilla.libsdl.org/show_bug.cgi?id=110 */
......@@ -353,10 +353,10 @@ static int PULSE_OpenAudio(_THIS, SDL_AudioSpec *spec)
/* Connect to the PulseAudio server */
stream = SDL_NAME(pa_simple_new)(
SDL_getenv("PASERVER"), /* server */
NULL, /* server */
get_progname(), /* application name */
PA_STREAM_PLAYBACK, /* playback mode */
SDL_getenv("PADEVICE"), /* device on the server */
NULL, /* device on the server */
"Simple DirectMedia Layer", /* stream description */
&paspec, /* sample format spec */
&pacmap, /* channel map */
......@@ -374,4 +374,3 @@ static int PULSE_OpenAudio(_THIS, SDL_AudioSpec *spec)
return(0);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment