diff options
Diffstat (limited to '')
-rw-r--r-- | src/audio_core/stream.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/audio_core/stream.cpp b/src/audio_core/stream.cpp index 11481a776..6a5f53a57 100644 --- a/src/audio_core/stream.cpp +++ b/src/audio_core/stream.cpp @@ -51,6 +51,10 @@ void Stream::Stop() { UNIMPLEMENTED(); } +void Stream::SetVolume(float volume) { + game_volume = volume; +} + Stream::State Stream::GetState() const { return state; } @@ -62,8 +66,8 @@ s64 Stream::GetBufferReleaseCycles(const Buffer& buffer) const { return Core::Timing::usToCycles(us); } -static void VolumeAdjustSamples(std::vector<s16>& samples) { - const float volume{std::clamp(Settings::values.volume, 0.0f, 1.0f)}; +static void VolumeAdjustSamples(std::vector<s16>& samples, float game_volume) { + const float volume{std::clamp(Settings::values.volume - (1.0f - game_volume), 0.0f, 1.0f)}; if (volume == 1.0f) { return; @@ -97,11 +101,11 @@ void Stream::PlayNextBuffer() { active_buffer = queued_buffers.front(); queued_buffers.pop(); - VolumeAdjustSamples(active_buffer->GetSamples()); + VolumeAdjustSamples(active_buffer->GetSamples(), game_volume); sink_stream.EnqueueSamples(GetNumChannels(), active_buffer->GetSamples()); - core_timing.ScheduleEventThreadsafe(GetBufferReleaseCycles(*active_buffer), release_event, {}); + core_timing.ScheduleEvent(GetBufferReleaseCycles(*active_buffer), release_event, {}); } void Stream::ReleaseActiveBuffer() { |