From 0298822ab953e04bfa7f6e87f09d251cff6b912f Mon Sep 17 00:00:00 2001 From: Miku AuahDark Date: Sat, 14 May 2022 15:48:10 +0800 Subject: [PATCH] OpenAL-soft: Add love-android-specific patches. --- libs/openal-soft/CMakeLists.txt | 6 +++++- libs/openal-soft/opensl_latency.cpp | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 libs/openal-soft/opensl_latency.cpp diff --git a/libs/openal-soft/CMakeLists.txt b/libs/openal-soft/CMakeLists.txt index 861dde52..7bd9aea7 100644 --- a/libs/openal-soft/CMakeLists.txt +++ b/libs/openal-soft/CMakeLists.txt @@ -728,7 +728,7 @@ set(OPENAL_OBJS al/effects/dedicated.cpp al/effects/distortion.cpp al/effects/echo.cpp - al/effects/effects.cpp + al/effects/effects.cpp al/effects/effects.h al/effects/equalizer.cpp al/effects/fshifter.cpp @@ -1143,6 +1143,10 @@ if(OBOE_TARGET) set(ALC_OBJS ${ALC_OBJS} alc/backends/oboe.cpp alc/backends/oboe.h) set(BACKENDS "${BACKENDS} Oboe,") set(EXTRA_LIBS ${OBOE_TARGET} ${EXTRA_LIBS}) + + if(MEGA) + set(ALC_OBJS ${ALC_OBJS} opensl_latency.cpp) + endif() endif() endif() if(ALSOFT_REQUIRE_OBOE AND NOT HAVE_OBOE) diff --git a/libs/openal-soft/opensl_latency.cpp b/libs/openal-soft/opensl_latency.cpp new file mode 100644 index 00000000..e0274a5d --- /dev/null +++ b/libs/openal-soft/opensl_latency.cpp @@ -0,0 +1,21 @@ +// This file is NOT part of OpenAL-soft + +#include + +#include "oboe/Oboe.h" + +extern "C" +{ + +JNIEXPORT void JNICALL +Java_org_love2d_android_GameActivity_nativeSetDefaultStreamValues( + JNIEnv *env, + jclass type, + jint sampleRate, + jint framesPerBurst +) { + oboe::DefaultStreamValues::SampleRate = (int32_t) sampleRate; + oboe::DefaultStreamValues::FramesPerBurst = (int32_t) framesPerBurst; +} + +}