fix panning and stream stopping

main
cosmonaut 2021-10-27 17:59:00 -07:00
parent 5570687a66
commit e27f3a55d7
1 changed files with 9 additions and 3 deletions

View File

@ -428,7 +428,7 @@ void FAudioGMS_Init(double spatialDistanceScale, double timestep)
device->listener.OrientFront.x = 0; device->listener.OrientFront.x = 0;
device->listener.OrientFront.y = 0; device->listener.OrientFront.y = 0;
device->listener.OrientFront.z = -1; device->listener.OrientFront.z = 1;
device->listener.OrientTop.x = 0; device->listener.OrientTop.x = 0;
device->listener.OrientTop.y = 1; device->listener.OrientTop.y = 1;
device->listener.OrientTop.z = 0; 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) static void FAudioGMS_INTERNAL_SoundInstance_SetVolume(FAudioGMS_SoundInstance* instance, float volume)
{ {
instance->adjustingVolumeOverTime = 0;
instance->volume = volume; instance->volume = volume;
FAudioVoice_SetVolume(instance->handle, volume, 0); 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.x = 0;
instance->emitter->OrientFront.y = 0; instance->emitter->OrientFront.y = 0;
instance->emitter->OrientFront.z = 1; instance->emitter->OrientFront.z = -1;
FAudioGMS_INTERNAL_Apply3D(instance); FAudioGMS_INTERNAL_Apply3D(instance);
} }
@ -1107,6 +1108,10 @@ static void FAudioGMS_INTERNAL_SoundInstance_Stop(FAudioGMS_SoundInstance* insta
{ {
FAudioSourceVoice_ExitLoop(instance->handle, 0); FAudioSourceVoice_ExitLoop(instance->handle, 0);
} }
else
{
FAudioSourceVoice_Stop(instance->handle, 0, 0);
}
instance->soundState = SoundState_Stopped; instance->soundState = SoundState_Stopped;
} }
@ -1132,6 +1137,7 @@ static void FAudioGMS_INTERNAL_SoundInstance_StopImmediate(FAudioGMS_SoundInstan
if (!instance->isStatic) if (!instance->isStatic)
{ {
FAudioGMS_INTERNAL_SoundInstance_ClearBuffers(instance); FAudioGMS_INTERNAL_SoundInstance_ClearBuffers(instance);
FAudioGMS_INTERNAL_SoundInstance_StreamingUpdate(instance);
} }
instance->soundState = SoundState_Stopped; instance->soundState = SoundState_Stopped;
@ -1238,7 +1244,7 @@ void FAudioGMS_SoundInstance_SetVolumeOverTime(double soundInstanceID, double vo
{ {
instance->adjustingVolumeOverTime = 1; instance->adjustingVolumeOverTime = 1;
instance->targetVolume = volume; instance->targetVolume = volume;
instance->volumeDelta = (volume - instance->volume) / (milliseconds / device->timestep); instance->volumeDelta = (volume - instance->volume) / ((milliseconds / 1000) / device->timestep);
} }
} }