From 8cfffb8119f4e78715d929aedbe304df235daaef Mon Sep 17 00:00:00 2001 From: wheremyfoodat <44909372+wheremyfoodat@users.noreply.github.com> Date: Thu, 7 Nov 2024 22:08:28 +0200 Subject: [PATCH] HLE DSP: Actually parse InterpolationMode config --- include/audio/hle_core.hpp | 2 ++ src/core/audio/hle_core.cpp | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/include/audio/hle_core.hpp b/include/audio/hle_core.hpp index 2fccd55d..29fd4542 100644 --- a/include/audio/hle_core.hpp +++ b/include/audio/hle_core.hpp @@ -88,12 +88,14 @@ namespace Audio { // Buffer of decoded PCM16 samples. TODO: Are there better alternatives to use over deque? using SampleBuffer = std::deque>; using BufferQueue = std::priority_queue; + using InterpolationMode = HLE::SourceConfiguration::Configuration::InterpolationMode; DSPMixer::StereoFrame currentFrame; BufferQueue buffers; SampleFormat sampleFormat = SampleFormat::ADPCM; SourceType sourceType = SourceType::Stereo; + InterpolationMode interpolationMode = InterpolationMode::Linear; // There's one gain configuration for each of the 3 intermediate mixing stages // And each gain configuration is composed of 4 gain values, one for each sample in a quad-channel sample diff --git a/src/core/audio/hle_core.cpp b/src/core/audio/hle_core.cpp index 4bc548dc..06e001f1 100644 --- a/src/core/audio/hle_core.cpp +++ b/src/core/audio/hle_core.cpp @@ -319,6 +319,10 @@ namespace Audio { source.sourceType = config.monoOrStereo; } + if (config.interpolationDirty) { + source.interpolationMode = config.interpolationMode; + } + if (config.rateMultiplierDirty) { source.rateMultiplier = (config.rateMultiplier > 0.f) ? config.rateMultiplier : 1.f; } @@ -499,6 +503,7 @@ namespace Audio { // Copy samples to current frame buffer // TODO: Implement linear/polyphase interpolation + std::copy( source.currentSamples.begin(), std::next(source.currentSamples.begin(), sampleCount), source.currentFrame.begin() + outputCount ); @@ -718,6 +723,7 @@ namespace Audio { // Initialize these to some sane defaults sampleFormat = SampleFormat::ADPCM; sourceType = SourceType::Stereo; + interpolationMode = InterpolationMode::Linear; samplePosition = 0; previousBufferID = 0;