diff options
| author | 2020-11-17 14:14:29 +1100 | |
|---|---|---|
| committer | 2020-11-17 14:14:29 +1100 | |
| commit | 9a4beac95a0f88ec312a28d06da8270aa58736e3 (patch) | |
| tree | f3cbfbea9881288a32c52181ad16201f2958946a /src/audio_core/sink_context.cpp | |
| parent | Merge pull request #4895 from Morph1984/cave-story-plus-applet-fix (diff) | |
| download | yuzu-9a4beac95a0f88ec312a28d06da8270aa58736e3.tar.gz yuzu-9a4beac95a0f88ec312a28d06da8270aa58736e3.tar.xz yuzu-9a4beac95a0f88ec312a28d06da8270aa58736e3.zip | |
audren: Make use of nodiscard, rework downmixing, release all buffers
Preliminary work for upmixing & general cleanup. Fixes basic issues in games such as Shovel Knight and slightly improves the LEGO games. Upmixing stitll needs to be implemented.
Audio levels in a few games will be fixed as we now use the downmix coefficients when possible instead of supplying our own
Diffstat (limited to 'src/audio_core/sink_context.cpp')
| -rw-r--r-- | src/audio_core/sink_context.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/audio_core/sink_context.cpp b/src/audio_core/sink_context.cpp index 0882b411a..cdb47ba81 100644 --- a/src/audio_core/sink_context.cpp +++ b/src/audio_core/sink_context.cpp | |||
| @@ -12,10 +12,16 @@ std::size_t SinkContext::GetCount() const { | |||
| 12 | return sink_count; | 12 | return sink_count; |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | void SinkContext::UpdateMainSink(SinkInfo::InParams& in) { | 15 | void SinkContext::UpdateMainSink(const SinkInfo::InParams& in) { |
| 16 | ASSERT(in.type == SinkTypes::Device); | ||
| 17 | |||
| 18 | downmix = in.device.down_matrix_enabled; | ||
| 19 | if (downmix) { | ||
| 20 | downmix_coefficients = in.device.down_matrix_coef; | ||
| 21 | } | ||
| 16 | in_use = in.in_use; | 22 | in_use = in.in_use; |
| 17 | use_count = in.device.input_count; | 23 | use_count = in.device.input_count; |
| 18 | std::memcpy(buffers.data(), in.device.input.data(), AudioCommon::MAX_CHANNEL_COUNT); | 24 | buffers = in.device.input; |
| 19 | } | 25 | } |
| 20 | 26 | ||
| 21 | bool SinkContext::InUse() const { | 27 | bool SinkContext::InUse() const { |
| @@ -28,4 +34,12 @@ std::vector<u8> SinkContext::OutputBuffers() const { | |||
| 28 | return buffer_ret; | 34 | return buffer_ret; |
| 29 | } | 35 | } |
| 30 | 36 | ||
| 37 | bool SinkContext::HasDownMixingCoefficients() const { | ||
| 38 | return downmix; | ||
| 39 | } | ||
| 40 | |||
| 41 | const std::array<float_le, 4>& SinkContext::GetDownmixCoefficients() const { | ||
| 42 | return downmix_coefficients; | ||
| 43 | } | ||
| 44 | |||
| 31 | } // namespace AudioCore | 45 | } // namespace AudioCore |