summaryrefslogtreecommitdiffstats
path: root/src/audio_core/hle/source.cpp
diff options
context:
space:
mode:
authorMerryMage <MerryMage@users.noreply.github.com>2017-08-03 13:22:51 +0200
committerMerryMage <MerryMage@users.noreply.github.com>2017-08-28 11:54:41 +0200
commit933508e2a2f7923cebc15d679b78933df8fb9ee5 (patch)
treee49faeb30929c03c5490d8ae507ec907060c1068 /src/audio_core/hle/source.cpp
parentMerge pull request #2850 from j-selby/fix_invalid_paths (diff)
downloadyuzu-933508e2a2f7923cebc15d679b78933df8fb9ee5.tar
yuzu-933508e2a2f7923cebc15d679b78933df8fb9ee5.tar.gz
yuzu-933508e2a2f7923cebc15d679b78933df8fb9ee5.tar.bz2
yuzu-933508e2a2f7923cebc15d679b78933df8fb9ee5.tar.lz
yuzu-933508e2a2f7923cebc15d679b78933df8fb9ee5.tar.xz
yuzu-933508e2a2f7923cebc15d679b78933df8fb9ee5.tar.zst
yuzu-933508e2a2f7923cebc15d679b78933df8fb9ee5.zip
Diffstat (limited to 'src/audio_core/hle/source.cpp')
-rw-r--r--src/audio_core/hle/source.cpp49
1 files changed, 20 insertions, 29 deletions
diff --git a/src/audio_core/hle/source.cpp b/src/audio_core/hle/source.cpp
index 92484c526..de4e88cae 100644
--- a/src/audio_core/hle/source.cpp
+++ b/src/audio_core/hle/source.cpp
@@ -244,17 +244,27 @@ void Source::GenerateFrame() {
break;
}
- const size_t size_to_copy =
- std::min(state.current_buffer.size(), current_frame.size() - frame_position);
-
- std::copy(state.current_buffer.begin(), state.current_buffer.begin() + size_to_copy,
- current_frame.begin() + frame_position);
- state.current_buffer.erase(state.current_buffer.begin(),
- state.current_buffer.begin() + size_to_copy);
-
- frame_position += size_to_copy;
- state.next_sample_number += static_cast<u32>(size_to_copy);
+ switch (state.interpolation_mode) {
+ case InterpolationMode::None:
+ AudioInterp::None(state.interp_state, state.current_buffer, state.rate_multiplier,
+ current_frame, frame_position);
+ break;
+ case InterpolationMode::Linear:
+ AudioInterp::Linear(state.interp_state, state.current_buffer, state.rate_multiplier,
+ current_frame, frame_position);
+ break;
+ case InterpolationMode::Polyphase:
+ // TODO(merry): Implement polyphase interpolation
+ LOG_DEBUG(Audio_DSP, "Polyphase interpolation unimplemented; falling back to linear");
+ AudioInterp::Linear(state.interp_state, state.current_buffer, state.rate_multiplier,
+ current_frame, frame_position);
+ break;
+ default:
+ UNIMPLEMENTED();
+ break;
+ }
}
+ state.next_sample_number += frame_position;
state.filters.ProcessFrame(current_frame);
}
@@ -305,25 +315,6 @@ bool Source::DequeueBuffer() {
return true;
}
- switch (state.interpolation_mode) {
- case InterpolationMode::None:
- state.current_buffer =
- AudioInterp::None(state.interp_state, state.current_buffer, state.rate_multiplier);
- break;
- case InterpolationMode::Linear:
- state.current_buffer =
- AudioInterp::Linear(state.interp_state, state.current_buffer, state.rate_multiplier);
- break;
- case InterpolationMode::Polyphase:
- // TODO(merry): Implement polyphase interpolation
- state.current_buffer =
- AudioInterp::Linear(state.interp_state, state.current_buffer, state.rate_multiplier);
- break;
- default:
- UNIMPLEMENTED();
- break;
- }
-
// the first playthrough starts at play_position, loops start at the beginning of the buffer
state.current_sample_number = (!buf.has_played) ? buf.play_position : 0;
state.next_sample_number = state.current_sample_number;