mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-04-23 15:36:07 +00:00
Merge 5303dba2e5 into d4ac3cd645
This commit is contained in:
commit
364665c160
|
|
@ -560,6 +560,7 @@ void SoundEngine::play(int iSound, float x, float y, float z, float volume, floa
|
|||
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);
|
||||
ma_sound_set_attenuation_model(&s->sound, ma_attenuation_model_linear); // Toru - Java uses linear attenuation, prevents audio from getting too quiet
|
||||
|
||||
float finalVolume = volume * m_MasterEffectsVolume * SFX_VOLUME_MULTIPLIER;
|
||||
if (finalVolume > SFX_MAX_GAIN)
|
||||
|
|
@ -619,10 +620,26 @@ void SoundEngine::playUI(int iSound, float volume, float pitch)
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
if (!found) // Toru - not found in UI folder, expand search (fixes missing portal sounds)
|
||||
{
|
||||
app.DebugPrintf("No sound file found for UI sound: %s\n", basePath);
|
||||
return;
|
||||
sprintf_s(basePath, "Windows64Media/Sound/Minecraft/%s", ConvertSoundPathToName(name));
|
||||
sprintf_s(finalPath, "%s.wav", basePath);
|
||||
|
||||
for (size_t i = 0; i < count; i++)
|
||||
{
|
||||
sprintf_s(finalPath, "%s%s", basePath, extensions[i]);
|
||||
if (FileExists(finalPath))
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) // still not found
|
||||
{
|
||||
app.DebugPrintf("No sound file found for UI sound: %s\n", basePath);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
MiniAudioSound* s = new MiniAudioSound();
|
||||
|
|
@ -649,8 +666,11 @@ void SoundEngine::playUI(int iSound, float volume, float pitch)
|
|||
ma_sound_set_spatialization_enabled(&s->sound, MA_FALSE);
|
||||
|
||||
float finalVolume = volume * m_MasterEffectsVolume;
|
||||
if (finalVolume > 1.0f)
|
||||
finalVolume = 1.0f;
|
||||
if (finalVolume > SFX_MAX_GAIN)
|
||||
finalVolume = SFX_MAX_GAIN;
|
||||
|
||||
finalVolume *= 0.25f; // Toru - Java multiplies UI sounds by 0.25 after clamping them
|
||||
|
||||
printf("UI Sound volume set to %f\nEffects volume: %f\n", finalVolume, m_MasterEffectsVolume);
|
||||
|
||||
ma_sound_set_volume(&s->sound, finalVolume);
|
||||
|
|
@ -1228,6 +1248,11 @@ void SoundEngine::playMusicUpdate()
|
|||
{
|
||||
ma_sound_set_spatialization_enabled(&m_musicStream, MA_TRUE);
|
||||
ma_sound_set_position(&m_musicStream, m_StreamingAudioInfo.x, m_StreamingAudioInfo.y, m_StreamingAudioInfo.z);
|
||||
|
||||
ma_sound_set_min_distance(&m_musicStream, SFX_3D_MIN_DISTANCE);
|
||||
ma_sound_set_max_distance(&m_musicStream, SFX_3D_MAX_DISTANCE * 4.0f); // Toru - Java increases the max distance by 4x for jukeboxes
|
||||
ma_sound_set_rolloff(&m_musicStream, SFX_3D_ROLLOFF);
|
||||
ma_sound_set_attenuation_model(&m_musicStream, ma_attenuation_model_linear); // Toru - Java uses linear attenuation, prevents audio from getting too quiet
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,11 +6,11 @@ using namespace std;
|
|||
|
||||
#include "miniaudio.h"
|
||||
|
||||
constexpr float SFX_3D_MIN_DISTANCE = 1.0f;
|
||||
constexpr float SFX_3D_MIN_DISTANCE = 0.001f;
|
||||
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;
|
||||
constexpr float SFX_3D_ROLLOFF = 1.0f;
|
||||
constexpr float SFX_VOLUME_MULTIPLIER = 1.0f;
|
||||
constexpr float SFX_MAX_GAIN = 1.0f;
|
||||
|
||||
enum eMUSICFILES
|
||||
{
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Reference in a new issue