diff options
| author | 2017-10-09 23:56:20 -0400 | |
|---|---|---|
| committer | 2017-10-09 23:56:20 -0400 | |
| commit | b1d5db1cf60344b6b081c9d03cb6ccc3264326cd (patch) | |
| tree | fde377c4ba3c0f92c032e6f5ec8627aae37270ef /src/audio_core/hle/source.cpp | |
| parent | loader: Various improvements for NSO/NRO loaders. (diff) | |
| parent | Merge pull request #2996 from MerryMage/split-travis (diff) | |
| download | yuzu-b1d5db1cf60344b6b081c9d03cb6ccc3264326cd.tar.gz yuzu-b1d5db1cf60344b6b081c9d03cb6ccc3264326cd.tar.xz yuzu-b1d5db1cf60344b6b081c9d03cb6ccc3264326cd.zip | |
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 92484c526..c12287700 100644 --- a/src/audio_core/hle/source.cpp +++ b/src/audio_core/hle/source.cpp | |||
| @@ -244,17 +244,27 @@ void Source::GenerateFrame() { | |||
| 244 | break; | 244 | break; |
| 245 | } | 245 | } |
| 246 | 246 | ||
| 247 | const size_t size_to_copy = | 247 | switch (state.interpolation_mode) { |
| 248 | std::min(state.current_buffer.size(), current_frame.size() - frame_position); | 248 | case InterpolationMode::None: |
| 249 | 249 | AudioInterp::None(state.interp_state, state.current_buffer, state.rate_multiplier, | |
| 250 | std::copy(state.current_buffer.begin(), state.current_buffer.begin() + size_to_copy, | 250 | current_frame, frame_position); |
| 251 | current_frame.begin() + frame_position); | 251 | break; |
| 252 | state.current_buffer.erase(state.current_buffer.begin(), | 252 | case InterpolationMode::Linear: |
| 253 | state.current_buffer.begin() + size_to_copy); | 253 | AudioInterp::Linear(state.interp_state, state.current_buffer, state.rate_multiplier, |
| 254 | 254 | current_frame, frame_position); | |
| 255 | frame_position += size_to_copy; | 255 | break; |
| 256 | state.next_sample_number += static_cast<u32>(size_to_copy); | 256 | case InterpolationMode::Polyphase: |
| 257 | // TODO(merry): Implement polyphase interpolation | ||
| 258 | LOG_DEBUG(Audio_DSP, "Polyphase interpolation unimplemented; falling back to linear"); | ||
| 259 | AudioInterp::Linear(state.interp_state, state.current_buffer, state.rate_multiplier, | ||
| 260 | current_frame, frame_position); | ||
| 261 | break; | ||
| 262 | default: | ||
| 263 | UNIMPLEMENTED(); | ||
| 264 | break; | ||
| 265 | } | ||
| 257 | } | 266 | } |
| 267 | state.next_sample_number += static_cast<u32>(frame_position); | ||
| 258 | 268 | ||
| 259 | state.filters.ProcessFrame(current_frame); | 269 | state.filters.ProcessFrame(current_frame); |
| 260 | } | 270 | } |
| @@ -305,25 +315,6 @@ bool Source::DequeueBuffer() { | |||
| 305 | return true; | 315 | return true; |
| 306 | } | 316 | } |
| 307 | 317 | ||
| 308 | switch (state.interpolation_mode) { | ||
| 309 | case InterpolationMode::None: | ||
| 310 | state.current_buffer = | ||
| 311 | AudioInterp::None(state.interp_state, state.current_buffer, state.rate_multiplier); | ||
| 312 | break; | ||
| 313 | case InterpolationMode::Linear: | ||
| 314 | state.current_buffer = | ||
| 315 | AudioInterp::Linear(state.interp_state, state.current_buffer, state.rate_multiplier); | ||
| 316 | break; | ||
| 317 | case InterpolationMode::Polyphase: | ||
| 318 | // TODO(merry): Implement polyphase interpolation | ||
| 319 | state.current_buffer = | ||
| 320 | AudioInterp::Linear(state.interp_state, state.current_buffer, state.rate_multiplier); | ||
| 321 | break; | ||
| 322 | default: | ||
| 323 | UNIMPLEMENTED(); | ||
| 324 | break; | ||
| 325 | } | ||
| 326 | |||
| 327 | // the first playthrough starts at play_position, loops start at the beginning of the buffer | 318 | // the first playthrough starts at play_position, loops start at the beginning of the buffer |
| 328 | state.current_sample_number = (!buf.has_played) ? buf.play_position : 0; | 319 | state.current_sample_number = (!buf.has_played) ? buf.play_position : 0; |
| 329 | state.next_sample_number = state.current_sample_number; | 320 | state.next_sample_number = state.current_sample_number; |