Skip to content

Commit

Permalink
HLE DSP: Actually parse InterpolationMode config
Browse files Browse the repository at this point in the history
  • Loading branch information
wheremyfoodat committed Nov 7, 2024
1 parent b299609 commit 8cfffb8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/audio/hle_core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,14 @@ namespace Audio {
// Buffer of decoded PCM16 samples. TODO: Are there better alternatives to use over deque?
using SampleBuffer = std::deque<std::array<s16, 2>>;
using BufferQueue = std::priority_queue<Buffer>;
using InterpolationMode = HLE::SourceConfiguration::Configuration::InterpolationMode;

DSPMixer::StereoFrame<s16> 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
Expand Down
6 changes: 6 additions & 0 deletions src/core/audio/hle_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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
);
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 8cfffb8

Please sign in to comment.