From 19dfdf88bc9e0d814d73a4e02090201f01651218 Mon Sep 17 00:00:00 2001 From: SlowRiot Date: Thu, 2 Jan 2025 02:53:28 +0000 Subject: [PATCH] don't adjust volume per channel --- main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.cpp b/main.cpp index 4353ec9..e6eba0c 100644 --- a/main.cpp +++ b/main.cpp @@ -108,10 +108,10 @@ void game_manager::audio_generator::output(std::span outputs) // produce a sine wave tone of desired frequency to all output channels for(auto const &output : outputs) { for(int i{0}; i != output.samplesPerChannel; ++i) { - float s{static_cast(std::sin(phase))}; + float const sample{static_cast(std::sin(phase)) * current_volume}; phase += phase_increment; for(int channel{0}; channel != output.numberOfChannels; ++channel) { - output.data[channel * output.samplesPerChannel + i] = s * current_volume; + output.data[channel * output.samplesPerChannel + i] = sample; } } }