Update Android support once again. And get rid of an unused argument in SetListenerOrientation.

pull/2/head
Nikita Krapivin 2022-01-08 15:36:24 +05:00
parent 3b39ed9d10
commit a77b9a39aa
5 changed files with 115 additions and 28 deletions

View File

@ -94,14 +94,14 @@ Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1StaticSound_1Destroy
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1StreamingSound_1LoadOGG Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1StreamingSound_1LoadOGG
(JNIEnv* jniEnv, jclass jniThis, jstring _filepath) (JNIEnv* jniEnv, jclass jniThis, jstring _filepath, jdouble _bufferSizeInBytes)
{ {
jboolean isCopy; jboolean isCopy;
const char* filepath; const char* filepath;
jdouble ret; jdouble ret;
filepath = (*jniEnv)->GetStringUTFChars(jniEnv, _filepath, &isCopy); filepath = (*jniEnv)->GetStringUTFChars(jniEnv, _filepath, &isCopy);
ret = FAudioGMS_StreamingSound_LoadOGG((char *)filepath); ret = FAudioGMS_StreamingSound_LoadOGG((char *)filepath, _bufferSizeInBytes);
(*jniEnv)->ReleaseStringUTFChars(jniEnv, _filepath, filepath); (*jniEnv)->ReleaseStringUTFChars(jniEnv, _filepath, filepath);
return ret; return ret;
} }
@ -130,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_1QueueSyncPlay
(JNIEnv* jniEnv, jclass jniThis, jdouble _soundInstanceID)
{
FAudioGMS_SoundInstance_QueueSyncPlay(_soundInstanceID);
return NOTHING;
}
JNIEXPORT jdouble JNICALL
Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1SoundInstance_1SyncPlay
(JNIEnv* jniEnv, jclass jniThis)
{
FAudioGMS_SoundInstance_SyncPlay();
return NOTHING;
}
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1SoundInstance_1SetPlayRegion Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1SoundInstance_1SetPlayRegion
(JNIEnv* jniEnv, jclass jniThis, jdouble _soundInstanceID, jdouble _startInMilliseconds, jdouble _endInMilliseconds) (JNIEnv* jniEnv, jclass jniThis, jdouble _soundInstanceID, jdouble _startInMilliseconds, jdouble _endInMilliseconds)
@ -186,6 +202,14 @@ Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1SoundInstance_1Set3DVelo
return NOTHING; return NOTHING;
} }
JNIEXPORT jdouble JNICALL
Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1SoundInstance_1Set3DOrientation
(JNIEnv* jniEnv, jclass jniThis, jdouble _soundInstanceID, jdouble _xFront, jdouble _yFront, jdouble _zFront, jdouble _xTop, jdouble _yTop, jdouble _zTop)
{
FAudioGMS_SoundInstance_Set3DOrientation(_soundInstanceID, _xFront, _yFront, _zFront, _xTop, _yTop, _zTop);
return NOTHING;
}
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1SoundInstance_1SetTrackPositionInSeconds Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1SoundInstance_1SetTrackPositionInSeconds
(JNIEnv* jniEnv, jclass jniThis, jdouble _soundInstanceID, jdouble _trackPositionInSeconds) (JNIEnv* jniEnv, jclass jniThis, jdouble _soundInstanceID, jdouble _trackPositionInSeconds)
@ -327,8 +351,7 @@ Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1EffectChain_1AddReverb
_reverbGain, _reverbGain,
_decayTime, _decayTime,
_density, _density,
_roomSize _roomSize);
);
return NOTHING; return NOTHING;
} }
@ -388,6 +411,14 @@ Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1SetListenerVelocity
return NOTHING; return NOTHING;
} }
JNIEXPORT jdouble JNICALL
Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1SetListenerOrientation
(JNIEnv* jniEnv, jclass jniThis, jdouble _xFront, jdouble _yFront, jdouble _zFront, jdouble _xTop, jdouble _yTop, jdouble _zTop)
{
FAudioGMS_SetListenerOrientation(_xFront, _yFront, _zFront, _xTop, _yTop, _zTop);
return NOTHING;
}
JNIEXPORT jdouble JNICALL JNIEXPORT jdouble JNICALL
Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1PauseAll Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1PauseAll
(JNIEnv* jniEnv, jclass jniThis) (JNIEnv* jniEnv, jclass jniThis)

View File

@ -12,30 +12,73 @@ public class FAudioGMSNative
/* exactly as in FAudioGMS_JNI.c: */ /* exactly as in FAudioGMS_JNI.c: */
public native double FAudioGMS_Init(double spatialDistanceScale, double timestep); public native double FAudioGMS_Init(double spatialDistanceScale, double timestep);
public native double FAudioGMS_StaticSound_LoadWAV(String filePath); public native double FAudioGMS_StaticSound_LoadWAV(
public native double FAudioGMS_StaticSound_CreateSoundInstance(double staticSoundID); String filePath); /* returns a static sound ID */
public native double FAudioGMS_StaticSound_CreateSoundInstance(
double staticSoundID); /* returns a sound instance ID */
public native double FAudioGMS_StaticSound_Destroy(double staticSoundID); public native double FAudioGMS_StaticSound_Destroy(double staticSoundID);
public native double FAudioGMS_StreamingSound_LoadOGG(String filepath); /* returns a sound instance ID */
public native double FAudioGMS_StreamingSound_LoadOGG(
String filepath,
double bufferSizeInBytes); /* if 0 is passed we will use a sensible default*/
public native double FAudioGMS_SoundInstance_Play(double soundInstanceID); 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_QueueSyncPlay(double soundInstanceID);
public native double FAudioGMS_SoundInstance_SyncPlay();
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_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);
public native double FAudioGMS_SoundInstance_Set3DPosition(double soundInstanceID, double x, double y, double z); public native double FAudioGMS_SoundInstance_Set3DPosition(
public native double FAudioGMS_SoundInstance_Set3DVelocity(double soundInstanceID, double xVelocity, double yVelocity, double zVelocity); double soundInstanceID,
public native double FAudioGMS_SoundInstance_SetTrackPositionInSeconds(double soundInstanceID, double trackPositionInSeconds); double x,
public native double FAudioGMS_SoundInstance_SetVolumeOverTime(double soundInstanceID, double volume, double milliseconds); double y,
public native double FAudioGMS_SoundInstance_SetLowPassFilter(double soundInstanceID, double lowPassFilter, double Q); double z);
public native double FAudioGMS_SoundInstance_SetHighPassFilter(double soundInstanceID, double highPassFilter, double Q); public native double FAudioGMS_SoundInstance_Set3DVelocity(
public native double FAudioGMS_SoundInstance_SetBandPassFilter(double soundInstanceID, double bandPassFilter, double Q); double soundInstanceID,
double xVelocity,
double yVelocity,
double zVelocity);
public native double FAudioGMS_SoundInstance_Set3DOrientation(
double soundInstanceID,
double xFront,
double yFront,
double zFront,
double xTop,
double yTop,
double zTop);
public native double FAudioGMS_SoundInstance_SetTrackPositionInSeconds(
double soundInstanceID,
double trackPositionInSeconds);
public native double FAudioGMS_SoundInstance_SetVolumeOverTime(
double soundInstanceID,
double volume,
double milliseconds);
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_SetBandPassFilter(
double soundInstanceID,
double bandPassFilter,
double Q);
public native double FAudioGMS_SoundInstance_QueueSoundInstance(double soundInstanceID, double queueSoundInstanceID); 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);
@ -62,25 +105,41 @@ public class FAudioGMSNative
double reverbGain, double reverbGain,
double decayTime, double decayTime,
double density, double density,
double roomSize double roomSize);
);
public native double FAudioGMS_EffectChain_Destroy(double effectChainID); public native double FAudioGMS_EffectChain_Destroy(double effectChainID);
/* /*
* NOTE: Any changes to the effect chain will NOT apply after this is set! * NOTE: Any changes to the effect chain will NOT apply after this is set!
* You MUST call SetEffectChain again if you make changes to the effect chain parameters! * You MUST call SetEffectChain again if you make changes to the effect
* chain parameters!
*/ */
public native double FAudioGMS_SoundInstance_SetEffectChain(double soundInstanceID, double effectChainID, double effectGain); public native double FAudioGMS_SoundInstance_SetEffectChain(
public native double FAudioGMS_SoundInstance_SetEffectGain(double soundInstanceID, double effectGain); double soundInstanceID,
double effectChainID,
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_SetMasteringEffectChain(double effectChainID, double effectGain);
public native double FAudioGMS_SetMasteringEffectGain(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);
public native double FAudioGMS_SetListenerOrientation(
double xFront,
double yFront,
double zFront,
double xTop,
double yTop,
double zTop);
public native double FAudioGMS_PauseAll(); /* mobile platforms, man... */ public native double FAudioGMS_PauseAll(); /* useful for mobile platforms, etc
public native double FAudioGMS_ResumeAll(); /* same thing here */ */
public native double FAudioGMS_ResumeAll(); /* same as above */
public native double FAudioGMS_StopAll(); public native double FAudioGMS_StopAll();
public native double FAudioGMS_Update(); public native double FAudioGMS_Update();

View File

@ -190,8 +190,7 @@
2, 2,
2, 2,
],"resourceVersion":"1.0","name":"FAudioGMS_SoundInstance_Set3DOrientation","tags":[],"resourceType":"GMExtensionFunction",}, ],"resourceVersion":"1.0","name":"FAudioGMS_SoundInstance_Set3DOrientation","tags":[],"resourceType":"GMExtensionFunction",},
{"externalName":"FAudioGMS_SetListenerOrientation","kind":1,"help":"FAudioGMS_SetListenerOrientation(soundInstanceID, xFront, yFront, zFront, xTop, yTop, zTop)","hidden":false,"returnType":2,"argCount":0,"args":[ {"externalName":"FAudioGMS_SetListenerOrientation","kind":1,"help":"FAudioGMS_SetListenerOrientation(xFront, yFront, zFront, xTop, yTop, zTop)","hidden":false,"returnType":2,"argCount":0,"args":[
2,
2, 2,
2, 2,
2, 2,

View File

@ -1664,7 +1664,6 @@ void FAudioGMS_SetListenerVelocity(double xVelocity, double yVelocity, double zV
} }
void FAudioGMS_SetListenerOrientation( void FAudioGMS_SetListenerOrientation(
double soundInstanceID,
double xFront, double xFront,
double yFront, double yFront,
double zFront, double zFront,

View File

@ -160,7 +160,6 @@ extern "C"
double yVelocity, double yVelocity,
double zVelocity); double zVelocity);
FAUDIOGMSAPI void FAudioGMS_SetListenerOrientation( FAUDIOGMSAPI void FAudioGMS_SetListenerOrientation(
double soundInstanceID,
double xFront, double xFront,
double yFront, double yFront,
double zFront, double zFront,