Use SDL_ prefixed versions of C library functions.
FIXME: Change #include <stdlib.h> to #include "SDL_stdlib.h" Change #include <string.h> to #include "SDL_string.h" Make sure nothing else broke because of this... --HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401340
This commit is contained in:
parent
00f6d8e5e3
commit
5d53175e4d
212 changed files with 1840 additions and 1884 deletions
|
@ -220,7 +220,7 @@ int SDL_RunAudio(void *audiop)
|
|||
stream = audio->fake_stream;
|
||||
}
|
||||
}
|
||||
memset(stream, silence, stream_len);
|
||||
SDL_memset(stream, silence, stream_len);
|
||||
|
||||
if ( ! audio->paused ) {
|
||||
SDL_mutexP(audio->mixer_lock);
|
||||
|
@ -235,7 +235,7 @@ int SDL_RunAudio(void *audiop)
|
|||
if ( stream == NULL ) {
|
||||
stream = audio->fake_stream;
|
||||
}
|
||||
memcpy(stream, audio->convert.buf,
|
||||
SDL_memcpy(stream, audio->convert.buf,
|
||||
audio->convert.len_cvt);
|
||||
}
|
||||
|
||||
|
@ -299,17 +299,17 @@ int SDL_AudioInit(const char *driver_name)
|
|||
audio = NULL;
|
||||
idx = 0;
|
||||
#ifdef unix
|
||||
if ( (driver_name == NULL) && (getenv("ESPEAKER") != NULL) ) {
|
||||
if ( (driver_name == NULL) && (SDL_getenv("ESPEAKER") != NULL) ) {
|
||||
/* Ahem, we know that if ESPEAKER is set, user probably wants
|
||||
to use ESD, but don't start it if it's not already running.
|
||||
This probably isn't the place to do this, but... Shh! :)
|
||||
*/
|
||||
for ( i=0; bootstrap[i]; ++i ) {
|
||||
if ( strcmp(bootstrap[i]->name, "esd") == 0 ) {
|
||||
if ( SDL_strcmp(bootstrap[i]->name, "esd") == 0 ) {
|
||||
const char *esd_no_spawn;
|
||||
|
||||
/* Don't start ESD if it's not running */
|
||||
esd_no_spawn = getenv("ESD_NO_SPAWN");
|
||||
esd_no_spawn = SDL_getenv("ESD_NO_SPAWN");
|
||||
if ( esd_no_spawn == NULL ) {
|
||||
putenv("ESD_NO_SPAWN=1");
|
||||
}
|
||||
|
@ -329,13 +329,13 @@ int SDL_AudioInit(const char *driver_name)
|
|||
if ( audio == NULL ) {
|
||||
if ( driver_name != NULL ) {
|
||||
#if 0 /* This will be replaced with a better driver selection API */
|
||||
if ( strrchr(driver_name, ':') != NULL ) {
|
||||
idx = atoi(strrchr(driver_name, ':')+1);
|
||||
if ( SDL_strrchr(driver_name, ':') != NULL ) {
|
||||
idx = atoi(SDL_strrchr(driver_name, ':')+1);
|
||||
}
|
||||
#endif
|
||||
for ( i=0; bootstrap[i]; ++i ) {
|
||||
if (strncmp(bootstrap[i]->name, driver_name,
|
||||
strlen(bootstrap[i]->name)) == 0) {
|
||||
if (SDL_strncmp(bootstrap[i]->name, driver_name,
|
||||
SDL_strlen(bootstrap[i]->name)) == 0) {
|
||||
if ( bootstrap[i]->available() ) {
|
||||
audio=bootstrap[i]->create(idx);
|
||||
break;
|
||||
|
@ -375,7 +375,7 @@ int SDL_AudioInit(const char *driver_name)
|
|||
char *SDL_AudioDriverName(char *namebuf, int maxlen)
|
||||
{
|
||||
if ( current_audio != NULL ) {
|
||||
strncpy(namebuf, current_audio->name, maxlen-1);
|
||||
SDL_strncpy(namebuf, current_audio->name, maxlen-1);
|
||||
namebuf[maxlen-1] = '\0';
|
||||
return(namebuf);
|
||||
}
|
||||
|
@ -436,7 +436,7 @@ int SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained)
|
|||
SDL_CalculateAudioSpec(desired);
|
||||
|
||||
/* Open the audio subsystem */
|
||||
memcpy(&audio->spec, desired, sizeof(audio->spec));
|
||||
SDL_memcpy(&audio->spec, desired, sizeof(audio->spec));
|
||||
audio->convert.needed = 0;
|
||||
audio->enabled = 1;
|
||||
audio->paused = 1;
|
||||
|
@ -489,7 +489,7 @@ int SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained)
|
|||
|
||||
/* See if we need to do any conversion */
|
||||
if ( obtained != NULL ) {
|
||||
memcpy(obtained, &audio->spec, sizeof(audio->spec));
|
||||
SDL_memcpy(obtained, &audio->spec, sizeof(audio->spec));
|
||||
} else if ( desired->freq != audio->spec.freq ||
|
||||
desired->format != audio->spec.format ||
|
||||
desired->channels != audio->spec.channels ) {
|
||||
|
|
|
@ -55,8 +55,8 @@ int SDL_OpenAudioPath(char *path, int maxlen, int flags, int classic)
|
|||
char audiopath[1024];
|
||||
|
||||
/* Figure out what our audio device is */
|
||||
if ( ((audiodev=getenv("SDL_PATH_DSP")) == NULL) &&
|
||||
((audiodev=getenv("AUDIODEV")) == NULL) ) {
|
||||
if ( ((audiodev=SDL_getenv("SDL_PATH_DSP")) == NULL) &&
|
||||
((audiodev=SDL_getenv("AUDIODEV")) == NULL) ) {
|
||||
if ( classic ) {
|
||||
audiodev = _PATH_DEV_AUDIO;
|
||||
} else {
|
||||
|
@ -74,7 +74,7 @@ int SDL_OpenAudioPath(char *path, int maxlen, int flags, int classic)
|
|||
audio_fd = open(audiodev, flags, 0);
|
||||
|
||||
/* If the first open fails, look for other devices */
|
||||
if ( (audio_fd < 0) && (strlen(audiodev) < (sizeof(audiopath)-3)) ) {
|
||||
if ( (audio_fd < 0) && (SDL_strlen(audiodev) < (sizeof(audiopath)-3)) ) {
|
||||
int exists, instance;
|
||||
struct stat sb;
|
||||
|
||||
|
@ -90,7 +90,7 @@ int SDL_OpenAudioPath(char *path, int maxlen, int flags, int classic)
|
|||
audiodev = audiopath;
|
||||
}
|
||||
if ( path != NULL ) {
|
||||
strncpy(path, audiodev, maxlen);
|
||||
SDL_strncpy(path, audiodev, maxlen);
|
||||
path[maxlen-1] = '\0';
|
||||
}
|
||||
return(audio_fd);
|
||||
|
@ -130,15 +130,15 @@ static int OpenUserDefinedDevice(char *path, int maxlen, int flags)
|
|||
int audio_fd;
|
||||
|
||||
/* Figure out what our audio device is */
|
||||
if ((audiodev=getenv("SDL_PATH_DSP")) == NULL) {
|
||||
audiodev=getenv("AUDIODEV");
|
||||
if ((audiodev=SDL_getenv("SDL_PATH_DSP")) == NULL) {
|
||||
audiodev=SDL_getenv("AUDIODEV");
|
||||
}
|
||||
if ( audiodev == NULL ) {
|
||||
return -1;
|
||||
}
|
||||
audio_fd = open(audiodev, flags, 0);
|
||||
if ( path != NULL ) {
|
||||
strncpy(path, audiodev, maxlen);
|
||||
SDL_strncpy(path, audiodev, maxlen);
|
||||
path[maxlen-1] = '\0';
|
||||
}
|
||||
return audio_fd;
|
||||
|
@ -168,7 +168,7 @@ int SDL_OpenAudioPath(char *path, int maxlen, int flags, int classic)
|
|||
audio_fd = open(audiopath, flags, 0);
|
||||
if ( audio_fd > 0 ) {
|
||||
if ( path != NULL ) {
|
||||
strncpy( path, audiopath, maxlen );
|
||||
SDL_strncpy( path, audiopath, maxlen );
|
||||
path[maxlen-1] = '\0';
|
||||
}
|
||||
return audio_fd;
|
||||
|
|
|
@ -52,7 +52,7 @@ void *SDL_AllocAudioMem(int size)
|
|||
/* Set the segment for deletion when it is detatched */
|
||||
shmctl(semid, IPC_RMID, NULL); /* Delets semid if shmat() fails */
|
||||
#else
|
||||
chunk = malloc(size);
|
||||
chunk = SDL_malloc(size);
|
||||
#endif
|
||||
return((void *)chunk);
|
||||
}
|
||||
|
@ -62,6 +62,6 @@ void SDL_FreeAudioMem(void *chunk)
|
|||
#ifdef FORK_HACK
|
||||
shmdt(chunk);
|
||||
#else
|
||||
free(chunk);
|
||||
SDL_free(chunk);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2006 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
This library is SDL_free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
|
|
@ -135,7 +135,7 @@ static int MS_ADPCM_decode(Uint8 **audio_buf, Uint32 *audio_len)
|
|||
*audio_len = (encoded_len/MS_ADPCM_state.wavefmt.blockalign) *
|
||||
MS_ADPCM_state.wSamplesPerBlock*
|
||||
MS_ADPCM_state.wavefmt.channels*sizeof(Sint16);
|
||||
*audio_buf = (Uint8 *)malloc(*audio_len);
|
||||
*audio_buf = (Uint8 *)SDL_malloc(*audio_len);
|
||||
if ( *audio_buf == NULL ) {
|
||||
SDL_Error(SDL_ENOMEM);
|
||||
return(-1);
|
||||
|
@ -214,7 +214,7 @@ static int MS_ADPCM_decode(Uint8 **audio_buf, Uint32 *audio_len)
|
|||
}
|
||||
encoded_len -= MS_ADPCM_state.wavefmt.blockalign;
|
||||
}
|
||||
free(freeable);
|
||||
SDL_free(freeable);
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
@ -352,7 +352,7 @@ static int IMA_ADPCM_decode(Uint8 **audio_buf, Uint32 *audio_len)
|
|||
*audio_len = (encoded_len/IMA_ADPCM_state.wavefmt.blockalign) *
|
||||
IMA_ADPCM_state.wSamplesPerBlock*
|
||||
IMA_ADPCM_state.wavefmt.channels*sizeof(Sint16);
|
||||
*audio_buf = (Uint8 *)malloc(*audio_len);
|
||||
*audio_buf = (Uint8 *)SDL_malloc(*audio_len);
|
||||
if ( *audio_buf == NULL ) {
|
||||
SDL_Error(SDL_ENOMEM);
|
||||
return(-1);
|
||||
|
@ -394,7 +394,7 @@ static int IMA_ADPCM_decode(Uint8 **audio_buf, Uint32 *audio_len)
|
|||
}
|
||||
encoded_len -= IMA_ADPCM_state.wavefmt.blockalign;
|
||||
}
|
||||
free(freeable);
|
||||
SDL_free(freeable);
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
@ -444,7 +444,7 @@ SDL_AudioSpec * SDL_LoadWAV_RW (SDL_RWops *src, int freesrc,
|
|||
chunk.data = NULL;
|
||||
do {
|
||||
if ( chunk.data != NULL ) {
|
||||
free(chunk.data);
|
||||
SDL_free(chunk.data);
|
||||
}
|
||||
lenread = ReadChunk(src, &chunk);
|
||||
if ( lenread < 0 ) {
|
||||
|
@ -489,7 +489,7 @@ SDL_AudioSpec * SDL_LoadWAV_RW (SDL_RWops *src, int freesrc,
|
|||
was_error = 1;
|
||||
goto done;
|
||||
}
|
||||
memset(spec, 0, (sizeof *spec));
|
||||
SDL_memset(spec, 0, (sizeof *spec));
|
||||
spec->freq = SDL_SwapLE32(format->frequency);
|
||||
switch (SDL_SwapLE16(format->bitspersample)) {
|
||||
case 4:
|
||||
|
@ -521,7 +521,7 @@ SDL_AudioSpec * SDL_LoadWAV_RW (SDL_RWops *src, int freesrc,
|
|||
*audio_buf = NULL;
|
||||
do {
|
||||
if ( *audio_buf != NULL ) {
|
||||
free(*audio_buf);
|
||||
SDL_free(*audio_buf);
|
||||
}
|
||||
lenread = ReadChunk(src, &chunk);
|
||||
if ( lenread < 0 ) {
|
||||
|
@ -553,7 +553,7 @@ SDL_AudioSpec * SDL_LoadWAV_RW (SDL_RWops *src, int freesrc,
|
|||
|
||||
done:
|
||||
if ( format != NULL ) {
|
||||
free(format);
|
||||
SDL_free(format);
|
||||
}
|
||||
if ( freesrc && src ) {
|
||||
SDL_RWclose(src);
|
||||
|
@ -574,7 +574,7 @@ done:
|
|||
void SDL_FreeWAV(Uint8 *audio_buf)
|
||||
{
|
||||
if ( audio_buf != NULL ) {
|
||||
free(audio_buf);
|
||||
SDL_free(audio_buf);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -582,14 +582,14 @@ static int ReadChunk(SDL_RWops *src, Chunk *chunk)
|
|||
{
|
||||
chunk->magic = SDL_ReadLE32(src);
|
||||
chunk->length = SDL_ReadLE32(src);
|
||||
chunk->data = (Uint8 *)malloc(chunk->length);
|
||||
chunk->data = (Uint8 *)SDL_malloc(chunk->length);
|
||||
if ( chunk->data == NULL ) {
|
||||
SDL_Error(SDL_ENOMEM);
|
||||
return(-1);
|
||||
}
|
||||
if ( SDL_RWread(src, chunk->data, chunk->length, 1) != 1 ) {
|
||||
SDL_Error(SDL_EFREAD);
|
||||
free(chunk->data);
|
||||
SDL_free(chunk->data);
|
||||
return(-1);
|
||||
}
|
||||
return(chunk->length);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2006 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
This library is SDL_free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
|
|
@ -170,7 +170,7 @@ static const char *get_audio_device(int channels)
|
|||
{
|
||||
const char *device;
|
||||
|
||||
device = getenv("AUDIODEV"); /* Is there a standard variable name? */
|
||||
device = SDL_getenv("AUDIODEV"); /* Is there a standard variable name? */
|
||||
if ( device == NULL ) {
|
||||
if (channels == 6) device = "surround51";
|
||||
else if (channels == 4) device = "surround40";
|
||||
|
@ -202,8 +202,8 @@ static int Audio_Available(void)
|
|||
|
||||
static void Audio_DeleteDevice(SDL_AudioDevice *device)
|
||||
{
|
||||
free(device->hidden);
|
||||
free(device);
|
||||
SDL_free(device->hidden);
|
||||
SDL_free(device);
|
||||
UnloadALSALibrary();
|
||||
}
|
||||
|
||||
|
@ -213,20 +213,20 @@ static SDL_AudioDevice *Audio_CreateDevice(int devindex)
|
|||
|
||||
/* Initialize all variables that we clean on shutdown */
|
||||
LoadALSALibrary();
|
||||
this = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice));
|
||||
this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
|
||||
if ( this ) {
|
||||
memset(this, 0, (sizeof *this));
|
||||
SDL_memset(this, 0, (sizeof *this));
|
||||
this->hidden = (struct SDL_PrivateAudioData *)
|
||||
malloc((sizeof *this->hidden));
|
||||
SDL_malloc((sizeof *this->hidden));
|
||||
}
|
||||
if ( (this == NULL) || (this->hidden == NULL) ) {
|
||||
SDL_OutOfMemory();
|
||||
if ( this ) {
|
||||
free(this);
|
||||
SDL_free(this);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
|
||||
/* Set the function pointers */
|
||||
this->OpenAudio = ALSA_OpenAudio;
|
||||
|
@ -435,7 +435,7 @@ static int ALSA_OpenAudio(_THIS, SDL_AudioSpec *spec)
|
|||
ALSA_CloseAudio(this);
|
||||
return(-1);
|
||||
}
|
||||
memset(mixbuf, spec->silence, spec->size);
|
||||
SDL_memset(mixbuf, spec->silence, spec->size);
|
||||
|
||||
/* Get the parent process id (we're the parent of the audio thread) */
|
||||
parent = getpid();
|
||||
|
|
|
@ -74,8 +74,8 @@ static int Audio_Available(void)
|
|||
|
||||
static void Audio_DeleteDevice(SDL_AudioDevice *device)
|
||||
{
|
||||
free(device->hidden);
|
||||
free(device);
|
||||
SDL_free(device->hidden);
|
||||
SDL_free(device);
|
||||
}
|
||||
|
||||
static SDL_AudioDevice *Audio_CreateDevice(int devindex)
|
||||
|
@ -87,20 +87,20 @@ static SDL_AudioDevice *Audio_CreateDevice(int devindex)
|
|||
#endif
|
||||
|
||||
/* Initialize all variables that we clean on shutdown */
|
||||
this = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice));
|
||||
this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
|
||||
if ( this ) {
|
||||
memset(this, 0, (sizeof *this));
|
||||
SDL_memset(this, 0, (sizeof *this));
|
||||
this->hidden = (struct SDL_PrivateAudioData *)
|
||||
malloc((sizeof *this->hidden));
|
||||
SDL_malloc((sizeof *this->hidden));
|
||||
}
|
||||
if ( (this == NULL) || (this->hidden == NULL) ) {
|
||||
SDL_OutOfMemory();
|
||||
if ( this ) {
|
||||
free(this);
|
||||
SDL_free(this);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
|
||||
/* Set the function pointers */
|
||||
this->OpenAudio = AHI_OpenAudio;
|
||||
|
@ -316,7 +316,7 @@ static int AHI_OpenAudio(_THIS, SDL_AudioSpec *spec)
|
|||
|
||||
D(bug("Before audio_req memcpy\n"));
|
||||
|
||||
memcpy(audio_req[1],audio_req[0],sizeof(struct AHIRequest));
|
||||
SDL_memcpy(audio_req[1],audio_req[0],sizeof(struct AHIRequest));
|
||||
|
||||
if ( mixbuf[0] == NULL || mixbuf[1] == NULL ) {
|
||||
SDL_OutOfMemory();
|
||||
|
@ -325,8 +325,8 @@ static int AHI_OpenAudio(_THIS, SDL_AudioSpec *spec)
|
|||
|
||||
D(bug("Before mixbuf memset\n"));
|
||||
|
||||
memset(mixbuf[0], spec->silence, spec->size);
|
||||
memset(mixbuf[1], spec->silence, spec->size);
|
||||
SDL_memset(mixbuf[0], spec->silence, spec->size);
|
||||
SDL_memset(mixbuf[1], spec->silence, spec->size);
|
||||
|
||||
current_buffer=0;
|
||||
playing=0;
|
||||
|
|
|
@ -152,8 +152,8 @@ static int Audio_Available(void)
|
|||
|
||||
static void Audio_DeleteDevice(SDL_AudioDevice *device)
|
||||
{
|
||||
free(device->hidden);
|
||||
free(device);
|
||||
SDL_free(device->hidden);
|
||||
SDL_free(device);
|
||||
UnloadARTSLibrary();
|
||||
}
|
||||
|
||||
|
@ -163,20 +163,20 @@ static SDL_AudioDevice *Audio_CreateDevice(int devindex)
|
|||
|
||||
/* Initialize all variables that we clean on shutdown */
|
||||
LoadARTSLibrary();
|
||||
this = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice));
|
||||
this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
|
||||
if ( this ) {
|
||||
memset(this, 0, (sizeof *this));
|
||||
SDL_memset(this, 0, (sizeof *this));
|
||||
this->hidden = (struct SDL_PrivateAudioData *)
|
||||
malloc((sizeof *this->hidden));
|
||||
SDL_malloc((sizeof *this->hidden));
|
||||
}
|
||||
if ( (this == NULL) || (this->hidden == NULL) ) {
|
||||
SDL_OutOfMemory();
|
||||
if ( this ) {
|
||||
free(this);
|
||||
SDL_free(this);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
stream = 0;
|
||||
|
||||
/* Set the function pointers */
|
||||
|
@ -331,7 +331,7 @@ static int ARTSC_OpenAudio(_THIS, SDL_AudioSpec *spec)
|
|||
if ( mixbuf == NULL ) {
|
||||
return(-1);
|
||||
}
|
||||
memset(mixbuf, spec->silence, spec->size);
|
||||
SDL_memset(mixbuf, spec->silence, spec->size);
|
||||
|
||||
/* Get the parent process id (we're the parent of the audio thread) */
|
||||
parent = getpid();
|
||||
|
|
|
@ -54,8 +54,8 @@ static int Audio_Available(void)
|
|||
|
||||
static void Audio_DeleteDevice(SDL_AudioDevice *device)
|
||||
{
|
||||
free(device->hidden);
|
||||
free(device);
|
||||
SDL_free(device->hidden);
|
||||
SDL_free(device);
|
||||
}
|
||||
|
||||
static SDL_AudioDevice *Audio_CreateDevice(int devindex)
|
||||
|
@ -63,20 +63,20 @@ static SDL_AudioDevice *Audio_CreateDevice(int devindex)
|
|||
SDL_AudioDevice *device;
|
||||
|
||||
/* Initialize all variables that we clean on shutdown */
|
||||
device = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice));
|
||||
device = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
|
||||
if ( device ) {
|
||||
memset(device, 0, (sizeof *device));
|
||||
SDL_memset(device, 0, (sizeof *device));
|
||||
device->hidden = (struct SDL_PrivateAudioData *)
|
||||
malloc((sizeof *device->hidden));
|
||||
SDL_malloc((sizeof *device->hidden));
|
||||
}
|
||||
if ( (device == NULL) || (device->hidden == NULL) ) {
|
||||
SDL_OutOfMemory();
|
||||
if ( device ) {
|
||||
free(device);
|
||||
SDL_free(device);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
memset(device->hidden, 0, (sizeof *device->hidden));
|
||||
SDL_memset(device->hidden, 0, (sizeof *device->hidden));
|
||||
|
||||
/* Set the function pointers */
|
||||
device->OpenAudio = BE_OpenAudio;
|
||||
|
@ -102,7 +102,7 @@ static void FillSound(void *device, void *stream, size_t len,
|
|||
SDL_AudioDevice *audio = (SDL_AudioDevice *)device;
|
||||
|
||||
/* Silence the buffer, since it's ours */
|
||||
memset(stream, audio->spec.silence, len);
|
||||
SDL_memset(stream, audio->spec.silence, len);
|
||||
|
||||
/* Only do soemthing if audio is enabled */
|
||||
if ( ! audio->enabled )
|
||||
|
@ -115,7 +115,7 @@ static void FillSound(void *device, void *stream, size_t len,
|
|||
(Uint8 *)audio->convert.buf,audio->convert.len);
|
||||
SDL_mutexV(audio->mixer_lock);
|
||||
SDL_ConvertAudio(&audio->convert);
|
||||
memcpy(stream,audio->convert.buf,audio->convert.len_cvt);
|
||||
SDL_memcpy(stream,audio->convert.buf,audio->convert.len_cvt);
|
||||
} else {
|
||||
SDL_mutexP(audio->mixer_lock);
|
||||
(*audio->spec.callback)(audio->spec.userdata,
|
||||
|
|
|
@ -94,7 +94,7 @@ int DART_OpenAudio(_THIS, SDL_AudioSpec *spec)
|
|||
int rc;
|
||||
|
||||
// First thing is to try to open a given DART device!
|
||||
memset(&AmpOpenParms, 0, sizeof(MCI_AMP_OPEN_PARMS));
|
||||
SDL_memset(&AmpOpenParms, 0, sizeof(MCI_AMP_OPEN_PARMS));
|
||||
// pszDeviceType should contain the device type in low word, and device ordinal in high word!
|
||||
AmpOpenParms.pszDeviceType = (PSZ) (MCI_DEVTYPE_AUDIO_AMPMIX | (iDeviceOrd << 16));
|
||||
|
||||
|
@ -138,7 +138,7 @@ int DART_OpenAudio(_THIS, SDL_AudioSpec *spec)
|
|||
iBufSize = spec->size;
|
||||
|
||||
// Now query this device if it supports the given freq/bits/channels!
|
||||
memset(&(_this->hidden->MixSetupParms), 0, sizeof(MCI_MIXSETUP_PARMS));
|
||||
SDL_memset(&(_this->hidden->MixSetupParms), 0, sizeof(MCI_MIXSETUP_PARMS));
|
||||
_this->hidden->MixSetupParms.ulBitsPerSample = iBits;
|
||||
_this->hidden->MixSetupParms.ulFormatTag = MCI_WAVE_FORMAT_PCM;
|
||||
_this->hidden->MixSetupParms.ulSamplesPerSec = iFreq;
|
||||
|
@ -170,7 +170,7 @@ int DART_OpenAudio(_THIS, SDL_AudioSpec *spec)
|
|||
// Ok, the device is initialized.
|
||||
// Now we should allocate buffers. For this, we need a place where
|
||||
// the buffer descriptors will be:
|
||||
_this->hidden->pMixBuffers = (MCI_MIX_BUFFER *) malloc(sizeof(MCI_MIX_BUFFER)*iNumBufs);
|
||||
_this->hidden->pMixBuffers = (MCI_MIX_BUFFER *) SDL_malloc(sizeof(MCI_MIX_BUFFER)*iNumBufs);
|
||||
if (!(_this->hidden->pMixBuffers))
|
||||
{ // Not enough memory!
|
||||
// Close DART, and exit with error code!
|
||||
|
@ -190,7 +190,7 @@ int DART_OpenAudio(_THIS, SDL_AudioSpec *spec)
|
|||
if ((rc!=MCIERR_SUCCESS) || (iNumBufs != _this->hidden->BufferParms.ulNumBuffers) || (_this->hidden->BufferParms.ulBufferSize==0))
|
||||
{ // Could not allocate memory!
|
||||
// Close DART, and exit with error code!
|
||||
free(_this->hidden->pMixBuffers); _this->hidden->pMixBuffers = NULL;
|
||||
SDL_free(_this->hidden->pMixBuffers); _this->hidden->pMixBuffers = NULL;
|
||||
mciSendCommand(iDeviceOrd, MCI_CLOSE, MCI_WAIT, &GenericParms, 0);
|
||||
SDL_SetError("DART could not allocate buffers");
|
||||
return(-1);
|
||||
|
@ -200,18 +200,18 @@ int DART_OpenAudio(_THIS, SDL_AudioSpec *spec)
|
|||
int i;
|
||||
for (i=0; i<iNumBufs; i++)
|
||||
{
|
||||
pMixBufferDesc pBufferDesc = (pMixBufferDesc) malloc(sizeof(tMixBufferDesc));;
|
||||
pMixBufferDesc pBufferDesc = (pMixBufferDesc) SDL_malloc(sizeof(tMixBufferDesc));;
|
||||
// Check if this buffer was really allocated by DART
|
||||
if ((!(_this->hidden->pMixBuffers[i].pBuffer)) || (!pBufferDesc))
|
||||
{ // Wrong buffer!
|
||||
// Close DART, and exit with error code!
|
||||
// Free buffer descriptions
|
||||
{ int j;
|
||||
for (j=0; j<i; j++) free((void *)(_this->hidden->pMixBuffers[j].ulUserParm));
|
||||
for (j=0; j<i; j++) SDL_free((void *)(_this->hidden->pMixBuffers[j].ulUserParm));
|
||||
}
|
||||
// and cleanup
|
||||
mciSendCommand(iDeviceOrd, MCI_BUFFER, MCI_WAIT | MCI_DEALLOCATE_MEMORY, &(_this->hidden->BufferParms), 0);
|
||||
free(_this->hidden->pMixBuffers); _this->hidden->pMixBuffers = NULL;
|
||||
SDL_free(_this->hidden->pMixBuffers); _this->hidden->pMixBuffers = NULL;
|
||||
mciSendCommand(iDeviceOrd, MCI_CLOSE, MCI_WAIT, &GenericParms, 0);
|
||||
SDL_SetError("Error at internal buffer check");
|
||||
return(-1);
|
||||
|
@ -224,7 +224,7 @@ int DART_OpenAudio(_THIS, SDL_AudioSpec *spec)
|
|||
_this->hidden->pMixBuffers[i].ulFlags = 0; // Some stuff should be flagged here for DART, like end of
|
||||
// audio data, but as we will continously send
|
||||
// audio data, there will be no end.:)
|
||||
memset(_this->hidden->pMixBuffers[i].pBuffer, iSilence, iBufSize);
|
||||
SDL_memset(_this->hidden->pMixBuffers[i].pBuffer, iSilence, iBufSize);
|
||||
}
|
||||
}
|
||||
_this->hidden->iNextFreeBuffer = 0;
|
||||
|
@ -235,10 +235,10 @@ int DART_OpenAudio(_THIS, SDL_AudioSpec *spec)
|
|||
// Could not create event semaphore!
|
||||
{
|
||||
int i;
|
||||
for (i=0; i<iNumBufs; i++) free((void *)(_this->hidden->pMixBuffers[i].ulUserParm));
|
||||
for (i=0; i<iNumBufs; i++) SDL_free((void *)(_this->hidden->pMixBuffers[i].ulUserParm));
|
||||
}
|
||||
mciSendCommand(iDeviceOrd, MCI_BUFFER, MCI_WAIT | MCI_DEALLOCATE_MEMORY, &(_this->hidden->BufferParms), 0);
|
||||
free(_this->hidden->pMixBuffers); _this->hidden->pMixBuffers = NULL;
|
||||
SDL_free(_this->hidden->pMixBuffers); _this->hidden->pMixBuffers = NULL;
|
||||
mciSendCommand(iDeviceOrd, MCI_CLOSE, MCI_WAIT, &GenericParms, 0);
|
||||
SDL_SetError("Could not create event semaphore");
|
||||
return(-1);
|
||||
|
@ -363,14 +363,14 @@ void DART_CloseAudio(_THIS)
|
|||
// Free memory of buffer descriptions
|
||||
{
|
||||
int i;
|
||||
for (i=0; i<_this->hidden->iCurrNumBufs; i++) free((void *)(_this->hidden->pMixBuffers[i].ulUserParm));
|
||||
for (i=0; i<_this->hidden->iCurrNumBufs; i++) SDL_free((void *)(_this->hidden->pMixBuffers[i].ulUserParm));
|
||||
}
|
||||
|
||||
// Deallocate buffers
|
||||
rc = mciSendCommand(_this->hidden->iCurrDeviceOrd, MCI_BUFFER, MCI_WAIT | MCI_DEALLOCATE_MEMORY, &(_this->hidden->BufferParms), 0);
|
||||
|
||||
// Free bufferlist
|
||||
free(_this->hidden->pMixBuffers); _this->hidden->pMixBuffers = NULL;
|
||||
SDL_free(_this->hidden->pMixBuffers); _this->hidden->pMixBuffers = NULL;
|
||||
|
||||
// Close dart
|
||||
rc = mciSendCommand(_this->hidden->iCurrDeviceOrd, MCI_CLOSE, MCI_WAIT, &(GenericParms), 0);
|
||||
|
@ -385,8 +385,8 @@ int Audio_Available(void)
|
|||
|
||||
void Audio_DeleteDevice(SDL_AudioDevice *device)
|
||||
{
|
||||
free(device->hidden);
|
||||
free(device);
|
||||
SDL_free(device->hidden);
|
||||
SDL_free(device);
|
||||
}
|
||||
|
||||
SDL_AudioDevice *Audio_CreateDevice(int devindex)
|
||||
|
@ -394,21 +394,21 @@ SDL_AudioDevice *Audio_CreateDevice(int devindex)
|
|||
SDL_AudioDevice *this;
|
||||
|
||||
/* Initialize all variables that we clean on shutdown */
|
||||
this = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice));
|
||||
this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
|
||||
if ( this )
|
||||
{
|
||||
memset(this, 0, (sizeof *this));
|
||||
SDL_memset(this, 0, (sizeof *this));
|
||||
this->hidden = (struct SDL_PrivateAudioData *)
|
||||
malloc((sizeof *this->hidden));
|
||||
SDL_malloc((sizeof *this->hidden));
|
||||
}
|
||||
if ( (this == NULL) || (this->hidden == NULL) )
|
||||
{
|
||||
SDL_OutOfMemory();
|
||||
if ( this )
|
||||
free(this);
|
||||
SDL_free(this);
|
||||
return(0);
|
||||
}
|
||||
memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
|
||||
/* Set the function pointers */
|
||||
this->OpenAudio = DART_OpenAudio;
|
||||
|
|
|
@ -60,8 +60,8 @@ static int DCAUD_Available(void)
|
|||
|
||||
static void DCAUD_DeleteDevice(SDL_AudioDevice *device)
|
||||
{
|
||||
free(device->hidden);
|
||||
free(device);
|
||||
SDL_free(device->hidden);
|
||||
SDL_free(device);
|
||||
}
|
||||
|
||||
static SDL_AudioDevice *DCAUD_CreateDevice(int devindex)
|
||||
|
@ -69,20 +69,20 @@ static SDL_AudioDevice *DCAUD_CreateDevice(int devindex)
|
|||
SDL_AudioDevice *this;
|
||||
|
||||
/* Initialize all variables that we clean on shutdown */
|
||||
this = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice));
|
||||
this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
|
||||
if ( this ) {
|
||||
memset(this, 0, (sizeof *this));
|
||||
SDL_memset(this, 0, (sizeof *this));
|
||||
this->hidden = (struct SDL_PrivateAudioData *)
|
||||
malloc((sizeof *this->hidden));
|
||||
SDL_malloc((sizeof *this->hidden));
|
||||
}
|
||||
if ( (this == NULL) || (this->hidden == NULL) ) {
|
||||
SDL_OutOfMemory();
|
||||
if ( this ) {
|
||||
free(this);
|
||||
SDL_free(this);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
|
||||
/* Set the function pointers */
|
||||
this->OpenAudio = DCAUD_OpenAudio;
|
||||
|
@ -229,7 +229,7 @@ static int DCAUD_OpenAudio(_THIS, SDL_AudioSpec *spec)
|
|||
if ( this->hidden->mixbuf == NULL ) {
|
||||
return(-1);
|
||||
}
|
||||
memset(this->hidden->mixbuf, spec->silence, spec->size);
|
||||
SDL_memset(this->hidden->mixbuf, spec->silence, spec->size);
|
||||
this->hidden->leftpos = 0x11000;
|
||||
this->hidden->rightpos = 0x11000+spec->size;
|
||||
this->hidden->playing = 0;
|
||||
|
|
|
@ -62,7 +62,7 @@ static void DISKAUD_CloseAudio(_THIS);
|
|||
|
||||
static const char *DISKAUD_GetOutputFilename(void)
|
||||
{
|
||||
const char *envr = getenv(DISKENVR_OUTFILE);
|
||||
const char *envr = SDL_getenv(DISKENVR_OUTFILE);
|
||||
return((envr != NULL) ? envr : DISKDEFAULT_OUTFILE);
|
||||
}
|
||||
|
||||
|
@ -75,10 +75,10 @@ static int DISKAUD_Available(void)
|
|||
int exists = 0;
|
||||
struct stat statbuf;
|
||||
const char *fname = DISKAUD_GetOutputFilename();
|
||||
const char *envr = getenv("SDL_AUDIODRIVER");
|
||||
const char *envr = SDL_getenv("SDL_AUDIODRIVER");
|
||||
available = 0;
|
||||
|
||||
if ((envr) && (strcmp(envr, DISKAUD_DRIVER_NAME) == 0)) {
|
||||
if ((envr) && (SDL_strcmp(envr, DISKAUD_DRIVER_NAME) == 0)) {
|
||||
if (stat(fname, &statbuf) == 0)
|
||||
exists = 1;
|
||||
|
||||
|
@ -93,8 +93,8 @@ static int DISKAUD_Available(void)
|
|||
}
|
||||
return(available);
|
||||
#else
|
||||
const char *envr = getenv("SDL_AUDIODRIVER");
|
||||
if ((envr) && (strcmp(envr, DISKAUD_DRIVER_NAME) == 0)) {
|
||||
const char *envr = SDL_getenv("SDL_AUDIODRIVER");
|
||||
if ((envr) && (SDL_strcmp(envr, DISKAUD_DRIVER_NAME) == 0)) {
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
@ -104,8 +104,8 @@ static int DISKAUD_Available(void)
|
|||
|
||||
static void DISKAUD_DeleteDevice(SDL_AudioDevice *device)
|
||||
{
|
||||
free(device->hidden);
|
||||
free(device);
|
||||
SDL_free(device->hidden);
|
||||
SDL_free(device);
|
||||
}
|
||||
|
||||
static SDL_AudioDevice *DISKAUD_CreateDevice(int devindex)
|
||||
|
@ -114,22 +114,22 @@ static SDL_AudioDevice *DISKAUD_CreateDevice(int devindex)
|
|||
const char *envr;
|
||||
|
||||
/* Initialize all variables that we clean on shutdown */
|
||||
this = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice));
|
||||
this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
|
||||
if ( this ) {
|
||||
memset(this, 0, (sizeof *this));
|
||||
SDL_memset(this, 0, (sizeof *this));
|
||||
this->hidden = (struct SDL_PrivateAudioData *)
|
||||
malloc((sizeof *this->hidden));
|
||||
SDL_malloc((sizeof *this->hidden));
|
||||
}
|
||||
if ( (this == NULL) || (this->hidden == NULL) ) {
|
||||
SDL_OutOfMemory();
|
||||
if ( this ) {
|
||||
free(this);
|
||||
SDL_free(this);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
|
||||
envr = getenv(DISKENVR_WRITEDELAY);
|
||||
envr = SDL_getenv(DISKENVR_WRITEDELAY);
|
||||
this->hidden->write_delay = (envr) ? atoi(envr) : DISKDEFAULT_WRITEDELAY;
|
||||
|
||||
/* Set the function pointers */
|
||||
|
@ -216,7 +216,7 @@ static int DISKAUD_OpenAudio(_THIS, SDL_AudioSpec *spec)
|
|||
if ( this->hidden->mixbuf == NULL ) {
|
||||
return(-1);
|
||||
}
|
||||
memset(this->hidden->mixbuf, spec->silence, spec->size);
|
||||
SDL_memset(this->hidden->mixbuf, spec->silence, spec->size);
|
||||
|
||||
/* We're ready to rock and roll. :-) */
|
||||
return(0);
|
||||
|
|
|
@ -93,8 +93,8 @@ static int Audio_Available(void)
|
|||
|
||||
static void Audio_DeleteDevice(SDL_AudioDevice *device)
|
||||
{
|
||||
free(device->hidden);
|
||||
free(device);
|
||||
SDL_free(device->hidden);
|
||||
SDL_free(device);
|
||||
}
|
||||
|
||||
static SDL_AudioDevice *Audio_CreateDevice(int devindex)
|
||||
|
@ -102,20 +102,20 @@ static SDL_AudioDevice *Audio_CreateDevice(int devindex)
|
|||
SDL_AudioDevice *this;
|
||||
|
||||
/* Initialize all variables that we clean on shutdown */
|
||||
this = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice));
|
||||
this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
|
||||
if ( this ) {
|
||||
memset(this, 0, (sizeof *this));
|
||||
SDL_memset(this, 0, (sizeof *this));
|
||||
this->hidden = (struct SDL_PrivateAudioData *)
|
||||
malloc((sizeof *this->hidden));
|
||||
SDL_malloc((sizeof *this->hidden));
|
||||
}
|
||||
if ( (this == NULL) || (this->hidden == NULL) ) {
|
||||
SDL_OutOfMemory();
|
||||
if ( this ) {
|
||||
free(this);
|
||||
SDL_free(this);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
audio_fd = -1;
|
||||
|
||||
/* Set the function pointers */
|
||||
|
@ -428,11 +428,11 @@ static int DMA_OpenAudio(_THIS, SDL_AudioSpec *spec)
|
|||
dma_buf = NULL;
|
||||
return(-1);
|
||||
}
|
||||
memset(dma_buf, spec->silence, dma_len);
|
||||
SDL_memset(dma_buf, spec->silence, dma_len);
|
||||
|
||||
/* Check to see if we need to use select() workaround */
|
||||
{ char *workaround;
|
||||
workaround = getenv("SDL_DSP_NOSELECT");
|
||||
workaround = SDL_getenv("SDL_DSP_NOSELECT");
|
||||
if ( workaround ) {
|
||||
frame_ticks = (float)(spec->samples*1000)/spec->freq;
|
||||
next_frame = SDL_GetTicks()+frame_ticks;
|
||||
|
|
|
@ -62,8 +62,8 @@ static int Audio_Available(void)
|
|||
|
||||
static void Audio_DeleteDevice(SDL_AudioDevice *device)
|
||||
{
|
||||
free(device->hidden);
|
||||
free(device);
|
||||
SDL_free(device->hidden);
|
||||
SDL_free(device);
|
||||
}
|
||||
|
||||
static SDL_AudioDevice *Audio_CreateDevice(int devindex)
|
||||
|
@ -71,20 +71,20 @@ static SDL_AudioDevice *Audio_CreateDevice(int devindex)
|
|||
SDL_AudioDevice *this;
|
||||
|
||||
/* Initialize all variables that we clean on shutdown */
|
||||
this = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice));
|
||||
this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
|
||||
if ( this ) {
|
||||
memset(this, 0, (sizeof *this));
|
||||
SDL_memset(this, 0, (sizeof *this));
|
||||
this->hidden = (struct SDL_PrivateAudioData *)
|
||||
malloc((sizeof *this->hidden));
|
||||
SDL_malloc((sizeof *this->hidden));
|
||||
}
|
||||
if ( (this == NULL) || (this->hidden == NULL) ) {
|
||||
SDL_OutOfMemory();
|
||||
if ( this ) {
|
||||
free(this);
|
||||
SDL_free(this);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
|
||||
/* Set the function pointers */
|
||||
this->OpenAudio = AL_OpenAudio;
|
||||
|
@ -211,7 +211,7 @@ static int AL_OpenAudio(_THIS, SDL_AudioSpec *spec)
|
|||
SDL_OutOfMemory();
|
||||
return(-1);
|
||||
}
|
||||
memset(mixbuf, spec->silence, spec->size);
|
||||
SDL_memset(mixbuf, spec->silence, spec->size);
|
||||
|
||||
/* We're ready to rock and roll. :-) */
|
||||
return(0);
|
||||
|
|
|
@ -82,8 +82,8 @@ static int Audio_Available(void)
|
|||
|
||||
static void Audio_DeleteDevice(SDL_AudioDevice *device)
|
||||
{
|
||||
free(device->hidden);
|
||||
free(device);
|
||||
SDL_free(device->hidden);
|
||||
SDL_free(device);
|
||||
}
|
||||
|
||||
static SDL_AudioDevice *Audio_CreateDevice(int devindex)
|
||||
|
@ -91,20 +91,20 @@ static SDL_AudioDevice *Audio_CreateDevice(int devindex)
|
|||
SDL_AudioDevice *this;
|
||||
|
||||
/* Initialize all variables that we clean on shutdown */
|
||||
this = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice));
|
||||
this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
|
||||
if ( this ) {
|
||||
memset(this, 0, (sizeof *this));
|
||||
SDL_memset(this, 0, (sizeof *this));
|
||||
this->hidden = (struct SDL_PrivateAudioData *)
|
||||
malloc((sizeof *this->hidden));
|
||||
SDL_malloc((sizeof *this->hidden));
|
||||
}
|
||||
if ( (this == NULL) || (this->hidden == NULL) ) {
|
||||
SDL_OutOfMemory();
|
||||
if ( this ) {
|
||||
free(this);
|
||||
SDL_free(this);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
audio_fd = -1;
|
||||
|
||||
/* Set the function pointers */
|
||||
|
@ -322,7 +322,7 @@ static int DSP_OpenAudio(_THIS, SDL_AudioSpec *spec)
|
|||
DSP_CloseAudio(this);
|
||||
return(-1);
|
||||
}
|
||||
memset(mixbuf, spec->silence, spec->size);
|
||||
SDL_memset(mixbuf, spec->silence, spec->size);
|
||||
|
||||
/* Get the parent process id (we're the parent of the audio thread) */
|
||||
parent = getpid();
|
||||
|
|
|
@ -142,8 +142,8 @@ static int Audio_Available(void)
|
|||
|
||||
static void Audio_DeleteDevice(SDL_AudioDevice *device)
|
||||
{
|
||||
free(device->hidden);
|
||||
free(device);
|
||||
SDL_free(device->hidden);
|
||||
SDL_free(device);
|
||||
UnloadESDLibrary();
|
||||
}
|
||||
|
||||
|
@ -153,20 +153,20 @@ static SDL_AudioDevice *Audio_CreateDevice(int devindex)
|
|||
|
||||
/* Initialize all variables that we clean on shutdown */
|
||||
LoadESDLibrary();
|
||||
this = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice));
|
||||
this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
|
||||
if ( this ) {
|
||||
memset(this, 0, (sizeof *this));
|
||||
SDL_memset(this, 0, (sizeof *this));
|
||||
this->hidden = (struct SDL_PrivateAudioData *)
|
||||
malloc((sizeof *this->hidden));
|
||||
SDL_malloc((sizeof *this->hidden));
|
||||
}
|
||||
if ( (this == NULL) || (this->hidden == NULL) ) {
|
||||
SDL_OutOfMemory();
|
||||
if ( this ) {
|
||||
free(this);
|
||||
SDL_free(this);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
audio_fd = -1;
|
||||
|
||||
/* Set the function pointers */
|
||||
|
@ -261,7 +261,7 @@ static char *get_progname(void)
|
|||
fp = fopen(temp, "r");
|
||||
if ( fp != NULL ) {
|
||||
if ( fgets(temp, sizeof(temp)-1, fp) ) {
|
||||
progname = strrchr(temp, '/');
|
||||
progname = SDL_strrchr(temp, '/');
|
||||
if ( progname == NULL ) {
|
||||
progname = temp;
|
||||
} else {
|
||||
|
@ -318,7 +318,7 @@ static int ESD_OpenAudio(_THIS, SDL_AudioSpec *spec)
|
|||
if ( mixbuf == NULL ) {
|
||||
return(-1);
|
||||
}
|
||||
memset(mixbuf, spec->silence, spec->size);
|
||||
SDL_memset(mixbuf, spec->silence, spec->size);
|
||||
|
||||
/* Get the parent process id (we're the parent of the audio thread) */
|
||||
parent = getpid();
|
||||
|
|
|
@ -52,8 +52,8 @@ static int Audio_Available(void)
|
|||
|
||||
static void Audio_DeleteDevice(SDL_AudioDevice *device)
|
||||
{
|
||||
free(device->hidden);
|
||||
free(device);
|
||||
SDL_free(device->hidden);
|
||||
SDL_free(device);
|
||||
}
|
||||
|
||||
static SDL_AudioDevice *Audio_CreateDevice(int devindex)
|
||||
|
@ -61,20 +61,20 @@ static SDL_AudioDevice *Audio_CreateDevice(int devindex)
|
|||
SDL_AudioDevice *this;
|
||||
|
||||
/* Initialize all variables that we clean on shutdown */
|
||||
this = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice));
|
||||
this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
|
||||
if ( this ) {
|
||||
memset(this, 0, (sizeof *this));
|
||||
SDL_memset(this, 0, (sizeof *this));
|
||||
this->hidden = (struct SDL_PrivateAudioData *)
|
||||
malloc((sizeof *this->hidden));
|
||||
SDL_malloc((sizeof *this->hidden));
|
||||
}
|
||||
if ( (this == NULL) || (this->hidden == NULL) ) {
|
||||
SDL_OutOfMemory();
|
||||
if ( this ) {
|
||||
free(this);
|
||||
SDL_free(this);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
|
||||
/* Set the function pointers */
|
||||
this->OpenAudio = Core_OpenAudio;
|
||||
|
@ -106,7 +106,7 @@ static OSStatus audioCallback (void *inRefCon,
|
|||
|
||||
/* Only do anything if audio is enabled and not paused */
|
||||
if ( ! this->enabled || this->paused ) {
|
||||
memset(ioData->mData, this->spec.silence, ioData->mDataByteSize);
|
||||
SDL_memset(ioData->mData, this->spec.silence, ioData->mDataByteSize);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -121,7 +121,7 @@ static OSStatus audioCallback (void *inRefCon,
|
|||
while (remaining > 0) {
|
||||
if (bufferOffset >= bufferSize) {
|
||||
/* Generate the data */
|
||||
memset(buffer, this->spec.silence, bufferSize);
|
||||
SDL_memset(buffer, this->spec.silence, bufferSize);
|
||||
SDL_mutexP(this->mixer_lock);
|
||||
(*this->spec.callback)(this->spec.userdata,
|
||||
buffer, bufferSize);
|
||||
|
@ -132,7 +132,7 @@ static OSStatus audioCallback (void *inRefCon,
|
|||
len = bufferSize - bufferOffset;
|
||||
if (len > remaining)
|
||||
len = remaining;
|
||||
memcpy(ptr, buffer + bufferOffset, len);
|
||||
SDL_memcpy(ptr, buffer + bufferOffset, len);
|
||||
ptr += len;
|
||||
remaining -= len;
|
||||
bufferOffset += len;
|
||||
|
@ -189,7 +189,7 @@ void Core_CloseAudio(_THIS)
|
|||
return;
|
||||
}
|
||||
|
||||
free(buffer);
|
||||
SDL_free(buffer);
|
||||
}
|
||||
|
||||
#define CHECK_RESULT(msg) \
|
||||
|
@ -269,7 +269,7 @@ int Core_OpenAudio(_THIS, SDL_AudioSpec *spec)
|
|||
|
||||
/* Allocate a sample buffer */
|
||||
bufferOffset = bufferSize = this->spec.size;
|
||||
buffer = malloc(bufferSize);
|
||||
buffer = SDL_malloc(bufferSize);
|
||||
assert(buffer);
|
||||
|
||||
/* Finally, start processing of the audio unit */
|
||||
|
|
|
@ -66,8 +66,8 @@ static int Audio_Available(void)
|
|||
|
||||
static void Audio_DeleteDevice(SDL_AudioDevice *device)
|
||||
{
|
||||
free(device->hidden);
|
||||
free(device);
|
||||
SDL_free(device->hidden);
|
||||
SDL_free(device);
|
||||
}
|
||||
|
||||
static SDL_AudioDevice *Audio_CreateDevice(int devindex)
|
||||
|
@ -75,20 +75,20 @@ static SDL_AudioDevice *Audio_CreateDevice(int devindex)
|
|||
SDL_AudioDevice *this;
|
||||
|
||||
/* Initialize all variables that we clean on shutdown */
|
||||
this = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice));
|
||||
this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
|
||||
if ( this ) {
|
||||
memset(this, 0, (sizeof *this));
|
||||
SDL_memset(this, 0, (sizeof *this));
|
||||
this->hidden = (struct SDL_PrivateAudioData *)
|
||||
malloc((sizeof *this->hidden));
|
||||
SDL_malloc((sizeof *this->hidden));
|
||||
}
|
||||
if ( (this == NULL) || (this->hidden == NULL) ) {
|
||||
SDL_OutOfMemory();
|
||||
if ( this ) {
|
||||
free(this);
|
||||
SDL_free(this);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
|
||||
/* Set the function pointers */
|
||||
this->OpenAudio = Mac_OpenAudio;
|
||||
|
@ -135,7 +135,7 @@ static void mix_buffer(SDL_AudioDevice *audio, UInt8 *buffer)
|
|||
if ( audio->convert.len_cvt != audio->spec.size ) {
|
||||
/* Uh oh... probably crashes here */;
|
||||
}
|
||||
memcpy(buffer, audio->convert.buf, audio->convert.len_cvt);
|
||||
SDL_memcpy(buffer, audio->convert.buf, audio->convert.len_cvt);
|
||||
} else {
|
||||
audio->spec.callback(audio->spec.userdata, buffer, audio->spec.size);
|
||||
}
|
||||
|
@ -267,7 +267,7 @@ static int Mac_OpenAudio(_THIS, SDL_AudioSpec *spec) {
|
|||
}
|
||||
|
||||
/* Create the sound manager channel */
|
||||
channel = (SndChannelPtr)malloc(sizeof(*channel));
|
||||
channel = (SndChannelPtr)SDL_malloc(sizeof(*channel));
|
||||
if ( channel == NULL ) {
|
||||
SDL_OutOfMemory();
|
||||
return(-1);
|
||||
|
@ -281,7 +281,7 @@ static int Mac_OpenAudio(_THIS, SDL_AudioSpec *spec) {
|
|||
channel->qLength = 128;
|
||||
if ( SndNewChannel(&channel, sampledSynth, initOptions, callback) != noErr ) {
|
||||
SDL_SetError("Unable to create audio channel");
|
||||
free(channel);
|
||||
SDL_free(channel);
|
||||
channel = NULL;
|
||||
return(-1);
|
||||
}
|
||||
|
@ -311,7 +311,7 @@ static void Mac_CloseAudio(_THIS) {
|
|||
|
||||
for ( i=0; i<2; ++i ) {
|
||||
if ( buffer[i] ) {
|
||||
free(buffer[i]);
|
||||
SDL_free(buffer[i]);
|
||||
buffer[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -355,7 +355,7 @@ void sndDoubleBackProc (SndChannelPtr chan, SndDoubleBufferPtr newbuf)
|
|||
/* Uh oh... probably crashes here */;
|
||||
}
|
||||
#endif
|
||||
memcpy(newbuf->dbSoundData, audio->convert.buf,
|
||||
SDL_memcpy(newbuf->dbSoundData, audio->convert.buf,
|
||||
audio->convert.len_cvt);
|
||||
} else {
|
||||
audio->spec.callback(audio->spec.userdata,
|
||||
|
@ -400,7 +400,7 @@ static void Mac_CloseAudio(_THIS)
|
|||
}
|
||||
for ( i=0; i<2; ++i ) {
|
||||
if ( audio_buf[i] ) {
|
||||
free(audio_buf[i]);
|
||||
SDL_free(audio_buf[i]);
|
||||
audio_buf[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -435,7 +435,7 @@ static int Mac_OpenAudio(_THIS, SDL_AudioSpec *spec)
|
|||
SDL_CalculateAudioSpec(spec);
|
||||
|
||||
/* initialize the double-back header */
|
||||
memset(&audio_dbh, 0, sizeof(audio_dbh));
|
||||
SDL_memset(&audio_dbh, 0, sizeof(audio_dbh));
|
||||
doubleBackProc = NewSndDoubleBackProc (sndDoubleBackProc);
|
||||
sample_bits = spec->size / spec->samples / spec->channels * 8;
|
||||
|
||||
|
@ -467,7 +467,7 @@ static int Mac_OpenAudio(_THIS, SDL_AudioSpec *spec)
|
|||
}
|
||||
|
||||
/* Create the sound manager channel */
|
||||
channel = (SndChannelPtr)malloc(sizeof(*channel));
|
||||
channel = (SndChannelPtr)SDL_malloc(sizeof(*channel));
|
||||
if ( channel == NULL ) {
|
||||
SDL_OutOfMemory();
|
||||
return(-1);
|
||||
|
@ -481,7 +481,7 @@ static int Mac_OpenAudio(_THIS, SDL_AudioSpec *spec)
|
|||
channel->qLength = 128;
|
||||
if ( SndNewChannel(&channel, sampledSynth, initOptions, 0L) != noErr ) {
|
||||
SDL_SetError("Unable to create audio channel");
|
||||
free(channel);
|
||||
SDL_free(channel);
|
||||
channel = NULL;
|
||||
return(-1);
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ void SDL_MintAudio_Callback(void)
|
|||
SDL_AudioDevice *audio = SDL_MintAudio_device;
|
||||
|
||||
buffer = SDL_MintAudio_audiobuf[SDL_MintAudio_numbuf];
|
||||
memset(buffer, audio->spec.silence, audio->spec.size);
|
||||
SDL_memset(buffer, audio->spec.silence, audio->spec.size);
|
||||
|
||||
if (audio->paused)
|
||||
return;
|
||||
|
@ -76,11 +76,11 @@ void SDL_MintAudio_Callback(void)
|
|||
} else {
|
||||
silence = 0;
|
||||
}
|
||||
memset(audio->convert.buf, silence, audio->convert.len);
|
||||
SDL_memset(audio->convert.buf, silence, audio->convert.len);
|
||||
audio->spec.callback(audio->spec.userdata,
|
||||
(Uint8 *)audio->convert.buf,audio->convert.len);
|
||||
SDL_ConvertAudio(&audio->convert);
|
||||
memcpy(buffer, audio->convert.buf, audio->convert.len_cvt);
|
||||
SDL_memcpy(buffer, audio->convert.buf, audio->convert.len_cvt);
|
||||
} else {
|
||||
audio->spec.callback(audio->spec.userdata, buffer, audio->spec.size);
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ void SDL_MintAudio_AddFrequency(_THIS, Uint32 frequency, Uint32 clock,
|
|||
/* Put all following ones farer */
|
||||
if (MINTAUDIO_freqcount>0) {
|
||||
for (i=MINTAUDIO_freqcount; i>p; i--) {
|
||||
memcpy(&MINTAUDIO_frequencies[i], &MINTAUDIO_frequencies[i-1], sizeof(mint_frequency_t));
|
||||
SDL_memcpy(&MINTAUDIO_frequencies[i], &MINTAUDIO_frequencies[i-1], sizeof(mint_frequency_t));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -81,10 +81,10 @@ static void Mint_InitAudio(_THIS, SDL_AudioSpec *spec);
|
|||
|
||||
static int Audio_Available(void)
|
||||
{
|
||||
const char *envr = getenv("SDL_AUDIODRIVER");
|
||||
const char *envr = SDL_getenv("SDL_AUDIODRIVER");
|
||||
|
||||
/* Check if user asked a different audio driver */
|
||||
if ((envr) && (strcmp(envr, MINT_AUDIO_DRIVER_NAME)!=0)) {
|
||||
if ((envr) && (SDL_strcmp(envr, MINT_AUDIO_DRIVER_NAME)!=0)) {
|
||||
DEBUG_PRINT((DEBUG_NAME "user asked a different audio driver\n"));
|
||||
return 0;
|
||||
}
|
||||
|
@ -121,8 +121,8 @@ static int Audio_Available(void)
|
|||
|
||||
static void Audio_DeleteDevice(SDL_AudioDevice *device)
|
||||
{
|
||||
free(device->hidden);
|
||||
free(device);
|
||||
SDL_free(device->hidden);
|
||||
SDL_free(device);
|
||||
}
|
||||
|
||||
static SDL_AudioDevice *Audio_CreateDevice(int devindex)
|
||||
|
@ -130,20 +130,20 @@ static SDL_AudioDevice *Audio_CreateDevice(int devindex)
|
|||
SDL_AudioDevice *this;
|
||||
|
||||
/* Initialize all variables that we clean on shutdown */
|
||||
this = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice));
|
||||
this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
|
||||
if ( this ) {
|
||||
memset(this, 0, (sizeof *this));
|
||||
SDL_memset(this, 0, (sizeof *this));
|
||||
this->hidden = (struct SDL_PrivateAudioData *)
|
||||
malloc((sizeof *this->hidden));
|
||||
SDL_malloc((sizeof *this->hidden));
|
||||
}
|
||||
if ( (this == NULL) || (this->hidden == NULL) ) {
|
||||
SDL_OutOfMemory();
|
||||
if ( this ) {
|
||||
free(this);
|
||||
SDL_free(this);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
|
||||
/* Set the function pointers */
|
||||
this->OpenAudio = Mint_OpenAudio;
|
||||
|
@ -347,7 +347,7 @@ static int Mint_OpenAudio(_THIS, SDL_AudioSpec *spec)
|
|||
}
|
||||
SDL_MintAudio_audiobuf[1] = SDL_MintAudio_audiobuf[0] + spec->size ;
|
||||
SDL_MintAudio_numbuf=0;
|
||||
memset(SDL_MintAudio_audiobuf[0], spec->silence, spec->size *2);
|
||||
SDL_memset(SDL_MintAudio_audiobuf[0], spec->silence, spec->size *2);
|
||||
SDL_MintAudio_audiosize = spec->size;
|
||||
SDL_MintAudio_mutex = 0;
|
||||
|
||||
|
|
|
@ -85,10 +85,10 @@ static void Mint_GsxbNullInterrupt(void);
|
|||
|
||||
static int Audio_Available(void)
|
||||
{
|
||||
const char *envr = getenv("SDL_AUDIODRIVER");
|
||||
const char *envr = SDL_getenv("SDL_AUDIODRIVER");
|
||||
|
||||
/* Check if user asked a different audio driver */
|
||||
if ((envr) && (strcmp(envr, MINT_AUDIO_DRIVER_NAME)!=0)) {
|
||||
if ((envr) && (SDL_strcmp(envr, MINT_AUDIO_DRIVER_NAME)!=0)) {
|
||||
DEBUG_PRINT((DEBUG_NAME "user asked a different audio driver\n"));
|
||||
return(0);
|
||||
}
|
||||
|
@ -127,8 +127,8 @@ static int Audio_Available(void)
|
|||
|
||||
static void Audio_DeleteDevice(SDL_AudioDevice *device)
|
||||
{
|
||||
free(device->hidden);
|
||||
free(device);
|
||||
SDL_free(device->hidden);
|
||||
SDL_free(device);
|
||||
}
|
||||
|
||||
static SDL_AudioDevice *Audio_CreateDevice(int devindex)
|
||||
|
@ -136,20 +136,20 @@ static SDL_AudioDevice *Audio_CreateDevice(int devindex)
|
|||
SDL_AudioDevice *this;
|
||||
|
||||
/* Initialize all variables that we clean on shutdown */
|
||||
this = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice));
|
||||
this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
|
||||
if ( this ) {
|
||||
memset(this, 0, (sizeof *this));
|
||||
SDL_memset(this, 0, (sizeof *this));
|
||||
this->hidden = (struct SDL_PrivateAudioData *)
|
||||
malloc((sizeof *this->hidden));
|
||||
SDL_malloc((sizeof *this->hidden));
|
||||
}
|
||||
if ( (this == NULL) || (this->hidden == NULL) ) {
|
||||
SDL_OutOfMemory();
|
||||
if ( this ) {
|
||||
free(this);
|
||||
SDL_free(this);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
|
||||
/* Set the function pointers */
|
||||
this->OpenAudio = Mint_OpenAudio;
|
||||
|
@ -384,7 +384,7 @@ static int Mint_OpenAudio(_THIS, SDL_AudioSpec *spec)
|
|||
}
|
||||
SDL_MintAudio_audiobuf[1] = SDL_MintAudio_audiobuf[0] + spec->size ;
|
||||
SDL_MintAudio_numbuf=0;
|
||||
memset(SDL_MintAudio_audiobuf[0], spec->silence, spec->size *2);
|
||||
SDL_memset(SDL_MintAudio_audiobuf[0], spec->silence, spec->size *2);
|
||||
SDL_MintAudio_audiosize = spec->size;
|
||||
SDL_MintAudio_mutex = 0;
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ static void Mint_InitAudio(_THIS, SDL_AudioSpec *spec);
|
|||
static int Audio_Available(void)
|
||||
{
|
||||
unsigned long dummy;
|
||||
const char *envr = getenv("SDL_AUDIODRIVER");
|
||||
const char *envr = SDL_getenv("SDL_AUDIODRIVER");
|
||||
|
||||
SDL_MintAudio_mint_present = (Getcookie(C_MiNT, &dummy) == C_FOUND);
|
||||
|
||||
|
@ -94,7 +94,7 @@ static int Audio_Available(void)
|
|||
}
|
||||
|
||||
/* Check if user asked a different audio driver */
|
||||
if ((envr) && (strcmp(envr, MINT_AUDIO_DRIVER_NAME)!=0)) {
|
||||
if ((envr) && (SDL_strcmp(envr, MINT_AUDIO_DRIVER_NAME)!=0)) {
|
||||
DEBUG_PRINT((DEBUG_NAME "user asked a different audio driver\n"));
|
||||
return(0);
|
||||
}
|
||||
|
@ -141,8 +141,8 @@ static int Audio_Available(void)
|
|||
|
||||
static void Audio_DeleteDevice(SDL_AudioDevice *device)
|
||||
{
|
||||
free(device->hidden);
|
||||
free(device);
|
||||
SDL_free(device->hidden);
|
||||
SDL_free(device);
|
||||
}
|
||||
|
||||
static SDL_AudioDevice *Audio_CreateDevice(int devindex)
|
||||
|
@ -150,20 +150,20 @@ static SDL_AudioDevice *Audio_CreateDevice(int devindex)
|
|||
SDL_AudioDevice *this;
|
||||
|
||||
/* Initialize all variables that we clean on shutdown */
|
||||
this = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice));
|
||||
this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
|
||||
if ( this ) {
|
||||
memset(this, 0, (sizeof *this));
|
||||
SDL_memset(this, 0, (sizeof *this));
|
||||
this->hidden = (struct SDL_PrivateAudioData *)
|
||||
malloc((sizeof *this->hidden));
|
||||
SDL_malloc((sizeof *this->hidden));
|
||||
}
|
||||
if ( (this == NULL) || (this->hidden == NULL) ) {
|
||||
SDL_OutOfMemory();
|
||||
if ( this ) {
|
||||
free(this);
|
||||
SDL_free(this);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
|
||||
/* Set the function pointers */
|
||||
this->OpenAudio = Mint_OpenAudio;
|
||||
|
@ -388,7 +388,7 @@ static int Mint_OpenAudio(_THIS, SDL_AudioSpec *spec)
|
|||
}
|
||||
SDL_MintAudio_audiobuf[1] = SDL_MintAudio_audiobuf[0] + spec->size ;
|
||||
SDL_MintAudio_numbuf=0;
|
||||
memset(SDL_MintAudio_audiobuf[0], spec->silence, spec->size *2);
|
||||
SDL_memset(SDL_MintAudio_audiobuf[0], spec->silence, spec->size *2);
|
||||
SDL_MintAudio_audiosize = spec->size;
|
||||
SDL_MintAudio_mutex = 0;
|
||||
|
||||
|
|
|
@ -89,10 +89,10 @@ static void Mint_InitAudio(_THIS, SDL_AudioSpec *spec);
|
|||
|
||||
static int Audio_Available(void)
|
||||
{
|
||||
const char *envr = getenv("SDL_AUDIODRIVER");
|
||||
const char *envr = SDL_getenv("SDL_AUDIODRIVER");
|
||||
|
||||
/* Check if user asked a different audio driver */
|
||||
if ((envr) && (strcmp(envr, MINT_AUDIO_DRIVER_NAME)!=0)) {
|
||||
if ((envr) && (SDL_strcmp(envr, MINT_AUDIO_DRIVER_NAME)!=0)) {
|
||||
DEBUG_PRINT((DEBUG_NAME "user asked a different audio driver\n"));
|
||||
return(0);
|
||||
}
|
||||
|
@ -121,8 +121,8 @@ static int Audio_Available(void)
|
|||
|
||||
static void Audio_DeleteDevice(SDL_AudioDevice *device)
|
||||
{
|
||||
free(device->hidden);
|
||||
free(device);
|
||||
SDL_free(device->hidden);
|
||||
SDL_free(device);
|
||||
}
|
||||
|
||||
static SDL_AudioDevice *Audio_CreateDevice(int devindex)
|
||||
|
@ -130,20 +130,20 @@ static SDL_AudioDevice *Audio_CreateDevice(int devindex)
|
|||
SDL_AudioDevice *this;
|
||||
|
||||
/* Initialize all variables that we clean on shutdown */
|
||||
this = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice));
|
||||
this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
|
||||
if ( this ) {
|
||||
memset(this, 0, (sizeof *this));
|
||||
SDL_memset(this, 0, (sizeof *this));
|
||||
this->hidden = (struct SDL_PrivateAudioData *)
|
||||
malloc((sizeof *this->hidden));
|
||||
SDL_malloc((sizeof *this->hidden));
|
||||
}
|
||||
if ( (this == NULL) || (this->hidden == NULL) ) {
|
||||
SDL_OutOfMemory();
|
||||
if ( this ) {
|
||||
free(this);
|
||||
SDL_free(this);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
|
||||
/* Set the function pointers */
|
||||
this->OpenAudio = Mint_OpenAudio;
|
||||
|
@ -308,7 +308,7 @@ static int Mint_OpenAudio(_THIS, SDL_AudioSpec *spec)
|
|||
}
|
||||
SDL_MintAudio_audiobuf[1] = SDL_MintAudio_audiobuf[0] + spec->size ;
|
||||
SDL_MintAudio_numbuf=0;
|
||||
memset(SDL_MintAudio_audiobuf[0], spec->silence, spec->size *2);
|
||||
SDL_memset(SDL_MintAudio_audiobuf[0], spec->silence, spec->size *2);
|
||||
SDL_MintAudio_audiosize = spec->size;
|
||||
SDL_MintAudio_mutex = 0;
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ static void Mint_InitAudio(_THIS, SDL_AudioSpec *spec);
|
|||
static int Audio_Available(void)
|
||||
{
|
||||
unsigned long dummy;
|
||||
const char *envr = getenv("SDL_AUDIODRIVER");
|
||||
const char *envr = SDL_getenv("SDL_AUDIODRIVER");
|
||||
|
||||
SDL_MintAudio_mint_present = (Getcookie(C_MiNT, &dummy) == C_FOUND);
|
||||
|
||||
|
@ -94,7 +94,7 @@ static int Audio_Available(void)
|
|||
}
|
||||
|
||||
/* Check if user asked a different audio driver */
|
||||
if ((envr) && (strcmp(envr, MINT_AUDIO_DRIVER_NAME)!=0)) {
|
||||
if ((envr) && (SDL_strcmp(envr, MINT_AUDIO_DRIVER_NAME)!=0)) {
|
||||
DEBUG_PRINT((DEBUG_NAME "user asked a different audio driver\n"));
|
||||
return(0);
|
||||
}
|
||||
|
@ -124,8 +124,8 @@ static int Audio_Available(void)
|
|||
|
||||
static void Audio_DeleteDevice(SDL_AudioDevice *device)
|
||||
{
|
||||
free(device->hidden);
|
||||
free(device);
|
||||
SDL_free(device->hidden);
|
||||
SDL_free(device);
|
||||
}
|
||||
|
||||
static SDL_AudioDevice *Audio_CreateDevice(int devindex)
|
||||
|
@ -133,20 +133,20 @@ static SDL_AudioDevice *Audio_CreateDevice(int devindex)
|
|||
SDL_AudioDevice *this;
|
||||
|
||||
/* Initialize all variables that we clean on shutdown */
|
||||
this = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice));
|
||||
this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
|
||||
if ( this ) {
|
||||
memset(this, 0, (sizeof *this));
|
||||
SDL_memset(this, 0, (sizeof *this));
|
||||
this->hidden = (struct SDL_PrivateAudioData *)
|
||||
malloc((sizeof *this->hidden));
|
||||
SDL_malloc((sizeof *this->hidden));
|
||||
}
|
||||
if ( (this == NULL) || (this->hidden == NULL) ) {
|
||||
SDL_OutOfMemory();
|
||||
if ( this ) {
|
||||
free(this);
|
||||
SDL_free(this);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
|
||||
/* Set the function pointers */
|
||||
this->OpenAudio = Mint_OpenAudio;
|
||||
|
@ -285,7 +285,7 @@ static void Mint_CheckExternalClock(_THIS)
|
|||
DEBUG_PRINT((DEBUG_NAME "Not enough memory for the measure\n"));
|
||||
return;
|
||||
}
|
||||
memset(buffer, 0, SIZE_BUF_CLOCK_MEASURE);
|
||||
SDL_memset(buffer, 0, SIZE_BUF_CLOCK_MEASURE);
|
||||
|
||||
Buffoper(0);
|
||||
Settracks(0,0);
|
||||
|
@ -477,7 +477,7 @@ static int Mint_OpenAudio(_THIS, SDL_AudioSpec *spec)
|
|||
}
|
||||
SDL_MintAudio_audiobuf[1] = SDL_MintAudio_audiobuf[0] + spec->size ;
|
||||
SDL_MintAudio_numbuf=0;
|
||||
memset(SDL_MintAudio_audiobuf[0], spec->silence, spec->size *2);
|
||||
SDL_memset(SDL_MintAudio_audiobuf[0], spec->silence, spec->size *2);
|
||||
SDL_MintAudio_audiosize = spec->size;
|
||||
SDL_MintAudio_mutex = 0;
|
||||
|
||||
|
|
|
@ -43,10 +43,10 @@ static void Audio_DeleteDevice(SDL_AudioDevice *device)
|
|||
{
|
||||
if ( device ) {
|
||||
if ( device->hidden ) {
|
||||
free(device->hidden);
|
||||
SDL_free(device->hidden);
|
||||
device->hidden = NULL;
|
||||
}
|
||||
free(device);
|
||||
SDL_free(device);
|
||||
device = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -56,19 +56,19 @@ static SDL_AudioDevice *Audio_CreateDevice(int devindex)
|
|||
SDL_AudioDevice *this;
|
||||
|
||||
/* Initialize all variables that we clean on shutdown */
|
||||
this = malloc(sizeof(SDL_AudioDevice));
|
||||
this = SDL_malloc(sizeof(SDL_AudioDevice));
|
||||
if ( this ) {
|
||||
memset(this, 0, (sizeof *this));
|
||||
this->hidden = malloc((sizeof *this->hidden));
|
||||
SDL_memset(this, 0, (sizeof *this));
|
||||
this->hidden = SDL_malloc((sizeof *this->hidden));
|
||||
}
|
||||
if ( (this == NULL) || (this->hidden == NULL) ) {
|
||||
SDL_OutOfMemory();
|
||||
if ( this ) {
|
||||
free(this);
|
||||
SDL_free(this);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
/* Set the function pointers */
|
||||
this->OpenAudio = MME_OpenAudio;
|
||||
this->WaitAudio = MME_WaitAudio;
|
||||
|
@ -92,7 +92,7 @@ static void SetMMerror(char *function, MMRESULT code)
|
|||
char errbuf[MAXERRORLENGTH];
|
||||
|
||||
sprintf(errbuf, "%s: ", function);
|
||||
len = strlen(errbuf);
|
||||
len = SDL_strlen(errbuf);
|
||||
waveOutGetErrorText(code, errbuf+len, MAXERRORLENGTH-len);
|
||||
SDL_SetError("%s",errbuf);
|
||||
}
|
||||
|
|
|
@ -66,8 +66,8 @@ static int Audio_Available(void)
|
|||
|
||||
static void Audio_DeleteDevice(SDL_AudioDevice *device)
|
||||
{
|
||||
free(device->hidden);
|
||||
free(device);
|
||||
SDL_free(device->hidden);
|
||||
SDL_free(device);
|
||||
}
|
||||
|
||||
static SDL_AudioDevice *Audio_CreateDevice(int devindex)
|
||||
|
@ -75,20 +75,20 @@ static SDL_AudioDevice *Audio_CreateDevice(int devindex)
|
|||
SDL_AudioDevice *this;
|
||||
|
||||
/* Initialize all variables that we clean on shutdown */
|
||||
this = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice));
|
||||
this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
|
||||
if ( this ) {
|
||||
memset(this, 0, (sizeof *this));
|
||||
SDL_memset(this, 0, (sizeof *this));
|
||||
this->hidden = (struct SDL_PrivateAudioData *)
|
||||
malloc((sizeof *this->hidden));
|
||||
SDL_malloc((sizeof *this->hidden));
|
||||
}
|
||||
if ( (this == NULL) || (this->hidden == NULL) ) {
|
||||
SDL_OutOfMemory();
|
||||
if ( this ) {
|
||||
free(this);
|
||||
SDL_free(this);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
|
||||
/* Set the function pointers */
|
||||
this->OpenAudio = NAS_OpenAudio;
|
||||
|
@ -293,7 +293,7 @@ static int NAS_OpenAudio(_THIS, SDL_AudioSpec *spec)
|
|||
if ( this->hidden->mixbuf == NULL ) {
|
||||
return(-1);
|
||||
}
|
||||
memset(this->hidden->mixbuf, spec->silence, spec->size);
|
||||
SDL_memset(this->hidden->mixbuf, spec->silence, spec->size);
|
||||
|
||||
/* Get the parent process id (we're the parent of the audio thread) */
|
||||
this->hidden->parent = getpid();
|
||||
|
|
|
@ -94,7 +94,7 @@ static int NTO_CheckBuggyCards(_THIS, unsigned long checkfor)
|
|||
|
||||
for (it=0; it<QSA_WA_CARDS; it++)
|
||||
{
|
||||
if (strcmp(buggycards[it].cardname, scardname)==0)
|
||||
if (SDL_strcmp(buggycards[it].cardname, scardname)==0)
|
||||
{
|
||||
if (buggycards[it].bugtype==checkfor)
|
||||
{
|
||||
|
@ -120,7 +120,7 @@ static void NTO_ThreadInit(_THIS)
|
|||
/* PCM transfer channel parameters initialize function */
|
||||
static void NTO_InitAudioParams(snd_pcm_channel_params_t* cpars)
|
||||
{
|
||||
memset(cpars, 0, sizeof(snd_pcm_channel_params_t));
|
||||
SDL_memset(cpars, 0, sizeof(snd_pcm_channel_params_t));
|
||||
|
||||
cpars->channel = SND_PCM_CHANNEL_PLAYBACK;
|
||||
cpars->mode = SND_PCM_MODE_BLOCK;
|
||||
|
@ -172,11 +172,11 @@ static void NTO_DeleteAudioDevice(SDL_AudioDevice *device)
|
|||
{
|
||||
if ((device)&&(device->hidden))
|
||||
{
|
||||
free(device->hidden);
|
||||
SDL_free(device->hidden);
|
||||
}
|
||||
if (device)
|
||||
{
|
||||
free(device);
|
||||
SDL_free(device);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -185,22 +185,22 @@ static SDL_AudioDevice* NTO_CreateAudioDevice(int devindex)
|
|||
SDL_AudioDevice *this;
|
||||
|
||||
/* Initialize all variables that we clean on shutdown */
|
||||
this = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice));
|
||||
this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
|
||||
if (this)
|
||||
{
|
||||
memset(this, 0, sizeof(SDL_AudioDevice));
|
||||
this->hidden = (struct SDL_PrivateAudioData *)malloc(sizeof(struct SDL_PrivateAudioData));
|
||||
SDL_memset(this, 0, sizeof(SDL_AudioDevice));
|
||||
this->hidden = (struct SDL_PrivateAudioData *)SDL_malloc(sizeof(struct SDL_PrivateAudioData));
|
||||
}
|
||||
if ((this == NULL) || (this->hidden == NULL))
|
||||
{
|
||||
SDL_OutOfMemory();
|
||||
if (this)
|
||||
{
|
||||
free(this);
|
||||
SDL_free(this);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
memset(this->hidden, 0, sizeof(struct SDL_PrivateAudioData));
|
||||
SDL_memset(this->hidden, 0, sizeof(struct SDL_PrivateAudioData));
|
||||
audio_handle = NULL;
|
||||
|
||||
/* Set the function pointers */
|
||||
|
@ -280,7 +280,7 @@ static void NTO_PlayAudio(_THIS)
|
|||
{
|
||||
if ((errno == EINVAL) || (errno == EIO))
|
||||
{
|
||||
memset(&cstatus, 0, sizeof(cstatus));
|
||||
SDL_memset(&cstatus, 0, sizeof(cstatus));
|
||||
cstatus.channel = SND_PCM_CHANNEL_PLAYBACK;
|
||||
if ((rval = snd_pcm_plugin_status(audio_handle, &cstatus)) < 0)
|
||||
{
|
||||
|
@ -455,7 +455,7 @@ static int NTO_OpenAudio(_THIS, SDL_AudioSpec* spec)
|
|||
}
|
||||
|
||||
/* Make sure channel is setup right one last time */
|
||||
memset(&csetup, 0x00, sizeof(csetup));
|
||||
SDL_memset(&csetup, 0x00, sizeof(csetup));
|
||||
csetup.channel = SND_PCM_CHANNEL_PLAYBACK;
|
||||
if (snd_pcm_plugin_setup(audio_handle, &csetup) < 0)
|
||||
{
|
||||
|
@ -483,7 +483,7 @@ static int NTO_OpenAudio(_THIS, SDL_AudioSpec* spec)
|
|||
SDL_SetError("NTO_OpenAudio(): pcm buffer allocation failed\n");
|
||||
return (-1);
|
||||
}
|
||||
memset(pcm_buf, spec->silence, pcm_len);
|
||||
SDL_memset(pcm_buf, spec->silence, pcm_len);
|
||||
|
||||
/* get the file descriptor */
|
||||
if ((audio_fd = snd_pcm_file_descriptor(audio_handle, SND_PCM_CHANNEL_PLAYBACK)) < 0)
|
||||
|
|
|
@ -95,8 +95,8 @@ Audio_Available(void)
|
|||
static void
|
||||
Audio_DeleteDevice(SDL_AudioDevice *device)
|
||||
{
|
||||
free(device->hidden);
|
||||
free(device);
|
||||
SDL_free(device->hidden);
|
||||
SDL_free(device);
|
||||
}
|
||||
|
||||
static SDL_AudioDevice
|
||||
|
@ -105,18 +105,18 @@ static SDL_AudioDevice
|
|||
SDL_AudioDevice *this;
|
||||
|
||||
/* Initialize all variables that we clean on shutdown */
|
||||
this = (SDL_AudioDevice*)malloc(sizeof(SDL_AudioDevice));
|
||||
this = (SDL_AudioDevice*)SDL_malloc(sizeof(SDL_AudioDevice));
|
||||
if(this) {
|
||||
memset(this, 0, (sizeof *this));
|
||||
SDL_memset(this, 0, (sizeof *this));
|
||||
this->hidden =
|
||||
(struct SDL_PrivateAudioData*)malloc((sizeof *this->hidden));
|
||||
(struct SDL_PrivateAudioData*)SDL_malloc((sizeof *this->hidden));
|
||||
}
|
||||
if((this == NULL) || (this->hidden == NULL)) {
|
||||
SDL_OutOfMemory();
|
||||
if(this) free(this);
|
||||
if(this) SDL_free(this);
|
||||
return(0);
|
||||
}
|
||||
memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
audio_fd = -1;
|
||||
|
||||
/* Set the function pointers */
|
||||
|
@ -397,7 +397,7 @@ OBSD_OpenAudio(_THIS, SDL_AudioSpec *spec)
|
|||
if(mixbuf == NULL) {
|
||||
return(-1);
|
||||
}
|
||||
memset(mixbuf, spec->silence, spec->size);
|
||||
SDL_memset(mixbuf, spec->silence, spec->size);
|
||||
|
||||
/* Get the parent process id (we're the parent of the audio thread) */
|
||||
parent = getpid();
|
||||
|
|
|
@ -82,8 +82,8 @@ static int Audio_Available(void)
|
|||
|
||||
static void Audio_DeleteDevice(SDL_AudioDevice *device)
|
||||
{
|
||||
free(device->hidden);
|
||||
free(device);
|
||||
SDL_free(device->hidden);
|
||||
SDL_free(device);
|
||||
}
|
||||
|
||||
static SDL_AudioDevice *Audio_CreateDevice(int devindex)
|
||||
|
@ -91,20 +91,20 @@ static SDL_AudioDevice *Audio_CreateDevice(int devindex)
|
|||
SDL_AudioDevice *this;
|
||||
|
||||
/* Initialize all variables that we clean on shutdown */
|
||||
this = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice));
|
||||
this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
|
||||
if ( this ) {
|
||||
memset(this, 0, (sizeof *this));
|
||||
SDL_memset(this, 0, (sizeof *this));
|
||||
this->hidden = (struct SDL_PrivateAudioData *)
|
||||
malloc((sizeof *this->hidden));
|
||||
SDL_malloc((sizeof *this->hidden));
|
||||
}
|
||||
if ( (this == NULL) || (this->hidden == NULL) ) {
|
||||
SDL_OutOfMemory();
|
||||
if ( this ) {
|
||||
free(this);
|
||||
SDL_free(this);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
audio_fd = -1;
|
||||
|
||||
/* Set the function pointers */
|
||||
|
@ -457,7 +457,7 @@ static int Paud_OpenAudio(_THIS, SDL_AudioSpec *spec)
|
|||
if ( mixbuf == NULL ) {
|
||||
return -1;
|
||||
}
|
||||
memset(mixbuf, spec->silence, spec->size);
|
||||
SDL_memset(mixbuf, spec->silence, spec->size);
|
||||
|
||||
/*
|
||||
* Set some paramters: full volume, first speaker that we can find.
|
||||
|
@ -498,7 +498,7 @@ static int Paud_OpenAudio(_THIS, SDL_AudioSpec *spec)
|
|||
|
||||
/* Check to see if we need to use select() workaround */
|
||||
{ char *workaround;
|
||||
workaround = getenv("SDL_DSP_NOSELECT");
|
||||
workaround = SDL_getenv("SDL_DSP_NOSELECT");
|
||||
if ( workaround ) {
|
||||
frame_ticks = (float)(spec->samples*1000)/spec->freq;
|
||||
next_frame = SDL_GetTicks()+frame_ticks;
|
||||
|
|
|
@ -75,8 +75,8 @@ static int Audio_Available(void)
|
|||
|
||||
static void Audio_DeleteDevice(SDL_AudioDevice *device)
|
||||
{
|
||||
free(device->hidden);
|
||||
free(device);
|
||||
SDL_free(device->hidden);
|
||||
SDL_free(device);
|
||||
}
|
||||
|
||||
static SDL_AudioDevice *Audio_CreateDevice(int devindex)
|
||||
|
@ -84,20 +84,20 @@ static SDL_AudioDevice *Audio_CreateDevice(int devindex)
|
|||
SDL_AudioDevice *this;
|
||||
|
||||
/* Initialize all variables that we clean on shutdown */
|
||||
this = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice));
|
||||
this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
|
||||
if ( this ) {
|
||||
memset(this, 0, (sizeof *this));
|
||||
SDL_memset(this, 0, (sizeof *this));
|
||||
this->hidden = (struct SDL_PrivateAudioData *)
|
||||
malloc((sizeof *this->hidden));
|
||||
SDL_malloc((sizeof *this->hidden));
|
||||
}
|
||||
if ( (this == NULL) || (this->hidden == NULL) ) {
|
||||
SDL_OutOfMemory();
|
||||
if ( this ) {
|
||||
free(this);
|
||||
SDL_free(this);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
audio_fd = -1;
|
||||
|
||||
/* Set the function pointers */
|
||||
|
@ -236,7 +236,7 @@ void DSP_CloseAudio(_THIS)
|
|||
mixbuf = NULL;
|
||||
}
|
||||
if ( ulaw_buf != NULL ) {
|
||||
free(ulaw_buf);
|
||||
SDL_free(ulaw_buf);
|
||||
ulaw_buf = NULL;
|
||||
}
|
||||
close(audio_fd);
|
||||
|
@ -349,7 +349,7 @@ int DSP_OpenAudio(_THIS, SDL_AudioSpec *spec)
|
|||
spec->freq = desired_freq;
|
||||
fragsize = (spec->samples*1000)/(spec->freq/8);
|
||||
frequency = 8;
|
||||
ulaw_buf = (Uint8 *)malloc(fragsize);
|
||||
ulaw_buf = (Uint8 *)SDL_malloc(fragsize);
|
||||
if ( ulaw_buf == NULL ) {
|
||||
SDL_OutOfMemory();
|
||||
return(-1);
|
||||
|
@ -375,7 +375,7 @@ int DSP_OpenAudio(_THIS, SDL_AudioSpec *spec)
|
|||
SDL_OutOfMemory();
|
||||
return(-1);
|
||||
}
|
||||
memset(mixbuf, spec->silence, spec->size);
|
||||
SDL_memset(mixbuf, spec->silence, spec->size);
|
||||
|
||||
/* We're ready to rock and roll. :-) */
|
||||
return(0);
|
||||
|
|
|
@ -84,11 +84,11 @@ static int Audio_Available(void)
|
|||
|
||||
static void Audio_DeleteDevice(_THIS)
|
||||
{
|
||||
if(this->hidden->playbuf._buffer) free(this->hidden->playbuf._buffer);
|
||||
if(this->hidden->fillbuf._buffer) free(this->hidden->fillbuf._buffer);
|
||||
if(this->hidden->playbuf._buffer) SDL_free(this->hidden->playbuf._buffer);
|
||||
if(this->hidden->fillbuf._buffer) SDL_free(this->hidden->fillbuf._buffer);
|
||||
_somFree( this->hidden->umsdev );
|
||||
free(this->hidden);
|
||||
free(this);
|
||||
SDL_free(this->hidden);
|
||||
SDL_free(this);
|
||||
}
|
||||
|
||||
static SDL_AudioDevice *Audio_CreateDevice(int devindex)
|
||||
|
@ -99,19 +99,19 @@ static SDL_AudioDevice *Audio_CreateDevice(int devindex)
|
|||
* Allocate and initialize management storage and private management
|
||||
* storage for this SDL-using library.
|
||||
*/
|
||||
this = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice));
|
||||
this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
|
||||
if ( this ) {
|
||||
memset(this, 0, (sizeof *this));
|
||||
this->hidden = (struct SDL_PrivateAudioData *)malloc((sizeof *this->hidden));
|
||||
SDL_memset(this, 0, (sizeof *this));
|
||||
this->hidden = (struct SDL_PrivateAudioData *)SDL_malloc((sizeof *this->hidden));
|
||||
}
|
||||
if ( (this == NULL) || (this->hidden == NULL) ) {
|
||||
SDL_OutOfMemory();
|
||||
if ( this ) {
|
||||
free(this);
|
||||
SDL_free(this);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
#ifdef DEBUG_AUDIO
|
||||
fprintf(stderr, "Creating UMS Audio device\n");
|
||||
#endif
|
||||
|
@ -204,9 +204,9 @@ static void UMS_PlayAudio(_THIS)
|
|||
while(samplesToWrite>0);
|
||||
|
||||
SDL_LockAudio();
|
||||
memcpy( &swpbuf, &this->hidden->playbuf, sizeof(UMSAudioTypes_Buffer) );
|
||||
memcpy( &this->hidden->playbuf, &this->hidden->fillbuf, sizeof(UMSAudioTypes_Buffer) );
|
||||
memcpy( &this->hidden->fillbuf, &swpbuf, sizeof(UMSAudioTypes_Buffer) );
|
||||
SDL_memcpy( &swpbuf, &this->hidden->playbuf, sizeof(UMSAudioTypes_Buffer) );
|
||||
SDL_memcpy( &this->hidden->playbuf, &this->hidden->fillbuf, sizeof(UMSAudioTypes_Buffer) );
|
||||
SDL_memcpy( &this->hidden->fillbuf, &swpbuf, sizeof(UMSAudioTypes_Buffer) );
|
||||
SDL_UnlockAudio();
|
||||
|
||||
#ifdef DEBUG_AUDIO
|
||||
|
@ -330,10 +330,10 @@ static int UMS_OpenAudio(_THIS, SDL_AudioSpec *spec)
|
|||
|
||||
this->hidden->playbuf._length = 0;
|
||||
this->hidden->playbuf._maximum = spec->size;
|
||||
this->hidden->playbuf._buffer = (unsigned char*)malloc(spec->size);
|
||||
this->hidden->playbuf._buffer = (unsigned char*)SDL_malloc(spec->size);
|
||||
this->hidden->fillbuf._length = 0;
|
||||
this->hidden->fillbuf._maximum = spec->size;
|
||||
this->hidden->fillbuf._buffer = (unsigned char*)malloc(spec->size);
|
||||
this->hidden->fillbuf._buffer = (unsigned char*)SDL_malloc(spec->size);
|
||||
|
||||
rc = UADSetBitsPerSample(this, bitsPerSample );
|
||||
rc = UADSetDMABufferSize(this, frag_spec, &outBufSize );
|
||||
|
|
|
@ -55,8 +55,8 @@ static int Audio_Available(void)
|
|||
|
||||
static void Audio_DeleteDevice(SDL_AudioDevice *device)
|
||||
{
|
||||
free(device->hidden);
|
||||
free(device);
|
||||
SDL_free(device->hidden);
|
||||
SDL_free(device);
|
||||
}
|
||||
|
||||
static SDL_AudioDevice *Audio_CreateDevice(int devindex)
|
||||
|
@ -64,20 +64,20 @@ static SDL_AudioDevice *Audio_CreateDevice(int devindex)
|
|||
SDL_AudioDevice *this;
|
||||
|
||||
/* Initialize all variables that we clean on shutdown */
|
||||
this = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice));
|
||||
this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
|
||||
if ( this ) {
|
||||
memset(this, 0, (sizeof *this));
|
||||
SDL_memset(this, 0, (sizeof *this));
|
||||
this->hidden = (struct SDL_PrivateAudioData *)
|
||||
malloc((sizeof *this->hidden));
|
||||
SDL_malloc((sizeof *this->hidden));
|
||||
}
|
||||
if ( (this == NULL) || (this->hidden == NULL) ) {
|
||||
SDL_OutOfMemory();
|
||||
if ( this ) {
|
||||
free(this);
|
||||
SDL_free(this);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
|
||||
/* Set the function pointers */
|
||||
this->OpenAudio = DIB_OpenAudio;
|
||||
|
@ -125,8 +125,8 @@ static void SetMMerror(char *function, MMRESULT code)
|
|||
wchar_t werrbuf[MAXERRORLENGTH];
|
||||
#endif
|
||||
|
||||
snprintf(errbuf, SDL_arraysize(errbuf), "%s: ", function);
|
||||
len = strlen(errbuf);
|
||||
SDL_snprintf(errbuf, SDL_arraysize(errbuf), "%s: ", function);
|
||||
len = SDL_strlen(errbuf);
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
/* UNICODE version */
|
||||
|
@ -213,7 +213,7 @@ void DIB_CloseAudio(_THIS)
|
|||
}
|
||||
/* Free raw mixing buffer */
|
||||
if ( mixbuf != NULL ) {
|
||||
free(mixbuf);
|
||||
SDL_free(mixbuf);
|
||||
mixbuf = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -232,7 +232,7 @@ int DIB_OpenAudio(_THIS, SDL_AudioSpec *spec)
|
|||
mixbuf = NULL;
|
||||
|
||||
/* Set basic WAVE format parameters */
|
||||
memset(&waveformat, 0, sizeof(waveformat));
|
||||
SDL_memset(&waveformat, 0, sizeof(waveformat));
|
||||
waveformat.wFormatTag = WAVE_FORMAT_PCM;
|
||||
|
||||
/* Determine the audio parameters from the AudioSpec */
|
||||
|
@ -299,13 +299,13 @@ int DIB_OpenAudio(_THIS, SDL_AudioSpec *spec)
|
|||
}
|
||||
|
||||
/* Create the sound buffers */
|
||||
mixbuf = (Uint8 *)malloc(NUM_BUFFERS*spec->size);
|
||||
mixbuf = (Uint8 *)SDL_malloc(NUM_BUFFERS*spec->size);
|
||||
if ( mixbuf == NULL ) {
|
||||
SDL_SetError("Out of memory");
|
||||
return(-1);
|
||||
}
|
||||
for ( i = 0; i < NUM_BUFFERS; ++i ) {
|
||||
memset(&wavebuf[i], 0, sizeof(wavebuf[i]));
|
||||
SDL_memset(&wavebuf[i], 0, sizeof(wavebuf[i]));
|
||||
wavebuf[i].lpData = (LPSTR) &mixbuf[i*spec->size];
|
||||
wavebuf[i].dwBufferLength = spec->size;
|
||||
wavebuf[i].dwFlags = WHDR_DONE;
|
||||
|
|
|
@ -133,8 +133,8 @@ static int DX5_Load(void)
|
|||
static void Audio_DeleteDevice(SDL_AudioDevice *device)
|
||||
{
|
||||
DX5_Unload();
|
||||
free(device->hidden);
|
||||
free(device);
|
||||
SDL_free(device->hidden);
|
||||
SDL_free(device);
|
||||
}
|
||||
|
||||
static SDL_AudioDevice *Audio_CreateDevice(int devindex)
|
||||
|
@ -147,20 +147,20 @@ static SDL_AudioDevice *Audio_CreateDevice(int devindex)
|
|||
}
|
||||
|
||||
/* Initialize all variables that we clean on shutdown */
|
||||
this = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice));
|
||||
this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
|
||||
if ( this ) {
|
||||
memset(this, 0, (sizeof *this));
|
||||
SDL_memset(this, 0, (sizeof *this));
|
||||
this->hidden = (struct SDL_PrivateAudioData *)
|
||||
malloc((sizeof *this->hidden));
|
||||
SDL_malloc((sizeof *this->hidden));
|
||||
}
|
||||
if ( (this == NULL) || (this->hidden == NULL) ) {
|
||||
SDL_OutOfMemory();
|
||||
if ( this ) {
|
||||
free(this);
|
||||
SDL_free(this);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
|
||||
/* Set the function pointers */
|
||||
this->OpenAudio = DX5_OpenAudio;
|
||||
|
@ -223,13 +223,13 @@ static void SetDSerror(const char *function, int code)
|
|||
error = "Function not supported";
|
||||
break;
|
||||
default:
|
||||
snprintf(errbuf, SDL_arraysize(errbuf),
|
||||
SDL_snprintf(errbuf, SDL_arraysize(errbuf),
|
||||
"%s: Unknown DirectSound error: 0x%x",
|
||||
function, code);
|
||||
break;
|
||||
}
|
||||
if ( ! errbuf[0] ) {
|
||||
snprintf(errbuf, SDL_arraysize(errbuf), "%s: %s", function, error);
|
||||
SDL_snprintf(errbuf, SDL_arraysize(errbuf), "%s: %s", function, error);
|
||||
}
|
||||
SDL_SetError("%s", errbuf);
|
||||
return;
|
||||
|
@ -386,7 +386,7 @@ static void DX5_WaitDone(_THIS)
|
|||
/* Wait for the playing chunk to finish */
|
||||
stream = this->GetAudioBuf(this);
|
||||
if ( stream != NULL ) {
|
||||
memset(stream, silence, mixlen);
|
||||
SDL_memset(stream, silence, mixlen);
|
||||
this->PlayAudio(this);
|
||||
}
|
||||
this->WaitAudio(this);
|
||||
|
@ -435,7 +435,7 @@ static int CreatePrimary(LPDIRECTSOUND sndObj, HWND focus,
|
|||
}
|
||||
|
||||
/* Try to create the primary buffer */
|
||||
memset(&format, 0, sizeof(format));
|
||||
SDL_memset(&format, 0, sizeof(format));
|
||||
format.dwSize = sizeof(format);
|
||||
format.dwFlags=(DSBCAPS_PRIMARYBUFFER|DSBCAPS_GETCURRENTPOSITION2);
|
||||
format.dwFlags |= DSBCAPS_STICKYFOCUS;
|
||||
|
@ -451,7 +451,7 @@ static int CreatePrimary(LPDIRECTSOUND sndObj, HWND focus,
|
|||
}
|
||||
|
||||
/* Check the size of the fragment buffer */
|
||||
memset(&caps, 0, sizeof(caps));
|
||||
SDL_memset(&caps, 0, sizeof(caps));
|
||||
caps.dwSize = sizeof(caps);
|
||||
result = IDirectSoundBuffer_GetCaps(*sndbuf, &caps);
|
||||
if ( result != DS_OK ) {
|
||||
|
@ -516,7 +516,7 @@ static int CreateSecondary(LPDIRECTSOUND sndObj, HWND focus,
|
|||
}
|
||||
|
||||
/* Try to create the secondary buffer */
|
||||
memset(&format, 0, sizeof(format));
|
||||
SDL_memset(&format, 0, sizeof(format));
|
||||
format.dwSize = sizeof(format);
|
||||
format.dwFlags = DSBCAPS_GETCURRENTPOSITION2;
|
||||
#ifdef USE_POSITION_NOTIFY
|
||||
|
@ -550,9 +550,9 @@ static int CreateSecondary(LPDIRECTSOUND sndObj, HWND focus,
|
|||
DSBLOCK_ENTIREBUFFER);
|
||||
if ( result == DS_OK ) {
|
||||
if ( wavefmt->wBitsPerSample == 8 ) {
|
||||
memset(pvAudioPtr1, 0x80, dwAudioBytes1);
|
||||
SDL_memset(pvAudioPtr1, 0x80, dwAudioBytes1);
|
||||
} else {
|
||||
memset(pvAudioPtr1, 0x00, dwAudioBytes1);
|
||||
SDL_memset(pvAudioPtr1, 0x00, dwAudioBytes1);
|
||||
}
|
||||
IDirectSoundBuffer_Unlock(*sndbuf,
|
||||
(LPVOID)pvAudioPtr1, dwAudioBytes1,
|
||||
|
@ -584,7 +584,7 @@ static int CreateAudioEvent(_THIS)
|
|||
}
|
||||
|
||||
/* Allocate the notify structures */
|
||||
notify_positions = (DSBPOSITIONNOTIFY *)malloc(NUM_BUFFERS*
|
||||
notify_positions = (DSBPOSITIONNOTIFY *)SDL_malloc(NUM_BUFFERS*
|
||||
sizeof(*notify_positions));
|
||||
if ( notify_positions == NULL ) {
|
||||
goto done;
|
||||
|
@ -620,7 +620,7 @@ static int DX5_OpenAudio(_THIS, SDL_AudioSpec *spec)
|
|||
WAVEFORMATEX waveformat;
|
||||
|
||||
/* Set basic WAVE format parameters */
|
||||
memset(&waveformat, 0, sizeof(waveformat));
|
||||
SDL_memset(&waveformat, 0, sizeof(waveformat));
|
||||
waveformat.wFormatTag = WAVE_FORMAT_PCM;
|
||||
|
||||
/* Determine the audio parameters from the AudioSpec */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue