--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;
/* !!! FIXME: I hate this SDL_NAME clutter...it makes everything so messy! */
static pa_simple* (*SDL_NAME(pa_simple_new))(
const char *server,
static pa_simple *(*SDL_NAME(pa_simple_new)) (const char *server,
const char *name,
pa_stream_direction_t dir,
const char *dev,
@ -70,26 +69,24 @@ static pa_simple* (*SDL_NAME(pa_simple_new))(
const pa_sample_spec * ss,
const pa_channel_map * map,
const pa_buffer_attr * attr,
int *error
);
int *error);
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_write))(
pa_simple *s,
static int (*SDL_NAME(pa_simple_write)) (pa_simple * s,
const void *data,
size_t length,
int *error
);
static pa_channel_map* (*SDL_NAME(pa_channel_map_init_auto))(
pa_channel_map *m,
unsigned channels,
pa_channel_map_def_t def
);
size_t length, int *error);
static pa_channel_map *(*SDL_NAME(pa_channel_map_init_auto)) (pa_channel_map *
m,
unsigned
channels,
pa_channel_map_def_t
def);
static const char *(*SDL_NAME(pa_strerror)) (int error);
#define SDL_PULSEAUDIO_SYM(x) { #x, (void **) (char *) &SDL_NAME(x) }
static struct {
static struct
{
const char *name;
void **func;
} pulse_functions[] = {
@ -102,6 +99,7 @@ static struct {
SDL_PULSEAUDIO_SYM(pa_strerror),
/* *INDENT-ON* */
};
#undef SDL_PULSEAUDIO_SYM
static void
@ -186,8 +184,7 @@ PULSEAUDIO_PlayDevice(_THIS)
{
/* Write the audio data */
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;
}
}
@ -227,7 +224,8 @@ PULSEAUDIO_CloseDevice(_THIS)
/* !!! FIXME: this could probably be expanded. */
/* Try to get the name of the program */
static char *get_progname(void)
static char *
get_progname(void)
{
char *progname = NULL;
#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 */
/* http://bugzilla.libsdl.org/show_bug.cgi?id=110 */
SDL_NAME(pa_channel_map_init_auto)(
&pacmap, this->spec.channels, PA_CHANNEL_MAP_WAVEEX);
SDL_NAME(pa_channel_map_init_auto) (&pacmap, this->spec.channels,
PA_CHANNEL_MAP_WAVEEX);
/* Connect to the PulseAudio server */
this->hidden->stream = SDL_NAME(pa_simple_new)(
SDL_getenv("PASERVER"), /* server */
this->hidden->stream = SDL_NAME(pa_simple_new) (SDL_getenv("PASERVER"), /* server */
get_progname(), /* application name */
PA_STREAM_PLAYBACK, /* playback mode */
SDL_getenv("PADEVICE"), /* device on the server */