From e27f3a55d75591905d71fa723844d712e6d5429c Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Wed, 27 Oct 2021 17:59:00 -0700 Subject: [PATCH] fix panning and stream stopping --- src/FAudioGMS.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/FAudioGMS.c b/src/FAudioGMS.c index e1c060d..a7d4b4a 100644 --- a/src/FAudioGMS.c +++ b/src/FAudioGMS.c @@ -428,7 +428,7 @@ void FAudioGMS_Init(double spatialDistanceScale, double timestep) device->listener.OrientFront.x = 0; device->listener.OrientFront.y = 0; - device->listener.OrientFront.z = -1; + device->listener.OrientFront.z = 1; device->listener.OrientTop.x = 0; device->listener.OrientTop.y = 1; device->listener.OrientTop.z = 0; @@ -670,6 +670,7 @@ static void FAudioGMS_INTERNAL_SoundInstance_SetPitch(FAudioGMS_SoundInstance* i static void FAudioGMS_INTERNAL_SoundInstance_SetVolume(FAudioGMS_SoundInstance* instance, float volume) { + instance->adjustingVolumeOverTime = 0; instance->volume = volume; FAudioVoice_SetVolume(instance->handle, volume, 0); } @@ -946,7 +947,7 @@ static void FAudioGMS_INTERNAL_StaticSound_AddEmitter(FAudioGMS_SoundInstance* i instance->emitter->OrientFront.x = 0; instance->emitter->OrientFront.y = 0; - instance->emitter->OrientFront.z = 1; + instance->emitter->OrientFront.z = -1; FAudioGMS_INTERNAL_Apply3D(instance); } @@ -1107,6 +1108,10 @@ static void FAudioGMS_INTERNAL_SoundInstance_Stop(FAudioGMS_SoundInstance* insta { FAudioSourceVoice_ExitLoop(instance->handle, 0); } + else + { + FAudioSourceVoice_Stop(instance->handle, 0, 0); + } instance->soundState = SoundState_Stopped; } @@ -1132,6 +1137,7 @@ static void FAudioGMS_INTERNAL_SoundInstance_StopImmediate(FAudioGMS_SoundInstan if (!instance->isStatic) { FAudioGMS_INTERNAL_SoundInstance_ClearBuffers(instance); + FAudioGMS_INTERNAL_SoundInstance_StreamingUpdate(instance); } instance->soundState = SoundState_Stopped; @@ -1238,7 +1244,7 @@ void FAudioGMS_SoundInstance_SetVolumeOverTime(double soundInstanceID, double vo { instance->adjustingVolumeOverTime = 1; instance->targetVolume = volume; - instance->volumeDelta = (volume - instance->volume) / (milliseconds / device->timestep); + instance->volumeDelta = (volume - instance->volume) / ((milliseconds / 1000) / device->timestep); } }