--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402638
This commit is contained in:
Sam Lantinga 2007-09-10 12:11:40 +00:00
parent e14963d9aa
commit fa9233eaca
3 changed files with 65 additions and 68 deletions

View file

@ -61,8 +61,7 @@ static const char *pulse_library = SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC;
static void *pulse_handle = NULL; static void *pulse_handle = NULL;
/* !!! FIXME: I hate this SDL_NAME clutter...it makes everything so messy! */ /* !!! FIXME: I hate this SDL_NAME clutter...it makes everything so messy! */
static pa_simple* (*SDL_NAME(pa_simple_new))( static pa_simple *(*SDL_NAME(pa_simple_new)) (const char *server,
const char *server,
const char *name, const char *name,
pa_stream_direction_t dir, pa_stream_direction_t dir,
const char *dev, const char *dev,
@ -70,26 +69,24 @@ static pa_simple* (*SDL_NAME(pa_simple_new))(
const pa_sample_spec * ss, const pa_sample_spec * ss,
const pa_channel_map * map, const pa_channel_map * map,
const pa_buffer_attr * attr, const pa_buffer_attr * attr,
int *error int *error);
);
static void (*SDL_NAME(pa_simple_free)) (pa_simple * s); static void (*SDL_NAME(pa_simple_free)) (pa_simple * s);
static int (*SDL_NAME(pa_simple_drain)) (pa_simple * s, int *error); static int (*SDL_NAME(pa_simple_drain)) (pa_simple * s, int *error);
static int (*SDL_NAME(pa_simple_write))( static int (*SDL_NAME(pa_simple_write)) (pa_simple * s,
pa_simple *s,
const void *data, const void *data,
size_t length, size_t length, int *error);
int *error static pa_channel_map *(*SDL_NAME(pa_channel_map_init_auto)) (pa_channel_map *
); m,
static pa_channel_map* (*SDL_NAME(pa_channel_map_init_auto))( unsigned
pa_channel_map *m, channels,
unsigned channels, pa_channel_map_def_t
pa_channel_map_def_t def def);
);
static const char *(*SDL_NAME(pa_strerror)) (int error); static const char *(*SDL_NAME(pa_strerror)) (int error);
#define SDL_PULSEAUDIO_SYM(x) { #x, (void **) (char *) &SDL_NAME(x) } #define SDL_PULSEAUDIO_SYM(x) { #x, (void **) (char *) &SDL_NAME(x) }
static struct { static struct
{
const char *name; const char *name;
void **func; void **func;
} pulse_functions[] = { } pulse_functions[] = {
@ -102,6 +99,7 @@ static struct {
SDL_PULSEAUDIO_SYM(pa_strerror), SDL_PULSEAUDIO_SYM(pa_strerror),
/* *INDENT-ON* */ /* *INDENT-ON* */
}; };
#undef SDL_PULSEAUDIO_SYM #undef SDL_PULSEAUDIO_SYM
static void static void
@ -186,8 +184,7 @@ PULSEAUDIO_PlayDevice(_THIS)
{ {
/* Write the audio data */ /* Write the audio data */
if (SDL_NAME(pa_simple_write) (this->hidden->stream, this->hidden->mixbuf, if (SDL_NAME(pa_simple_write) (this->hidden->stream, this->hidden->mixbuf,
this->hidden->mixlen, NULL) != 0 ) this->hidden->mixlen, NULL) != 0) {
{
this->enabled = 0; this->enabled = 0;
} }
} }
@ -227,7 +224,8 @@ PULSEAUDIO_CloseDevice(_THIS)
/* !!! FIXME: this could probably be expanded. */ /* !!! FIXME: this could probably be expanded. */
/* Try to get the name of the program */ /* Try to get the name of the program */
static char *get_progname(void) static char *
get_progname(void)
{ {
char *progname = NULL; char *progname = NULL;
#ifdef __LINUX__ #ifdef __LINUX__
@ -328,12 +326,11 @@ PULSEAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
/* The SDL ALSA output hints us that we use Windows' channel mapping */ /* The SDL ALSA output hints us that we use Windows' channel mapping */
/* http://bugzilla.libsdl.org/show_bug.cgi?id=110 */ /* http://bugzilla.libsdl.org/show_bug.cgi?id=110 */
SDL_NAME(pa_channel_map_init_auto)( SDL_NAME(pa_channel_map_init_auto) (&pacmap, this->spec.channels,
&pacmap, this->spec.channels, PA_CHANNEL_MAP_WAVEEX); PA_CHANNEL_MAP_WAVEEX);
/* Connect to the PulseAudio server */ /* Connect to the PulseAudio server */
this->hidden->stream = SDL_NAME(pa_simple_new)( this->hidden->stream = SDL_NAME(pa_simple_new) (SDL_getenv("PASERVER"), /* server */
SDL_getenv("PASERVER"), /* server */
get_progname(), /* application name */ get_progname(), /* application name */
PA_STREAM_PLAYBACK, /* playback mode */ PA_STREAM_PLAYBACK, /* playback mode */
SDL_getenv("PADEVICE"), /* device on the server */ SDL_getenv("PADEVICE"), /* device on the server */