diff --git a/ChaosMod/Components/EffectSound/EffectSound3D.cpp b/ChaosMod/Components/EffectSound/EffectSound3D.cpp index 2278c6e4f..091cb048f 100644 --- a/ChaosMod/Components/EffectSound/EffectSound3D.cpp +++ b/ChaosMod/Components/EffectSound/EffectSound3D.cpp @@ -1,9 +1,10 @@ #include -#include "Util/Camera.h" - #include "EffectSound3D.h" +#include "Memory/Hooks/AudioPitchHook.h" +#include "Util/Camera.h" + #define MINIAUDIO_IMPLEMENTATION #include @@ -92,6 +93,8 @@ void EffectSound3D::OnRun() ma_sound_start(&sound.Handle); ma_sound_set_rolloff(&sound.Handle, .1f); + ma_sound_set_pitch(&sound.Handle, + 1.f + (!Hooks::GetTargetAudioPitch() ? 0.f : Hooks::GetTargetAudioPitch() * .0001f)); switch (sound.PlayOptions.PlayType) { diff --git a/ChaosMod/Memory/Hooks/AudioPitchHook.cpp b/ChaosMod/Memory/Hooks/AudioPitchHook.cpp index 25f32e14e..20bcc6cbe 100644 --- a/ChaosMod/Memory/Hooks/AudioPitchHook.cpp +++ b/ChaosMod/Memory/Hooks/AudioPitchHook.cpp @@ -36,6 +36,11 @@ namespace Hooks ms_TargetPitch = pitch; } + int GetTargetAudioPitch() + { + return !ms_EnabledHook ? 0.f : ms_TargetPitch; + } + void ResetAudioPitch() { ms_EnabledHook = false; diff --git a/ChaosMod/Memory/Hooks/AudioPitchHook.h b/ChaosMod/Memory/Hooks/AudioPitchHook.h index feba28191..92915bcc1 100644 --- a/ChaosMod/Memory/Hooks/AudioPitchHook.h +++ b/ChaosMod/Memory/Hooks/AudioPitchHook.h @@ -3,6 +3,6 @@ namespace Hooks { void SetAudioPitch(int pitch); - + int GetTargetAudioPitch(); void ResetAudioPitch(); } \ No newline at end of file