Commit 05a29201 authored by Sam Lantinga's avatar Sam Lantinga

indent is evil

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402208
parent 3d24370c
...@@ -91,12 +91,10 @@ typedef uintptr_t(__cdecl * pfnSDL_CurrentBeginThread) (void *, unsigned, ...@@ -91,12 +91,10 @@ typedef uintptr_t(__cdecl * pfnSDL_CurrentBeginThread) (void *, unsigned,
typedef void (__cdecl * pfnSDL_CurrentEndThread) (unsigned code); typedef void (__cdecl * pfnSDL_CurrentEndThread) (unsigned code);
#endif #endif
extern DECLSPEC SDL_Thread *SDLCALL SDL_CreateThread(int (SDLCALL * f) (void *), extern DECLSPEC SDL_Thread *SDLCALL
void *data, SDL_CreateThread(int (SDLCALL * f) (void *), void *data,
pfnSDL_CurrentBeginThread pfnSDL_CurrentBeginThread pfnBeginThread,
pfnBeginThread, pfnSDL_CurrentEndThread pfnEndThread);
pfnSDL_CurrentEndThread
pfnEndThread);
#ifdef __OS2__ #ifdef __OS2__
#define SDL_CreateThread(fn, data) SDL_CreateThread(fn, data, _beginthread, _endthread) #define SDL_CreateThread(fn, data) SDL_CreateThread(fn, data, _beginthread, _endthread)
......
This diff is collapsed.
...@@ -47,14 +47,15 @@ ...@@ -47,14 +47,15 @@
#endif #endif
static inline void static inline void
test_device(const char *fname, int flags, int (*test)(int fd), test_device(const char *fname, int flags, int (*test) (int fd),
char ***devices, int *devCount) char ***devices, int *devCount)
{ {
struct stat sb; struct stat sb;
if ( (stat(fname, &sb) == 0) && (S_ISCHR(sb.st_mode)) ) { if ((stat(fname, &sb) == 0) && (S_ISCHR(sb.st_mode))) {
int audio_fd = open(fname, flags, 0); int audio_fd = open(fname, flags, 0);
if ( (audio_fd >= 0) && (test(audio_fd)) ) { if ((audio_fd >= 0) && (test(audio_fd))) {
void *p = SDL_realloc(*devices, ((*devCount)+1) * sizeof (char *)); void *p =
SDL_realloc(*devices, ((*devCount) + 1) * sizeof(char *));
if (p != NULL) { if (p != NULL) {
size_t len = strlen(fname) + 1; size_t len = strlen(fname) + 1;
char *str = (char *) SDL_malloc(len); char *str = (char *) SDL_malloc(len);
...@@ -75,7 +76,7 @@ SDL_FreeUnixAudioDevices(char ***devices, int *devCount) ...@@ -75,7 +76,7 @@ SDL_FreeUnixAudioDevices(char ***devices, int *devCount)
int i = *devCount; int i = *devCount;
if ((i > 0) && (*devices != NULL)) { if ((i > 0) && (*devices != NULL)) {
while (i--) { while (i--) {
SDL_free( (*devices)[*devCount] ); SDL_free((*devices)[*devCount]);
} }
} }
...@@ -94,7 +95,7 @@ test_stub(int fd) ...@@ -94,7 +95,7 @@ test_stub(int fd)
} }
void void
SDL_EnumUnixAudioDevices(int flags, int classic, int (*test)(int fd), SDL_EnumUnixAudioDevices(int flags, int classic, int (*test) (int fd),
char ***devices, int *devCount) char ***devices, int *devCount)
{ {
const char *audiodev; const char *audiodev;
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
*/ */
#include "SDL_config.h" #include "SDL_config.h"
void SDL_EnumUnixAudioDevices(int flags, int classic, int (*test)(int fd), void SDL_EnumUnixAudioDevices(int flags, int classic, int (*test) (int fd),
char ***devs, int *count); char ***devs, int *count);
void SDL_FreeUnixAudioDevices(char ***devices, int *devCount); void SDL_FreeUnixAudioDevices(char ***devices, int *devCount);
......
...@@ -33,8 +33,8 @@ typedef struct SDL_AudioDevice SDL_AudioDevice; ...@@ -33,8 +33,8 @@ typedef struct SDL_AudioDevice SDL_AudioDevice;
typedef struct SDL_AudioDriverImpl typedef struct SDL_AudioDriverImpl
{ {
int (*DetectDevices)(int iscapture); int (*DetectDevices) (int iscapture);
const char *(*GetDeviceName)(int index, int iscapture); const char *(*GetDeviceName) (int index, int iscapture);
int (*OpenDevice) (_THIS, const char *devname, int iscapture); int (*OpenDevice) (_THIS, const char *devname, int iscapture);
void (*ThreadInit) (_THIS); /* Called by audio thread at start */ void (*ThreadInit) (_THIS); /* Called by audio thread at start */
void (*WaitDevice) (_THIS); void (*WaitDevice) (_THIS);
...@@ -107,7 +107,7 @@ typedef struct AudioBootStrap ...@@ -107,7 +107,7 @@ typedef struct AudioBootStrap
{ {
const char *name; const char *name;
const char *desc; const char *desc;
int (*init) (SDL_AudioDriverImpl *impl); int (*init) (SDL_AudioDriverImpl * impl);
int demand_only:1; /* 1==request explicitly, or it won't be available. */ int demand_only:1; /* 1==request explicitly, or it won't be available. */
} AudioBootStrap; } AudioBootStrap;
......
...@@ -44,40 +44,42 @@ ...@@ -44,40 +44,42 @@
static int (*ALSA_snd_pcm_open) static int (*ALSA_snd_pcm_open)
(snd_pcm_t **, const char *, snd_pcm_stream_t, int); (snd_pcm_t **, const char *, snd_pcm_stream_t, int);
static int (*ALSA_snd_pcm_close)(snd_pcm_t * pcm); static int (*ALSA_snd_pcm_close) (snd_pcm_t * pcm);
static snd_pcm_sframes_t(*ALSA_snd_pcm_writei) static snd_pcm_sframes_t(*ALSA_snd_pcm_writei)
(snd_pcm_t *,const void *, snd_pcm_uframes_t); (snd_pcm_t *, const void *, snd_pcm_uframes_t);
static int (*ALSA_snd_pcm_resume)(snd_pcm_t *); static int (*ALSA_snd_pcm_resume) (snd_pcm_t *);
static int (*ALSA_snd_pcm_prepare)(snd_pcm_t *); static int (*ALSA_snd_pcm_prepare) (snd_pcm_t *);
static int (*ALSA_snd_pcm_drain)(snd_pcm_t *); static int (*ALSA_snd_pcm_drain) (snd_pcm_t *);
static const char *(*ALSA_snd_strerror)(int); static const char *(*ALSA_snd_strerror) (int);
static size_t(*ALSA_snd_pcm_hw_params_sizeof)(void); static size_t(*ALSA_snd_pcm_hw_params_sizeof) (void);
static size_t(*ALSA_snd_pcm_sw_params_sizeof)(void); static size_t(*ALSA_snd_pcm_sw_params_sizeof) (void);
static int (*ALSA_snd_pcm_hw_params_any)(snd_pcm_t *, snd_pcm_hw_params_t *); static int (*ALSA_snd_pcm_hw_params_any) (snd_pcm_t *, snd_pcm_hw_params_t *);
static int (*ALSA_snd_pcm_hw_params_set_access) static int (*ALSA_snd_pcm_hw_params_set_access)
(snd_pcm_t *, snd_pcm_hw_params_t *, snd_pcm_access_t); (snd_pcm_t *, snd_pcm_hw_params_t *, snd_pcm_access_t);
static int (*ALSA_snd_pcm_hw_params_set_format) static int (*ALSA_snd_pcm_hw_params_set_format)
(snd_pcm_t *, snd_pcm_hw_params_t *, snd_pcm_format_t); (snd_pcm_t *, snd_pcm_hw_params_t *, snd_pcm_format_t);
static int (*ALSA_snd_pcm_hw_params_set_channels) static int (*ALSA_snd_pcm_hw_params_set_channels)
(snd_pcm_t *, snd_pcm_hw_params_t *, unsigned int); (snd_pcm_t *, snd_pcm_hw_params_t *, unsigned int);
static int (*ALSA_snd_pcm_hw_params_get_channels)(const snd_pcm_hw_params_t *); static int (*ALSA_snd_pcm_hw_params_get_channels) (const snd_pcm_hw_params_t
*);
static unsigned int (*ALSA_snd_pcm_hw_params_set_rate_near) static unsigned int (*ALSA_snd_pcm_hw_params_set_rate_near)
(snd_pcm_t *, snd_pcm_hw_params_t *, unsigned int, int *); (snd_pcm_t *, snd_pcm_hw_params_t *, unsigned int, int *);
static snd_pcm_uframes_t (*ALSA_snd_pcm_hw_params_set_period_size_near) static snd_pcm_uframes_t(*ALSA_snd_pcm_hw_params_set_period_size_near)
(snd_pcm_t *, snd_pcm_hw_params_t *, snd_pcm_uframes_t, int *); (snd_pcm_t *, snd_pcm_hw_params_t *, snd_pcm_uframes_t, int *);
static snd_pcm_sframes_t (*ALSA_snd_pcm_hw_params_get_period_size) static snd_pcm_sframes_t(*ALSA_snd_pcm_hw_params_get_period_size)
(const snd_pcm_hw_params_t *); (const snd_pcm_hw_params_t *);
static unsigned int (*ALSA_snd_pcm_hw_params_set_periods_near) static unsigned int (*ALSA_snd_pcm_hw_params_set_periods_near)
(snd_pcm_t *,snd_pcm_hw_params_t *, unsigned int, int *); (snd_pcm_t *, snd_pcm_hw_params_t *, unsigned int, int *);
static int (*ALSA_snd_pcm_hw_params_get_periods)(snd_pcm_hw_params_t *); static int (*ALSA_snd_pcm_hw_params_get_periods) (snd_pcm_hw_params_t *);
static int (*ALSA_snd_pcm_hw_params)(snd_pcm_t *, snd_pcm_hw_params_t *); static int (*ALSA_snd_pcm_hw_params) (snd_pcm_t *, snd_pcm_hw_params_t *);
static int (*ALSA_snd_pcm_sw_params_current)(snd_pcm_t*, snd_pcm_sw_params_t*); static int (*ALSA_snd_pcm_sw_params_current) (snd_pcm_t *,
snd_pcm_sw_params_t *);
static int (*ALSA_snd_pcm_sw_params_set_start_threshold) static int (*ALSA_snd_pcm_sw_params_set_start_threshold)
(snd_pcm_t *, snd_pcm_sw_params_t *, snd_pcm_uframes_t); (snd_pcm_t *, snd_pcm_sw_params_t *, snd_pcm_uframes_t);
static int (*ALSA_snd_pcm_sw_params_set_avail_min) static int (*ALSA_snd_pcm_sw_params_set_avail_min)
(snd_pcm_t *, snd_pcm_sw_params_t *, snd_pcm_uframes_t); (snd_pcm_t *, snd_pcm_sw_params_t *, snd_pcm_uframes_t);
static int (*ALSA_snd_pcm_sw_params)(snd_pcm_t *, snd_pcm_sw_params_t *); static int (*ALSA_snd_pcm_sw_params) (snd_pcm_t *, snd_pcm_sw_params_t *);
static int (*ALSA_snd_pcm_nonblock)(snd_pcm_t *, int); static int (*ALSA_snd_pcm_nonblock) (snd_pcm_t *, int);
#define snd_pcm_hw_params_sizeof ALSA_snd_pcm_hw_params_sizeof #define snd_pcm_hw_params_sizeof ALSA_snd_pcm_hw_params_sizeof
#define snd_pcm_sw_params_sizeof ALSA_snd_pcm_sw_params_sizeof #define snd_pcm_sw_params_sizeof ALSA_snd_pcm_sw_params_sizeof
...@@ -118,7 +120,8 @@ load_alsa_sym(const char *fn, void **addr) ...@@ -118,7 +120,8 @@ load_alsa_sym(const char *fn, void **addr)
#define SDL_ALSA_SYM(x) ALSA_##x = x #define SDL_ALSA_SYM(x) ALSA_##x = x
#endif #endif
static int load_alsa_syms(void) static int
load_alsa_syms(void)
{ {
SDL_ALSA_SYM(snd_pcm_open); SDL_ALSA_SYM(snd_pcm_open);
SDL_ALSA_SYM(snd_pcm_close); SDL_ALSA_SYM(snd_pcm_close);
...@@ -147,6 +150,7 @@ static int load_alsa_syms(void) ...@@ -147,6 +150,7 @@ static int load_alsa_syms(void)
SDL_ALSA_SYM(snd_pcm_nonblock); SDL_ALSA_SYM(snd_pcm_nonblock);
return 0; return 0;
} }
#undef SDL_ALSA_SYM #undef SDL_ALSA_SYM
#ifdef SDL_AUDIO_DRIVER_ALSA_DYNAMIC #ifdef SDL_AUDIO_DRIVER_ALSA_DYNAMIC
...@@ -512,15 +516,15 @@ ALSA_OpenDevice(_THIS, const char *devname, int iscapture) ...@@ -512,15 +516,15 @@ ALSA_OpenDevice(_THIS, const char *devname, int iscapture)
ALSA_snd_strerror(status)); ALSA_snd_strerror(status));
return 0; return 0;
} }
#if AUDIO_DEBUG #if AUDIO_DEBUG
{ {
snd_pcm_sframes_t bufsize; snd_pcm_sframes_t bufsize;
int fragments; int fragments;
bufsize = ALSA_snd_pcm_hw_params_get_period_size(hwparams); bufsize = ALSA_snd_pcm_hw_params_get_period_size(hwparams);
fragments = ALSA_snd_pcm_hw_params_get_periods(hwparams); fragments = ALSA_snd_pcm_hw_params_get_periods(hwparams);
fprintf(stderr,"ALSA: bufsize = %ld, fragments = %d\n",bufsize,fragments); fprintf(stderr, "ALSA: bufsize = %ld, fragments = %d\n", bufsize,
} fragments);
}
#endif #endif
/* Set the software parameters */ /* Set the software parameters */
...@@ -532,14 +536,16 @@ ALSA_OpenDevice(_THIS, const char *devname, int iscapture) ...@@ -532,14 +536,16 @@ ALSA_OpenDevice(_THIS, const char *devname, int iscapture)
ALSA_snd_strerror(status)); ALSA_snd_strerror(status));
return 0; return 0;
} }
status = ALSA_snd_pcm_sw_params_set_start_threshold(pcm_handle,swparams,0); status =
ALSA_snd_pcm_sw_params_set_start_threshold(pcm_handle, swparams, 0);
if (status < 0) { if (status < 0) {
ALSA_CloseDevice(this); ALSA_CloseDevice(this);
SDL_SetError("ALSA: Couldn't set start threshold: %s", SDL_SetError("ALSA: Couldn't set start threshold: %s",
ALSA_snd_strerror(status)); ALSA_snd_strerror(status));
return 0; return 0;
} }
status = ALSA_snd_pcm_sw_params_set_avail_min(pcm_handle, swparams, frames); status =
ALSA_snd_pcm_sw_params_set_avail_min(pcm_handle, swparams, frames);
if (status < 0) { if (status < 0) {
ALSA_CloseDevice(this); ALSA_CloseDevice(this);
SDL_SetError("Couldn't set avail min: %s", ALSA_snd_strerror(status)); SDL_SetError("Couldn't set avail min: %s", ALSA_snd_strerror(status));
...@@ -583,7 +589,7 @@ ALSA_Deinitialize(void) ...@@ -583,7 +589,7 @@ ALSA_Deinitialize(void)
} }
static int static int
ALSA_Init(SDL_AudioDriverImpl *impl) ALSA_Init(SDL_AudioDriverImpl * impl)
{ {
if (LoadALSALibrary() < 0) { if (LoadALSALibrary() < 0) {
return 0; return 0;
......
...@@ -66,15 +66,13 @@ static struct ...@@ -66,15 +66,13 @@ static struct
const char *name; const char *name;
void **func; void **func;
} arts_functions[] = { } arts_functions[] = {
SDL_ARTS_SYM(arts_init), SDL_ARTS_SYM(arts_init),
SDL_ARTS_SYM(arts_free), SDL_ARTS_SYM(arts_free),
SDL_ARTS_SYM(arts_play_stream), SDL_ARTS_SYM(arts_play_stream),
SDL_ARTS_SYM(arts_stream_set), SDL_ARTS_SYM(arts_stream_set),
SDL_ARTS_SYM(arts_stream_get), SDL_ARTS_SYM(arts_stream_get),
SDL_ARTS_SYM(arts_write), SDL_ARTS_SYM(arts_write),
SDL_ARTS_SYM(arts_close_stream), SDL_ARTS_SYM(arts_close_stream), SDL_ARTS_SYM(arts_error_text),};
SDL_ARTS_SYM(arts_error_text),
};
#undef SDL_ARTS_SYM #undef SDL_ARTS_SYM
static void static void
...@@ -147,7 +145,8 @@ ARTS_WaitDevice(_THIS) ...@@ -147,7 +145,8 @@ ARTS_WaitDevice(_THIS)
} }
/* Use timer for general audio synchronization */ /* Use timer for general audio synchronization */
ticks = ((Sint32) (this->hidden->next_frame-SDL_GetTicks())) - FUDGE_TICKS; ticks =
((Sint32) (this->hidden->next_frame - SDL_GetTicks())) - FUDGE_TICKS;
if (ticks > 0) { if (ticks > 0) {
SDL_Delay(ticks); SDL_Delay(ticks);
} }
...@@ -157,8 +156,7 @@ static void ...@@ -157,8 +156,7 @@ static void
ARTS_PlayDevice(_THIS) ARTS_PlayDevice(_THIS)
{ {
/* Write the audio data */ /* Write the audio data */
int written = SDL_NAME(arts_write) ( int written = SDL_NAME(arts_write) (this->hidden->stream,
this->hidden->stream,
this->hidden->mixbuf, this->hidden->mixbuf,
this->hidden->mixlen); this->hidden->mixlen);
...@@ -257,13 +255,13 @@ ARTS_OpenDevice(_THIS, const char *devname, int iscapture) ...@@ -257,13 +255,13 @@ ARTS_OpenDevice(_THIS, const char *devname, int iscapture)
if ((rc = SDL_NAME(arts_init) ()) != 0) { if ((rc = SDL_NAME(arts_init) ()) != 0) {
ARTS_CloseDevice(this); ARTS_CloseDevice(this);
SDL_SetError( "Unable to initialize ARTS: %s", SDL_SetError("Unable to initialize ARTS: %s",
SDL_NAME(arts_error_text)(rc) ); SDL_NAME(arts_error_text) (rc));
return 0; return 0;
} }
this->hidden->stream = SDL_NAME(arts_play_stream) ( this->hidden->stream = SDL_NAME(arts_play_stream) (this->spec.freq,
this->spec.freq, bits,
bits, this->spec.channels, this->spec.channels,
"SDL"); "SDL");
/* Calculate the final parameters for this audio specification */ /* Calculate the final parameters for this audio specification */
...@@ -316,7 +314,7 @@ ARTS_Deinitialize(void) ...@@ -316,7 +314,7 @@ ARTS_Deinitialize(void)
static int static int
ARTS_Init(SDL_AudioDriverImpl *impl) ARTS_Init(SDL_AudioDriverImpl * impl)
{ {
if (LoadARTSLibrary() < 0) { if (LoadARTSLibrary() < 0) {
return 0; return 0;
......
...@@ -190,7 +190,7 @@ BEOSAUDIO_Deinitialize(void) ...@@ -190,7 +190,7 @@ BEOSAUDIO_Deinitialize(void)
} }
static int static int
BEOSAUDIO_Init(SDL_AudioDriverImpl *impl) BEOSAUDIO_Init(SDL_AudioDriverImpl * impl)
{ {
/* Initialize the Be Application, if it's not already started */ /* Initialize the Be Application, if it's not already started */
if (SDL_InitBeApp() < 0) { if (SDL_InitBeApp() < 0) {
...@@ -207,10 +207,12 @@ BEOSAUDIO_Init(SDL_AudioDriverImpl *impl) ...@@ -207,10 +207,12 @@ BEOSAUDIO_Init(SDL_AudioDriverImpl *impl)
return 1; return 1;
} }
extern "C" { extern AudioBootStrap BEOSAUDIO_bootstrap; } extern "C"
{
extern AudioBootStrap BEOSAUDIO_bootstrap;
}
AudioBootStrap BEOSAUDIO_bootstrap = { AudioBootStrap BEOSAUDIO_bootstrap = {
"baudio", "BeOS BSoundPlayer", BEOSAUDIO_Init, 0 "baudio", "BeOS BSoundPlayer", BEOSAUDIO_Init, 0
}; };
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */
...@@ -149,7 +149,7 @@ BSDAUDIO_Status(_THIS) ...@@ -149,7 +149,7 @@ BSDAUDIO_Status(_THIS)
fprintf(stderr, "AUDIO_GETINFO failed.\n"); fprintf(stderr, "AUDIO_GETINFO failed.\n");
return; return;
} }
/* *INDENT-OFF* */
fprintf(stderr, "\n" fprintf(stderr, "\n"
"[play/record info]\n" "[play/record info]\n"
"buffer size : %d bytes\n" "buffer size : %d bytes\n"
...@@ -177,7 +177,9 @@ BSDAUDIO_Status(_THIS) ...@@ -177,7 +177,9 @@ BSDAUDIO_Status(_THIS)
info.play.error ? "yes" : "no", info.play.error ? "yes" : "no",
info.play.waiting ? "yes" : "no", info.play.waiting ? "yes" : "no",
info.play.active ? "yes" : "no"); info.play.active ? "yes" : "no");
/* *INDENT-ON* */
/* *INDENT-OFF* */
fprintf(stderr, "\n" fprintf(stderr, "\n"
"[audio info]\n" "[audio info]\n"
"monitor_gain : %i\n" "monitor_gain : %i\n"
...@@ -192,6 +194,7 @@ BSDAUDIO_Status(_THIS) ...@@ -192,6 +194,7 @@ BSDAUDIO_Status(_THIS)
(info.mode == AUMODE_PLAY) ? "PLAY" (info.mode == AUMODE_PLAY) ? "PLAY"
: (info.mode = AUMODE_RECORD) ? "RECORD" : (info.mode = AUMODE_RECORD) ? "RECORD"
: (info.mode == AUMODE_PLAY_ALL ? "PLAY_ALL" : "?")); : (info.mode == AUMODE_PLAY_ALL ? "PLAY_ALL" : "?"));
/* *INDENT-ON* */
#endif /* DEBUG_AUDIO */ #endif /* DEBUG_AUDIO */
} }
...@@ -206,7 +209,9 @@ BSDAUDIO_WaitDevice(_THIS) ...@@ -206,7 +209,9 @@ BSDAUDIO_WaitDevice(_THIS)
/* Use timer for general audio synchronization */ /* Use timer for general audio synchronization */
Sint32 ticks; Sint32 ticks;
ticks = ((Sint32)(this->hidden->next_frame-SDL_GetTicks()))-FUDGE_TICKS; ticks =
((Sint32) (this->hidden->next_frame - SDL_GetTicks())) -
FUDGE_TICKS;
if (ticks > 0) { if (ticks > 0) {
SDL_Delay(ticks); SDL_Delay(ticks);
} }
...@@ -222,7 +227,8 @@ BSDAUDIO_WaitDevice(_THIS) ...@@ -222,7 +227,8 @@ BSDAUDIO_WaitDevice(_THIS)
#ifdef DEBUG_AUDIO #ifdef DEBUG_AUDIO
fprintf(stderr, "Waiting for audio to get ready\n"); fprintf(stderr, "Waiting for audio to get ready\n");
#endif #endif
if (select(this->hidden->audio_fd+1,NULL,&fdset,NULL,&timeout) <= 0) { if (select(this->hidden->audio_fd + 1, NULL, &fdset, NULL, &timeout)
<= 0) {
const char *message = const char *message =
"Audio timeout - buggy audio driver? (disabled)"; "Audio timeout - buggy audio driver? (disabled)";
/* In general we should never print to the screen, /* In general we should never print to the screen,
...@@ -252,8 +258,7 @@ BSDAUDIO_PlayDevice(_THIS) ...@@ -252,8 +258,7 @@ BSDAUDIO_PlayDevice(_THIS)
/* Write the audio data, checking for EAGAIN on broken audio drivers */ /* Write the audio data, checking for EAGAIN on broken audio drivers */
do { do {
written = write(this->hidden->audio_fd, written = write(this->hidden->audio_fd,
&this->hidden->mixbuf[p], &this->hidden->mixbuf[p], this->hidden->mixlen - p);
this->hidden->mixlen - p);
if (written > 0) if (written > 0)
p += written; p += written;
...@@ -317,8 +322,8 @@ BSDAUDIO_OpenDevice(_THIS, const char *devname, int iscapture) ...@@ -317,8 +322,8 @@ BSDAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
/* We don't care what the devname is...we'll try to open anything. */ /* We don't care what the devname is...we'll try to open anything. */
/* ...but default to first name in the list... */ /* ...but default to first name in the list... */
if (devname == NULL) { if (devname == NULL) {
if ( ((iscapture) && (inputDeviceCount == 0)) || if (((iscapture) && (inputDeviceCount == 0)) ||
((!iscapture) && (outputDeviceCount == 0)) ) { ((!iscapture) && (outputDeviceCount == 0))) {
SDL_SetError("No such audio device"); SDL_SetError("No such audio device");
return 0; return 0;
} }
...@@ -429,7 +434,7 @@ BSDAUDIO_OpenDevice(_THIS, const char *devname, int iscapture) ...@@ -429,7 +434,7 @@ BSDAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
} }
static int static int
BSDAUDIO_Init(SDL_AudioDriverImpl *impl) BSDAUDIO_Init(SDL_AudioDriverImpl * impl)
{ {
/* Set the function pointers */ /* Set the function pointers */
impl->DetectDevices = BSDAUDIO_DetectDevices; impl->DetectDevices = BSDAUDIO_DetectDevices;
......
...@@ -113,7 +113,6 @@ DART_OpenDevice(_THIS, const char *devname, int iscapture) ...@@ -113,7 +113,6 @@ DART_OpenDevice(_THIS, const char *devname, int iscapture)
SDL_SetError("DART: Couldn't open audio device."); SDL_SetError("DART: Couldn't open audio device.");
return 0; return 0;
} }
// Save the device ID we got from DART! // Save the device ID we got from DART!
// We will use this in the next calls! // We will use this in the next calls!
_this->hidden->iCurrDeviceOrd = iDeviceOrd = AmpOpenParms.usDeviceID; _this->hidden->iCurrDeviceOrd = iDeviceOrd = AmpOpenParms.usDeviceID;
...@@ -388,13 +387,11 @@ DART_CloseDevice(_THIS) ...@@ -388,13 +387,11 @@ DART_CloseDevice(_THIS)
} }
#endif #endif
} }
// Close event semaphore // Close event semaphore
if (_this->hidden->hevAudioBufferPlayed) { if (_this->hidden->hevAudioBufferPlayed) {
DosCloseEventSem(_this->hidden->hevAudioBufferPlayed); DosCloseEventSem(_this->hidden->hevAudioBufferPlayed);
_this->hidden->hevAudioBufferPlayed = 0; _this->hidden->hevAudioBufferPlayed = 0;
} }
// Free memory of buffer descriptions // Free memory of buffer descriptions
for (i = 0; i < _this->hidden->iCurrNumBufs; i++) { for (i = 0; i < _this->hidden->iCurrNumBufs; i++) {
SDL_free((void *) (_this->hidden->pMixBuffers[i].ulUserParm)); SDL_free((void *) (_this->hidden->pMixBuffers[i].ulUserParm));
...@@ -408,13 +405,11 @@ DART_CloseDevice(_THIS) ...@@ -408,13 +405,11 @@ DART_CloseDevice(_THIS)
MCI_WAIT | MCI_DEALLOCATE_MEMORY, MCI_WAIT | MCI_DEALLOCATE_MEMORY,
&(_this->hidden->BufferParms), 0); &(_this->hidden->BufferParms), 0);
} }
// Free bufferlist // Free bufferlist
if (_this->hidden->pMixBuffers != NULL) { if (_this->hidden->pMixBuffers != NULL) {
SDL_free(_this->hidden->pMixBuffers); SDL_free(_this->hidden->pMixBuffers);
_this->hidden->pMixBuffers = NULL; _this->hidden->pMixBuffers = NULL;
} }
// Close dart // Close dart
if (_this->hidden->iCurrDeviceOrd) { if (_this->hidden->iCurrDeviceOrd) {
rc = mciSendCommand(_this->hidden->iCurrDeviceOrd, MCI_CLOSE, rc = mciSendCommand(_this->hidden->iCurrDeviceOrd, MCI_CLOSE,
...@@ -429,7 +424,7 @@ DART_CloseDevice(_THIS) ...@@ -429,7 +424,7 @@ DART_CloseDevice(_THIS)
static int static int
DART_Init(SDL_AudioDriverImpl *impl) DART_Init(SDL_AudioDriverImpl * impl)
{ {
/* Set the function pointers */ /* Set the function pointers */
impl->OpenDevice = DART_OpenDevice; impl->OpenDevice = DART_OpenDevice;
......
...@@ -225,7 +225,7 @@ DCAUD_OpenDevice(_THIS, SDL_AudioSpec * spec) ...@@ -225,7 +225,7 @@ DCAUD_OpenDevice(_THIS, SDL_AudioSpec * spec)
} }
static int static int
DCAUD_Init(SDL_AudioDriverImpl *impl) DCAUD_Init(SDL_AudioDriverImpl * impl)
{ {
/* Set the function pointers */ /* Set the function pointers */
impl->OpenDevice = DCAUD_OpenDevice; impl->OpenDevice = DCAUD_OpenDevice;
......
...@@ -112,12 +112,12 @@ DISKAUD_OpenDevice(_THIS, const char *devname, int iscapture) ...@@ -112,12 +112,12 @@ DISKAUD_OpenDevice(_THIS, const char *devname, int iscapture)
const char *fname = DISKAUD_GetOutputFilename(devname); const char *fname = DISKAUD_GetOutputFilename(devname);
this->hidden = (struct SDL_PrivateAudioData *) this->hidden = (struct SDL_PrivateAudioData *)
SDL_malloc(sizeof (*this->hidden)); SDL_malloc(sizeof(*this->hidden));
if (this->hidden == NULL) { if (this->hidden == NULL) {
SDL_OutOfMemory(); SDL_OutOfMemory();
return 0; return 0;
} }
SDL_memset(this->hidden, 0, sizeof (*this->hidden)); SDL_memset(this->hidden, 0, sizeof(*this->hidden));
/* Open the audio device */ /* Open the audio device */
this->hidden->output = SDL_RWFromFile(fname, "wb"); this->hidden->output = SDL_RWFromFile(fname, "wb");
...@@ -149,7 +149,7 @@ DISKAUD_OpenDevice(_THIS, const char *devname, int iscapture) ...@@ -149,7 +149,7 @@ DISKAUD_OpenDevice(_THIS, const char *devname, int iscapture)
} }
static int static int
DISKAUD_Init(SDL_AudioDriverImpl *impl) DISKAUD_Init(SDL_AudioDriverImpl * impl)
{ {
/* Set the function pointers */ /* Set the function pointers */
impl->OpenDevice = DISKAUD_OpenDevice; impl->OpenDevice = DISKAUD_OpenDevice;
......
...@@ -74,8 +74,7 @@ test_for_mmap(int fd) ...@@ -74,8 +74,7 @@ test_for_mmap(int fd)
struct audio_buf_info info; struct audio_buf_info info;
if ((ioctl(fd, SNDCTL_DSP_GETCAPS, &caps) == 0) && if ((ioctl(fd, SNDCTL_DSP_GETCAPS, &caps) == 0) &&
(caps & DSP_CAP_TRIGGER) && (caps & DSP_CAP_MMAP) && (caps & DSP_CAP_TRIGGER) && (caps & DSP_CAP_MMAP) &&
(ioctl(fd, SNDCTL_DSP_GETOSPACE, &info) == 0)) (ioctl(fd, SNDCTL_DSP_GETOSPACE, &info) == 0)) {
{
size_t len = info.fragstotal * info.fragsize; size_t len = info.fragstotal * info.fragsize;
Uint8 *buf = (Uint8 *) mmap(NULL, len, PROT_WRITE, MAP_SHARED, fd, 0); Uint8 *buf = (Uint8 *) mmap(NULL, len, PROT_WRITE, MAP_SHARED, fd, 0);
if (buf != MAP_FAILED) { if (buf != MAP_FAILED) {
...@@ -117,7 +116,8 @@ free_device_lists(void) ...@@ -117,7 +116,8 @@ free_device_lists(void)
} }
static void DMA_Deinitialize(void) static void
DMA_Deinitialize(void)
{ {
free_device_lists(); free_device_lists();
} }
...@@ -240,8 +240,8 @@ DMA_OpenDevice(_THIS, const char *devname, int iscapture) ...@@ -240,8 +240,8 @@ DMA_OpenDevice(_THIS, const char *devname, int iscapture)
/* We don't care what the devname is...we'll try to open anything. */ /* We don't care what the devname is...we'll try to open anything. */
/* ...but default to first name in the list... */ /* ...but default to first name in the list... */
if (devname == NULL) { if (devname == NULL) {
if ( ((iscapture) && (inputDeviceCount == 0)) || if (((iscapture) && (inputDeviceCount == 0)) ||
((!iscapture) && (outputDeviceCount == 0)) ) { ((!iscapture) && (outputDeviceCount == 0))) {
SDL_SetError("No such audio device"); SDL_SetError("No such audio device");
return 0; return 0;
} }
...@@ -380,7 +380,8 @@ DMA_OpenDevice(_THIS, const char *devname, int iscapture) ...@@ -380,7 +380,8 @@ DMA_OpenDevice(_THIS, const char *devname, int iscapture)
char *workaround; char *workaround;
workaround = SDL_getenv("SDL_DSP_NOSELECT"); workaround = SDL_getenv("SDL_DSP_NOSELECT");
if (workaround) { if (workaround) {
frame_ticks = (float) (this->spec.samples*1000) / this->spec.freq; frame_ticks =
(float) (this->spec.samples * 1000) / this->spec.freq;
next_frame = SDL_GetTicks() + frame_ticks; next_frame = SDL_GetTicks() + frame_ticks;
} }
} }
...@@ -511,7 +512,7 @@ DMA_GetDeviceBuf(_THIS) ...@@ -511,7 +512,7 @@ DMA_GetDeviceBuf(_THIS)
static int static int
DMA_Init(SDL_AudioDriverImpl *impl) DMA_Init(SDL_AudioDriverImpl * impl)
{ {
/* Set the function pointers */ /* Set the function pointers */
impl->DetectDevices = DMA_DetectDevices; impl->DetectDevices = DMA_DetectDevices;
......
...@@ -167,8 +167,10 @@ IRIXAUDIO_OpenDevice(_THIS, const char *devname, int iscapture) ...@@ -167,8 +167,10 @@ IRIXAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
if ((alSetSampFmt(audio_config, fmt) >= 0) && if ((alSetSampFmt(audio_config, fmt) >= 0) &&
((!width) || (alSetWidth(audio_config, width) >= 0)) && ((!width) || (alSetWidth(audio_config, width) >= 0)) &&
(alSetQueueSize(audio_config,this->spec.samples*2) >= 0) && (alSetQueueSize(audio_config, this->spec.samples * 2) >=
(alSetChannels(audio_config, this->spec.channels) >= 0)) { 0)
&& (alSetChannels(audio_config, this->spec.channels) >=
0)) {
this->hidden->audio_port = alOpenPort("SDL audio", "w", this->hidden->audio_port = alOpenPort("SDL audio", "w",
audio_config); audio_config);
...@@ -178,8 +180,8 @@ IRIXAUDIO_OpenDevice(_THIS, const char *devname, int iscapture) ...@@ -178,8 +180,8 @@ IRIXAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
if (err == AL_BAD_CHANNELS) { if (err == AL_BAD_CHANNELS) {
this->spec.channels = 2; this->spec.channels = 2;
alSetChannels(audio_config, this->spec.channels); alSetChannels(audio_config, this->spec.channels);
this->hidden->audio_port = alOpenPort("SDL audio", "w", this->hidden->audio_port =
audio_config); alOpenPort("SDL audio", "w", audio_config);
} }
} }
...@@ -216,7 +218,7 @@ IRIXAUDIO_OpenDevice(_THIS, const char *devname, int iscapture) ...@@ -216,7 +218,7 @@ IRIXAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
} }
static int static int
IRIXAUDIO_Init(SDL_AudioDriverImpl *impl) IRIXAUDIO_Init(SDL_AudioDriverImpl * impl)
{ {
/* Set the function pointers */ /* Set the function pointers */
impl->OpenDevice = DSP_OpenDevice; impl->OpenDevice = DSP_OpenDevice;
......
...@@ -158,8 +158,8 @@ DSP_OpenDevice(_THIS, const char *devname, int iscapture) ...@@ -158,8 +158,8 @@ DSP_OpenDevice(_THIS, const char *devname, int iscapture)
/* We don't care what the devname is...we'll try to open anything. */ /* We don't care what the devname is...we'll try to open anything. */
/* ...but default to first name in the list... */ /* ...but default to first name in the list... */
if (devname == NULL) { if (devname == NULL) {
if ( ((iscapture) && (inputDeviceCount == 0)) || if (((iscapture) && (inputDeviceCount == 0)) ||
((!iscapture) && (outputDeviceCount == 0)) ) { ((!iscapture) && (outputDeviceCount == 0))) {
SDL_SetError("No such audio device"); SDL_SetError("No such audio device");
return 0; return 0;
} }
...@@ -265,8 +265,8 @@ DSP_OpenDevice(_THIS, const char *devname, int iscapture) ...@@ -265,8 +265,8 @@ DSP_OpenDevice(_THIS, const char *devname, int iscapture)
/* Set the audio format */ /* Set the audio format */
value = format; value = format;
if ( (ioctl(this->hidden->audio_fd, SNDCTL_DSP_SETFMT, &value) < 0) || if ((ioctl(this->hidden->audio_fd, SNDCTL_DSP_SETFMT, &value) < 0) ||
(value != format) ) { (value != format)) {
perror("SNDCTL_DSP_SETFMT"); perror("SNDCTL_DSP_SETFMT");
DSP_CloseDevice(this); DSP_CloseDevice(this);
SDL_SetError("Couldn't set audio format"); SDL_SetError("Couldn't set audio format");
...@@ -360,7 +360,7 @@ DSP_GetDeviceBuf(_THIS) ...@@ -360,7 +360,7 @@ DSP_GetDeviceBuf(_THIS)
} }
static int static int
DSP_Init(SDL_AudioDriverImpl *impl) DSP_Init(SDL_AudioDriverImpl * impl)
{ {
/* Set the function pointers */ /* Set the function pointers */
impl->DetectDevices = DSP_DetectDevices; impl->DetectDevices = DSP_DetectDevices;
......
...@@ -36,7 +36,7 @@ DUMMYAUD_OpenDevice(_THIS, const char *devname, int iscapture) ...@@ -36,7 +36,7 @@ DUMMYAUD_OpenDevice(_THIS, const char *devname, int iscapture)
} }
static int static int
DUMMYAUD_Init(SDL_AudioDriverImpl *impl) DUMMYAUD_Init(SDL_AudioDriverImpl * impl)
{ {
/* Set the function pointers */ /* Set the function pointers */
impl->OpenDevice = DUMMYAUD_OpenDevice; impl->OpenDevice = DUMMYAUD_OpenDevice;
......
...@@ -61,10 +61,8 @@ static struct ...@@ -61,10 +61,8 @@ static struct
const char *name; const char *name;
void **func; void **func;
} esd_functions[] = { } esd_functions[] = {
SDL_ESD_SYM(esd_open_sound), SDL_ESD_SYM(esd_open_sound),
SDL_ESD_SYM(esd_close), SDL_ESD_SYM(esd_close), SDL_ESD_SYM(esd_play_stream),};
SDL_ESD_SYM(esd_play_stream),
};
#undef SDL_ESD_SYM #undef SDL_ESD_SYM
static void static void
...@@ -137,7 +135,8 @@ ESD_WaitDevice(_THIS) ...@@ -137,7 +135,8 @@ ESD_WaitDevice(_THIS)
} }
/* Use timer for general audio synchronization */ /* Use timer for general audio synchronization */
ticks = ((Sint32) (this->hidden->next_frame-SDL_GetTicks())) - FUDGE_TICKS; ticks =
((Sint32) (this->hidden->next_frame - SDL_GetTicks())) - FUDGE_TICKS;
if (ticks > 0) { if (ticks > 0) {
SDL_Delay(ticks); SDL_Delay(ticks);
} }
...@@ -151,8 +150,7 @@ ESD_PlayDevice(_THIS) ...@@ -151,8 +150,7 @@ ESD_PlayDevice(_THIS)
/* Write the audio data, checking for EAGAIN on broken audio drivers */ /* Write the audio data, checking for EAGAIN on broken audio drivers */
do { do {
written = write(this->hidden->audio_fd, written = write(this->hidden->audio_fd,
this->hidden->mixbuf, this->hidden->mixbuf, this->hidden->mixlen);
this->hidden->mixlen);
if ((written < 0) && ((errno == 0) || (errno == EAGAIN))) { if ((written < 0) && ((errno == 0) || (errno == EAGAIN))) {
SDL_Delay(1); /* Let a little CPU time go by */ SDL_Delay(1); /* Let a little CPU time go by */
} }
...@@ -275,7 +273,8 @@ ESD_OpenDevice(_THIS, const char *devname, int iscapture) ...@@ -275,7 +273,8 @@ ESD_OpenDevice(_THIS, const char *devname, int iscapture)
/* Open a connection to the ESD audio server */ /* Open a connection to the ESD audio server */
this->hidden->audio_fd = this->hidden->audio_fd =
SDL_NAME(esd_play_stream)(format,this->spec.freq,NULL,get_progname()); SDL_NAME(esd_play_stream) (format, this->spec.freq, NULL,
get_progname());
if (this->hidden->audio_fd < 0) { if (this->hidden->audio_fd < 0) {
ESD_CloseDevice(this); ESD_CloseDevice(this);
...@@ -285,7 +284,8 @@ ESD_OpenDevice(_THIS, const char *devname, int iscapture) ...@@ -285,7 +284,8 @@ ESD_OpenDevice(_THIS, const char *devname, int iscapture)
/* Calculate the final parameters for this audio specification */ /* Calculate the final parameters for this audio specification */
SDL_CalculateAudioSpec(&this->spec); SDL_CalculateAudioSpec(&this->spec);
this->hidden->frame_ticks = (float) (this->spec.samples*1000) / this->spec.freq; this->hidden->frame_ticks =
(float) (this->spec.samples * 1000) / this->spec.freq;
this->hidden->next_frame = SDL_GetTicks() + this->hidden->frame_ticks; this->hidden->next_frame = SDL_GetTicks() + this->hidden->frame_ticks;
/* Allocate mixing buffer */ /* Allocate mixing buffer */
...@@ -312,7 +312,7 @@ ESD_Deinitialize(void) ...@@ -312,7 +312,7 @@ ESD_Deinitialize(void)
} }
static int static int
ESD_Init(SDL_AudioDriverImpl *impl) ESD_Init(SDL_AudioDriverImpl * impl)
{ {
if (LoadESDLibrary() < 0) { if (LoadESDLibrary() < 0) {
return 0; return 0;
......
This diff is collapsed.
...@@ -292,7 +292,7 @@ SNDMGR_OpenDevice(_THIS, const char *devname, int iscapture) ...@@ -292,7 +292,7 @@ SNDMGR_OpenDevice(_THIS, const char *devname, int iscapture)
} }
static int static int
SNDMGR_Init(SDL_AudioDriverImpl *impl) SNDMGR_Init(SDL_AudioDriverImpl * impl)
{ {
/* Set the function pointers */ /* Set the function pointers */
impl->OpenDevice = SNDMGR_OpenDevice; impl->OpenDevice = SNDMGR_OpenDevice;
......
...@@ -101,7 +101,8 @@ MINTDMA8_CloseDevice(_THIS) ...@@ -101,7 +101,8 @@ MINTDMA8_CloseDevice(_THIS)
DEBUG_PRINT((DEBUG_NAME "closeaudio: interrupt disabled\n")); DEBUG_PRINT((DEBUG_NAME "closeaudio: interrupt disabled\n"));
/* Wait if currently playing sound */ /* Wait if currently playing sound */
while (SDL_MintAudio_mutex != 0) {} while (SDL_MintAudio_mutex != 0) {
}
DEBUG_PRINT((DEBUG_NAME "closeaudio: no more interrupt running\n")); DEBUG_PRINT((DEBUG_NAME "closeaudio: no more interrupt running\n"));
...@@ -127,7 +128,8 @@ MINTDMA8_CheckAudio(_THIS) ...@@ -127,7 +128,8 @@ MINTDMA8_CheckAudio(_THIS)
SDL_AUDIO_BITSIZE(this->spec.format))); SDL_AUDIO_BITSIZE(this->spec.format)));
DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(this->spec.format))); DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(this->spec.format)));
DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(this->spec.format))); DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(this->spec.format)));
DEBUG_PRINT(("big endian=%d, ", SDL_AUDIO_ISBIGENDIAN(this->spec.format))); DEBUG_PRINT(("big endian=%d, ",
SDL_AUDIO_ISBIGENDIAN(this->spec.format)));
DEBUG_PRINT(("channels=%d, ", this->spec.channels)); DEBUG_PRINT(("channels=%d, ", this->spec.channels));
DEBUG_PRINT(("freq=%d\n", this->spec.freq)); DEBUG_PRINT(("freq=%d\n", this->spec.freq));
...@@ -184,7 +186,8 @@ MINTDMA8_CheckAudio(_THIS) ...@@ -184,7 +186,8 @@ MINTDMA8_CheckAudio(_THIS)
SDL_AUDIO_BITSIZE(this->spec.format))); SDL_AUDIO_BITSIZE(this->spec.format)));
DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(this->spec.format))); DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(this->spec.format)));
DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(this->spec.format))); DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(this->spec.format)));
DEBUG_PRINT(("big endian=%d, ", SDL_AUDIO_ISBIGENDIAN(this->spec.format))); DEBUG_PRINT(("big endian=%d, ",
SDL_AUDIO_ISBIGENDIAN(this->spec.format)));
DEBUG_PRINT(("channels=%d, ", this->spec.channels)); DEBUG_PRINT(("channels=%d, ", this->spec.channels));
DEBUG_PRINT(("freq=%d\n", this->spec.freq)); DEBUG_PRINT(("freq=%d\n", this->spec.freq));
...@@ -267,7 +270,8 @@ MINTDMA8_OpenDevice(_THIS, const char *devname, int iscapture) ...@@ -267,7 +270,8 @@ MINTDMA8_OpenDevice(_THIS, const char *devname, int iscapture)
/* Allocate memory for audio buffers in DMA-able RAM */ /* Allocate memory for audio buffers in DMA-able RAM */
DEBUG_PRINT((DEBUG_NAME "buffer size=%d\n", this->spec.size)); DEBUG_PRINT((DEBUG_NAME "buffer size=%d\n", this->spec.size));
SDL_MintAudio_audiobuf[0] = Atari_SysMalloc(this->spec.size * 2, MX_STRAM); SDL_MintAudio_audiobuf[0] =
Atari_SysMalloc(this->spec.size * 2, MX_STRAM);
if (SDL_MintAudio_audiobuf[0] == NULL) { if (SDL_MintAudio_audiobuf[0] == NULL) {
SDL_free(this->hidden); SDL_free(this->hidden);
this->hidden = NULL; this->hidden = NULL;
...@@ -276,7 +280,8 @@ MINTDMA8_OpenDevice(_THIS, const char *devname, int iscapture) ...@@ -276,7 +280,8 @@ MINTDMA8_OpenDevice(_THIS, const char *devname, int iscapture)
} }
SDL_MintAudio_audiobuf[1] = SDL_MintAudio_audiobuf[0] + this->spec.size; SDL_MintAudio_audiobuf[1] = SDL_MintAudio_audiobuf[0] + this->spec.size;
SDL_MintAudio_numbuf = 0; SDL_MintAudio_numbuf = 0;
SDL_memset(SDL_MintAudio_audiobuf[0],this->spec.silence,this->spec.size*2); SDL_memset(SDL_MintAudio_audiobuf[0], this->spec.silence,
this->spec.size * 2);
SDL_MintAudio_audiosize = this->spec.size; SDL_MintAudio_audiosize = this->spec.size;
SDL_MintAudio_mutex = 0; SDL_MintAudio_mutex = 0;
...@@ -294,7 +299,7 @@ MINTDMA8_OpenDevice(_THIS, const char *devname, int iscapture) ...@@ -294,7 +299,7 @@ MINTDMA8_OpenDevice(_THIS, const char *devname, int iscapture)
} }
static int static int
MINTDMA8_Init(SDL_AudioDriverImpl *impl) MINTDMA8_Init(SDL_AudioDriverImpl * impl)
{ {
/* Cookie _MCH present ? if not, assume ST machine */ /* Cookie _MCH present ? if not, assume ST machine */
if (Getcookie(C__MCH, &cookie_mch) == C_NOTFOUND) { if (Getcookie(C__MCH, &cookie_mch) == C_NOTFOUND) {
......
...@@ -94,7 +94,8 @@ MINTGSXB_CloseDevice(_THIS) ...@@ -94,7 +94,8 @@ MINTGSXB_CloseDevice(_THIS)
} }
/* Wait if currently playing sound */ /* Wait if currently playing sound */
while (SDL_MintAudio_mutex != 0) {} while (SDL_MintAudio_mutex != 0) {
}
/* Clear buffers */ /* Clear buffers */
if (SDL_MintAudio_audiobuf[0]) { if (SDL_MintAudio_audiobuf[0]) {
...@@ -238,7 +239,8 @@ MINTGSXB_CheckAudio(_THIS) ...@@ -238,7 +239,8 @@ MINTGSXB_CheckAudio(_THIS)
SDL_AUDIO_BITSIZE(this->spec.format))); SDL_AUDIO_BITSIZE(this->spec.format)));
DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(this->spec.format))); DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(this->spec.format)));
DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(this->spec.format))); DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(this->spec.format)));
DEBUG_PRINT(("big endian=%d, ", SDL_AUDIO_ISBIGENDIAN(this->spec.format))); DEBUG_PRINT(("big endian=%d, ",
SDL_AUDIO_ISBIGENDIAN(this->spec.format)));
DEBUG_PRINT(("channels=%d, ", this->spec.channels)); DEBUG_PRINT(("channels=%d, ", this->spec.channels));
DEBUG_PRINT(("freq=%d\n", this->spec.freq)); DEBUG_PRINT(("freq=%d\n", this->spec.freq));
...@@ -338,7 +340,8 @@ MINTGSXB_OpenDevice(_THIS, const char *devname, int iscapture) ...@@ -338,7 +340,8 @@ MINTGSXB_OpenDevice(_THIS, const char *devname, int iscapture)
/* Allocate memory for audio buffers in DMA-able RAM */ /* Allocate memory for audio buffers in DMA-able RAM */
DEBUG_PRINT((DEBUG_NAME "buffer size=%d\n", this->spec.size)); DEBUG_PRINT((DEBUG_NAME "buffer size=%d\n", this->spec.size));
SDL_MintAudio_audiobuf[0] = Atari_SysMalloc(this->spec.size * 2, MX_STRAM); SDL_MintAudio_audiobuf[0] =
Atari_SysMalloc(this->spec.size * 2, MX_STRAM);
if (SDL_MintAudio_audiobuf[0] == NULL) { if (SDL_MintAudio_audiobuf[0] == NULL) {
SDL_free(this->hidden); SDL_free(this->hidden);
this->hidden = NULL; this->hidden = NULL;
...@@ -347,7 +350,8 @@ MINTGSXB_OpenDevice(_THIS, const char *devname, int iscapture) ...@@ -347,7 +350,8 @@ MINTGSXB_OpenDevice(_THIS, const char *devname, int iscapture)
} }
SDL_MintAudio_audiobuf[1] = SDL_MintAudio_audiobuf[0] + this->spec.size; SDL_MintAudio_audiobuf[1] = SDL_MintAudio_audiobuf[0] + this->spec.size;
SDL_MintAudio_numbuf = 0; SDL_MintAudio_numbuf = 0;
SDL_memset(SDL_MintAudio_audiobuf[0],this->spec.silence,this->spec.size*2); SDL_memset(SDL_MintAudio_audiobuf[0], this->spec.silence,
this->spec.size * 2);
SDL_MintAudio_audiosize = this->spec.size; SDL_MintAudio_audiosize = this->spec.size;
SDL_MintAudio_mutex = 0; SDL_MintAudio_mutex = 0;
...@@ -388,7 +392,7 @@ MINTGSXB_GsxbNullInterrupt(void) ...@@ -388,7 +392,7 @@ MINTGSXB_GsxbNullInterrupt(void)
} }
static int static int
MINTGSXB_Init(SDL_AudioDriverImpl *impl) MINTGSXB_Init(SDL_AudioDriverImpl * impl)
{ {
/* Cookie _SND present ? if not, assume ST machine */ /* Cookie _SND present ? if not, assume ST machine */
if (Getcookie(C__SND, &cookie_snd) == C_NOTFOUND) { if (Getcookie(C__SND, &cookie_snd) == C_NOTFOUND) {
......
...@@ -93,7 +93,8 @@ MINTMCSN_CloseDevice(_THIS) ...@@ -93,7 +93,8 @@ MINTMCSN_CloseDevice(_THIS)
} }
/* Wait if currently playing sound */ /* Wait if currently playing sound */
while (SDL_MintAudio_mutex != 0) {} while (SDL_MintAudio_mutex != 0) {
}
/* Clear buffers */ /* Clear buffers */
if (SDL_MintAudio_audiobuf[0]) { if (SDL_MintAudio_audiobuf[0]) {
...@@ -119,7 +120,8 @@ MINTMCSN_CheckAudio(_THIS) ...@@ -119,7 +120,8 @@ MINTMCSN_CheckAudio(_THIS)
SDL_AUDIO_BITSIZE(this->spec.format))); SDL_AUDIO_BITSIZE(this->spec.format)));
DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(this->spec.format))); DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(this->spec.format)));
DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(this->spec.format))); DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(this->spec.format)));
DEBUG_PRINT(("big endian=%d, ", SDL_AUDIO_ISBIGENDIAN(this->spec.format))); DEBUG_PRINT(("big endian=%d, ",
SDL_AUDIO_ISBIGENDIAN(this->spec.format)));
DEBUG_PRINT(("channels=%d, ", this->spec.channels)); DEBUG_PRINT(("channels=%d, ", this->spec.channels));
DEBUG_PRINT(("freq=%d\n", this->spec.freq)); DEBUG_PRINT(("freq=%d\n", this->spec.freq));
...@@ -194,7 +196,8 @@ MINTMCSN_CheckAudio(_THIS) ...@@ -194,7 +196,8 @@ MINTMCSN_CheckAudio(_THIS)
SDL_AUDIO_BITSIZE(this->spec.format))); SDL_AUDIO_BITSIZE(this->spec.format)));
DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(this->spec.format))); DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(this->spec.format)));
DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(this->spec.format))); DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(this->spec.format)));
DEBUG_PRINT(("big endian=%d, ", SDL_AUDIO_ISBIGENDIAN(this->spec.format))); DEBUG_PRINT(("big endian=%d, ",
SDL_AUDIO_ISBIGENDIAN(this->spec.format)));
DEBUG_PRINT(("channels=%d, ", this->spec.channels)); DEBUG_PRINT(("channels=%d, ", this->spec.channels));
DEBUG_PRINT(("freq=%d\n", this->spec.freq)); DEBUG_PRINT(("freq=%d\n", this->spec.freq));
...@@ -300,7 +303,8 @@ MINTMCSN_OpenDevice(_THIS, const char *devname, int iscapture) ...@@ -300,7 +303,8 @@ MINTMCSN_OpenDevice(_THIS, const char *devname, int iscapture)
/* Allocate memory for audio buffers in DMA-able RAM */ /* Allocate memory for audio buffers in DMA-able RAM */
DEBUG_PRINT((DEBUG_NAME "buffer size=%d\n", this->spec.size)); DEBUG_PRINT((DEBUG_NAME "buffer size=%d\n", this->spec.size));
SDL_MintAudio_audiobuf[0] = Atari_SysMalloc(this->spec.size * 2, MX_STRAM); SDL_MintAudio_audiobuf[0] =
Atari_SysMalloc(this->spec.size * 2, MX_STRAM);
if (SDL_MintAudio_audiobuf[0] == NULL) { if (SDL_MintAudio_audiobuf[0] == NULL) {
SDL_free(this->hidden); SDL_free(this->hidden);
this->hidden = NULL; this->hidden = NULL;
...@@ -309,7 +313,8 @@ MINTMCSN_OpenDevice(_THIS, const char *devname, int iscapture) ...@@ -309,7 +313,8 @@ MINTMCSN_OpenDevice(_THIS, const char *devname, int iscapture)
} }
SDL_MintAudio_audiobuf[1] = SDL_MintAudio_audiobuf[0] + this->spec.size; SDL_MintAudio_audiobuf[1] = SDL_MintAudio_audiobuf[0] + this->spec.size;
SDL_MintAudio_numbuf = 0; SDL_MintAudio_numbuf = 0;
SDL_memset(SDL_MintAudio_audiobuf[0],this->spec.silence,this->spec.size*2); SDL_memset(SDL_MintAudio_audiobuf[0], this->spec.silence,
this->spec.size * 2);
SDL_MintAudio_audiosize = this->spec.size; SDL_MintAudio_audiosize = this->spec.size;
SDL_MintAudio_mutex = 0; SDL_MintAudio_mutex = 0;
...@@ -327,7 +332,7 @@ MINTMCSN_OpenDevice(_THIS, const char *devname, int iscapture) ...@@ -327,7 +332,7 @@ MINTMCSN_OpenDevice(_THIS, const char *devname, int iscapture)
} }
static int static int
MINTMCSN_Init(SDL_AudioDriverImpl *impl) MINTMCSN_Init(SDL_AudioDriverImpl * impl)
{ {
unsigned long dummy = 0; unsigned long dummy = 0;
......
...@@ -98,7 +98,8 @@ MINTSTFA_CloseDevice(_THIS) ...@@ -98,7 +98,8 @@ MINTSTFA_CloseDevice(_THIS)
Super(oldpile); Super(oldpile);
/* Wait if currently playing sound */ /* Wait if currently playing sound */
while (SDL_MintAudio_mutex != 0) {} while (SDL_MintAudio_mutex != 0) {
}
/* Clear buffers */ /* Clear buffers */
if (SDL_MintAudio_audiobuf[0]) { if (SDL_MintAudio_audiobuf[0]) {
...@@ -120,7 +121,8 @@ MINTSTFA_CheckAudio(_THIS) ...@@ -120,7 +121,8 @@ MINTSTFA_CheckAudio(_THIS)
SDL_AUDIO_BITSIZE(this->spec.format))); SDL_AUDIO_BITSIZE(this->spec.format)));
DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(this->spec.format))); DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(this->spec.format)));
DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(this->spec.format))); DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(this->spec.format)));
DEBUG_PRINT(("big endian=%d, ", SDL_AUDIO_ISBIGENDIAN(this->spec.format))); DEBUG_PRINT(("big endian=%d, ",
SDL_AUDIO_ISBIGENDIAN(this->spec.format)));
DEBUG_PRINT(("channels=%d, ", this->spec.channels)); DEBUG_PRINT(("channels=%d, ", this->spec.channels));
DEBUG_PRINT(("freq=%d\n", this->spec.freq)); DEBUG_PRINT(("freq=%d\n", this->spec.freq));
...@@ -154,7 +156,8 @@ MINTSTFA_CheckAudio(_THIS) ...@@ -154,7 +156,8 @@ MINTSTFA_CheckAudio(_THIS)
SDL_AUDIO_BITSIZE(this->spec.format))); SDL_AUDIO_BITSIZE(this->spec.format)));
DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(this->spec.format))); DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(this->spec.format)));
DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(this->spec.format))); DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(this->spec.format)));
DEBUG_PRINT(("big endian=%d, ", SDL_AUDIO_ISBIGENDIAN(this->spec.format))); DEBUG_PRINT(("big endian=%d, ",
SDL_AUDIO_ISBIGENDIAN(this->spec.format)));
DEBUG_PRINT(("channels=%d, ", this->spec.channels)); DEBUG_PRINT(("channels=%d, ", this->spec.channels));
DEBUG_PRINT(("freq=%d\n", this->spec.freq)); DEBUG_PRINT(("freq=%d\n", this->spec.freq));
...@@ -233,7 +236,8 @@ MINTSTFA_OpenDevice(_THIS, const char *devname, int iscapture) ...@@ -233,7 +236,8 @@ MINTSTFA_OpenDevice(_THIS, const char *devname, int iscapture)
/* Allocate memory for audio buffers in DMA-able RAM */ /* Allocate memory for audio buffers in DMA-able RAM */
DEBUG_PRINT((DEBUG_NAME "buffer size=%d\n", this->spec.size)); DEBUG_PRINT((DEBUG_NAME "buffer size=%d\n", this->spec.size));
SDL_MintAudio_audiobuf[0] = Atari_SysMalloc(this->spec.size * 2, MX_STRAM); SDL_MintAudio_audiobuf[0] =
Atari_SysMalloc(this->spec.size * 2, MX_STRAM);
if (SDL_MintAudio_audiobuf[0] == NULL) { if (SDL_MintAudio_audiobuf[0] == NULL) {
SDL_OutOfMemory() SDL_OutOfMemory()
SDL_free(this->hidden); SDL_free(this->hidden);
...@@ -242,7 +246,8 @@ MINTSTFA_OpenDevice(_THIS, const char *devname, int iscapture) ...@@ -242,7 +246,8 @@ MINTSTFA_OpenDevice(_THIS, const char *devname, int iscapture)
} }
SDL_MintAudio_audiobuf[1] = SDL_MintAudio_audiobuf[0] + this->spec.size; SDL_MintAudio_audiobuf[1] = SDL_MintAudio_audiobuf[0] + this->spec.size;
SDL_MintAudio_numbuf = 0; SDL_MintAudio_numbuf = 0;
SDL_memset(SDL_MintAudio_audiobuf[0],this->spec.silence,this->spec.size*2); SDL_memset(SDL_MintAudio_audiobuf[0], this->spec.silence,
this->spec.size * 2);
SDL_MintAudio_audiosize = this->spec.size; SDL_MintAudio_audiosize = this->spec.size;
SDL_MintAudio_mutex = 0; SDL_MintAudio_mutex = 0;
...@@ -261,7 +266,7 @@ MINTSTFA_OpenDevice(_THIS, const char *devname, int iscapture) ...@@ -261,7 +266,7 @@ MINTSTFA_OpenDevice(_THIS, const char *devname, int iscapture)
static int static int
MINTSTFA_Init(SDL_AudioDriverImpl *impl) MINTSTFA_Init(SDL_AudioDriverImpl * impl)
{ {
/* Cookie _MCH present ? if not, assume ST machine */ /* Cookie _MCH present ? if not, assume ST machine */
if (Getcookie(C__MCH, &cookie_mch) == C_NOTFOUND) { if (Getcookie(C__MCH, &cookie_mch) == C_NOTFOUND) {
......
...@@ -90,7 +90,8 @@ MINTXBIOS_CloseDevice(_THIS) ...@@ -90,7 +90,8 @@ MINTXBIOS_CloseDevice(_THIS)
} }
/* Wait if currently playing sound */ /* Wait if currently playing sound */
while (SDL_MintAudio_mutex != 0) {} while (SDL_MintAudio_mutex != 0) {
}
/* Clear buffers */ /* Clear buffers */
if (SDL_MintAudio_audiobuf[0]) { if (SDL_MintAudio_audiobuf[0]) {
...@@ -267,7 +268,8 @@ MINTXBIOS_CheckAudio(_THIS) ...@@ -267,7 +268,8 @@ MINTXBIOS_CheckAudio(_THIS)
SDL_AUDIO_BITSIZE(this->spec.format))); SDL_AUDIO_BITSIZE(this->spec.format)));
DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(this->spec.format))); DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(this->spec.format)));
DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(this->spec.format))); DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(this->spec.format)));
DEBUG_PRINT(("big endian=%d, ", SDL_AUDIO_ISBIGENDIAN(this->spec.format))); DEBUG_PRINT(("big endian=%d, ",
SDL_AUDIO_ISBIGENDIAN(this->spec.format)));
DEBUG_PRINT(("channels=%d, ", this->spec.channels)); DEBUG_PRINT(("channels=%d, ", this->spec.channels));
DEBUG_PRINT(("freq=%d\n", this->spec.freq)); DEBUG_PRINT(("freq=%d\n", this->spec.freq));
...@@ -314,7 +316,8 @@ MINTXBIOS_CheckAudio(_THIS) ...@@ -314,7 +316,8 @@ MINTXBIOS_CheckAudio(_THIS)
SDL_AUDIO_BITSIZE(this->spec.format))); SDL_AUDIO_BITSIZE(this->spec.format)));
DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(this->spec.format))); DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(this->spec.format)));
DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(this->spec.format))); DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(this->spec.format)));
DEBUG_PRINT(("big endian=%d, ", SDL_AUDIO_ISBIGENDIAN(this->spec.format))); DEBUG_PRINT(("big endian=%d, ",
SDL_AUDIO_ISBIGENDIAN(this->spec.format)));
DEBUG_PRINT(("channels=%d, ", this->spec.channels)); DEBUG_PRINT(("channels=%d, ", this->spec.channels));
DEBUG_PRINT(("freq=%d\n", this->spec.freq)); DEBUG_PRINT(("freq=%d\n", this->spec.freq));
...@@ -417,7 +420,8 @@ MINTXBIOS_OpenDevice(_THIS, const char *devname, int iscapture) ...@@ -417,7 +420,8 @@ MINTXBIOS_OpenDevice(_THIS, const char *devname, int iscapture)
/* Allocate memory for audio buffers in DMA-able RAM */ /* Allocate memory for audio buffers in DMA-able RAM */
DEBUG_PRINT((DEBUG_NAME "buffer size=%d\n", this->spec.size)); DEBUG_PRINT((DEBUG_NAME "buffer size=%d\n", this->spec.size));
SDL_MintAudio_audiobuf[0] = Atari_SysMalloc(this->spec.size * 2, MX_STRAM); SDL_MintAudio_audiobuf[0] =
Atari_SysMalloc(this->spec.size * 2, MX_STRAM);
if (SDL_MintAudio_audiobuf[0] == NULL) { if (SDL_MintAudio_audiobuf[0] == NULL) {
SDL_free(this->hidden); SDL_free(this->hidden);
this->hidden = NULL; this->hidden = NULL;
...@@ -426,7 +430,8 @@ MINTXBIOS_OpenDevice(_THIS, const char *devname, int iscapture) ...@@ -426,7 +430,8 @@ MINTXBIOS_OpenDevice(_THIS, const char *devname, int iscapture)
} }
SDL_MintAudio_audiobuf[1] = SDL_MintAudio_audiobuf[0] + this->spec.size; SDL_MintAudio_audiobuf[1] = SDL_MintAudio_audiobuf[0] + this->spec.size;
SDL_MintAudio_numbuf = 0; SDL_MintAudio_numbuf = 0;
SDL_memset(SDL_MintAudio_audiobuf[0],this->spec.silence,this->spec.size*2); SDL_memset(SDL_MintAudio_audiobuf[0], this->spec.silence,
this->spec.size * 2);
SDL_MintAudio_audiosize = this->spec.size; SDL_MintAudio_audiosize = this->spec.size;
SDL_MintAudio_mutex = 0; SDL_MintAudio_mutex = 0;
...@@ -444,7 +449,7 @@ MINTXBIOS_OpenDevice(_THIS, const char *devname, int iscapture) ...@@ -444,7 +449,7 @@ MINTXBIOS_OpenDevice(_THIS, const char *devname, int iscapture)
} }
static int static int
MINTXBIOS_Init(SDL_AudioDriverImpl *impl) MINTXBIOS_Init(SDL_AudioDriverImpl * impl)
{ {
unsigned long dummy = 0; unsigned long dummy = 0;
/*SDL_MintAudio_mint_present = (Getcookie(C_MiNT, &dummy) == C_FOUND); */ /*SDL_MintAudio_mint_present = (Getcookie(C_MiNT, &dummy) == C_FOUND); */
......
...@@ -78,7 +78,7 @@ MME_OpenDevice(_THIS, const char *devname, int iscapture) ...@@ -78,7 +78,7 @@ MME_OpenDevice(_THIS, const char *devname, int iscapture)
return 0; return 0;
} }
SDL_memset(this->hidden->shm, '\0', sizeof (*this->hidden->shm)); SDL_memset(this->hidden->shm, '\0', sizeof(*this->hidden->shm));
this->hidden->shm->sound = 0; this->hidden->shm->sound = 0;
this->hidden->shm->wFmt.wf.wFormatTag = WAVE_FORMAT_PCM; this->hidden->shm->wFmt.wf.wFormatTag = WAVE_FORMAT_PCM;
...@@ -183,7 +183,7 @@ MME_PlayDevice(_THIS) ...@@ -183,7 +183,7 @@ MME_PlayDevice(_THIS)
/* Queue it up */ /* Queue it up */
waveOutWrite(this->hidden->shm->sound, waveOutWrite(this->hidden->shm->sound,
&(this->hidden->shm->wHdr[this->hidden->next_buffer]), &(this->hidden->shm->wHdr[this->hidden->next_buffer]),
sizeof (WAVEHDR)); sizeof(WAVEHDR));
this->hidden->next_buffer = (this->hidden->next_buffer + 1) % NUM_BUFFERS; this->hidden->next_buffer = (this->hidden->next_buffer + 1) % NUM_BUFFERS;
} }
...@@ -238,7 +238,7 @@ MME_CloseDevice(_THIS) ...@@ -238,7 +238,7 @@ MME_CloseDevice(_THIS)
} }
static int static int
MME_Init(SDL_AudioDriverImpl *impl) MME_Init(SDL_AudioDriverImpl * impl)
{ {
/* Set the function pointers */ /* Set the function pointers */
impl->OpenDevice = MME_OpenDevice; impl->OpenDevice = MME_OpenDevice;
......
...@@ -43,11 +43,11 @@ ...@@ -43,11 +43,11 @@
static struct SDL_PrivateAudioData *this2 = NULL; static struct SDL_PrivateAudioData *this2 = NULL;
static void (*NAS_AuCloseServer)(AuServer *); static void (*NAS_AuCloseServer) (AuServer *);
static void (*NAS_AuNextEvent)(AuServer *, AuBool, AuEvent *); static void (*NAS_AuNextEvent) (AuServer *, AuBool, AuEvent *);
static AuBool (*NAS_AuDispatchEvent)(AuServer *, AuEvent *); static AuBool(*NAS_AuDispatchEvent) (AuServer *, AuEvent *);
static AuFlowID (*NAS_AuCreateFlow)(AuServer *, AuStatus *); static AuFlowID(*NAS_AuCreateFlow) (AuServer *, AuStatus *);
static void (*NAS_AuStartFlow)(AuServer *, AuFlowID, AuStatus *); static void (*NAS_AuStartFlow) (AuServer *, AuFlowID, AuStatus *);
static void (*NAS_AuSetElements) static void (*NAS_AuSetElements)
(AuServer *, AuFlowID, AuBool, int, AuElement *, AuStatus *); (AuServer *, AuFlowID, AuBool, int, AuElement *, AuStatus *);
static void (*NAS_AuWriteElement) static void (*NAS_AuWriteElement)
...@@ -80,7 +80,8 @@ load_nas_sym(const char *fn, void **addr) ...@@ -80,7 +80,8 @@ load_nas_sym(const char *fn, void **addr)
#define SDL_NAS_SYM(x) NAS_##x = x #define SDL_NAS_SYM(x) NAS_##x = x
#endif #endif
static int load_nas_syms(void) static int
load_nas_syms(void)
{ {
SDL_NAS_SYM(AuCloseServer); SDL_NAS_SYM(AuCloseServer);
SDL_NAS_SYM(AuNextEvent); SDL_NAS_SYM(AuNextEvent);
...@@ -93,6 +94,7 @@ static int load_nas_syms(void) ...@@ -93,6 +94,7 @@ static int load_nas_syms(void)
SDL_NAS_SYM(AuRegisterEventHandler); SDL_NAS_SYM(AuRegisterEventHandler);
return 0; return 0;
} }
#undef SDL_NAS_SYM #undef SDL_NAS_SYM
#ifdef SDL_AUDIO_DRIVER_NAS_DYNAMIC #ifdef SDL_AUDIO_DRIVER_NAS_DYNAMIC
...@@ -175,7 +177,8 @@ NAS_PlayDevice(_THIS) ...@@ -175,7 +177,8 @@ NAS_PlayDevice(_THIS)
/* Write the audio data */ /* Write the audio data */
NAS_AuWriteElement(this->hidden->aud, this->hidden->flow, 0, NAS_AuWriteElement(this->hidden->aud, this->hidden->flow, 0,
this->hidden->mixlen, this->hidden->mixbuf, AuFalse, NULL); this->hidden->mixlen, this->hidden->mixbuf, AuFalse,
NULL);
this->hidden->written += this->hidden->mixlen; this->hidden->written += this->hidden->mixlen;
...@@ -339,12 +342,13 @@ NAS_OpenDevice(_THIS, const char *devname, int iscapture) ...@@ -339,12 +342,13 @@ NAS_OpenDevice(_THIS, const char *devname, int iscapture)
this2 = this->hidden; this2 = this->hidden;
AuMakeElementImportClient(elms,this->spec.freq,format,this->spec.channels, AuMakeElementImportClient(elms, this->spec.freq, format,
AuTrue, buffer_size, buffer_size / 4, 0, NULL); this->spec.channels, AuTrue, buffer_size,
buffer_size / 4, 0, NULL);
AuMakeElementExportDevice(elms + 1, 0, this->hidden->dev, this->spec.freq, AuMakeElementExportDevice(elms + 1, 0, this->hidden->dev, this->spec.freq,
AuUnlimitedSamples, 0, NULL); AuUnlimitedSamples, 0, NULL);
NAS_AuSetElements(this->hidden->aud, this->hidden->flow, NAS_AuSetElements(this->hidden->aud, this->hidden->flow, AuTrue, 2, elms,
AuTrue, 2, elms, NULL); NULL);
NAS_AuRegisterEventHandler(this->hidden->aud, AuEventHandlerIDMask, 0, NAS_AuRegisterEventHandler(this->hidden->aud, AuEventHandlerIDMask, 0,
this->hidden->flow, event_handler, this->hidden->flow, event_handler,
(AuPointer) NULL); (AuPointer) NULL);
...@@ -372,7 +376,7 @@ NAS_Deinitialize(void) ...@@ -372,7 +376,7 @@ NAS_Deinitialize(void)
} }
static int static int
NAS_Init(SDL_AudioDriverImpl *impl) NAS_Init(SDL_AudioDriverImpl * impl)
{ {
if (LoadNASLibrary() < 0) { if (LoadNASLibrary() < 0) {
return 0; return 0;
......
...@@ -141,7 +141,8 @@ NTO_WaitDevice(_THIS) ...@@ -141,7 +141,8 @@ NTO_WaitDevice(_THIS)
FD_SET(this->hidden->audio_fd, &wfds); FD_SET(this->hidden->audio_fd, &wfds);
do { do {
selectret = select(this->hidden->audio_fd+1, NULL, &wfds, NULL, NULL); selectret =
select(this->hidden->audio_fd + 1, NULL, &wfds, NULL, NULL);
switch (selectret) { switch (selectret) {
case -1: case -1:
case 0: case 0:
...@@ -185,7 +186,7 @@ NTO_PlayDevice(_THIS) ...@@ -185,7 +186,7 @@ NTO_PlayDevice(_THIS)
pcmbuffer += written * this->spec.channels; pcmbuffer += written * this->spec.channels;
continue; continue;
} else if ((errno == EINVAL) || (errno == EIO)) { } else if ((errno == EINVAL) || (errno == EIO)) {
SDL_memset(&cstatus, 0, sizeof (cstatus)); SDL_memset(&cstatus, 0, sizeof(cstatus));
cstatus.channel = SND_PCM_CHANNEL_PLAYBACK; cstatus.channel = SND_PCM_CHANNEL_PLAYBACK;
rval = snd_pcm_plugin_status(this->hidden->audio_handle, rval = snd_pcm_plugin_status(this->hidden->audio_handle,
&cstatus); &cstatus);
...@@ -194,7 +195,7 @@ NTO_PlayDevice(_THIS) ...@@ -194,7 +195,7 @@ NTO_PlayDevice(_THIS)
return; return;
} }
if ( (cstatus.status == SND_PCM_STATUS_UNDERRUN) || if ((cstatus.status == SND_PCM_STATUS_UNDERRUN) ||
(cstatus.status == SND_PCM_STATUS_READY)) { (cstatus.status == SND_PCM_STATUS_READY)) {
rval = snd_pcm_plugin_prepare(this->hidden->audio_handle, rval = snd_pcm_plugin_prepare(this->hidden->audio_handle,
SND_PCM_CHANNEL_PLAYBACK); SND_PCM_CHANNEL_PLAYBACK);
...@@ -374,7 +375,7 @@ NTO_OpenDevice(_THIS, const char *devname, int iscapture) ...@@ -374,7 +375,7 @@ NTO_OpenDevice(_THIS, const char *devname, int iscapture)
} }
/* Make sure channel is setup right one last time */ /* Make sure channel is setup right one last time */
SDL_memset(&csetup, '\0', sizeof (csetup)); SDL_memset(&csetup, '\0', sizeof(csetup));
csetup.channel = SND_PCM_CHANNEL_PLAYBACK; csetup.channel = SND_PCM_CHANNEL_PLAYBACK;
if (snd_pcm_plugin_setup(this->hidden->audio_handle, &csetup) < 0) { if (snd_pcm_plugin_setup(this->hidden->audio_handle, &csetup) < 0) {
NTO_CloseDevice(this); NTO_CloseDevice(this);
...@@ -398,16 +399,19 @@ NTO_OpenDevice(_THIS, const char *devname, int iscapture) ...@@ -398,16 +399,19 @@ NTO_OpenDevice(_THIS, const char *devname, int iscapture)
* (Note that buffer size must be a multiple of fragment size, so find * (Note that buffer size must be a multiple of fragment size, so find
* closest multiple) * closest multiple)
*/ */
this->hidden->pcm_buf = (Uint8 *) SDL_AllocAudioMem(this->hidden->pcm_len); this->hidden->pcm_buf =
(Uint8 *) SDL_AllocAudioMem(this->hidden->pcm_len);
if (this->hidden->pcm_buf == NULL) { if (this->hidden->pcm_buf == NULL) {
NTO_CloseDevice(this); NTO_CloseDevice(this);
SDL_OutOfMemory(); SDL_OutOfMemory();
return 0; return 0;
} }
SDL_memset(this->hidden->pcm_buf,this->spec.silence,this->hidden->pcm_len); SDL_memset(this->hidden->pcm_buf, this->spec.silence,
this->hidden->pcm_len);
/* get the file descriptor */ /* get the file descriptor */
this->hidden->audio_fd = snd_pcm_file_descriptor(this->hidden->audio_handle, this->hidden->audio_fd =
snd_pcm_file_descriptor(this->hidden->audio_handle,
SND_PCM_CHANNEL_PLAYBACK); SND_PCM_CHANNEL_PLAYBACK);
if (this->hidden->audio_fd < 0) { if (this->hidden->audio_fd < 0) {
NTO_CloseDevice(this); NTO_CloseDevice(this);
...@@ -430,7 +434,7 @@ NTO_OpenDevice(_THIS, const char *devname, int iscapture) ...@@ -430,7 +434,7 @@ NTO_OpenDevice(_THIS, const char *devname, int iscapture)
static int static int
NTO_Init(SDL_AudioDriverImpl *impl) NTO_Init(SDL_AudioDriverImpl * impl)
{ {
/* See if we can open a nonblocking channel. */ /* See if we can open a nonblocking channel. */
snd_pcm_t *handle = NULL; snd_pcm_t *handle = NULL;
......
...@@ -137,7 +137,9 @@ PAUDIO_WaitDevice(_THIS) ...@@ -137,7 +137,9 @@ PAUDIO_WaitDevice(_THIS)
/* Use timer for general audio synchronization */ /* Use timer for general audio synchronization */
Sint32 ticks; Sint32 ticks;
ticks = ((Sint32)(this->hidden->next_frame-SDL_GetTicks()))-FUDGE_TICKS; ticks =
((Sint32) (this->hidden->next_frame - SDL_GetTicks())) -
FUDGE_TICKS;
if (ticks > 0) { if (ticks > 0) {
SDL_Delay(ticks); SDL_Delay(ticks);
} }
...@@ -170,7 +172,8 @@ PAUDIO_WaitDevice(_THIS) ...@@ -170,7 +172,8 @@ PAUDIO_WaitDevice(_THIS)
#ifdef DEBUG_AUDIO #ifdef DEBUG_AUDIO
fprintf(stderr, "Waiting for audio to get ready\n"); fprintf(stderr, "Waiting for audio to get ready\n");
#endif #endif
if (select(this->hidden->audio_fd+1,NULL,&fdset,NULL,&timeout) <= 0) { if (select(this->hidden->audio_fd + 1, NULL, &fdset, NULL, &timeout)
<= 0) {
const char *message = const char *message =
"Audio timeout - buggy audio driver? (disabled)"; "Audio timeout - buggy audio driver? (disabled)";
/* /*
...@@ -524,7 +527,7 @@ PAUDIO_OpenDevice(_THIS, const char *devname, int iscapture) ...@@ -524,7 +527,7 @@ PAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
} }
static int static int
PAUDIO_Init(SDL_AudioDriverImpl *impl) PAUDIO_Init(SDL_AudioDriverImpl * impl)
{ {
int fd = OpenAudioPath(NULL, 0, OPEN_FLAGS, 0); int fd = OpenAudioPath(NULL, 0, OPEN_FLAGS, 0);
if (fd < 0) { if (fd < 0) {
......
...@@ -107,7 +107,8 @@ WINWAVEOUT_WaitDevice(_THIS) ...@@ -107,7 +107,8 @@ WINWAVEOUT_WaitDevice(_THIS)
Uint8 * Uint8 *
WINWAVEOUT_GetDeviceBuf(_THIS) WINWAVEOUT_GetDeviceBuf(_THIS)
{ {
return (Uint8 *) (this->hidden->wavebuf[this->hidden->next_buffer].lpData); return (Uint8 *) (this->hidden->wavebuf[this->hidden->next_buffer].
lpData);
} }
void void
...@@ -116,7 +117,7 @@ WINWAVEOUT_PlayDevice(_THIS) ...@@ -116,7 +117,7 @@ WINWAVEOUT_PlayDevice(_THIS)
/* Queue it up */ /* Queue it up */
waveOutWrite(this->hidden->sound, waveOutWrite(this->hidden->sound,
&this->hidden->wavebuf[this->hidden->next_buffer], &this->hidden->wavebuf[this->hidden->next_buffer],
sizeof (this->hidden->wavebuf[0])); sizeof(this->hidden->wavebuf[0]));
this->hidden->next_buffer = (this->hidden->next_buffer + 1) % NUM_BUFFERS; this->hidden->next_buffer = (this->hidden->next_buffer + 1) % NUM_BUFFERS;
} }
...@@ -165,7 +166,7 @@ WINWAVEOUT_CloseDevice(_THIS) ...@@ -165,7 +166,7 @@ WINWAVEOUT_CloseDevice(_THIS)
if (this->hidden->wavebuf[i].dwUser != 0xFFFF) { if (this->hidden->wavebuf[i].dwUser != 0xFFFF) {
waveOutUnprepareHeader(this->hidden->sound, waveOutUnprepareHeader(this->hidden->sound,
&this->hidden->wavebuf[i], &this->hidden->wavebuf[i],
sizeof (this->hidden->wavebuf[i])); sizeof(this->hidden->wavebuf[i]));
this->hidden->wavebuf[i].dwUser = 0xFFFF; this->hidden->wavebuf[i].dwUser = 0xFFFF;
} }
} }
...@@ -226,7 +227,7 @@ WINWAVEOUT_OpenDevice(_THIS, const char *devname, int iscapture) ...@@ -226,7 +227,7 @@ WINWAVEOUT_OpenDevice(_THIS, const char *devname, int iscapture)
} }
/* Set basic WAVE format parameters */ /* Set basic WAVE format parameters */
SDL_memset(&waveformat, '\0', sizeof (waveformat)); SDL_memset(&waveformat, '\0', sizeof(waveformat));
waveformat.wFormatTag = WAVE_FORMAT_PCM; waveformat.wFormatTag = WAVE_FORMAT_PCM;
waveformat.wBitsPerSample = SDL_AUDIO_BITSIZE(this->spec.format); waveformat.wBitsPerSample = SDL_AUDIO_BITSIZE(this->spec.format);
...@@ -286,7 +287,8 @@ WINWAVEOUT_OpenDevice(_THIS, const char *devname, int iscapture) ...@@ -286,7 +287,8 @@ WINWAVEOUT_OpenDevice(_THIS, const char *devname, int iscapture)
} }
/* Create the sound buffers */ /* Create the sound buffers */
this->hidden->mixbuf = (Uint8 *) SDL_malloc(NUM_BUFFERS * this->spec.size); this->hidden->mixbuf =
(Uint8 *) SDL_malloc(NUM_BUFFERS * this->spec.size);
if (this->hidden->mixbuf == NULL) { if (this->hidden->mixbuf == NULL) {
WINWAVEOUT_CloseDevice(this); WINWAVEOUT_CloseDevice(this);
SDL_OutOfMemory(); SDL_OutOfMemory();
...@@ -294,14 +296,14 @@ WINWAVEOUT_OpenDevice(_THIS, const char *devname, int iscapture) ...@@ -294,14 +296,14 @@ WINWAVEOUT_OpenDevice(_THIS, const char *devname, int iscapture)
} }
for (i = 0; i < NUM_BUFFERS; ++i) { for (i = 0; i < NUM_BUFFERS; ++i) {
SDL_memset(&this->hidden->wavebuf[i], '\0', SDL_memset(&this->hidden->wavebuf[i], '\0',
sizeof (this->hidden->wavebuf[i])); sizeof(this->hidden->wavebuf[i]));
this->hidden->wavebuf[i].dwBufferLength = this->spec.size; this->hidden->wavebuf[i].dwBufferLength = this->spec.size;
this->hidden->wavebuf[i].dwFlags = WHDR_DONE; this->hidden->wavebuf[i].dwFlags = WHDR_DONE;
this->hidden->wavebuf[i].lpData = this->hidden->wavebuf[i].lpData =
(LPSTR) &this->hidden->mixbuf[i * this->spec.size]; (LPSTR) & this->hidden->mixbuf[i * this->spec.size];
result = waveOutPrepareHeader(this->hidden->sound, result = waveOutPrepareHeader(this->hidden->sound,
&this->hidden->wavebuf[i], &this->hidden->wavebuf[i],
sizeof (this->hidden->wavebuf[i])); sizeof(this->hidden->wavebuf[i]));
if (result != MMSYSERR_NOERROR) { if (result != MMSYSERR_NOERROR) {
WINWAVEOUT_CloseDevice(this); WINWAVEOUT_CloseDevice(this);
SetMMerror("waveOutPrepareHeader()", result); SetMMerror("waveOutPrepareHeader()", result);
...@@ -314,7 +316,7 @@ WINWAVEOUT_OpenDevice(_THIS, const char *devname, int iscapture) ...@@ -314,7 +316,7 @@ WINWAVEOUT_OpenDevice(_THIS, const char *devname, int iscapture)
static int static int
WINWAVEOUT_Init(SDL_AudioDriverImpl *impl) WINWAVEOUT_Init(SDL_AudioDriverImpl * impl)
{ {
/* Set the function pointers */ /* Set the function pointers */
impl->OpenDevice = WINWAVEOUT_OpenDevice; impl->OpenDevice = WINWAVEOUT_OpenDevice;
......
...@@ -39,7 +39,8 @@ ...@@ -39,7 +39,8 @@
/* DirectX function pointers for audio */ /* DirectX function pointers for audio */
static HINSTANCE DSoundDLL = NULL; static HINSTANCE DSoundDLL = NULL;
static HRESULT (WINAPI *DSoundCreate)(LPGUID,LPDIRECTSOUND*,LPUNKNOWN) = NULL; static HRESULT(WINAPI * DSoundCreate) (LPGUID, LPDIRECTSOUND *, LPUNKNOWN) =
NULL;
static void static void
DSOUND_Unload(void) DSOUND_Unload(void)
...@@ -271,14 +272,14 @@ DSOUND_GetDeviceBuf(_THIS) ...@@ -271,14 +272,14 @@ DSOUND_GetDeviceBuf(_THIS)
/* Lock the audio buffer */ /* Lock the audio buffer */
result = IDirectSoundBuffer_Lock(this->hidden->mixbuf, cursor, result = IDirectSoundBuffer_Lock(this->hidden->mixbuf, cursor,
this->hidden->mixlen, this->hidden->mixlen,
(LPVOID *) &this->hidden->locked_buf, (LPVOID *) & this->hidden->locked_buf,
&rawlen, NULL, &junk, 0); &rawlen, NULL, &junk, 0);
if (result == DSERR_BUFFERLOST) { if (result == DSERR_BUFFERLOST) {
IDirectSoundBuffer_Restore(this->hidden->mixbuf); IDirectSoundBuffer_Restore(this->hidden->mixbuf);
result = IDirectSoundBuffer_Lock(this->hidden->mixbuf, cursor, result = IDirectSoundBuffer_Lock(this->hidden->mixbuf, cursor,
this->hidden->mixlen, this->hidden->mixlen,
(LPVOID *) &this->hidden->locked_buf, (LPVOID *) & this->hidden->
&rawlen, NULL, &junk, 0); locked_buf, &rawlen, NULL, &junk, 0);
} }
if (result != DS_OK) { if (result != DS_OK) {
SetDSerror("DirectSound Lock", result); SetDSerror("DirectSound Lock", result);
...@@ -326,7 +327,7 @@ DSOUND_CloseDevice(_THIS) ...@@ -326,7 +327,7 @@ DSOUND_CloseDevice(_THIS)
number of audio chunks available in the created buffer. number of audio chunks available in the created buffer.
*/ */
static int static int
CreateSecondary(_THIS, HWND focus, WAVEFORMATEX *wavefmt) CreateSecondary(_THIS, HWND focus, WAVEFORMATEX * wavefmt)
{ {
LPDIRECTSOUND sndObj = this->hidden->sound; LPDIRECTSOUND sndObj = this->hidden->sound;
LPDIRECTSOUNDBUFFER *sndbuf = &this->hidden->mixbuf; LPDIRECTSOUNDBUFFER *sndbuf = &this->hidden->mixbuf;
...@@ -473,7 +474,7 @@ DSOUND_Deinitialize(void) ...@@ -473,7 +474,7 @@ DSOUND_Deinitialize(void)
static int static int
DSOUND_Init(SDL_AudioDriverImpl *impl) DSOUND_Init(SDL_AudioDriverImpl * impl)
{ {
OSVERSIONINFO ver; OSVERSIONINFO ver;
...@@ -482,7 +483,7 @@ DSOUND_Init(SDL_AudioDriverImpl *impl) ...@@ -482,7 +483,7 @@ DSOUND_Init(SDL_AudioDriverImpl *impl)
* audio buffers used by many SDL applications, so there are gaps in the * audio buffers used by many SDL applications, so there are gaps in the
* audio - it sounds terrible. Punt for now. * audio - it sounds terrible. Punt for now.
*/ */
SDL_memset(&ver, '\0', sizeof (OSVERSIONINFO)); SDL_memset(&ver, '\0', sizeof(OSVERSIONINFO));
ver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); ver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&ver); GetVersionEx(&ver);
if (ver.dwPlatformId == VER_PLATFORM_WIN32_NT) { if (ver.dwPlatformId == VER_PLATFORM_WIN32_NT) {
......
...@@ -64,6 +64,7 @@ SDL_GetTicks(void) ...@@ -64,6 +64,7 @@ SDL_GetTicks(void)
hires_now /= hires_ticks_per_second; hires_now /= hires_ticks_per_second;
*/ */
/* inline asm to avoid runtime inclusion */ /* inline asm to avoid runtime inclusion */
/* *INDENT-OFF* */
_asm { _asm {
push edx push edx
push eax push eax
...@@ -87,6 +88,7 @@ SDL_GetTicks(void) ...@@ -87,6 +88,7 @@ SDL_GetTicks(void)
pop edx pop edx
pop eax pop eax
} }
/* *INDENT-ON* */
return ticks; return ticks;
......
#include "SDL.h" #include "SDL.h"
static void print_devices(int iscapture) static void
print_devices(int iscapture)
{ {
const char *typestr = ((iscapture) ? "capture" : "output"); const char *typestr = ((iscapture) ? "capture" : "output");
int n = SDL_GetNumAudioDevices(iscapture); int n = SDL_GetNumAudioDevices(iscapture);
...@@ -11,8 +12,7 @@ static void print_devices(int iscapture) ...@@ -11,8 +12,7 @@ static void print_devices(int iscapture)
printf(" Driver can't detect specific devices.\n\n", typestr); printf(" Driver can't detect specific devices.\n\n", typestr);
else if (n == 0) else if (n == 0)
printf(" No %s devices found.\n\n", typestr); printf(" No %s devices found.\n\n", typestr);
else else {
{
int i; int i;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
printf(" %s\n", SDL_GetAudioDeviceName(i, iscapture)); printf(" %s\n", SDL_GetAudioDeviceName(i, iscapture));
...@@ -21,7 +21,8 @@ static void print_devices(int iscapture) ...@@ -21,7 +21,8 @@ static void print_devices(int iscapture)
} }
} }
int main(int argc, char **argv) int
main(int argc, char **argv)
{ {
/* Print available audio drivers */ /* Print available audio drivers */
int n = SDL_GetNumAudioDrivers(); int n = SDL_GetNumAudioDrivers();
...@@ -50,4 +51,3 @@ int main(int argc, char **argv) ...@@ -50,4 +51,3 @@ int main(int argc, char **argv)
SDL_Quit(); SDL_Quit();
return 0; return 0;
} }
...@@ -11,7 +11,8 @@ typedef struct ...@@ -11,7 +11,8 @@ typedef struct
volatile int done; volatile int done;
} callback_data; } callback_data;
void SDLCALL play_through_once(void *arg, Uint8 * stream, int len) void SDLCALL
play_through_once(void *arg, Uint8 * stream, int len)
{ {
callback_data *cbd = (callback_data *) arg; callback_data *cbd = (callback_data *) arg;
Uint8 *waveptr = sound + cbd->soundpos; Uint8 *waveptr = sound + cbd->soundpos;
...@@ -30,14 +31,16 @@ void SDLCALL play_through_once(void *arg, Uint8 * stream, int len) ...@@ -30,14 +31,16 @@ void SDLCALL play_through_once(void *arg, Uint8 * stream, int len)
} }
} }
static void test_multi_audio(int devcount) static void
test_multi_audio(int devcount)
{ {
callback_data cbd[64]; callback_data cbd[64];
int keep_going = 1; int keep_going = 1;
int i; int i;
if (devcount > 64) { if (devcount > 64) {
fprintf(stderr, "Too many devices (%d), clamping to 64...\n", devcount); fprintf(stderr, "Too many devices (%d), clamping to 64...\n",
devcount);
devcount = 64; devcount = 64;
} }
...@@ -48,7 +51,7 @@ static void test_multi_audio(int devcount) ...@@ -48,7 +51,7 @@ static void test_multi_audio(int devcount)
printf("playing on device #%d: ('%s')...", i, devname); printf("playing on device #%d: ('%s')...", i, devname);
fflush(stdout); fflush(stdout);
memset(&cbd[0], '\0', sizeof (callback_data)); memset(&cbd[0], '\0', sizeof(callback_data));
spec.userdata = &cbd[0]; spec.userdata = &cbd[0];
cbd[0].dev = SDL_OpenAudioDevice(devname, 0, &spec, NULL); cbd[0].dev = SDL_OpenAudioDevice(devname, 0, &spec, NULL);
if (cbd[0].dev == 0) { if (cbd[0].dev == 0) {
...@@ -63,7 +66,7 @@ static void test_multi_audio(int devcount) ...@@ -63,7 +66,7 @@ static void test_multi_audio(int devcount)
} }
} }
memset(cbd, '\0', sizeof (cbd)); memset(cbd, '\0', sizeof(cbd));
printf("playing on all devices...\n"); printf("playing on all devices...\n");
for (i = 0; i < devcount; i++) { for (i = 0; i < devcount; i++) {
...@@ -102,7 +105,8 @@ static void test_multi_audio(int devcount) ...@@ -102,7 +105,8 @@ static void test_multi_audio(int devcount)
} }
int main(int argc, char **argv) int
main(int argc, char **argv)
{ {
int devcount = 0; int devcount = 0;
...@@ -124,7 +128,8 @@ int main(int argc, char **argv) ...@@ -124,7 +128,8 @@ int main(int argc, char **argv)
/* Load the wave file into memory */ /* Load the wave file into memory */
if (SDL_LoadWAV(argv[1], &spec, &sound, &soundlen) == NULL) { if (SDL_LoadWAV(argv[1], &spec, &sound, &soundlen) == NULL) {
fprintf(stderr, "Couldn't load %s: %s\n", argv[1], SDL_GetError()); fprintf(stderr, "Couldn't load %s: %s\n", argv[1],
SDL_GetError());
} else { } else {
test_multi_audio(devcount); test_multi_audio(devcount);
SDL_FreeWAV(sound); SDL_FreeWAV(sound);
......
...@@ -276,7 +276,7 @@ int ...@@ -276,7 +276,7 @@ int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
SDL_Event event; SDL_Event event;
char *title; const char *title;
SDL_Surface *icon; SDL_Surface *icon;
Uint8 *icon_mask; Uint8 *icon_mask;
int parsed; int parsed;
......
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