Skip to content

Commit

Permalink
androidaudio: Move Init/bootstrap code to bottom of source code.
Browse files Browse the repository at this point in the history
I can't ever find this when it's in the middle! It's a "me" problem.  :)
  • Loading branch information
icculus committed Jul 30, 2023
1 parent 8aa5f0c commit 51b5b94
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions src/audio/android/SDL_androidaudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,28 +126,6 @@ static void ANDROIDAUDIO_CloseDevice(SDL_AudioDevice *device)
}
}

static SDL_bool ANDROIDAUDIO_Init(SDL_AudioDriverImpl *impl)
{
// !!! FIXME: if on Android API < 24, DetectDevices and Deinitialize should be NULL and OnlyHasDefaultOutputDevice and OnlyHasDefaultCaptureDevice should be SDL_TRUE, since audio device enum and hotplug appears to require Android 7.0+.
impl->ThreadInit = Android_AudioThreadInit;
impl->DetectDevices = Android_StartAudioHotplug;
impl->Deinitialize = Android_StopAudioHotplug;
impl->OpenDevice = ANDROIDAUDIO_OpenDevice;
impl->PlayDevice = ANDROIDAUDIO_PlayDevice;
impl->GetDeviceBuf = ANDROIDAUDIO_GetDeviceBuf;
impl->CloseDevice = ANDROIDAUDIO_CloseDevice;
impl->CaptureFromDevice = ANDROIDAUDIO_CaptureFromDevice;
impl->FlushCapture = ANDROIDAUDIO_FlushCapture;

impl->HasCaptureSupport = SDL_TRUE;

return SDL_TRUE;
}

AudioBootStrap ANDROIDAUDIO_bootstrap = {
"android", "SDL Android audio driver", ANDROIDAUDIO_Init, SDL_FALSE
};

// Pause (block) all non already paused audio devices by taking their mixer lock
void ANDROIDAUDIO_PauseDevices(void)
{
Expand Down Expand Up @@ -188,4 +166,26 @@ void ANDROIDAUDIO_ResumeDevices(void)
}
}

static SDL_bool ANDROIDAUDIO_Init(SDL_AudioDriverImpl *impl)
{
// !!! FIXME: if on Android API < 24, DetectDevices and Deinitialize should be NULL and OnlyHasDefaultOutputDevice and OnlyHasDefaultCaptureDevice should be SDL_TRUE, since audio device enum and hotplug appears to require Android 7.0+.
impl->ThreadInit = Android_AudioThreadInit;
impl->DetectDevices = Android_StartAudioHotplug;
impl->Deinitialize = Android_StopAudioHotplug;
impl->OpenDevice = ANDROIDAUDIO_OpenDevice;
impl->PlayDevice = ANDROIDAUDIO_PlayDevice;
impl->GetDeviceBuf = ANDROIDAUDIO_GetDeviceBuf;
impl->CloseDevice = ANDROIDAUDIO_CloseDevice;
impl->CaptureFromDevice = ANDROIDAUDIO_CaptureFromDevice;
impl->FlushCapture = ANDROIDAUDIO_FlushCapture;

impl->HasCaptureSupport = SDL_TRUE;

return SDL_TRUE;
}

AudioBootStrap ANDROIDAUDIO_bootstrap = {
"android", "SDL Android audio driver", ANDROIDAUDIO_Init, SDL_FALSE
};

#endif // SDL_AUDIO_DRIVER_ANDROID

0 comments on commit 51b5b94

Please sign in to comment.