opensles: Fixed capitalization to match other SDL backends.
parent
34914bfb49
commit
442e84916a
|
@ -55,7 +55,7 @@ static const AudioBootStrap *const bootstrap[] = {
|
|||
&AAUDIO_bootstrap,
|
||||
#endif
|
||||
#ifdef SDL_AUDIO_DRIVER_OPENSLES
|
||||
&openslES_bootstrap,
|
||||
&OPENSLES_bootstrap,
|
||||
#endif
|
||||
#ifdef SDL_AUDIO_DRIVER_ANDROID
|
||||
&ANDROIDAUDIO_bootstrap,
|
||||
|
|
|
@ -338,7 +338,7 @@ extern AudioBootStrap COREAUDIO_bootstrap;
|
|||
extern AudioBootStrap DISKAUDIO_bootstrap;
|
||||
extern AudioBootStrap DUMMYAUDIO_bootstrap;
|
||||
extern AudioBootStrap AAUDIO_bootstrap;
|
||||
extern AudioBootStrap openslES_bootstrap; // !!! FIXME: capitalize this to match the others
|
||||
extern AudioBootStrap OPENSLES_bootstrap;
|
||||
extern AudioBootStrap ANDROIDAUDIO_bootstrap;
|
||||
extern AudioBootStrap PS2AUDIO_bootstrap;
|
||||
extern AudioBootStrap PSPAUDIO_bootstrap;
|
||||
|
|
|
@ -108,7 +108,7 @@ static const char *sldevaudioplayerstr = "SLES Audio Player";
|
|||
|
||||
#define SLES_DEV_AUDIO_RECORDER sldevaudiorecorderstr
|
||||
#define SLES_DEV_AUDIO_PLAYER sldevaudioplayerstr
|
||||
static void openslES_DetectDevices( int iscapture )
|
||||
static void OPENSLES_DetectDevices( int iscapture )
|
||||
{
|
||||
LOGI( "openSLES_DetectDevices()" );
|
||||
if ( iscapture )
|
||||
|
@ -118,9 +118,9 @@ static void openslES_DetectDevices( int iscapture )
|
|||
}
|
||||
#endif
|
||||
|
||||
static void openslES_DestroyEngine(void)
|
||||
static void OPENSLES_DestroyEngine(void)
|
||||
{
|
||||
LOGI("openslES_DestroyEngine()");
|
||||
LOGI("OPENSLES_DestroyEngine()");
|
||||
|
||||
// destroy output mix object, and invalidate all associated interfaces
|
||||
if (outputMixObject != NULL) {
|
||||
|
@ -136,7 +136,7 @@ static void openslES_DestroyEngine(void)
|
|||
}
|
||||
}
|
||||
|
||||
static int openslES_CreateEngine(void)
|
||||
static int OPENSLES_CreateEngine(void)
|
||||
{
|
||||
const SLInterfaceID ids[1] = { SL_IID_VOLUME };
|
||||
const SLboolean req[1] = { SL_BOOLEAN_FALSE };
|
||||
|
@ -185,7 +185,7 @@ static int openslES_CreateEngine(void)
|
|||
return 1;
|
||||
|
||||
error:
|
||||
openslES_DestroyEngine();
|
||||
OPENSLES_DestroyEngine();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -198,7 +198,7 @@ static void bqRecorderCallback(SLAndroidSimpleBufferQueueItf bq, void *context)
|
|||
SDL_PostSemaphore(audiodata->playsem);
|
||||
}
|
||||
|
||||
static void openslES_DestroyPCMRecorder(SDL_AudioDevice *device)
|
||||
static void OPENSLES_DestroyPCMRecorder(SDL_AudioDevice *device)
|
||||
{
|
||||
struct SDL_PrivateAudioData *audiodata = device->hidden;
|
||||
SLresult result;
|
||||
|
@ -229,7 +229,7 @@ static void openslES_DestroyPCMRecorder(SDL_AudioDevice *device)
|
|||
}
|
||||
}
|
||||
|
||||
static int openslES_CreatePCMRecorder(SDL_AudioDevice *device)
|
||||
static int OPENSLES_CreatePCMRecorder(SDL_AudioDevice *device)
|
||||
{
|
||||
struct SDL_PrivateAudioData *audiodata = device->hidden;
|
||||
SLDataFormat_PCM format_pcm;
|
||||
|
@ -375,7 +375,7 @@ static void bqPlayerCallback(SLAndroidSimpleBufferQueueItf bq, void *context)
|
|||
SDL_PostSemaphore(audiodata->playsem);
|
||||
}
|
||||
|
||||
static void openslES_DestroyPCMPlayer(SDL_AudioDevice *device)
|
||||
static void OPENSLES_DestroyPCMPlayer(SDL_AudioDevice *device)
|
||||
{
|
||||
struct SDL_PrivateAudioData *audiodata = device->hidden;
|
||||
|
||||
|
@ -406,7 +406,7 @@ static void openslES_DestroyPCMPlayer(SDL_AudioDevice *device)
|
|||
}
|
||||
}
|
||||
|
||||
static int openslES_CreatePCMPlayer(SDL_AudioDevice *device)
|
||||
static int OPENSLES_CreatePCMPlayer(SDL_AudioDevice *device)
|
||||
{
|
||||
/* If we want to add floating point audio support (requires API level 21)
|
||||
it can be done as described here:
|
||||
|
@ -597,7 +597,7 @@ failed:
|
|||
return -1;
|
||||
}
|
||||
|
||||
static int openslES_OpenDevice(SDL_AudioDevice *device)
|
||||
static int OPENSLES_OpenDevice(SDL_AudioDevice *device)
|
||||
{
|
||||
device->hidden = (struct SDL_PrivateAudioData *)SDL_calloc(1, sizeof(*device->hidden));
|
||||
if (device->hidden == NULL) {
|
||||
|
@ -605,18 +605,18 @@ static int openslES_OpenDevice(SDL_AudioDevice *device)
|
|||
}
|
||||
|
||||
if (device->iscapture) {
|
||||
LOGI("openslES_OpenDevice() for capture");
|
||||
return openslES_CreatePCMRecorder(device);
|
||||
LOGI("OPENSLES_OpenDevice() for capture");
|
||||
return OPENSLES_CreatePCMRecorder(device);
|
||||
} else {
|
||||
int ret;
|
||||
LOGI("openslES_OpenDevice() for playing");
|
||||
ret = openslES_CreatePCMPlayer(device);
|
||||
LOGI("OPENSLES_OpenDevice() for playing");
|
||||
ret = OPENSLES_CreatePCMPlayer(device);
|
||||
if (ret < 0) {
|
||||
// Another attempt to open the device with a lower frequency
|
||||
if (device->spec.freq > 48000) {
|
||||
openslES_DestroyPCMPlayer(device);
|
||||
OPENSLES_DestroyPCMPlayer(device);
|
||||
device->spec.freq = 48000;
|
||||
ret = openslES_CreatePCMPlayer(device);
|
||||
ret = OPENSLES_CreatePCMPlayer(device);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -628,21 +628,21 @@ static int openslES_OpenDevice(SDL_AudioDevice *device)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int openslES_WaitDevice(SDL_AudioDevice *device)
|
||||
static int OPENSLES_WaitDevice(SDL_AudioDevice *device)
|
||||
{
|
||||
struct SDL_PrivateAudioData *audiodata = device->hidden;
|
||||
|
||||
LOGV("openslES_WaitDevice()");
|
||||
LOGV("OPENSLES_WaitDevice()");
|
||||
|
||||
// Wait for an audio chunk to finish
|
||||
return SDL_WaitSemaphore(audiodata->playsem);
|
||||
}
|
||||
|
||||
static int openslES_PlayDevice(SDL_AudioDevice *device, const Uint8 *buffer, int buflen)
|
||||
static int OPENSLES_PlayDevice(SDL_AudioDevice *device, const Uint8 *buffer, int buflen)
|
||||
{
|
||||
struct SDL_PrivateAudioData *audiodata = device->hidden;
|
||||
|
||||
LOGV("======openslES_PlayDevice()======");
|
||||
LOGV("======OPENSLES_PlayDevice()======");
|
||||
|
||||
// Queue it up
|
||||
const SLresult result = (*bqPlayerBufferQueue)->Enqueue(bqPlayerBufferQueue, buffer, buflen);
|
||||
|
@ -673,15 +673,15 @@ static int openslES_PlayDevice(SDL_AudioDevice *device, const Uint8 *buffer, int
|
|||
//
|
||||
// okay..
|
||||
|
||||
static Uint8 *openslES_GetDeviceBuf(SDL_AudioDevice *device, int *bufsize)
|
||||
static Uint8 *OPENSLES_GetDeviceBuf(SDL_AudioDevice *device, int *bufsize)
|
||||
{
|
||||
struct SDL_PrivateAudioData *audiodata = device->hidden;
|
||||
|
||||
LOGV("openslES_GetDeviceBuf()");
|
||||
LOGV("OPENSLES_GetDeviceBuf()");
|
||||
return audiodata->pmixbuff[audiodata->next_buffer];
|
||||
}
|
||||
|
||||
static int openslES_CaptureFromDevice(SDL_AudioDevice *device, void *buffer, int buflen)
|
||||
static int OPENSLES_CaptureFromDevice(SDL_AudioDevice *device, void *buffer, int buflen)
|
||||
{
|
||||
struct SDL_PrivateAudioData *audiodata = device->hidden;
|
||||
|
||||
|
@ -704,16 +704,16 @@ static int openslES_CaptureFromDevice(SDL_AudioDevice *device, void *buffer, int
|
|||
return device->buffer_size;
|
||||
}
|
||||
|
||||
static void openslES_CloseDevice(SDL_AudioDevice *device)
|
||||
static void OPENSLES_CloseDevice(SDL_AudioDevice *device)
|
||||
{
|
||||
// struct SDL_PrivateAudioData *audiodata = device->hidden;
|
||||
if (device->hidden) {
|
||||
if (device->iscapture) {
|
||||
LOGI("openslES_CloseDevice() for capture");
|
||||
openslES_DestroyPCMRecorder(device);
|
||||
LOGI("OPENSLES_CloseDevice() for capture");
|
||||
OPENSLES_DestroyPCMRecorder(device);
|
||||
} else {
|
||||
LOGI("openslES_CloseDevice() for playing");
|
||||
openslES_DestroyPCMPlayer(device);
|
||||
LOGI("OPENSLES_CloseDevice() for playing");
|
||||
OPENSLES_DestroyPCMPlayer(device);
|
||||
}
|
||||
|
||||
SDL_free(device->hidden);
|
||||
|
@ -721,61 +721,61 @@ static void openslES_CloseDevice(SDL_AudioDevice *device)
|
|||
}
|
||||
}
|
||||
|
||||
static SDL_bool openslES_Init(SDL_AudioDriverImpl *impl)
|
||||
static SDL_bool OPENSLES_Init(SDL_AudioDriverImpl *impl)
|
||||
{
|
||||
LOGI("openslES_Init() called");
|
||||
LOGI("OPENSLES_Init() called");
|
||||
|
||||
if (!openslES_CreateEngine()) {
|
||||
if (!OPENSLES_CreateEngine()) {
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
LOGI("openslES_Init() - set pointers");
|
||||
LOGI("OPENSLES_Init() - set pointers");
|
||||
|
||||
// Set the function pointers
|
||||
// impl->DetectDevices = openslES_DetectDevices;
|
||||
// impl->DetectDevices = OPENSLES_DetectDevices;
|
||||
impl->ThreadInit = Android_AudioThreadInit;
|
||||
impl->OpenDevice = openslES_OpenDevice;
|
||||
impl->WaitDevice = openslES_WaitDevice;
|
||||
impl->PlayDevice = openslES_PlayDevice;
|
||||
impl->GetDeviceBuf = openslES_GetDeviceBuf;
|
||||
impl->WaitCaptureDevice = openslES_WaitDevice;
|
||||
impl->CaptureFromDevice = openslES_CaptureFromDevice;
|
||||
impl->CloseDevice = openslES_CloseDevice;
|
||||
impl->Deinitialize = openslES_DestroyEngine;
|
||||
impl->OpenDevice = OPENSLES_OpenDevice;
|
||||
impl->WaitDevice = OPENSLES_WaitDevice;
|
||||
impl->PlayDevice = OPENSLES_PlayDevice;
|
||||
impl->GetDeviceBuf = OPENSLES_GetDeviceBuf;
|
||||
impl->WaitCaptureDevice = OPENSLES_WaitDevice;
|
||||
impl->CaptureFromDevice = OPENSLES_CaptureFromDevice;
|
||||
impl->CloseDevice = OPENSLES_CloseDevice;
|
||||
impl->Deinitialize = OPENSLES_DestroyEngine;
|
||||
|
||||
// and the capabilities
|
||||
impl->HasCaptureSupport = SDL_TRUE;
|
||||
impl->OnlyHasDefaultOutputDevice = SDL_TRUE;
|
||||
impl->OnlyHasDefaultCaptureDevice = SDL_TRUE;
|
||||
|
||||
LOGI("openslES_Init() - success");
|
||||
LOGI("OPENSLES_Init() - success");
|
||||
|
||||
// this audio target is available.
|
||||
return SDL_TRUE;
|
||||
}
|
||||
|
||||
AudioBootStrap openslES_bootstrap = {
|
||||
"openslES", "opensl ES audio driver", openslES_Init, SDL_FALSE
|
||||
AudioBootStrap OPENSLES_bootstrap = {
|
||||
"openslES", "opensl ES audio driver", OPENSLES_Init, SDL_FALSE
|
||||
};
|
||||
|
||||
void openslES_ResumeDevices(void)
|
||||
void OPENSLES_ResumeDevices(void)
|
||||
{
|
||||
if (bqPlayerPlay != NULL) {
|
||||
// set the player's state to 'playing'
|
||||
SLresult result = (*bqPlayerPlay)->SetPlayState(bqPlayerPlay, SL_PLAYSTATE_PLAYING);
|
||||
if (SL_RESULT_SUCCESS != result) {
|
||||
LOGE("openslES_ResumeDevices failed: %d", result);
|
||||
LOGE("OPENSLES_ResumeDevices failed: %d", result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void openslES_PauseDevices(void)
|
||||
void OPENSLES_PauseDevices(void)
|
||||
{
|
||||
if (bqPlayerPlay != NULL) {
|
||||
// set the player's state to 'paused'
|
||||
SLresult result = (*bqPlayerPlay)->SetPlayState(bqPlayerPlay, SL_PLAYSTATE_PAUSED);
|
||||
if (SL_RESULT_SUCCESS != result) {
|
||||
LOGE("openslES_PauseDevices failed: %d", result);
|
||||
LOGE("OPENSLES_PauseDevices failed: %d", result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue