OpenAL + Android

This commit is contained in:
TheBrokenRail
2023-11-05 00:13:35 -04:00
committed by iProgramInCpp
parent 68166a3c36
commit 93dc4e934e
5 changed files with 17 additions and 11 deletions

View File

@@ -10,9 +10,19 @@ add_library(reminecraftpe-openal STATIC
target_link_libraries(reminecraftpe-openal PUBLIC reminecraftpe-core)
# OpenAL
if(EMSCRIPTEN)
if(ANDROID)
# Use Vendored OpenAL
set(ALSOFT_UTILS FALSE CACHE BOOL "" FORCE)
set(ALSOFT_EXAMPLES FALSE CACHE BOOL "" FORCE)
set(ALSOFT_TESTS FALSE CACHE BOOL "" FORCE)
set(ALSOFT_REQUIRE_OPENSL TRUE CACHE BOOL "" FORCE)
add_subdirectory(../../thirdparty/OpenAL openal EXCLUDE_FROM_ALL)
target_link_libraries(reminecraftpe-openal PUBLIC OpenAL::OpenAL)
elseif(EMSCRIPTEN)
# Use Emscripten's OpenAL
target_link_libraries(reminecraftpe-openal PUBLIC openal)
else()
# Use System ZLib
find_library(OPENAL_LIBRARY NAMES openal REQUIRED)
target_link_libraries(reminecraftpe-openal PUBLIC "${OPENAL_LIBRARY}")
endif()

View File

@@ -55,10 +55,8 @@ add_subdirectory(../../source source)
target_link_libraries(reminecraftpe reminecraftpe-core)
# OpenAL
if(NOT ANDROID)
add_subdirectory(../openal openal)
target_link_libraries(reminecraftpe reminecraftpe-openal)
endif()
add_subdirectory(../openal openal)
target_link_libraries(reminecraftpe reminecraftpe-openal)
# stb_image (If Needed)
if(NOT EMSCRIPTEN)

View File

@@ -13,9 +13,7 @@
#include "common/Utils.hpp"
#ifndef ANDROID
#include "SoundSystemAL.hpp"
#endif
void AppPlatform_sdl_base::_init(std::string storageDir, SDL_Window *window)
{
@@ -58,11 +56,7 @@ void AppPlatform_sdl_base::initSoundSystem()
{
if (!m_pSoundSystem)
{
#ifndef ANDROID
m_pSoundSystem = new SoundSystemAL();
#else
m_pSoundSystem = new SoundSystem();
#endif
LOG_I("Initializing OpenAL SoundSystem...");
}
else