File style cleanup for the SDL 2.0 release

This commit is contained in:
Sam Lantinga 2013-05-18 14:17:52 -07:00
parent 2ac8624930
commit 0cb6385637
376 changed files with 17562 additions and 17773 deletions

View file

@ -972,7 +972,7 @@ SDL_BuildAudioCVT(SDL_AudioCVT * cvt,
if (cvt == NULL) {
return SDL_InvalidParamError("cvt");
}
/* there are no unsigned types over 16 bits, so catch this up front. */
if ((SDL_AUDIO_BITSIZE(src_fmt) > 16) && (!SDL_AUDIO_ISSIGNED(src_fmt))) {
return SDL_SetError("Invalid source format");

View file

@ -40,10 +40,10 @@
#endif
#endif
#ifndef _PATH_DEV_DSP24
#define _PATH_DEV_DSP24 "/dev/sound/dsp"
#define _PATH_DEV_DSP24 "/dev/sound/dsp"
#endif
#ifndef _PATH_DEV_AUDIO
#define _PATH_DEV_AUDIO "/dev/audio"
#define _PATH_DEV_AUDIO "/dev/audio"
#endif
static inline void

View file

@ -20,6 +20,6 @@
*/
#include "SDL_config.h"
#define SDL_AllocAudioMem SDL_malloc
#define SDL_FreeAudioMem SDL_free
#define SDL_AllocAudioMem SDL_malloc
#define SDL_FreeAudioMem SDL_free
/* vi: set ts=4 sw=4 expandtab: */

View file

@ -82,8 +82,8 @@ static const Uint8 mix8[] = {
};
/* The volume ranges from 0 - 128 */
#define ADJUST_VOLUME(s, v) (s = (s*v)/SDL_MIX_MAXVOLUME)
#define ADJUST_VOLUME_U8(s, v) (s = (((s-128)*v)/SDL_MIX_MAXVOLUME)+128)
#define ADJUST_VOLUME(s, v) (s = (s*v)/SDL_MIX_MAXVOLUME)
#define ADJUST_VOLUME_U8(s, v) (s = (((s-128)*v)/SDL_MIX_MAXVOLUME)+128)
void

View file

@ -28,7 +28,7 @@
/* The SDL audio driver */
typedef struct SDL_AudioDevice SDL_AudioDevice;
#define _THIS SDL_AudioDevice *_this
#define _THIS SDL_AudioDevice *_this
/* Used by audio targets during DetectDevices() */
typedef void (*SDL_AddAudioDevice)(const char *name);

View file

@ -25,26 +25,26 @@
/*******************************************/
/* Define values for Microsoft WAVE format */
/*******************************************/
#define RIFF 0x46464952 /* "RIFF" */
#define WAVE 0x45564157 /* "WAVE" */
#define FACT 0x74636166 /* "fact" */
#define LIST 0x5453494c /* "LIST" */
#define FMT 0x20746D66 /* "fmt " */
#define DATA 0x61746164 /* "data" */
#define PCM_CODE 0x0001
#define MS_ADPCM_CODE 0x0002
#define IEEE_FLOAT_CODE 0x0003
#define IMA_ADPCM_CODE 0x0011
#define MP3_CODE 0x0055
#define WAVE_MONO 1
#define WAVE_STEREO 2
#define RIFF 0x46464952 /* "RIFF" */
#define WAVE 0x45564157 /* "WAVE" */
#define FACT 0x74636166 /* "fact" */
#define LIST 0x5453494c /* "LIST" */
#define FMT 0x20746D66 /* "fmt " */
#define DATA 0x61746164 /* "data" */
#define PCM_CODE 0x0001
#define MS_ADPCM_CODE 0x0002
#define IEEE_FLOAT_CODE 0x0003
#define IMA_ADPCM_CODE 0x0011
#define MP3_CODE 0x0055
#define WAVE_MONO 1
#define WAVE_STEREO 2
/* Normally, these three chunks come consecutively in a WAVE file */
typedef struct WaveFMT
{
/* Not saved in the chunk we read:
Uint32 FMTchunk;
Uint32 fmtlen;
Uint32 FMTchunk;
Uint32 fmtlen;
*/
Uint16 encoding;
Uint16 channels; /* 1 = mono, 2 = stereo */
@ -61,4 +61,5 @@ typedef struct Chunk
Uint32 length;
Uint8 *data;
} Chunk;
/* vi: set ts=4 sw=4 expandtab: */

View file

@ -155,7 +155,7 @@ static void
UnloadALSALibrary(void)
{
if (alsa_handle != NULL) {
SDL_UnloadObject(alsa_handle);
SDL_UnloadObject(alsa_handle);
alsa_handle = NULL;
}
}

View file

@ -28,7 +28,7 @@
#include "../SDL_sysaudio.h"
/* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *this
#define _THIS SDL_AudioDevice *this
struct SDL_PrivateAudioData
{

View file

@ -40,12 +40,12 @@ AndroidAUD_OpenDevice(_THIS, const char *devname, int iscapture)
SDL_AudioFormat test_format;
if (iscapture) {
//TODO: implement capture
return SDL_SetError("Capture not supported on Android");
/* TODO: implement capture */
return SDL_SetError("Capture not supported on Android");
}
if (audioDevice != NULL) {
return SDL_SetError("Only one audio device at a time please!");
return SDL_SetError("Only one audio device at a time please!");
}
audioDevice = this;
@ -57,39 +57,39 @@ AndroidAUD_OpenDevice(_THIS, const char *devname, int iscapture)
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
test_format = SDL_FirstAudioFormat(this->spec.format);
while (test_format != 0) { // no "UNKNOWN" constant
while (test_format != 0) { /* no "UNKNOWN" constant */
if ((test_format == AUDIO_U8) || (test_format == AUDIO_S16LSB)) {
this->spec.format = test_format;
break;
}
test_format = SDL_NextAudioFormat();
}
if (test_format == 0) {
// Didn't find a compatible format :(
return SDL_SetError("No compatible audio format!");
/* Didn't find a compatible format :( */
return SDL_SetError("No compatible audio format!");
}
if (this->spec.channels > 1) {
this->spec.channels = 2;
this->spec.channels = 2;
} else {
this->spec.channels = 1;
this->spec.channels = 1;
}
if (this->spec.freq < 8000) {
this->spec.freq = 8000;
this->spec.freq = 8000;
}
if (this->spec.freq > 48000) {
this->spec.freq = 48000;
this->spec.freq = 48000;
}
// TODO: pass in/return a (Java) device ID, also whether we're opening for input or output
/* TODO: pass in/return a (Java) device ID, also whether we're opening for input or output */
this->spec.samples = Android_JNI_OpenAudioDevice(this->spec.freq, this->spec.format == AUDIO_U8 ? 0 : 1, this->spec.channels, this->spec.samples);
SDL_CalculateAudioSpec(&this->spec);
if (this->spec.samples == 0) {
// Init failed?
return SDL_SetError("Java-side initialization failed!");
/* Init failed? */
return SDL_SetError("Java-side initialization failed!");
}
return 0;
@ -111,13 +111,13 @@ static void
AndroidAUD_CloseDevice(_THIS)
{
if (this->hidden != NULL) {
SDL_free(this->hidden);
this->hidden = NULL;
SDL_free(this->hidden);
this->hidden = NULL;
}
Android_JNI_CloseAudioDevice();
Android_JNI_CloseAudioDevice();
if (audioDevice == this) {
audioDevice = NULL;
audioDevice = NULL;
}
}
@ -132,7 +132,7 @@ AndroidAUD_Init(SDL_AudioDriverImpl * impl)
/* and the capabilities */
impl->ProvidesOwnCallbackThread = 1;
impl->HasCaptureSupport = 0; //TODO
impl->HasCaptureSupport = 0; /* TODO */
impl->OnlyHasDefaultOutputDevice = 1;
impl->OnlyHasDefaultInputDevice = 1;
@ -147,7 +147,7 @@ AudioBootStrap ANDROIDAUD_bootstrap = {
void
Android_RunAudioThread()
{
SDL_RunAudio(audioDevice);
SDL_RunAudio(audioDevice);
}
#endif /* SDL_AUDIO_DRIVER_ANDROID */

View file

@ -26,7 +26,7 @@
#include "../SDL_sysaudio.h"
/* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *this
#define _THIS SDL_AudioDevice *this
struct SDL_PrivateAudioData
{

View file

@ -28,7 +28,7 @@
#include "../SDL_sysaudio.h"
/* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *this
#define _THIS SDL_AudioDevice *this
struct SDL_PrivateAudioData
{
@ -46,7 +46,7 @@ struct SDL_PrivateAudioData
float frame_ticks;
float next_frame;
};
#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */
#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */
#endif /* _SDL_artscaudio_h */
/* vi: set ts=4 sw=4 expandtab: */

View file

@ -26,7 +26,7 @@
#include "../SDL_sysaudio.h"
/* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *_this
#define _THIS SDL_AudioDevice *_this
struct SDL_PrivateAudioData
{

View file

@ -25,7 +25,7 @@
#include "../SDL_sysaudio.h"
#define _THIS SDL_AudioDevice *this
#define _THIS SDL_AudioDevice *this
struct SDL_PrivateAudioData
{
@ -44,7 +44,7 @@ struct SDL_PrivateAudioData
float next_frame;
};
#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */
#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */
#endif /* _SDL_bsdaudio_h */

View file

@ -308,8 +308,8 @@ inputCallback(void *inRefCon,
UInt32 inBusNumber, UInt32 inNumberFrames,
AudioBufferList * ioData)
{
//err = AudioUnitRender(afr->fAudioUnit, ioActionFlags, inTimeStamp, inBusNumber, inNumberFrames, afr->fAudioBuffer);
// !!! FIXME: write me!
/* err = AudioUnitRender(afr->fAudioUnit, ioActionFlags, inTimeStamp, inBusNumber, inNumberFrames, afr->fAudioBuffer); */
/* !!! FIXME: write me! */
return noErr;
}
@ -380,7 +380,7 @@ prepare_audiounit(_THIS, const char *devname, int iscapture,
return 0;
}
#endif
SDL_zero(desc);
desc.componentType = kAudioUnitType_Output;
desc.componentManufacturer = kAudioUnitManufacturer_Apple;

View file

@ -42,7 +42,7 @@
#include <AudioUnit/AudioUnit.h>
/* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *this
#define _THIS SDL_AudioDevice *this
struct SDL_PrivateAudioData
{

View file

@ -28,7 +28,7 @@
#include "../SDL_sysaudio.h"
/* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *this
#define _THIS SDL_AudioDevice *this
/* The DirectSound objects */
struct SDL_PrivateAudioData

View file

@ -19,47 +19,47 @@
/* Error codes not yet included in Win32 API header files */
#ifndef MAKE_HRESULT
#define MAKE_HRESULT(sev,fac,code) \
((HRESULT)(((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) | ((unsigned long)(code))))
((HRESULT)(((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) | ((unsigned long)(code))))
#endif
#ifndef S_OK
#define S_OK (HRESULT)0x00000000L
#define S_OK (HRESULT)0x00000000L
#endif
#ifndef SUCCEEDED
#define SUCCEEDED(x) ((HRESULT)(x) >= 0)
#define SUCCEEDED(x) ((HRESULT)(x) >= 0)
#endif
#ifndef FAILED
#define FAILED(x) ((HRESULT)(x)<0)
#define FAILED(x) ((HRESULT)(x)<0)
#endif
#ifndef E_FAIL
#define E_FAIL (HRESULT)0x80000008L
#define E_FAIL (HRESULT)0x80000008L
#endif
#ifndef E_NOINTERFACE
#define E_NOINTERFACE (HRESULT)0x80004002L
#define E_NOINTERFACE (HRESULT)0x80004002L
#endif
#ifndef E_OUTOFMEMORY
#define E_OUTOFMEMORY (HRESULT)0x8007000EL
#define E_OUTOFMEMORY (HRESULT)0x8007000EL
#endif
#ifndef E_INVALIDARG
#define E_INVALIDARG (HRESULT)0x80070057L
#define E_INVALIDARG (HRESULT)0x80070057L
#endif
#ifndef E_NOTIMPL
#define E_NOTIMPL (HRESULT)0x80004001L
#define E_NOTIMPL (HRESULT)0x80004001L
#endif
#ifndef REGDB_E_CLASSNOTREG
#define REGDB_E_CLASSNOTREG (HRESULT)0x80040154L
#define REGDB_E_CLASSNOTREG (HRESULT)0x80040154L
#endif
/* Severity codes */
#ifndef SEVERITY_ERROR
#define SEVERITY_ERROR 1
#define SEVERITY_ERROR 1
#endif
/* Error facility codes */
#ifndef FACILITY_WIN32
#define FACILITY_WIN32 7
#define FACILITY_WIN32 7
#endif
#ifndef FIELD_OFFSET

View file

@ -27,7 +27,7 @@
#include "../SDL_sysaudio.h"
/* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *this
#define _THIS SDL_AudioDevice *this
struct SDL_PrivateAudioData
{

View file

@ -161,7 +161,7 @@ DSP_OpenDevice(_THIS, const char *devname, int iscapture)
break;
#if 0
/*
* These formats are not used by any real life systems so they are not
* These formats are not used by any real life systems so they are not
* needed here.
*/
case AUDIO_S8:

View file

@ -26,7 +26,7 @@
#include "../SDL_sysaudio.h"
/* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *this
#define _THIS SDL_AudioDevice *this
struct SDL_PrivateAudioData
{
@ -37,7 +37,7 @@ struct SDL_PrivateAudioData
Uint8 *mixbuf;
int mixlen;
};
#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */
#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */
#endif /* _SDL_dspaudio_h */
/* vi: set ts=4 sw=4 expandtab: */

View file

@ -26,7 +26,7 @@
#include "../SDL_sysaudio.h"
/* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *this
#define _THIS SDL_AudioDevice *this
struct SDL_PrivateAudioData
{

View file

@ -40,7 +40,7 @@
#include "SDL_name.h"
#include "SDL_loadso.h"
#else
#define SDL_NAME(X) X
#define SDL_NAME(X) X
#endif
#ifdef SDL_AUDIO_DRIVER_ESD_DYNAMIC
@ -123,7 +123,7 @@ ESD_WaitDevice(_THIS)
/* Check to see if the thread-parent process is still alive */
{
static int cnt = 0;
/* Note that this only works with thread implementations
/* Note that this only works with thread implementations
that use a different process id for each thread.
*/
/* Check every 10 loops */

View file

@ -26,7 +26,7 @@
#include "../SDL_sysaudio.h"
/* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *this
#define _THIS SDL_AudioDevice *this
struct SDL_PrivateAudioData
{
@ -44,7 +44,7 @@ struct SDL_PrivateAudioData
float frame_ticks;
float next_frame;
};
#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */
#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */
#endif /* _SDL_esdaudio_h */
/* vi: set ts=4 sw=4 expandtab: */

View file

@ -37,13 +37,13 @@
#include <fusionsound/fusionsound_version.h>
//#define SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC "libfusionsound.so"
/* #define SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC "libfusionsound.so" */
#ifdef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC
#include "SDL_name.h"
#include "SDL_loadso.h"
#else
#define SDL_NAME(X) X
#define SDL_NAME(X) X
#endif
#if (FUSIONSOUND_MAJOR_VERSION == 1) && (FUSIONSOUND_MINOR_VERSION < 1)
@ -51,7 +51,7 @@ typedef DFBResult DirectResult;
#endif
/* Buffers to use - more than 2 gives a lot of latency */
#define FUSION_BUFFERS (2)
#define FUSION_BUFFERS (2)
#ifdef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC

View file

@ -28,7 +28,7 @@
#include "../SDL_sysaudio.h"
/* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *this
#define _THIS SDL_AudioDevice *this
struct SDL_PrivateAudioData
{

View file

@ -33,7 +33,7 @@
#include "../SDL_sysaudio.h"
/* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *this
#define _THIS SDL_AudioDevice *this
struct SDL_PrivateAudioData
{

View file

@ -48,13 +48,13 @@
#include <sys/audio.h>
/* Open the audio device for playback, and don't block if busy */
/* #define OPEN_FLAGS (O_WRONLY|O_NONBLOCK) */
#define OPEN_FLAGS O_WRONLY
/* #define OPEN_FLAGS (O_WRONLY|O_NONBLOCK) */
#define OPEN_FLAGS O_WRONLY
/* Get the name of the audio device we use for output */
#ifndef _PATH_DEV_DSP
#define _PATH_DEV_DSP "/dev/%caud%c/%c"
#define _PATH_DEV_DSP "/dev/%caud%c/%c"
#endif
static char devsettings[][3] = {

View file

@ -26,7 +26,7 @@
#include "../SDL_sysaudio.h"
/* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *this
#define _THIS SDL_AudioDevice *this
struct SDL_PrivateAudioData
{
@ -41,7 +41,7 @@ struct SDL_PrivateAudioData
float frame_ticks;
float next_frame;
};
#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */
#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */
#endif /* _SDL_paudaudio_h */
/* vi: set ts=4 sw=4 expandtab: */

View file

@ -42,28 +42,28 @@
static int
PSPAUD_OpenDevice(_THIS, const char *devname, int iscapture)
{
int format, mixlen, i;
int format, mixlen, i;
this->hidden = (struct SDL_PrivateAudioData *)
SDL_malloc(sizeof(*this->hidden));
if (this->hidden == NULL) {
return SDL_OutOfMemory();
}
SDL_memset(this->hidden, 0, sizeof(*this->hidden));
switch (this->spec.format & 0xff) {
case 8:
case 16:
this->spec.format = AUDIO_S16LSB;
break;
default:
return SDL_SetError("Unsupported audio format");
}
switch (this->spec.format & 0xff) {
case 8:
case 16:
this->spec.format = AUDIO_S16LSB;
break;
default:
return SDL_SetError("Unsupported audio format");
}
/* The sample count must be a multiple of 64. */
this->spec.samples = PSP_AUDIO_SAMPLE_ALIGN(this->spec.samples);
this->spec.freq = 44100;
/* The sample count must be a multiple of 64. */
this->spec.samples = PSP_AUDIO_SAMPLE_ALIGN(this->spec.samples);
this->spec.freq = 44100;
/* Update the fragment size as size in bytes. */
// SDL_CalculateAudioSpec(this->spec); MOD
/* Update the fragment size as size in bytes. */
// SDL_CalculateAudioSpec(this->spec); MOD
switch (this->spec.format) {
case AUDIO_U8:
this->spec.silence = 0x80;
@ -75,86 +75,86 @@ PSPAUD_OpenDevice(_THIS, const char *devname, int iscapture)
this->spec.size = SDL_AUDIO_BITSIZE(this->spec.format) / 8;
this->spec.size *= this->spec.channels;
this->spec.size *= this->spec.samples;
//==========================================
/* Allocate the mixing buffer. Its size and starting address must
be a multiple of 64 bytes. Our sample count is already a multiple of
64, so spec->size should be a multiple of 64 as well. */
mixlen = this->spec.size * NUM_BUFFERS;
this->hidden->rawbuf = (Uint8 *) memalign(64, mixlen);
if (this->hidden->rawbuf == NULL) {
return SDL_SetError("Couldn't allocate mixing buffer");
}
/* Allocate the mixing buffer. Its size and starting address must
be a multiple of 64 bytes. Our sample count is already a multiple of
64, so spec->size should be a multiple of 64 as well. */
mixlen = this->spec.size * NUM_BUFFERS;
this->hidden->rawbuf = (Uint8 *) memalign(64, mixlen);
if (this->hidden->rawbuf == NULL) {
return SDL_SetError("Couldn't allocate mixing buffer");
}
/* Setup the hardware channel. */
if (this->spec.channels == 1) {
format = PSP_AUDIO_FORMAT_MONO;
} else {
format = PSP_AUDIO_FORMAT_STEREO;
}
this->hidden->channel = sceAudioChReserve(PSP_AUDIO_NEXT_CHANNEL, this->spec.samples, format);
if (this->hidden->channel < 0) {
free(this->hidden->rawbuf);
this->hidden->rawbuf = NULL;
return SDL_SetError("Couldn't reserve hardware channel");
}
/* Setup the hardware channel. */
if (this->spec.channels == 1) {
format = PSP_AUDIO_FORMAT_MONO;
} else {
format = PSP_AUDIO_FORMAT_STEREO;
}
this->hidden->channel = sceAudioChReserve(PSP_AUDIO_NEXT_CHANNEL, this->spec.samples, format);
if (this->hidden->channel < 0) {
free(this->hidden->rawbuf);
this->hidden->rawbuf = NULL;
return SDL_SetError("Couldn't reserve hardware channel");
}
memset(this->hidden->rawbuf, 0, mixlen);
for (i = 0; i < NUM_BUFFERS; i++) {
this->hidden->mixbufs[i] = &this->hidden->rawbuf[i * this->spec.size];
}
memset(this->hidden->rawbuf, 0, mixlen);
for (i = 0; i < NUM_BUFFERS; i++) {
this->hidden->mixbufs[i] = &this->hidden->rawbuf[i * this->spec.size];
}
this->hidden->next_buffer = 0;
return 0;
this->hidden->next_buffer = 0;
return 0;
}
static void PSPAUD_PlayDevice(_THIS)
{
Uint8 *mixbuf = this->hidden->mixbufs[this->hidden->next_buffer];
Uint8 *mixbuf = this->hidden->mixbufs[this->hidden->next_buffer];
if (this->spec.channels == 1) {
sceAudioOutputBlocking(this->hidden->channel, PSP_AUDIO_VOLUME_MAX, mixbuf);
} else {
sceAudioOutputPannedBlocking(this->hidden->channel, PSP_AUDIO_VOLUME_MAX, PSP_AUDIO_VOLUME_MAX, mixbuf);
}
if (this->spec.channels == 1) {
sceAudioOutputBlocking(this->hidden->channel, PSP_AUDIO_VOLUME_MAX, mixbuf);
} else {
sceAudioOutputPannedBlocking(this->hidden->channel, PSP_AUDIO_VOLUME_MAX, PSP_AUDIO_VOLUME_MAX, mixbuf);
}
this->hidden->next_buffer = (this->hidden->next_buffer + 1) % NUM_BUFFERS;
this->hidden->next_buffer = (this->hidden->next_buffer + 1) % NUM_BUFFERS;
}
/* This function waits until it is possible to write a full sound buffer */
static void PSPAUD_WaitDevice(_THIS)
{
/* Because we block when sending audio, there's no need for this function to do anything. */
/* Because we block when sending audio, there's no need for this function to do anything. */
}
static Uint8 *PSPAUD_GetDeviceBuf(_THIS)
{
return this->hidden->mixbufs[this->hidden->next_buffer];
return this->hidden->mixbufs[this->hidden->next_buffer];
}
static void PSPAUD_CloseDevice(_THIS)
{
if (this->hidden->channel >= 0) {
sceAudioChRelease(this->hidden->channel);
this->hidden->channel = -1;
}
if (this->hidden->channel >= 0) {
sceAudioChRelease(this->hidden->channel);
this->hidden->channel = -1;
}
if (this->hidden->rawbuf != NULL) {
free(this->hidden->rawbuf);
this->hidden->rawbuf = NULL;
}
if (this->hidden->rawbuf != NULL) {
free(this->hidden->rawbuf);
this->hidden->rawbuf = NULL;
}
}
static void PSPAUD_ThreadInit(_THIS)
{
/* Increase the priority of this audio thread by 1 to put it
ahead of other SDL threads. */
SceUID thid;
SceKernelThreadInfo status;
thid = sceKernelGetThreadId();
status.size = sizeof(SceKernelThreadInfo);
if (sceKernelReferThreadStatus(thid, &status) == 0) {
sceKernelChangeThreadPriority(thid, status.currentPriority - 1);
}
/* Increase the priority of this audio thread by 1 to put it
ahead of other SDL threads. */
SceUID thid;
SceKernelThreadInfo status;
thid = sceKernelGetThreadId();
status.size = sizeof(SceKernelThreadInfo);
if (sceKernelReferThreadStatus(thid, &status) == 0) {
sceKernelChangeThreadPriority(thid, status.currentPriority - 1);
}
}
@ -162,17 +162,17 @@ static int
PSPAUD_Init(SDL_AudioDriverImpl * impl)
{
// Set the function pointers
// Set the function pointers
impl->OpenDevice = PSPAUD_OpenDevice;
impl->PlayDevice = PSPAUD_PlayDevice;
impl->WaitDevice = PSPAUD_WaitDevice;
impl->GetDeviceBuf = PSPAUD_GetDeviceBuf;
impl->GetDeviceBuf = PSPAUD_GetDeviceBuf;
impl->WaitDone = PSPAUD_WaitDevice;
impl->CloseDevice = PSPAUD_CloseDevice;
impl->ThreadInit = PSPAUD_ThreadInit;
//PSP audio device
impl->OnlyHasDefaultOutputDevice = 1;
impl->OnlyHasDefaultOutputDevice = 1;
/*
impl->HasCaptureSupport = 1;

View file

@ -25,19 +25,19 @@
#include "../SDL_sysaudio.h"
/* Hidden "this" pointer for the video functions */
#define _THIS SDL_AudioDevice *this
#define _THIS SDL_AudioDevice *this
#define NUM_BUFFERS 2
struct SDL_PrivateAudioData {
/* The hardware output channel. */
int channel;
/* The raw allocated mixing buffer. */
Uint8 *rawbuf;
/* Individual mixing buffers. */
Uint8 *mixbufs[NUM_BUFFERS];
/* Index of the next available mixing buffer. */
int next_buffer;
/* The hardware output channel. */
int channel;
/* The raw allocated mixing buffer. */
Uint8 *rawbuf;
/* Individual mixing buffers. */
Uint8 *mixbufs[NUM_BUFFERS];
/* Index of the next available mixing buffer. */
int next_buffer;
};
#endif /* _SDL_pspaudio_h */

View file

@ -131,7 +131,7 @@ static void
UnloadPulseAudioLibrary(void)
{
if (pulseaudio_handle != NULL) {
SDL_UnloadObject(pulseaudio_handle);
SDL_UnloadObject(pulseaudio_handle);
pulseaudio_handle = NULL;
}
}

View file

@ -47,7 +47,7 @@
/* Open the audio device for playback, and don't block if busy */
#if defined(AUDIO_GETINFO) && !defined(AUDIO_GETBUFINFO)
#if defined(AUDIO_GETINFO) && !defined(AUDIO_GETBUFINFO)
#define AUDIO_GETBUFINFO AUDIO_GETINFO
#endif
@ -82,7 +82,7 @@ static void
SUNAUDIO_WaitDevice(_THIS)
{
#ifdef AUDIO_GETBUFINFO
#define SLEEP_FUDGE 10 /* 10 ms scheduling fudge factor */
#define SLEEP_FUDGE 10 /* 10 ms scheduling fudge factor */
audio_info_t info;
Sint32 left;

View file

@ -26,7 +26,7 @@
#include "../SDL_sysaudio.h"
/* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *this
#define _THIS SDL_AudioDevice *this
struct SDL_PrivateAudioData
{

View file

@ -26,7 +26,7 @@
#include "../SDL_sysaudio.h"
/* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *this
#define _THIS SDL_AudioDevice *this
#define NUM_BUFFERS 2 /* -- Don't lower this! */

View file

@ -41,7 +41,7 @@
#include <XAudio2.h>
/* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *this
#define _THIS SDL_AudioDevice *this
struct SDL_PrivateAudioData
{
@ -232,17 +232,17 @@ XAUDIO2_OpenDevice(_THIS, const char *devname, int iscapture)
IXAudio2SourceVoice *source = NULL;
UINT32 devId = 0; /* 0 == system default device. */
static IXAudio2VoiceCallbackVtbl callbacks_vtable = {
VoiceCBOnVoiceProcessPassStart,
static IXAudio2VoiceCallbackVtbl callbacks_vtable = {
VoiceCBOnVoiceProcessPassStart,
VoiceCBOnVoiceProcessPassEnd,
VoiceCBOnStreamEnd,
VoiceCBOnBufferStart,
VoiceCBOnBufferEnd,
VoiceCBOnLoopEnd,
VoiceCBOnVoiceError
};
};
static IXAudio2VoiceCallback callbacks = { &callbacks_vtable };
static IXAudio2VoiceCallback callbacks = { &callbacks_vtable };
if (iscapture) {
return SDL_SetError("XAudio2: capture devices unsupported.");