Navigation Menu

Skip to content

Commit

Permalink
Android/openslES: register and use CloseDevice function.
Browse files Browse the repository at this point in the history
  • Loading branch information
1bsyl committed Jan 14, 2019
1 parent 365fd9c commit 5aeeaaa
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/audio/openslES/SDL_openslES.c
Expand Up @@ -235,8 +235,7 @@ openslES_DestroyPCMRecorder(void)
}

static int
openslES_CreatePCMPlayer(
_THIS)
openslES_CreatePCMPlayer(_THIS)
{
SLDataFormat_PCM format_pcm;

Expand Down Expand Up @@ -463,6 +462,11 @@ openslES_DestroyPCMPlayer(void)
static int
openslES_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
{
this->hidden = (struct SDL_PrivateAudioData *) SDL_calloc(1, (sizeof *this->hidden));
if (this->hidden == NULL) {
return SDL_OutOfMemory();
}

if (iscapture) {
LOGI("openslES_OpenDevice( ) %s for capture", devname);
return openslES_CreatePCMRecorder(this);
Expand All @@ -480,9 +484,12 @@ openslES_CloseDevice(_THIS)
openslES_DestroyPCMRecorder();
} else {
LOGI("openslES_CloseDevice( ) for playing");
SDL_Log("openslES_CloseDevice( ) for playing");
openslES_DestroyPCMPlayer();
}

SDL_free(this->hidden);

return;
}

Expand Down Expand Up @@ -553,6 +560,7 @@ openslES_Init(SDL_AudioDriverImpl * impl)
/* Set the function pointers */
// impl->DetectDevices = openslES_DetectDevices;
impl->OpenDevice = openslES_OpenDevice;
impl->CloseDevice = openslES_CloseDevice;
impl->PlayDevice = openslES_PlayDevice;
impl->GetDeviceBuf = openslES_GetDeviceBuf;
impl->Deinitialize = openslES_DestroyEngine;
Expand Down

0 comments on commit 5aeeaaa

Please sign in to comment.