mirror of
https://github.com/Ryujinx/libsoundio.git
synced 2025-07-01 04:48:34 +00:00
Add (empty) Android OpenSL ES backend
This commit is contained in:
parent
fbf7df3b40
commit
dfe2ac7f86
|
@ -36,6 +36,7 @@ option(ENABLE_PULSEAUDIO "Enable PulseAudio backend" ON)
|
||||||
option(ENABLE_ALSA "Enable ALSA backend" ON)
|
option(ENABLE_ALSA "Enable ALSA backend" ON)
|
||||||
option(ENABLE_COREAUDIO "Enable CoreAudio backend" ON)
|
option(ENABLE_COREAUDIO "Enable CoreAudio backend" ON)
|
||||||
option(ENABLE_WASAPI "Enable WASAPI backend" ON)
|
option(ENABLE_WASAPI "Enable WASAPI backend" ON)
|
||||||
|
option(ENABLE_ANDROID "Enable Android OpenSL ES backend" ON)
|
||||||
|
|
||||||
find_package(Threads)
|
find_package(Threads)
|
||||||
if(Threads_FOUND)
|
if(Threads_FOUND)
|
||||||
|
@ -138,6 +139,21 @@ else()
|
||||||
set(SOUNDIO_HAVE_WASAPI false)
|
set(SOUNDIO_HAVE_WASAPI false)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(ENABLE_ANDROID)
|
||||||
|
find_package(AndroidOpenSLES)
|
||||||
|
if(ANDROID_OPENSLES_FOUND)
|
||||||
|
set(STATUS_ANDROID "OK")
|
||||||
|
set(SOUNDIO_HAVE_ANDROID true)
|
||||||
|
else()
|
||||||
|
set(STATUS_ANDROID "not found")
|
||||||
|
set(SOUNDIO_HAVE_ANDROID false)
|
||||||
|
set(ANDROID_OPENSLES_LIBRARY "")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
set(STATUS_ANDROID "disabled")
|
||||||
|
set(SOUNDIO_HAVE_ANDROID false)
|
||||||
|
set(ANDROID_OPENSLES_LIBRARY "")
|
||||||
|
endif()
|
||||||
|
|
||||||
set(LIBSOUNDIO_SOURCES
|
set(LIBSOUNDIO_SOURCES
|
||||||
"${libsoundio_SOURCE_DIR}/src/soundio.c"
|
"${libsoundio_SOURCE_DIR}/src/soundio.c"
|
||||||
|
@ -179,6 +195,11 @@ if(SOUNDIO_HAVE_WASAPI)
|
||||||
"${libsoundio_SOURCE_DIR}/src/wasapi.c"
|
"${libsoundio_SOURCE_DIR}/src/wasapi.c"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
if(SOUNDIO_HAVE_ANDROID)
|
||||||
|
set(LIBSOUNDIO_SOURCES ${LIBSOUNDIO_SOURCES}
|
||||||
|
"${libsoundio_SOURCE_DIR}/src/android.c"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
${libsoundio_SOURCE_DIR}
|
${libsoundio_SOURCE_DIR}
|
||||||
|
@ -195,6 +216,7 @@ set(LIBSOUNDIO_LIBS
|
||||||
${COREFOUNDATION_LIBRARY}
|
${COREFOUNDATION_LIBRARY}
|
||||||
${AUDIOUNIT_LIBRARY}
|
${AUDIOUNIT_LIBRARY}
|
||||||
${CMAKE_THREAD_LIBS_INIT}
|
${CMAKE_THREAD_LIBS_INIT}
|
||||||
|
${ANDROID_OPENSLES_LIBRARY}
|
||||||
)
|
)
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
|
@ -380,9 +402,10 @@ message(
|
||||||
"System Dependencies\n"
|
"System Dependencies\n"
|
||||||
"-------------------\n"
|
"-------------------\n"
|
||||||
"* threads : ${STATUS_THREADS}\n"
|
"* threads : ${STATUS_THREADS}\n"
|
||||||
"* JACK (optional) : ${STATUS_JACK}\n"
|
"* JACK (optional) : ${STATUS_JACK}\n"
|
||||||
"* PulseAudio (optional) : ${STATUS_PULSEAUDIO}\n"
|
"* PulseAudio (optional) : ${STATUS_PULSEAUDIO}\n"
|
||||||
"* ALSA (optional) : ${STATUS_ALSA}\n"
|
"* ALSA (optional) : ${STATUS_ALSA}\n"
|
||||||
"* CoreAudio (optional) : ${STATUS_COREAUDIO}\n"
|
"* CoreAudio (optional) : ${STATUS_COREAUDIO}\n"
|
||||||
"* WASAPI (optional) : ${STATUS_WASAPI}\n"
|
"* WASAPI (optional) : ${STATUS_WASAPI}\n"
|
||||||
|
"* Android OpenSL ES (optional) : ${STATUS_ANDROID}\n"
|
||||||
)
|
)
|
||||||
|
|
16
cmake/FindAndroidOpenSLES.cmake
Normal file
16
cmake/FindAndroidOpenSLES.cmake
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
# Copyright (c) 2016 libsoundio
|
||||||
|
# This file is MIT licensed.
|
||||||
|
# See http://opensource.org/licenses/MIT
|
||||||
|
|
||||||
|
# ANDROID_OPENSLES_FOUND
|
||||||
|
# ANDROID_OPENSLES_INCLUDE_DIR
|
||||||
|
# ANDROID_OPENSLES_LIBRARY
|
||||||
|
|
||||||
|
find_path(ANDROID_OPENSLES_INCLUDE_DIR NAMES SLES/OpenSLES_Android.h)
|
||||||
|
|
||||||
|
find_library(ANDROID_OPENSLES_LIBRARY NAMES OpenSLES)
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(ANDROID_OPENSLES DEFAULT_MSG ANDROID_OPENSLES_LIBRARY ANDROID_OPENSLES_INCLUDE_DIR)
|
||||||
|
|
||||||
|
mark_as_advanced(ANDROID_OPENSLES_INCLUDE_DIR ANDROID_OPENSLES_LIBRARY)
|
|
@ -223,6 +223,7 @@ enum SoundIoBackend {
|
||||||
SoundIoBackendAlsa,
|
SoundIoBackendAlsa,
|
||||||
SoundIoBackendCoreAudio,
|
SoundIoBackendCoreAudio,
|
||||||
SoundIoBackendWasapi,
|
SoundIoBackendWasapi,
|
||||||
|
SoundIoBackendAndroid
|
||||||
};
|
};
|
||||||
|
|
||||||
enum SoundIoDeviceAim {
|
enum SoundIoDeviceAim {
|
||||||
|
|
13
src/android.c
Normal file
13
src/android.c
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2016 libsoundio
|
||||||
|
*
|
||||||
|
* This file is part of libsoundio, which is MIT licensed.
|
||||||
|
* See http://opensource.org/licenses/MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "android.h"
|
||||||
|
#include "soundio_private.h"
|
||||||
|
|
||||||
|
enum SoundIoError soundio_android_init(struct SoundIoPrivate *si) {
|
||||||
|
return SoundIoErrorInitAudioBackend;
|
||||||
|
}
|
16
src/android.h
Normal file
16
src/android.h
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2016 libsoundio
|
||||||
|
*
|
||||||
|
* This file is part of libsoundio, which is MIT licensed.
|
||||||
|
* See http://opensource.org/licenses/MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SOUNDIO_ANDROID_H
|
||||||
|
#define SOUNDIO_ANDROID_H
|
||||||
|
|
||||||
|
#include "soundio_internal.h"
|
||||||
|
|
||||||
|
struct SoundIoPrivate;
|
||||||
|
enum SoundIoError soundio_android_init(struct SoundIoPrivate *si);
|
||||||
|
|
||||||
|
#endif
|
|
@ -18,5 +18,6 @@
|
||||||
#cmakedefine SOUNDIO_HAVE_ALSA
|
#cmakedefine SOUNDIO_HAVE_ALSA
|
||||||
#cmakedefine SOUNDIO_HAVE_COREAUDIO
|
#cmakedefine SOUNDIO_HAVE_COREAUDIO
|
||||||
#cmakedefine SOUNDIO_HAVE_WASAPI
|
#cmakedefine SOUNDIO_HAVE_WASAPI
|
||||||
|
#cmakedefine SOUNDIO_HAVE_ANDROID
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -29,6 +29,9 @@ static const enum SoundIoBackend available_backends[] = {
|
||||||
#endif
|
#endif
|
||||||
#ifdef SOUNDIO_HAVE_WASAPI
|
#ifdef SOUNDIO_HAVE_WASAPI
|
||||||
SoundIoBackendWasapi,
|
SoundIoBackendWasapi,
|
||||||
|
#endif
|
||||||
|
#ifdef SOUNDIO_HAVE_ANDROID
|
||||||
|
SoundIoBackendAndroid,
|
||||||
#endif
|
#endif
|
||||||
SoundIoBackendDummy,
|
SoundIoBackendDummy,
|
||||||
};
|
};
|
||||||
|
@ -67,6 +70,12 @@ static backend_init_t backend_init_fns[] = {
|
||||||
NULL,
|
NULL,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef SOUNDIO_HAVE_ANDROID
|
||||||
|
soundio_android_init,
|
||||||
|
#else
|
||||||
|
NULL,
|
||||||
|
#endif
|
||||||
|
|
||||||
&soundio_dummy_init,
|
&soundio_dummy_init,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -165,6 +174,7 @@ const char *soundio_backend_name(enum SoundIoBackend backend) {
|
||||||
case SoundIoBackendAlsa: return "ALSA";
|
case SoundIoBackendAlsa: return "ALSA";
|
||||||
case SoundIoBackendCoreAudio: return "CoreAudio";
|
case SoundIoBackendCoreAudio: return "CoreAudio";
|
||||||
case SoundIoBackendWasapi: return "WASAPI";
|
case SoundIoBackendWasapi: return "WASAPI";
|
||||||
|
case SoundIoBackendAndroid: return "Android OpenSL ES";
|
||||||
case SoundIoBackendDummy: return "Dummy";
|
case SoundIoBackendDummy: return "Dummy";
|
||||||
}
|
}
|
||||||
return "(invalid backend)";
|
return "(invalid backend)";
|
||||||
|
|
|
@ -32,6 +32,10 @@
|
||||||
#include "wasapi.h"
|
#include "wasapi.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef SOUNDIO_HAVE_ANDROID
|
||||||
|
#include "android.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "dummy.h"
|
#include "dummy.h"
|
||||||
|
|
||||||
union SoundIoBackendData {
|
union SoundIoBackendData {
|
||||||
|
|
Loading…
Reference in a new issue