From c9198729b09d9a3e43e19547d41828f27acd9c90 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 15 Dec 2019 20:55:15 +0100 Subject: [PATCH] - did some tweaks to the sound. The angle was wrong and the rolloff type apparently as well. It sounds a lot better now, especially after also altering the minimum distance for the rolloff. This one is interesting, it looks like a bug where the desired value was shifted two bits too much, quadrupling the distance where volume reduction starts. --- source/duke3d/src/sounds.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/duke3d/src/sounds.cpp b/source/duke3d/src/sounds.cpp index 3ddba504d..8a2bf3529 100644 --- a/source/duke3d/src/sounds.cpp +++ b/source/duke3d/src/sounds.cpp @@ -43,7 +43,9 @@ class DukeSoundEngine : public SoundEngine public: DukeSoundEngine() { - S_Rolloff = { ROLLOFF_Linear, 576, 1088 }; // These are the original values derived from the DN3D source, but the lower end looks like a bug. Needs checking and maybe an option. + S_Rolloff.RolloffType = ROLLOFF_Doom; // Seems like Duke uses the same rolloff type as Doom. + S_Rolloff.MinDistance = 144; // was originally 576 which looks like a bug and sounds like crap. + S_Rolloff.MaxDistance = 1088; } }; @@ -353,7 +355,7 @@ void S_Update(void) if (c != nullptr) { - listener.angle = (float)ca * pi::pi() / 2048; // todo: Check value range for angle. + listener.angle = (float)ca * pi::pi() / 1024; // Build uses a period of 2048. listener.velocity.Zero(); listener.position = { c->x / 16.f, c->z / 256.f, -c->y / 16.f }; listener.underwater = false;