aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2020-04-18 15:17:53 -0700
committerChris Robinson <[email protected]>2020-04-18 15:17:53 -0700
commit67e54a26697f5e898f5b0e040f18281a28c16023 (patch)
tree2209f07479fea9c4787032cd79d693dee746687c
parenta1e5f4eb8374e46348146ee19a031e446a65bade (diff)
Add an Oboe backend stub
-rw-r--r--CMakeLists.txt29
-rw-r--r--alc/alc.cpp6
-rw-r--r--alc/backends/oboe.cpp28
-rw-r--r--alc/backends/oboe.h19
-rw-r--r--cmake/FindOboe.cmake31
-rw-r--r--config.h.in3
6 files changed, 116 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1745704a..782ac46d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -988,6 +988,35 @@ IF(ALSOFT_REQUIRE_OPENSL AND NOT HAVE_OPENSL)
MESSAGE(FATAL_ERROR "Failed to enabled required OpenSL backend")
ENDIF()
+# Check for Oboe (Android) backend
+set(OBOE_TARGET )
+if(ANDROID)
+ set(OBOE_SOURCE "" CACHE STRING "Source directory for Oboe.")
+ if(OBOE_SOURCE)
+ add_subdirectory(${OBOE_SOURCE} ./oboe)
+ set(OBOE_TARGET oboe)
+ else()
+ find_package(Oboe)
+ if(OBOE_FOUND)
+ set(OBOE_TARGET "oboe::oboe")
+ endif()
+ endif()
+endif()
+
+option(ALSOFT_REQUIRE_OBOE "Require Oboe backend" OFF)
+if(OBOE_TARGET)
+ option(ALSOFT_BACKEND_OBOE "Enable Oboe backend" ON)
+ if(ALSOFT_BACKEND_OBOE)
+ set(HAVE_OBOE 1)
+ set(ALC_OBJS ${ALC_OBJS} alc/backends/oboe.cpp alc/backends/oboe.h)
+ set(BACKENDS "${BACKENDS} Oboe,")
+ set(EXTRA_LIBS ${OBOE_TARGET} ${EXTRA_LIBS})
+ endif()
+endif()
+if(ALSOFT_REQUIRE_OBOE AND NOT HAVE_OBOE)
+ message(FATAL_ERROR "Failed to enabled required Oboe backend")
+endif()
+
# Check for SDL2 backend
OPTION(ALSOFT_REQUIRE_SDL2 "Require SDL2 backend" OFF)
FIND_PACKAGE(SDL2)
diff --git a/alc/alc.cpp b/alc/alc.cpp
index e8c23476..d0d8510b 100644
--- a/alc/alc.cpp
+++ b/alc/alc.cpp
@@ -116,6 +116,9 @@
#ifdef HAVE_OPENSL
#include "backends/opensl.h"
#endif
+#ifdef HAVE_OBOE
+#include "backends/oboe.h"
+#endif
#ifdef HAVE_SOLARIS
#include "backends/solaris.h"
#endif
@@ -173,6 +176,9 @@ BackendInfo BackendList[] = {
#ifdef HAVE_COREAUDIO
{ "core", CoreAudioBackendFactory::getFactory },
#endif
+#ifdef HAVE_OBOE
+ { "oboe", OboeBackendFactory::getFactory },
+#endif
#ifdef HAVE_OPENSL
{ "opensl", OSLBackendFactory::getFactory },
#endif
diff --git a/alc/backends/oboe.cpp b/alc/backends/oboe.cpp
new file mode 100644
index 00000000..54fd0f1c
--- /dev/null
+++ b/alc/backends/oboe.cpp
@@ -0,0 +1,28 @@
+
+#include "config.h"
+
+#include "oboe.h"
+
+#include "oboe/Oboe.h"
+
+
+bool OboeBackendFactory::init() { return true; }
+
+bool OboeBackendFactory::querySupport(BackendType /*type*/)
+{ return false; }
+
+std::string OboeBackendFactory::probe(BackendType /*type*/)
+{
+ return std::string{};
+}
+
+BackendPtr OboeBackendFactory::createBackend(ALCdevice* /*device*/, BackendType /*type*/)
+{
+ return nullptr;
+}
+
+BackendFactory &OboeBackendFactory::getFactory()
+{
+ static OboeBackendFactory factory{};
+ return factory;
+}
diff --git a/alc/backends/oboe.h b/alc/backends/oboe.h
new file mode 100644
index 00000000..93b98e37
--- /dev/null
+++ b/alc/backends/oboe.h
@@ -0,0 +1,19 @@
+#ifndef BACKENDS_OBOE_H
+#define BACKENDS_OBOE_H
+
+#include "backends/base.h"
+
+struct OboeBackendFactory final : public BackendFactory {
+public:
+ bool init() override;
+
+ bool querySupport(BackendType type) override;
+
+ std::string probe(BackendType type) override;
+
+ BackendPtr createBackend(ALCdevice *device, BackendType type) override;
+
+ static BackendFactory &getFactory();
+};
+
+#endif /* BACKENDS_OBOE_H */
diff --git a/cmake/FindOboe.cmake b/cmake/FindOboe.cmake
new file mode 100644
index 00000000..bf12c12c
--- /dev/null
+++ b/cmake/FindOboe.cmake
@@ -0,0 +1,31 @@
+# - Find Oboe
+# Find the Oboe library
+#
+# This module defines the following variable:
+# OBOE_FOUND - True if Oboe was found
+#
+# This module defines the following target:
+# oboe::oboe - Import target for linking Oboe to a project
+#
+
+find_path(OBOE_INCLUDE_DIR NAMES oboe/Oboe.h
+ DOC "The Oboe include directory"
+)
+
+find_library(OBOE_LIBRARY NAMES oboe
+ DOC "The Oboe library"
+)
+
+# handle the QUIETLY and REQUIRED arguments and set OBOE_FOUND to TRUE if
+# all listed variables are TRUE
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Oboe REQUIRED_VARS OBOE_LIBRARY OBOE_INCLUDE_DIR)
+
+if(OBOE_FOUND)
+ add_library(oboe::oboe UNKNOWN IMPORTED)
+ set_target_properties(oboe::oboe PROPERTIES
+ IMPORTED_LOCATION ${OBOE_LIBRARY}
+ INTERFACE_INCLUDE_DIRECTORIES ${OBOE_INCLUDE_DIR})
+endif()
+
+mark_as_advanced(OBOE_INCLUDE_DIR OBOE_LIBRARY)
diff --git a/config.h.in b/config.h.in
index 60879df9..29a10b20 100644
--- a/config.h.in
+++ b/config.h.in
@@ -65,6 +65,9 @@
/* Define if we have the OpenSL backend */
#cmakedefine HAVE_OPENSL
+/* Define if we have the Oboe backend */
+#cmakedefine HAVE_OBOE
+
/* Define if we have the Wave Writer backend */
#cmakedefine HAVE_WAVE