diff options
author | bunnei <bunneidev@gmail.com> | 2017-10-09 23:56:20 -0400 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2017-10-09 23:56:20 -0400 |
commit | b1d5db1cf60344b6b081c9d03cb6ccc3264326cd (patch) | |
tree | fde377c4ba3c0f92c032e6f5ec8627aae37270ef /src/audio_core/hle/source.cpp | |
parent | 23ce4f5afc66eb04a7aafc4f89685b8109b8d5c6 (diff) | |
parent | d15e15bd058f93f1600c86ad8de7482740724f3f (diff) |
Merge remote-tracking branch 'upstream/master' into nx
# Conflicts:
# src/core/CMakeLists.txt
# src/core/arm/dynarmic/arm_dynarmic.cpp
# src/core/arm/dyncom/arm_dyncom.cpp
# src/core/hle/kernel/process.cpp
# src/core/hle/kernel/thread.cpp
# src/core/hle/kernel/thread.h
# src/core/hle/kernel/vm_manager.cpp
# src/core/loader/3dsx.cpp
# src/core/loader/elf.cpp
# src/core/loader/ncch.cpp
# src/core/memory.cpp
# src/core/memory.h
# src/core/memory_setup.h
Diffstat (limited to 'src/audio_core/hle/source.cpp')
-rw-r--r-- | src/audio_core/hle/source.cpp | 49 |
1 files changed, 20 insertions, 29 deletions
diff --git a/src/audio_core/hle/source.cpp b/src/audio_core/hle/source.cpp index 92484c5261..c122877002 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 += static_cast<u32>(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; |