Skip to content

Commit

Permalink
Fixed source localization.
Browse files Browse the repository at this point in the history
  • Loading branch information
sinshu committed Dec 27, 2022
1 parent 5d09934 commit fdbf1b5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions ManagedDoom/src/Silk/SilkSound.cs
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ public void Update()
{
uiChannel.Stop();
}
uiChannel.Position = new Vector3(0, 0, -1);
uiChannel.Volume = masterVolumeDecay;
uiChannel.AudioClip = buffers[(int)uiReserved];
uiChannel.Play();
Expand Down Expand Up @@ -423,7 +424,7 @@ private void SetParam(AudioChannel sound, ChannelInfo info)
{
if (info.Type == SfxType.Diffuse)
{
sound.Position = new Vector3(0, 0, 1);
sound.Position = new Vector3(0, 0, -1);
sound.Volume = 0.01F * masterVolumeDecay * info.Volume;
}
else
Expand All @@ -446,14 +447,14 @@ private void SetParam(AudioChannel sound, ChannelInfo info)

if (Math.Abs(x) < 16 && Math.Abs(y) < 16)
{
sound.Position = new Vector3(0, 0, 1);
sound.Position = new Vector3(0, 0, -1);
sound.Volume = 0.01F * masterVolumeDecay * info.Volume;
}
else
{
var dist = MathF.Sqrt(x * x + y * y);
var angle = MathF.Atan2(y, x) - (float)listener.Angle.ToRadian() + MathF.PI / 2;
sound.Position = new Vector3(MathF.Cos(angle), 0, MathF.Sin(angle));
var angle = MathF.Atan2(y, x) - (float)listener.Angle.ToRadian();
sound.Position = new Vector3(-MathF.Sin(angle), 0, -MathF.Cos(angle));
sound.Volume = 0.01F * masterVolumeDecay * GetDistanceDecay(dist) * info.Volume;
}
}
Expand Down

0 comments on commit fdbf1b5

Please sign in to comment.