forked from MoonsideGames/FAudioGMS
Update Android support once again and add a Windows NDK build script. (#1)
Co-authored-by: Nikita Krapivin <alienoom@yandex.ru> Reviewed-on: MoonsideGames/FAudioGMS#1 Co-authored-by: Nikita Krapivin <nik@noreply.example.org> Co-committed-by: Nikita Krapivin <nik@noreply.example.org>main
parent
6ef79855ab
commit
2fd95ea452
|
@ -63,6 +63,7 @@ LOCAL_MODULE := FAudioGMS
|
||||||
# Tell ndk-build we rely on these two fellas:
|
# Tell ndk-build we rely on these two fellas:
|
||||||
LOCAL_SHARED_LIBRARIES := SDL2 FAudio_static
|
LOCAL_SHARED_LIBRARIES := SDL2 FAudio_static
|
||||||
LOCAL_C_INCLUDES := $(SDL_PATH)/include $(FAUDIO_PATH)/include $(FAUDIOGMS_PATH)/src
|
LOCAL_C_INCLUDES := $(SDL_PATH)/include $(FAUDIO_PATH)/include $(FAUDIOGMS_PATH)/src
|
||||||
|
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES)
|
||||||
LOCAL_SRC_FILES := $(FAUDIOGMS_PATH)/src/FAudioGMS.c $(LOCAL_PATH)/FAudioGMS_JNI.c
|
LOCAL_SRC_FILES := $(FAUDIOGMS_PATH)/src/FAudioGMS.c $(LOCAL_PATH)/FAudioGMS_JNI.c
|
||||||
|
|
||||||
include $(BUILD_SHARED_LIBRARY)
|
include $(BUILD_SHARED_LIBRARY)
|
||||||
|
|
|
@ -27,6 +27,11 @@
|
||||||
/* These are the Native -> JNI conv wrappers, they must only be built for Android */
|
/* These are the Native -> JNI conv wrappers, they must only be built for Android */
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
|
|
||||||
|
/* no mangling please */
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
#include <FAudioGMS.h>
|
#include <FAudioGMS.h>
|
||||||
|
|
||||||
|
@ -103,9 +108,9 @@ Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1StreamingSound_1LoadOGG
|
||||||
|
|
||||||
JNIEXPORT jdouble JNICALL
|
JNIEXPORT jdouble JNICALL
|
||||||
Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1SoundInstance_1Play
|
Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1SoundInstance_1Play
|
||||||
(JNIEnv* jniEnv, jclass jniThis, jdouble _soundInstanceID, jdouble _loop)
|
(JNIEnv* jniEnv, jclass jniThis, jdouble _soundInstanceID)
|
||||||
{
|
{
|
||||||
FAudioGMS_SoundInstance_Play(_soundInstanceID, _loop);
|
FAudioGMS_SoundInstance_Play(_soundInstanceID);
|
||||||
return NOTHING;
|
return NOTHING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,6 +130,22 @@ Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1SoundInstance_1Stop
|
||||||
return NOTHING;
|
return NOTHING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JNIEXPORT jdouble JNICALL
|
||||||
|
Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1SoundInstance_1SetPlayRegion
|
||||||
|
(JNIEnv* jniEnv, jclass jniThis, jdouble _soundInstanceID, jdouble _startInMilliseconds, jdouble _endInMilliseconds)
|
||||||
|
{
|
||||||
|
FAudioGMS_SoundInstance_SetPlayRegion(_soundInstanceID, _startInMilliseconds, _endInMilliseconds);
|
||||||
|
return NOTHING;
|
||||||
|
}
|
||||||
|
|
||||||
|
JNIEXPORT jdouble JNICALL
|
||||||
|
Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1SoundInstance_1SetLoop
|
||||||
|
(JNIEnv* jniEnv, jclass jniThis, jdouble _soundInstanceID, jdouble _loop)
|
||||||
|
{
|
||||||
|
FAudioGMS_SoundInstance_SetLoop(_soundInstanceID, _loop);
|
||||||
|
return NOTHING;
|
||||||
|
}
|
||||||
|
|
||||||
JNIEXPORT jdouble JNICALL
|
JNIEXPORT jdouble JNICALL
|
||||||
Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1SoundInstance_1SetPan
|
Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1SoundInstance_1SetPan
|
||||||
(JNIEnv* jniEnv, jclass jniThis, jdouble _soundInstanceID, jdouble _pan)
|
(JNIEnv* jniEnv, jclass jniThis, jdouble _soundInstanceID, jdouble _pan)
|
||||||
|
@ -205,6 +226,14 @@ Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1SoundInstance_1SetBandPa
|
||||||
return NOTHING;
|
return NOTHING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JNIEXPORT jdouble JNICALL
|
||||||
|
Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1SoundInstance_1QueueSoundInstance
|
||||||
|
(JNIEnv* jniEnv, jclass jniThis, jdouble _soundInstanceID, jdouble _queueSoundInstanceID)
|
||||||
|
{
|
||||||
|
FAudioGMS_SoundInstance_QueueSoundInstance(_soundInstanceID, _queueSoundInstanceID);
|
||||||
|
return NOTHING;
|
||||||
|
}
|
||||||
|
|
||||||
JNIEXPORT jdouble JNICALL
|
JNIEXPORT jdouble JNICALL
|
||||||
Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1SoundInstance_1GetPitch
|
Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1SoundInstance_1GetPitch
|
||||||
(JNIEnv* jniEnv, jclass jniThis, jdouble _soundInstanceID)
|
(JNIEnv* jniEnv, jclass jniThis, jdouble _soundInstanceID)
|
||||||
|
@ -327,6 +356,22 @@ Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1SoundInstance_1SetEffect
|
||||||
return NOTHING;
|
return NOTHING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JNIEXPORT jdouble JNICALL
|
||||||
|
Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1SetMasteringEffectChain
|
||||||
|
(JNIEnv* jniEnv, jclass jniThis, jdouble _effectChainID, double _effectGain)
|
||||||
|
{
|
||||||
|
FAudioGMS_SetMasteringEffectChain(_effectChainID, _effectGain);
|
||||||
|
return NOTHING;
|
||||||
|
}
|
||||||
|
|
||||||
|
JNIEXPORT jdouble JNICALL
|
||||||
|
Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1SetMasteringEffectGain
|
||||||
|
(JNIEnv* jniEnv, jclass jniThis, jdouble _effectGain)
|
||||||
|
{
|
||||||
|
FAudioGMS_SetMasteringEffectGain(_effectGain);
|
||||||
|
return NOTHING;
|
||||||
|
}
|
||||||
|
|
||||||
JNIEXPORT jdouble JNICALL
|
JNIEXPORT jdouble JNICALL
|
||||||
Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1SetListenerPosition
|
Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1SetListenerPosition
|
||||||
(JNIEnv* jniEnv, jclass jniThis, jdouble _x, jdouble _y, jdouble _z)
|
(JNIEnv* jniEnv, jclass jniThis, jdouble _x, jdouble _y, jdouble _z)
|
||||||
|
@ -383,6 +428,10 @@ Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1Destroy
|
||||||
return NOTHING;
|
return NOTHING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
#endif /* __ANDROID__ */
|
#endif /* __ANDROID__ */
|
||||||
|
|
||||||
/* Do nothing for other platforms, because they, thankly, do not require JNI bindings... */
|
/* Do nothing for other platforms, because they, thankly, do not require JNI bindings... */
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
|
||||||
|
cd /d %~dp0
|
||||||
|
mkdir buildandroid
|
||||||
|
|
||||||
|
call ndk-build NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=Android.mk APP_ABI="armeabi-v7a arm64-v8a x86 x86_64" APP_PLATFORM=android-16 APP_MODULES="SDL2 FAudio_static FAudioGMS" NDK_OUT=buildandroid\obj NDK_LIBS_OUT=buildandroid\lib
|
||||||
|
|
||||||
|
xcopy /e /r /y buildandroid\lib ..\gamemaker\extensions\FAudioGMS\AndroidSource\libs
|
||||||
|
rd /s /q buildandroid
|
|
@ -22,12 +22,14 @@ import android.content.res.AssetManager;
|
||||||
public class FAudioGMSBridge extends FAudioGMSNative implements IExtensionBase
|
public class FAudioGMSBridge extends FAudioGMSNative implements IExtensionBase
|
||||||
{
|
{
|
||||||
public SDLActivity sdl;
|
public SDLActivity sdl;
|
||||||
public boolean paused;
|
public boolean handlenativepause; /* automatically pause all sounds on onPause or not? */
|
||||||
|
public boolean paused; /* are we currently paused */
|
||||||
|
|
||||||
public FAudioGMSBridge()
|
public FAudioGMSBridge()
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
paused = false;
|
handlenativepause = true; /* set this to false if you wish to handle pauses manually */
|
||||||
|
paused = false; /* this one must be false at initialization */
|
||||||
SDL.setContext(RunnerJNILib.GetApplicationContext());
|
SDL.setContext(RunnerJNILib.GetApplicationContext());
|
||||||
sdl = new SDLActivity();
|
sdl = new SDLActivity();
|
||||||
}
|
}
|
||||||
|
@ -62,7 +64,7 @@ public class FAudioGMSBridge extends FAudioGMSNative implements IExtensionBase
|
||||||
public void onPause()
|
public void onPause()
|
||||||
{
|
{
|
||||||
sdl.onPause();
|
sdl.onPause();
|
||||||
if (!paused)
|
if (handlenativepause && !paused)
|
||||||
{
|
{
|
||||||
paused = true;
|
paused = true;
|
||||||
FAudioGMS_PauseAll();
|
FAudioGMS_PauseAll();
|
||||||
|
@ -72,7 +74,7 @@ public class FAudioGMSBridge extends FAudioGMSNative implements IExtensionBase
|
||||||
public void onResume()
|
public void onResume()
|
||||||
{
|
{
|
||||||
sdl.onResume();
|
sdl.onResume();
|
||||||
if (paused)
|
if (handlenativepause && paused)
|
||||||
{
|
{
|
||||||
paused = false;
|
paused = false;
|
||||||
FAudioGMS_ResumeAll();
|
FAudioGMS_ResumeAll();
|
||||||
|
|
|
@ -18,10 +18,12 @@ public class FAudioGMSNative
|
||||||
|
|
||||||
public native double FAudioGMS_StreamingSound_LoadOGG(String filepath);
|
public native double FAudioGMS_StreamingSound_LoadOGG(String filepath);
|
||||||
|
|
||||||
public native double FAudioGMS_SoundInstance_Play(double soundInstanceID, double loop);
|
public native double FAudioGMS_SoundInstance_Play(double soundInstanceID);
|
||||||
public native double FAudioGMS_SoundInstance_Pause(double soundInstanceID);
|
public native double FAudioGMS_SoundInstance_Pause(double soundInstanceID);
|
||||||
public native double FAudioGMS_SoundInstance_Stop(double soundInstanceID);
|
public native double FAudioGMS_SoundInstance_Stop(double soundInstanceID);
|
||||||
|
|
||||||
|
public native double FAudioGMS_SoundInstance_SetPlayRegion(double soundInstanceID, double startInMilliseconds, double endInMilliseconds);
|
||||||
|
public native double FAudioGMS_SoundInstance_SetLoop(double soundInstanceID, double loop);
|
||||||
public native double FAudioGMS_SoundInstance_SetPan(double soundInstanceID, double pan);
|
public native double FAudioGMS_SoundInstance_SetPan(double soundInstanceID, double pan);
|
||||||
public native double FAudioGMS_SoundInstance_SetPitch(double soundInstanceID, double pitch);
|
public native double FAudioGMS_SoundInstance_SetPitch(double soundInstanceID, double pitch);
|
||||||
public native double FAudioGMS_SoundInstance_SetVolume(double soundInstanceID, double volume);
|
public native double FAudioGMS_SoundInstance_SetVolume(double soundInstanceID, double volume);
|
||||||
|
@ -32,7 +34,9 @@ public class FAudioGMSNative
|
||||||
public native double FAudioGMS_SoundInstance_SetLowPassFilter(double soundInstanceID, double lowPassFilter, double Q);
|
public native double FAudioGMS_SoundInstance_SetLowPassFilter(double soundInstanceID, double lowPassFilter, double Q);
|
||||||
public native double FAudioGMS_SoundInstance_SetHighPassFilter(double soundInstanceID, double highPassFilter, double Q);
|
public native double FAudioGMS_SoundInstance_SetHighPassFilter(double soundInstanceID, double highPassFilter, double Q);
|
||||||
public native double FAudioGMS_SoundInstance_SetBandPassFilter(double soundInstanceID, double bandPassFilter, double Q);
|
public native double FAudioGMS_SoundInstance_SetBandPassFilter(double soundInstanceID, double bandPassFilter, double Q);
|
||||||
|
|
||||||
|
public native double FAudioGMS_SoundInstance_QueueSoundInstance(double soundInstanceID, double queueSoundInstanceID);
|
||||||
|
|
||||||
public native double FAudioGMS_SoundInstance_GetPitch(double soundInstanceID);
|
public native double FAudioGMS_SoundInstance_GetPitch(double soundInstanceID);
|
||||||
public native double FAudioGMS_SoundInstance_GetVolume(double soundInstanceID);
|
public native double FAudioGMS_SoundInstance_GetVolume(double soundInstanceID);
|
||||||
public native double FAudioGMS_SoundInstance_GetTrackLengthInSeconds(double soundInstanceID);
|
public native double FAudioGMS_SoundInstance_GetTrackLengthInSeconds(double soundInstanceID);
|
||||||
|
@ -69,6 +73,9 @@ public class FAudioGMSNative
|
||||||
public native double FAudioGMS_SoundInstance_SetEffectChain(double soundInstanceID, double effectChainID, double effectGain);
|
public native double FAudioGMS_SoundInstance_SetEffectChain(double soundInstanceID, double effectChainID, double effectGain);
|
||||||
public native double FAudioGMS_SoundInstance_SetEffectGain(double soundInstanceID, double effectGain);
|
public native double FAudioGMS_SoundInstance_SetEffectGain(double soundInstanceID, double effectGain);
|
||||||
|
|
||||||
|
public native double FAudioGMS_SetMasteringEffectChain(double effectChainID, double effectGain);
|
||||||
|
public native double FAudioGMS_SetMasteringEffectGain(double effectGain);
|
||||||
|
|
||||||
public native double FAudioGMS_SetListenerPosition(double x, double y, double z);
|
public native double FAudioGMS_SetListenerPosition(double x, double y, double z);
|
||||||
public native double FAudioGMS_SetListenerVelocity(double xVelocity, double yVelocity, double zVelocity);
|
public native double FAudioGMS_SetListenerVelocity(double xVelocity, double yVelocity, double zVelocity);
|
||||||
|
|
||||||
|
|
BIN
gamemaker/extensions/FAudioGMS/AndroidSource/libs/arm64-v8a/libFAudioGMS.so (Stored with Git LFS)
BIN
gamemaker/extensions/FAudioGMS/AndroidSource/libs/arm64-v8a/libFAudioGMS.so (Stored with Git LFS)
Binary file not shown.
BIN
gamemaker/extensions/FAudioGMS/AndroidSource/libs/arm64-v8a/libSDL2.so (Stored with Git LFS)
BIN
gamemaker/extensions/FAudioGMS/AndroidSource/libs/arm64-v8a/libSDL2.so (Stored with Git LFS)
Binary file not shown.
BIN
gamemaker/extensions/FAudioGMS/AndroidSource/libs/arm64-v8a/libhidapi.so (Stored with Git LFS)
BIN
gamemaker/extensions/FAudioGMS/AndroidSource/libs/arm64-v8a/libhidapi.so (Stored with Git LFS)
Binary file not shown.
BIN
gamemaker/extensions/FAudioGMS/AndroidSource/libs/armeabi-v7a/libFAudioGMS.so (Stored with Git LFS)
BIN
gamemaker/extensions/FAudioGMS/AndroidSource/libs/armeabi-v7a/libFAudioGMS.so (Stored with Git LFS)
Binary file not shown.
BIN
gamemaker/extensions/FAudioGMS/AndroidSource/libs/armeabi-v7a/libSDL2.so (Stored with Git LFS)
BIN
gamemaker/extensions/FAudioGMS/AndroidSource/libs/armeabi-v7a/libSDL2.so (Stored with Git LFS)
Binary file not shown.
BIN
gamemaker/extensions/FAudioGMS/AndroidSource/libs/armeabi-v7a/libhidapi.so (Stored with Git LFS)
BIN
gamemaker/extensions/FAudioGMS/AndroidSource/libs/armeabi-v7a/libhidapi.so (Stored with Git LFS)
Binary file not shown.
BIN
gamemaker/extensions/FAudioGMS/AndroidSource/libs/x86/libFAudioGMS.so (Stored with Git LFS)
BIN
gamemaker/extensions/FAudioGMS/AndroidSource/libs/x86/libFAudioGMS.so (Stored with Git LFS)
Binary file not shown.
BIN
gamemaker/extensions/FAudioGMS/AndroidSource/libs/x86/libSDL2.so (Stored with Git LFS)
BIN
gamemaker/extensions/FAudioGMS/AndroidSource/libs/x86/libSDL2.so (Stored with Git LFS)
Binary file not shown.
BIN
gamemaker/extensions/FAudioGMS/AndroidSource/libs/x86/libhidapi.so (Stored with Git LFS)
BIN
gamemaker/extensions/FAudioGMS/AndroidSource/libs/x86/libhidapi.so (Stored with Git LFS)
Binary file not shown.
BIN
gamemaker/extensions/FAudioGMS/AndroidSource/libs/x86_64/libFAudioGMS.so (Stored with Git LFS)
BIN
gamemaker/extensions/FAudioGMS/AndroidSource/libs/x86_64/libFAudioGMS.so (Stored with Git LFS)
Binary file not shown.
BIN
gamemaker/extensions/FAudioGMS/AndroidSource/libs/x86_64/libSDL2.so (Stored with Git LFS)
BIN
gamemaker/extensions/FAudioGMS/AndroidSource/libs/x86_64/libSDL2.so (Stored with Git LFS)
Binary file not shown.
BIN
gamemaker/extensions/FAudioGMS/AndroidSource/libs/x86_64/libhidapi.so (Stored with Git LFS)
BIN
gamemaker/extensions/FAudioGMS/AndroidSource/libs/x86_64/libhidapi.so (Stored with Git LFS)
Binary file not shown.
Loading…
Reference in New Issue