mirror of https://github.com/encounter/SDL.git
audio: Renamed some internal driver symbols in various targets.
This commit is contained in:
parent
8f0af77354
commit
6f4bcd2498
|
@ -46,7 +46,7 @@ extern AudioBootStrap QSAAUDIO_bootstrap;
|
||||||
extern AudioBootStrap SUNAUDIO_bootstrap;
|
extern AudioBootStrap SUNAUDIO_bootstrap;
|
||||||
extern AudioBootStrap ARTS_bootstrap;
|
extern AudioBootStrap ARTS_bootstrap;
|
||||||
extern AudioBootStrap ESD_bootstrap;
|
extern AudioBootStrap ESD_bootstrap;
|
||||||
extern AudioBootStrap NACLAUD_bootstrap;
|
extern AudioBootStrap NACLAUDIO_bootstrap;
|
||||||
extern AudioBootStrap NAS_bootstrap;
|
extern AudioBootStrap NAS_bootstrap;
|
||||||
extern AudioBootStrap XAUDIO2_bootstrap;
|
extern AudioBootStrap XAUDIO2_bootstrap;
|
||||||
extern AudioBootStrap DSOUND_bootstrap;
|
extern AudioBootStrap DSOUND_bootstrap;
|
||||||
|
@ -55,17 +55,16 @@ extern AudioBootStrap PAUDIO_bootstrap;
|
||||||
extern AudioBootStrap HAIKUAUDIO_bootstrap;
|
extern AudioBootStrap HAIKUAUDIO_bootstrap;
|
||||||
extern AudioBootStrap COREAUDIO_bootstrap;
|
extern AudioBootStrap COREAUDIO_bootstrap;
|
||||||
extern AudioBootStrap SNDMGR_bootstrap;
|
extern AudioBootStrap SNDMGR_bootstrap;
|
||||||
extern AudioBootStrap DISKAUD_bootstrap;
|
extern AudioBootStrap DISKAUDIO_bootstrap;
|
||||||
extern AudioBootStrap DUMMYAUD_bootstrap;
|
extern AudioBootStrap DUMMYAUDIO_bootstrap;
|
||||||
extern AudioBootStrap DCAUD_bootstrap;
|
extern AudioBootStrap DCAUDIO_bootstrap;
|
||||||
extern AudioBootStrap DART_bootstrap;
|
extern AudioBootStrap DART_bootstrap;
|
||||||
extern AudioBootStrap NDSAUD_bootstrap;
|
extern AudioBootStrap NDSAUDIO_bootstrap;
|
||||||
extern AudioBootStrap FUSIONSOUND_bootstrap;
|
extern AudioBootStrap FUSIONSOUND_bootstrap;
|
||||||
extern AudioBootStrap ANDROIDAUD_bootstrap;
|
extern AudioBootStrap ANDROIDAUDIO_bootstrap;
|
||||||
extern AudioBootStrap PSPAUD_bootstrap;
|
extern AudioBootStrap PSPAUDIO_bootstrap;
|
||||||
extern AudioBootStrap SNDIO_bootstrap;
|
extern AudioBootStrap SNDIO_bootstrap;
|
||||||
extern AudioBootStrap EmscriptenAudio_bootstrap;
|
extern AudioBootStrap EMSCRIPTENAUDIO_bootstrap;
|
||||||
|
|
||||||
|
|
||||||
/* Available audio drivers */
|
/* Available audio drivers */
|
||||||
static const AudioBootStrap *const bootstrap[] = {
|
static const AudioBootStrap *const bootstrap[] = {
|
||||||
|
@ -97,7 +96,7 @@ static const AudioBootStrap *const bootstrap[] = {
|
||||||
&ESD_bootstrap,
|
&ESD_bootstrap,
|
||||||
#endif
|
#endif
|
||||||
#if SDL_AUDIO_DRIVER_NACL
|
#if SDL_AUDIO_DRIVER_NACL
|
||||||
&NACLAUD_bootstrap,
|
&NACLAUDIO_bootstrap,
|
||||||
#endif
|
#endif
|
||||||
#if SDL_AUDIO_DRIVER_NAS
|
#if SDL_AUDIO_DRIVER_NAS
|
||||||
&NAS_bootstrap,
|
&NAS_bootstrap,
|
||||||
|
@ -121,22 +120,22 @@ static const AudioBootStrap *const bootstrap[] = {
|
||||||
&COREAUDIO_bootstrap,
|
&COREAUDIO_bootstrap,
|
||||||
#endif
|
#endif
|
||||||
#if SDL_AUDIO_DRIVER_DISK
|
#if SDL_AUDIO_DRIVER_DISK
|
||||||
&DISKAUD_bootstrap,
|
&DISKAUDIO_bootstrap,
|
||||||
#endif
|
#endif
|
||||||
#if SDL_AUDIO_DRIVER_DUMMY
|
#if SDL_AUDIO_DRIVER_DUMMY
|
||||||
&DUMMYAUD_bootstrap,
|
&DUMMYAUDIO_bootstrap,
|
||||||
#endif
|
#endif
|
||||||
#if SDL_AUDIO_DRIVER_FUSIONSOUND
|
#if SDL_AUDIO_DRIVER_FUSIONSOUND
|
||||||
&FUSIONSOUND_bootstrap,
|
&FUSIONSOUND_bootstrap,
|
||||||
#endif
|
#endif
|
||||||
#if SDL_AUDIO_DRIVER_ANDROID
|
#if SDL_AUDIO_DRIVER_ANDROID
|
||||||
&ANDROIDAUD_bootstrap,
|
&ANDROIDAUDIO_bootstrap,
|
||||||
#endif
|
#endif
|
||||||
#if SDL_AUDIO_DRIVER_PSP
|
#if SDL_AUDIO_DRIVER_PSP
|
||||||
&PSPAUD_bootstrap,
|
&PSPAUDIO_bootstrap,
|
||||||
#endif
|
#endif
|
||||||
#if SDL_AUDIO_DRIVER_EMSCRIPTEN
|
#if SDL_AUDIO_DRIVER_EMSCRIPTEN
|
||||||
&EmscriptenAudio_bootstrap,
|
&EMSCRIPTENAUDIO_bootstrap,
|
||||||
#endif
|
#endif
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
|
@ -37,7 +37,7 @@ static SDL_AudioDevice* audioDevice = NULL;
|
||||||
static SDL_AudioDevice* captureDevice = NULL;
|
static SDL_AudioDevice* captureDevice = NULL;
|
||||||
|
|
||||||
static int
|
static int
|
||||||
AndroidAUD_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
|
ANDROIDAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
|
||||||
{
|
{
|
||||||
SDL_AudioFormat test_format;
|
SDL_AudioFormat test_format;
|
||||||
|
|
||||||
|
@ -96,31 +96,31 @@ AndroidAUD_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
AndroidAUD_PlayDevice(_THIS)
|
ANDROIDAUDIO_PlayDevice(_THIS)
|
||||||
{
|
{
|
||||||
Android_JNI_WriteAudioBuffer();
|
Android_JNI_WriteAudioBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
static Uint8 *
|
static Uint8 *
|
||||||
AndroidAUD_GetDeviceBuf(_THIS)
|
ANDROIDAUDIO_GetDeviceBuf(_THIS)
|
||||||
{
|
{
|
||||||
return Android_JNI_GetAudioBuffer();
|
return Android_JNI_GetAudioBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
AndroidAUD_CaptureFromDevice(_THIS, void *buffer, int buflen)
|
ANDROIDAUDIO_CaptureFromDevice(_THIS, void *buffer, int buflen)
|
||||||
{
|
{
|
||||||
return Android_JNI_CaptureAudioBuffer(buffer, buflen);
|
return Android_JNI_CaptureAudioBuffer(buffer, buflen);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
AndroidAUD_FlushCapture(_THIS)
|
ANDROIDAUDIO_FlushCapture(_THIS)
|
||||||
{
|
{
|
||||||
Android_JNI_FlushCapturedAudio();
|
Android_JNI_FlushCapturedAudio();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
AndroidAUD_CloseDevice(_THIS)
|
ANDROIDAUDIO_CloseDevice(_THIS)
|
||||||
{
|
{
|
||||||
/* At this point SDL_CloseAudioDevice via close_audio_device took care of terminating the audio thread
|
/* At this point SDL_CloseAudioDevice via close_audio_device took care of terminating the audio thread
|
||||||
so it's safe to terminate the Java side buffer and AudioTrack
|
so it's safe to terminate the Java side buffer and AudioTrack
|
||||||
|
@ -137,15 +137,15 @@ AndroidAUD_CloseDevice(_THIS)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
AndroidAUD_Init(SDL_AudioDriverImpl * impl)
|
ANDROIDAUDIO_Init(SDL_AudioDriverImpl * impl)
|
||||||
{
|
{
|
||||||
/* Set the function pointers */
|
/* Set the function pointers */
|
||||||
impl->OpenDevice = AndroidAUD_OpenDevice;
|
impl->OpenDevice = ANDROIDAUDIO_OpenDevice;
|
||||||
impl->PlayDevice = AndroidAUD_PlayDevice;
|
impl->PlayDevice = ANDROIDAUDIO_PlayDevice;
|
||||||
impl->GetDeviceBuf = AndroidAUD_GetDeviceBuf;
|
impl->GetDeviceBuf = ANDROIDAUDIO_GetDeviceBuf;
|
||||||
impl->CloseDevice = AndroidAUD_CloseDevice;
|
impl->CloseDevice = ANDROIDAUDIO_CloseDevice;
|
||||||
impl->CaptureFromDevice = AndroidAUD_CaptureFromDevice;
|
impl->CaptureFromDevice = ANDROIDAUDIO_CaptureFromDevice;
|
||||||
impl->FlushCapture = AndroidAUD_FlushCapture;
|
impl->FlushCapture = ANDROIDAUDIO_FlushCapture;
|
||||||
|
|
||||||
/* and the capabilities */
|
/* and the capabilities */
|
||||||
impl->HasCaptureSupport = SDL_TRUE;
|
impl->HasCaptureSupport = SDL_TRUE;
|
||||||
|
@ -155,12 +155,12 @@ AndroidAUD_Init(SDL_AudioDriverImpl * impl)
|
||||||
return 1; /* this audio target is available. */
|
return 1; /* this audio target is available. */
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioBootStrap ANDROIDAUD_bootstrap = {
|
AudioBootStrap ANDROIDAUDIO_bootstrap = {
|
||||||
"android", "SDL Android audio driver", AndroidAUD_Init, 0
|
"android", "SDL Android audio driver", ANDROIDAUDIO_Init, 0
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Pause (block) all non already paused audio devices by taking their mixer lock */
|
/* Pause (block) all non already paused audio devices by taking their mixer lock */
|
||||||
void AndroidAUD_PauseDevices(void)
|
void ANDROIDAUDIO_PauseDevices(void)
|
||||||
{
|
{
|
||||||
/* TODO: Handle multiple devices? */
|
/* TODO: Handle multiple devices? */
|
||||||
struct SDL_PrivateAudioData *private;
|
struct SDL_PrivateAudioData *private;
|
||||||
|
@ -192,7 +192,7 @@ void AndroidAUD_PauseDevices(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Resume (unblock) all non already paused audio devices by releasing their mixer lock */
|
/* Resume (unblock) all non already paused audio devices by releasing their mixer lock */
|
||||||
void AndroidAUD_ResumeDevices(void)
|
void ANDROIDAUDIO_ResumeDevices(void)
|
||||||
{
|
{
|
||||||
/* TODO: Handle multiple devices? */
|
/* TODO: Handle multiple devices? */
|
||||||
struct SDL_PrivateAudioData *private;
|
struct SDL_PrivateAudioData *private;
|
||||||
|
|
|
@ -34,8 +34,6 @@ struct SDL_PrivateAudioData
|
||||||
int resume;
|
int resume;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void AndroidAUD_CloseDevice(_THIS);
|
|
||||||
|
|
||||||
#endif /* _SDL_androidaudio_h */
|
#endif /* _SDL_androidaudio_h */
|
||||||
|
|
||||||
/* vi: set ts=4 sw=4 expandtab: */
|
/* vi: set ts=4 sw=4 expandtab: */
|
||||||
|
|
|
@ -44,13 +44,13 @@
|
||||||
|
|
||||||
/* This function waits until it is possible to write a full sound buffer */
|
/* This function waits until it is possible to write a full sound buffer */
|
||||||
static void
|
static void
|
||||||
DISKAUD_WaitDevice(_THIS)
|
DISKAUDIO_WaitDevice(_THIS)
|
||||||
{
|
{
|
||||||
SDL_Delay(this->hidden->io_delay);
|
SDL_Delay(this->hidden->io_delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
DISKAUD_PlayDevice(_THIS)
|
DISKAUDIO_PlayDevice(_THIS)
|
||||||
{
|
{
|
||||||
const size_t written = SDL_RWwrite(this->hidden->io,
|
const size_t written = SDL_RWwrite(this->hidden->io,
|
||||||
this->hidden->mixbuf,
|
this->hidden->mixbuf,
|
||||||
|
@ -66,13 +66,13 @@ DISKAUD_PlayDevice(_THIS)
|
||||||
}
|
}
|
||||||
|
|
||||||
static Uint8 *
|
static Uint8 *
|
||||||
DISKAUD_GetDeviceBuf(_THIS)
|
DISKAUDIO_GetDeviceBuf(_THIS)
|
||||||
{
|
{
|
||||||
return (this->hidden->mixbuf);
|
return (this->hidden->mixbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
DISKAUD_CaptureFromDevice(_THIS, void *buffer, int buflen)
|
DISKAUDIO_CaptureFromDevice(_THIS, void *buffer, int buflen)
|
||||||
{
|
{
|
||||||
struct SDL_PrivateAudioData *h = this->hidden;
|
struct SDL_PrivateAudioData *h = this->hidden;
|
||||||
const int origbuflen = buflen;
|
const int origbuflen = buflen;
|
||||||
|
@ -96,14 +96,14 @@ DISKAUD_CaptureFromDevice(_THIS, void *buffer, int buflen)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
DISKAUD_FlushCapture(_THIS)
|
DISKAUDIO_FlushCapture(_THIS)
|
||||||
{
|
{
|
||||||
/* no op...we don't advance the file pointer or anything. */
|
/* no op...we don't advance the file pointer or anything. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
DISKAUD_CloseDevice(_THIS)
|
DISKAUDIO_CloseDevice(_THIS)
|
||||||
{
|
{
|
||||||
if (this->hidden->io != NULL) {
|
if (this->hidden->io != NULL) {
|
||||||
SDL_RWclose(this->hidden->io);
|
SDL_RWclose(this->hidden->io);
|
||||||
|
@ -126,7 +126,7 @@ get_filename(const int iscapture, const char *devname)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
DISKAUD_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
|
DISKAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
|
||||||
{
|
{
|
||||||
/* handle != NULL means "user specified the placeholder name on the fake detected device list" */
|
/* handle != NULL means "user specified the placeholder name on the fake detected device list" */
|
||||||
const char *fname = get_filename(iscapture, handle ? NULL : devname);
|
const char *fname = get_filename(iscapture, handle ? NULL : devname);
|
||||||
|
@ -172,25 +172,25 @@ DISKAUD_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
DISKAUD_DetectDevices(void)
|
DISKAUDIO_DetectDevices(void)
|
||||||
{
|
{
|
||||||
SDL_AddAudioDevice(SDL_FALSE, DEFAULT_OUTPUT_DEVNAME, (void *) 0x1);
|
SDL_AddAudioDevice(SDL_FALSE, DEFAULT_OUTPUT_DEVNAME, (void *) 0x1);
|
||||||
SDL_AddAudioDevice(SDL_TRUE, DEFAULT_INPUT_DEVNAME, (void *) 0x2);
|
SDL_AddAudioDevice(SDL_TRUE, DEFAULT_INPUT_DEVNAME, (void *) 0x2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
DISKAUD_Init(SDL_AudioDriverImpl * impl)
|
DISKAUDIO_Init(SDL_AudioDriverImpl * impl)
|
||||||
{
|
{
|
||||||
/* Set the function pointers */
|
/* Set the function pointers */
|
||||||
impl->OpenDevice = DISKAUD_OpenDevice;
|
impl->OpenDevice = DISKAUDIO_OpenDevice;
|
||||||
impl->WaitDevice = DISKAUD_WaitDevice;
|
impl->WaitDevice = DISKAUDIO_WaitDevice;
|
||||||
impl->PlayDevice = DISKAUD_PlayDevice;
|
impl->PlayDevice = DISKAUDIO_PlayDevice;
|
||||||
impl->GetDeviceBuf = DISKAUD_GetDeviceBuf;
|
impl->GetDeviceBuf = DISKAUDIO_GetDeviceBuf;
|
||||||
impl->CaptureFromDevice = DISKAUD_CaptureFromDevice;
|
impl->CaptureFromDevice = DISKAUDIO_CaptureFromDevice;
|
||||||
impl->FlushCapture = DISKAUD_FlushCapture;
|
impl->FlushCapture = DISKAUDIO_FlushCapture;
|
||||||
|
|
||||||
impl->CloseDevice = DISKAUD_CloseDevice;
|
impl->CloseDevice = DISKAUDIO_CloseDevice;
|
||||||
impl->DetectDevices = DISKAUD_DetectDevices;
|
impl->DetectDevices = DISKAUDIO_DetectDevices;
|
||||||
|
|
||||||
impl->AllowsArbitraryDeviceNames = 1;
|
impl->AllowsArbitraryDeviceNames = 1;
|
||||||
impl->HasCaptureSupport = SDL_TRUE;
|
impl->HasCaptureSupport = SDL_TRUE;
|
||||||
|
@ -198,8 +198,8 @@ DISKAUD_Init(SDL_AudioDriverImpl * impl)
|
||||||
return 1; /* this audio target is available. */
|
return 1; /* this audio target is available. */
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioBootStrap DISKAUD_bootstrap = {
|
AudioBootStrap DISKAUDIO_bootstrap = {
|
||||||
"disk", "direct-to-disk audio", DISKAUD_Init, 1
|
"disk", "direct-to-disk audio", DISKAUDIO_Init, 1
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SDL_AUDIO_DRIVER_DISK */
|
#endif /* SDL_AUDIO_DRIVER_DISK */
|
||||||
|
|
|
@ -28,13 +28,13 @@
|
||||||
#include "SDL_dummyaudio.h"
|
#include "SDL_dummyaudio.h"
|
||||||
|
|
||||||
static int
|
static int
|
||||||
DUMMYAUD_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
|
DUMMYAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
|
||||||
{
|
{
|
||||||
return 0; /* always succeeds. */
|
return 0; /* always succeeds. */
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
DUMMYAUD_CaptureFromDevice(_THIS, void *buffer, int buflen)
|
DUMMYAUDIO_CaptureFromDevice(_THIS, void *buffer, int buflen)
|
||||||
{
|
{
|
||||||
/* Delay to make this sort of simulate real audio input. */
|
/* Delay to make this sort of simulate real audio input. */
|
||||||
SDL_Delay((this->spec.samples * 1000) / this->spec.freq);
|
SDL_Delay((this->spec.samples * 1000) / this->spec.freq);
|
||||||
|
@ -45,11 +45,11 @@ DUMMYAUD_CaptureFromDevice(_THIS, void *buffer, int buflen)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
DUMMYAUD_Init(SDL_AudioDriverImpl * impl)
|
DUMMYAUDIO_Init(SDL_AudioDriverImpl * impl)
|
||||||
{
|
{
|
||||||
/* Set the function pointers */
|
/* Set the function pointers */
|
||||||
impl->OpenDevice = DUMMYAUD_OpenDevice;
|
impl->OpenDevice = DUMMYAUDIO_OpenDevice;
|
||||||
impl->CaptureFromDevice = DUMMYAUD_CaptureFromDevice;
|
impl->CaptureFromDevice = DUMMYAUDIO_CaptureFromDevice;
|
||||||
|
|
||||||
impl->OnlyHasDefaultOutputDevice = 1;
|
impl->OnlyHasDefaultOutputDevice = 1;
|
||||||
impl->OnlyHasDefaultCaptureDevice = 1;
|
impl->OnlyHasDefaultCaptureDevice = 1;
|
||||||
|
@ -58,8 +58,8 @@ DUMMYAUD_Init(SDL_AudioDriverImpl * impl)
|
||||||
return 1; /* this audio target is available. */
|
return 1; /* this audio target is available. */
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioBootStrap DUMMYAUD_bootstrap = {
|
AudioBootStrap DUMMYAUDIO_bootstrap = {
|
||||||
"dummy", "SDL dummy audio driver", DUMMYAUD_Init, 1
|
"dummy", "SDL dummy audio driver", DUMMYAUDIO_Init, 1
|
||||||
};
|
};
|
||||||
|
|
||||||
/* vi: set ts=4 sw=4 expandtab: */
|
/* vi: set ts=4 sw=4 expandtab: */
|
||||||
|
|
|
@ -196,7 +196,7 @@ HandleCaptureProcess(_THIS)
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
Emscripten_CloseDevice(_THIS)
|
EMSCRIPTENAUDIO_CloseDevice(_THIS)
|
||||||
{
|
{
|
||||||
EM_ASM_({
|
EM_ASM_({
|
||||||
if ($0) {
|
if ($0) {
|
||||||
|
@ -233,7 +233,7 @@ Emscripten_CloseDevice(_THIS)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
Emscripten_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
|
EMSCRIPTENAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
|
||||||
{
|
{
|
||||||
SDL_bool valid_format = SDL_FALSE;
|
SDL_bool valid_format = SDL_FALSE;
|
||||||
SDL_AudioFormat test_format;
|
SDL_AudioFormat test_format;
|
||||||
|
@ -380,11 +380,11 @@ Emscripten_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
Emscripten_Init(SDL_AudioDriverImpl * impl)
|
EMSCRIPTENAUDIO_Init(SDL_AudioDriverImpl * impl)
|
||||||
{
|
{
|
||||||
/* Set the function pointers */
|
/* Set the function pointers */
|
||||||
impl->OpenDevice = Emscripten_OpenDevice;
|
impl->OpenDevice = EMSCRIPTENAUDIO_OpenDevice;
|
||||||
impl->CloseDevice = Emscripten_CloseDevice;
|
impl->CloseDevice = EMSCRIPTENAUDIO_CloseDevice;
|
||||||
|
|
||||||
impl->OnlyHasDefaultOutputDevice = 1;
|
impl->OnlyHasDefaultOutputDevice = 1;
|
||||||
|
|
||||||
|
@ -421,8 +421,8 @@ Emscripten_Init(SDL_AudioDriverImpl * impl)
|
||||||
return available;
|
return available;
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioBootStrap EmscriptenAudio_bootstrap = {
|
AudioBootStrap EMSCRIPTENAUDIO_bootstrap = {
|
||||||
"emscripten", "SDL emscripten audio driver", Emscripten_Init, 0
|
"emscripten", "SDL emscripten audio driver", EMSCRIPTENAUDIO_Init, 0
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SDL_AUDIO_DRIVER_EMSCRIPTEN */
|
#endif /* SDL_AUDIO_DRIVER_EMSCRIPTEN */
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
#include "ppapi_simple/ps_event.h"
|
#include "ppapi_simple/ps_event.h"
|
||||||
|
|
||||||
/* The tag name used by NACL audio */
|
/* The tag name used by NACL audio */
|
||||||
#define NACLAUD_DRIVER_NAME "nacl"
|
#define NACLAUDIO_DRIVER_NAME "nacl"
|
||||||
|
|
||||||
#define SAMPLE_FRAME_COUNT 4096
|
#define SAMPLE_FRAME_COUNT 4096
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ static void nacl_audio_callback(void* samples, uint32_t buffer_size, PP_TimeDelt
|
||||||
SDL_UnlockMutex(private->mutex);
|
SDL_UnlockMutex(private->mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void NACLAUD_CloseDevice(SDL_AudioDevice *device) {
|
static void NACLAUDIO_CloseDevice(SDL_AudioDevice *device) {
|
||||||
const PPB_Core *core = PSInterfaceCore();
|
const PPB_Core *core = PSInterfaceCore();
|
||||||
const PPB_Audio *ppb_audio = PSInterfaceAudio();
|
const PPB_Audio *ppb_audio = PSInterfaceAudio();
|
||||||
SDL_PrivateAudioData *hidden = (SDL_PrivateAudioData *) device->hidden;
|
SDL_PrivateAudioData *hidden = (SDL_PrivateAudioData *) device->hidden;
|
||||||
|
@ -82,7 +82,7 @@ static void NACLAUD_CloseDevice(SDL_AudioDevice *device) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
NACLAUD_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) {
|
NACLAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) {
|
||||||
PP_Instance instance = PSGetInstanceId();
|
PP_Instance instance = PSGetInstanceId();
|
||||||
const PPB_Audio *ppb_audio = PSInterfaceAudio();
|
const PPB_Audio *ppb_audio = PSInterfaceAudio();
|
||||||
const PPB_AudioConfig *ppb_audiocfg = PSInterfaceAudioConfig();
|
const PPB_AudioConfig *ppb_audiocfg = PSInterfaceAudioConfig();
|
||||||
|
@ -118,30 +118,30 @@ NACLAUD_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
NACLAUD_Init(SDL_AudioDriverImpl * impl)
|
NACLAUDIO_Init(SDL_AudioDriverImpl * impl)
|
||||||
{
|
{
|
||||||
if (PSGetInstanceId() == 0) {
|
if (PSGetInstanceId() == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the function pointers */
|
/* Set the function pointers */
|
||||||
impl->OpenDevice = NACLAUD_OpenDevice;
|
impl->OpenDevice = NACLAUDIO_OpenDevice;
|
||||||
impl->CloseDevice = NACLAUD_CloseDevice;
|
impl->CloseDevice = NACLAUDIO_CloseDevice;
|
||||||
impl->OnlyHasDefaultOutputDevice = 1;
|
impl->OnlyHasDefaultOutputDevice = 1;
|
||||||
impl->ProvidesOwnCallbackThread = 1;
|
impl->ProvidesOwnCallbackThread = 1;
|
||||||
/*
|
/*
|
||||||
* impl->WaitDevice = NACLAUD_WaitDevice;
|
* impl->WaitDevice = NACLAUDIO_WaitDevice;
|
||||||
* impl->GetDeviceBuf = NACLAUD_GetDeviceBuf;
|
* impl->GetDeviceBuf = NACLAUDIO_GetDeviceBuf;
|
||||||
* impl->PlayDevice = NACLAUD_PlayDevice;
|
* impl->PlayDevice = NACLAUDIO_PlayDevice;
|
||||||
* impl->Deinitialize = NACLAUD_Deinitialize;
|
* impl->Deinitialize = NACLAUDIO_Deinitialize;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioBootStrap NACLAUD_bootstrap = {
|
AudioBootStrap NACLAUDIO_bootstrap = {
|
||||||
NACLAUD_DRIVER_NAME, "SDL NaCl Audio Driver",
|
NACLAUDIO_DRIVER_NAME, "SDL NaCl Audio Driver",
|
||||||
NACLAUD_Init, 0
|
NACLAUDIO_Init, 0
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SDL_AUDIO_DRIVER_NACL */
|
#endif /* SDL_AUDIO_DRIVER_NACL */
|
||||||
|
|
|
@ -39,10 +39,10 @@
|
||||||
#include <pspthreadman.h>
|
#include <pspthreadman.h>
|
||||||
|
|
||||||
/* The tag name used by PSP audio */
|
/* The tag name used by PSP audio */
|
||||||
#define PSPAUD_DRIVER_NAME "psp"
|
#define PSPAUDIO_DRIVER_NAME "psp"
|
||||||
|
|
||||||
static int
|
static int
|
||||||
PSPAUD_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
|
PSPAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
|
||||||
{
|
{
|
||||||
int format, mixlen, i;
|
int format, mixlen, i;
|
||||||
this->hidden = (struct SDL_PrivateAudioData *)
|
this->hidden = (struct SDL_PrivateAudioData *)
|
||||||
|
@ -98,7 +98,7 @@ PSPAUD_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PSPAUD_PlayDevice(_THIS)
|
static void PSPAUDIO_PlayDevice(_THIS)
|
||||||
{
|
{
|
||||||
Uint8 *mixbuf = this->hidden->mixbufs[this->hidden->next_buffer];
|
Uint8 *mixbuf = this->hidden->mixbufs[this->hidden->next_buffer];
|
||||||
|
|
||||||
|
@ -112,16 +112,16 @@ static void PSPAUD_PlayDevice(_THIS)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function waits until it is possible to write a full sound buffer */
|
/* This function waits until it is possible to write a full sound buffer */
|
||||||
static void PSPAUD_WaitDevice(_THIS)
|
static void PSPAUDIO_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)
|
static Uint8 *PSPAUDIO_GetDeviceBuf(_THIS)
|
||||||
{
|
{
|
||||||
return this->hidden->mixbufs[this->hidden->next_buffer];
|
return this->hidden->mixbufs[this->hidden->next_buffer];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PSPAUD_CloseDevice(_THIS)
|
static void PSPAUDIO_CloseDevice(_THIS)
|
||||||
{
|
{
|
||||||
if (this->hidden->channel >= 0) {
|
if (this->hidden->channel >= 0) {
|
||||||
sceAudioChRelease(this->hidden->channel);
|
sceAudioChRelease(this->hidden->channel);
|
||||||
|
@ -130,7 +130,7 @@ static void PSPAUD_CloseDevice(_THIS)
|
||||||
SDL_free(this->hidden);
|
SDL_free(this->hidden);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PSPAUD_ThreadInit(_THIS)
|
static void PSPAUDIO_ThreadInit(_THIS)
|
||||||
{
|
{
|
||||||
/* Increase the priority of this audio thread by 1 to put it
|
/* Increase the priority of this audio thread by 1 to put it
|
||||||
ahead of other SDL threads. */
|
ahead of other SDL threads. */
|
||||||
|
@ -145,16 +145,16 @@ static void PSPAUD_ThreadInit(_THIS)
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
PSPAUD_Init(SDL_AudioDriverImpl * impl)
|
PSPAUDIO_Init(SDL_AudioDriverImpl * impl)
|
||||||
{
|
{
|
||||||
/* Set the function pointers */
|
/* Set the function pointers */
|
||||||
impl->OpenDevice = PSPAUD_OpenDevice;
|
impl->OpenDevice = PSPAUDIO_OpenDevice;
|
||||||
impl->PlayDevice = PSPAUD_PlayDevice;
|
impl->PlayDevice = PSPAUDIO_PlayDevice;
|
||||||
impl->WaitDevice = PSPAUD_WaitDevice;
|
impl->WaitDevice = PSPAUDIO_WaitDevice;
|
||||||
impl->GetDeviceBuf = PSPAUD_GetDeviceBuf;
|
impl->GetDeviceBuf = PSPAUDIO_GetDeviceBuf;
|
||||||
impl->WaitDone = PSPAUD_WaitDevice;
|
impl->WaitDone = PSPAUDIO_WaitDevice;
|
||||||
impl->CloseDevice = PSPAUD_CloseDevice;
|
impl->CloseDevice = PSPAUDIO_CloseDevice;
|
||||||
impl->ThreadInit = PSPAUD_ThreadInit;
|
impl->ThreadInit = PSPAUDIO_ThreadInit;
|
||||||
|
|
||||||
/* PSP audio device */
|
/* PSP audio device */
|
||||||
impl->OnlyHasDefaultOutputDevice = 1;
|
impl->OnlyHasDefaultOutputDevice = 1;
|
||||||
|
@ -170,8 +170,8 @@ PSPAUD_Init(SDL_AudioDriverImpl * impl)
|
||||||
return 1; /* this audio target is available. */
|
return 1; /* this audio target is available. */
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioBootStrap PSPAUD_bootstrap = {
|
AudioBootStrap PSPAUDIO_bootstrap = {
|
||||||
"psp", "PSP audio driver", PSPAUD_Init, 0
|
"psp", "PSP audio driver", PSPAUDIO_Init, 0
|
||||||
};
|
};
|
||||||
|
|
||||||
/* SDL_AUDI */
|
/* SDL_AUDI */
|
||||||
|
|
|
@ -34,11 +34,11 @@ void android_egl_context_backup();
|
||||||
void android_egl_context_restore();
|
void android_egl_context_restore();
|
||||||
|
|
||||||
#if SDL_AUDIO_DRIVER_ANDROID
|
#if SDL_AUDIO_DRIVER_ANDROID
|
||||||
void AndroidAUD_ResumeDevices(void);
|
void ANDROIDAUDIO_ResumeDevices(void);
|
||||||
void AndroidAUD_PauseDevices(void);
|
void ANDROIDAUDIO_PauseDevices(void);
|
||||||
#else
|
#else
|
||||||
static void AndroidAUD_ResumeDevices(void) {}
|
static void ANDROIDAUDIO_ResumeDevices(void) {}
|
||||||
static void AndroidAUD_PauseDevices(void) {}
|
static void ANDROIDAUDIO_PauseDevices(void) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -83,14 +83,14 @@ Android_PumpEvents(_THIS)
|
||||||
if (isPaused && !isPausing) {
|
if (isPaused && !isPausing) {
|
||||||
/* Make sure this is the last thing we do before pausing */
|
/* Make sure this is the last thing we do before pausing */
|
||||||
android_egl_context_backup();
|
android_egl_context_backup();
|
||||||
AndroidAUD_PauseDevices();
|
ANDROIDAUDIO_PauseDevices();
|
||||||
if(SDL_SemWait(Android_ResumeSem) == 0) {
|
if(SDL_SemWait(Android_ResumeSem) == 0) {
|
||||||
#else
|
#else
|
||||||
if (isPaused) {
|
if (isPaused) {
|
||||||
if(SDL_SemTryWait(Android_ResumeSem) == 0) {
|
if(SDL_SemTryWait(Android_ResumeSem) == 0) {
|
||||||
#endif
|
#endif
|
||||||
isPaused = 0;
|
isPaused = 0;
|
||||||
AndroidAUD_ResumeDevices();
|
ANDROIDAUDIO_ResumeDevices();
|
||||||
/* Restore the GL Context from here, as this operation is thread dependent */
|
/* Restore the GL Context from here, as this operation is thread dependent */
|
||||||
if (!SDL_HasEvent(SDL_QUIT)) {
|
if (!SDL_HasEvent(SDL_QUIT)) {
|
||||||
android_egl_context_restore();
|
android_egl_context_restore();
|
||||||
|
@ -113,7 +113,7 @@ Android_PumpEvents(_THIS)
|
||||||
#else
|
#else
|
||||||
if(SDL_SemTryWait(Android_PauseSem) == 0) {
|
if(SDL_SemTryWait(Android_PauseSem) == 0) {
|
||||||
android_egl_context_backup();
|
android_egl_context_backup();
|
||||||
AndroidAUD_PauseDevices();
|
ANDROIDAUDIO_PauseDevices();
|
||||||
isPaused = 1;
|
isPaused = 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue