add 3d orientation API

main
cosmonaut 2021-11-29 10:45:08 -08:00
parent 90250633de
commit 30cb6959e0
4 changed files with 88 additions and 4 deletions

Binary file not shown.

View File

@ -181,6 +181,24 @@
2,
],"resourceVersion":"1.0","name":"FAudioGMS_SoundInstance_QueueSyncPlay","tags":[],"resourceType":"GMExtensionFunction",},
{"externalName":"FAudioGMS_SoundInstance_SyncPlay","kind":1,"help":"FAudioGMS_SoundInstance_SyncPlay()","hidden":false,"returnType":2,"argCount":0,"args":[],"resourceVersion":"1.0","name":"FAudioGMS_SoundInstance_SyncPlay","tags":[],"resourceType":"GMExtensionFunction",},
{"externalName":"FAudioGMS_SoundInstance_Set3DOrientation","kind":1,"help":"FAudioGMS_SoundInstance_Set3DOrientation(soundInstanceID, xFront, yFront, zFront, xTop, yTop, zTop)","hidden":false,"returnType":2,"argCount":0,"args":[
2,
2,
2,
2,
2,
2,
2,
],"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":[
2,
2,
2,
2,
2,
2,
2,
],"resourceVersion":"1.0","name":"FAudioGMS_SetListenerOrientation","tags":[],"resourceType":"GMExtensionFunction",},
],"constants":[],"ProxyFiles":[
{"TargetMask":7,"resourceVersion":"1.0","name":"libFAudioGMS.so","tags":[],"resourceType":"GMProxyFile",},
{"TargetMask":3,"resourceVersion":"1.0","name":"FAudioGMSAndroidDummy.ext","tags":[],"resourceType":"GMProxyFile",},
@ -202,6 +220,7 @@
{"name":"FAudioGMS_SoundInstance_SetVolume","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_SoundInstance_Set3DPosition","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_SoundInstance_Set3DVelocity","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_SoundInstance_Set3DOrientation","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_SoundInstance_SetTrackPositionInSeconds","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_SoundInstance_SetPlayRegion","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_SoundInstance_SetVolumeOverTime","path":"extensions/FAudioGMS/FAudioGMS.yy",},
@ -225,6 +244,7 @@
{"name":"FAudioGMS_SetMasteringEffectGain","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_SetListenerPosition","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_SetListenerVelocity","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_SetListenerOrientation","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_ResumeAll","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_PauseAll","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_StopAll","path":"extensions/FAudioGMS/FAudioGMS.yy",},

View File

@ -1391,7 +1391,37 @@ void FAudioGMS_SoundInstance_Set3DVelocity(
}
}
/* FIXME: this will die horribly if position is greater than total length */
void FAudioGMS_SoundInstance_Set3DOrientation(
double soundInstanceID,
double xFront,
double yFront,
double zFront,
double xTop,
double yTop,
double zTop)
{
RETURN_ON_NULL_DEVICE_VOID
FAudioGMS_SoundInstance *instance =
FAudioGMS_INTERNAL_LookupSoundInstance((uint32_t)soundInstanceID);
if (instance != NULL)
{
if (!instance->is3D)
{
Log("Not a 3D sound!");
return;
}
instance->emitter->OrientFront.x = xFront;
instance->emitter->OrientFront.y = yFront;
instance->emitter->OrientFront.z = zFront;
instance->emitter->OrientTop.x = xTop;
instance->emitter->OrientTop.y = yTop;
instance->emitter->OrientTop.z = zTop;
}
}
/* FIXME: this will die horribly if position is greater than total length */
void FAudioGMS_SoundInstance_SetTrackPositionInSeconds(
double soundInstanceID,
double trackPositionInSeconds)
@ -1618,7 +1648,25 @@ void FAudioGMS_SetListenerVelocity(double xVelocity, double yVelocity, double zV
device->listener.Velocity.z = zVelocity;
}
static void FAudioGMS_INTERNAL_SoundInstance_Destroy(FAudioGMS_SoundInstance *instance)
void FAudioGMS_SetListenerOrientation(
double soundInstanceID,
double xFront,
double yFront,
double zFront,
double xTop,
double yTop,
double zTop)
{
RETURN_ON_NULL_DEVICE_VOID
device->listener.OrientFront.x = xFront;
device->listener.OrientFront.y = yFront;
device->listener.OrientFront.z = zFront;
device->listener.OrientTop.x = xTop;
device->listener.OrientTop.y = yTop;
device->listener.OrientTop.z = zTop;
}
static void FAudioGMS_INTERNAL_SoundInstance_Destroy(FAudioGMS_SoundInstance *instance)
{
uint32_t i;

View File

@ -78,6 +78,14 @@ extern "C"
double xVelocity,
double yVelocity,
double zVelocity);
FAUDIOGMSAPI void FAudioGMS_SoundInstance_Set3DOrientation(
double soundInstanceID,
double xFront,
double yFront,
double zFront,
double xTop,
double yTop,
double zTop);
FAUDIOGMSAPI void FAudioGMS_SoundInstance_SetTrackPositionInSeconds(
double soundInstanceID,
double trackPositionInSeconds);
@ -151,6 +159,14 @@ extern "C"
double xVelocity,
double yVelocity,
double zVelocity);
FAUDIOGMSAPI void FAudioGMS_SetListenerOrientation(
double soundInstanceID,
double xFront,
double yFront,
double zFront,
double xTop,
double yTop,
double zTop);
FAUDIOGMSAPI void FAudioGMS_PauseAll(); /* useful for mobile platforms, etc
*/