aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client
diff options
context:
space:
mode:
authorModMaker101 <119018978+ModMaker101@users.noreply.github.com>2026-03-12 02:43:12 -0400
committerGitHub <noreply@github.com>2026-03-12 01:43:12 -0500
commit44fc8a4db21252ee2d0a53a9e50d884d8ae76e36 (patch)
tree32ac51c71b2b15cbdd12bd15f2f83c85efeb221d /Minecraft.Client
parent1036b7368e5625d34666beb24163756c1da6b227 (diff)
Fix quiet in-game audio after engine update #897 (#1171)
Diffstat (limited to 'Minecraft.Client')
-rw-r--r--Minecraft.Client/Common/Audio/SoundEngine.cpp15
-rw-r--r--Minecraft.Client/Common/Audio/SoundEngine.h6
2 files changed, 15 insertions, 6 deletions
diff --git a/Minecraft.Client/Common/Audio/SoundEngine.cpp b/Minecraft.Client/Common/Audio/SoundEngine.cpp
index 24cb7bf4..cf140c78 100644
--- a/Minecraft.Client/Common/Audio/SoundEngine.cpp
+++ b/Minecraft.Client/Common/Audio/SoundEngine.cpp
@@ -260,9 +260,9 @@ void SoundEngine::updateMiniAudio()
continue;
}
- float finalVolume = s->info.volume * m_MasterEffectsVolume;
- if (finalVolume > 1.0f)
- finalVolume = 1.0f;
+ float finalVolume = s->info.volume * m_MasterEffectsVolume * SFX_VOLUME_MULTIPLIER;
+ if (finalVolume > SFX_MAX_GAIN)
+ finalVolume = SFX_MAX_GAIN;
ma_sound_set_volume(&s->sound, finalVolume);
ma_sound_set_pitch(&s->sound, s->info.pitch);
@@ -557,10 +557,13 @@ void SoundEngine::play(int iSound, float x, float y, float z, float volume, floa
}
ma_sound_set_spatialization_enabled(&s->sound, MA_TRUE);
+ ma_sound_set_min_distance(&s->sound, SFX_3D_MIN_DISTANCE);
+ ma_sound_set_max_distance(&s->sound, SFX_3D_MAX_DISTANCE);
+ ma_sound_set_rolloff(&s->sound, SFX_3D_ROLLOFF);
- float finalVolume = volume * m_MasterEffectsVolume;
- if (finalVolume > 1.0f)
- finalVolume = 1.0f;
+ float finalVolume = volume * m_MasterEffectsVolume * SFX_VOLUME_MULTIPLIER;
+ if (finalVolume > SFX_MAX_GAIN)
+ finalVolume = SFX_MAX_GAIN;
ma_sound_set_volume(&s->sound, finalVolume);
ma_sound_set_pitch(&s->sound, pitch);
diff --git a/Minecraft.Client/Common/Audio/SoundEngine.h b/Minecraft.Client/Common/Audio/SoundEngine.h
index 2134c491..38d70d41 100644
--- a/Minecraft.Client/Common/Audio/SoundEngine.h
+++ b/Minecraft.Client/Common/Audio/SoundEngine.h
@@ -6,6 +6,12 @@ using namespace std;
#include "miniaudio.h"
+constexpr float SFX_3D_MIN_DISTANCE = 1.0f;
+constexpr float SFX_3D_MAX_DISTANCE = 16.0f;
+constexpr float SFX_3D_ROLLOFF = 0.5f;
+constexpr float SFX_VOLUME_MULTIPLIER = 1.5f;
+constexpr float SFX_MAX_GAIN = 1.5f;
+
enum eMUSICFILES
{
eStream_Overworld_Calm1 = 0,