diff --git a/src/audio/synthesis.c b/src/audio/synthesis.c index 1b3ceecf..94f2644d 100644 --- a/src/audio/synthesis.c +++ b/src/audio/synthesis.c @@ -1496,11 +1496,6 @@ void note_set_vel_pan_reverb(struct Note *note, f32 velocity, f32 pan, u8 reverb velocity = 0; } - - float master_vol = CVarGetInteger("gSettings.Volume.Master", 100) / 100.0f; - volLeft *= master_vol; - volRight *= master_vol; - #ifdef VERSION_JP note->targetVolLeft = (u16)(velocity * volLeft) & ~0x80FF; // 0x7F00, but that doesn't match note->targetVolRight = (u16)(velocity * volRight) & ~0x80FF; diff --git a/src/port/Engine.cpp b/src/port/Engine.cpp index 946d3817..727c0113 100644 --- a/src/port/Engine.cpp +++ b/src/port/Engine.cpp @@ -400,6 +400,12 @@ void GameEngine::HandleAudioThread() { create_next_audio_buffer(audio_buffer + i * (num_audio_samples * 2), num_audio_samples); } + float master_vol = CVarGetInteger("gSettings.Volume.Master", 100) / 100.0f; + + for (u32 i = 0; i < SAMPLES_PER_FRAME; i++) { + audio_buffer[i] = static_cast(audio_buffer[i] * master_vol); + } + AudioPlayerPlayFrame((u8*)audio_buffer, 2 * num_audio_samples * 4); audio.processing = false;