From b54cdeb28448aade6eb84bc703d04d63348eea3d Mon Sep 17 00:00:00 2001 From: David Marcec Date: Fri, 20 Sep 2019 10:42:09 +1000 Subject: [PATCH 1/2] Added frame_count for REV7 audio renderer Added framecount --- src/audio_core/audio_renderer.cpp | 10 ++++++++++ src/audio_core/audio_renderer.h | 25 ++++++++++++++----------- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/src/audio_core/audio_renderer.cpp b/src/audio_core/audio_renderer.cpp index da50a0bbcc..cf24527f30 100644 --- a/src/audio_core/audio_renderer.cpp +++ b/src/audio_core/audio_renderer.cpp @@ -107,6 +107,11 @@ Stream::State AudioRenderer::GetStreamState() const { return stream->GetState(); } +constexpr u32 VersionFromRevision(u32_le rev) { + // "REV7" -> 7 + return ((rev >> 24) & 0xff) - 0x30; +} + std::vector AudioRenderer::UpdateAudioRenderer(const std::vector& input_params) { // Copy UpdateDataHeader struct UpdateDataHeader config{}; @@ -166,6 +171,11 @@ std::vector AudioRenderer::UpdateAudioRenderer(const std::vector& input_ // Copy output header UpdateDataHeader response_data{worker_params}; std::vector output_params(response_data.total_size); + const auto audren_revision = VersionFromRevision(config.revision); + if (audren_revision >= 7) { + response_data.frame_count = 0x10; + response_data.total_size += 0x10; + } std::memcpy(output_params.data(), &response_data, sizeof(UpdateDataHeader)); // Copy output memory pool entries diff --git a/src/audio_core/audio_renderer.h b/src/audio_core/audio_renderer.h index 45afbe7598..4f14b91cd7 100644 --- a/src/audio_core/audio_renderer.h +++ b/src/audio_core/audio_renderer.h @@ -194,21 +194,24 @@ struct UpdateDataHeader { mixes_size = 0x0; sinks_size = config.sink_count * 0x20; performance_manager_size = 0x10; + frame_count = 0; total_size = sizeof(UpdateDataHeader) + behavior_size + memory_pools_size + voices_size + effects_size + sinks_size + performance_manager_size; } - u32_le revision; - u32_le behavior_size; - u32_le memory_pools_size; - u32_le voices_size; - u32_le voice_resource_size; - u32_le effects_size; - u32_le mixes_size; - u32_le sinks_size; - u32_le performance_manager_size; - INSERT_PADDING_WORDS(6); - u32_le total_size; + u32_le revision{}; + u32_le behavior_size{}; + u32_le memory_pools_size{}; + u32_le voices_size{}; + u32_le voice_resource_size{}; + u32_le effects_size{}; + u32_le mixes_size{}; + u32_le sinks_size{}; + u32_le performance_manager_size{}; + INSERT_PADDING_WORDS(1); + u32_le frame_count{}; + INSERT_PADDING_WORDS(4); + u32_le total_size{}; }; static_assert(sizeof(UpdateDataHeader) == 0x40, "UpdateDataHeader has wrong size"); From e9d19add7d4a857a87191ec421a298eea1b89cf5 Mon Sep 17 00:00:00 2001 From: David Marcec Date: Sat, 21 Sep 2019 16:24:56 +1000 Subject: [PATCH 2/2] Used revision 5 instead of 7, marked constexpr as static --- src/audio_core/audio_renderer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/audio_core/audio_renderer.cpp b/src/audio_core/audio_renderer.cpp index cf24527f30..e6f38d6000 100644 --- a/src/audio_core/audio_renderer.cpp +++ b/src/audio_core/audio_renderer.cpp @@ -107,7 +107,7 @@ Stream::State AudioRenderer::GetStreamState() const { return stream->GetState(); } -constexpr u32 VersionFromRevision(u32_le rev) { +static constexpr u32 VersionFromRevision(u32_le rev) { // "REV7" -> 7 return ((rev >> 24) & 0xff) - 0x30; } @@ -172,7 +172,7 @@ std::vector AudioRenderer::UpdateAudioRenderer(const std::vector& input_ UpdateDataHeader response_data{worker_params}; std::vector output_params(response_data.total_size); const auto audren_revision = VersionFromRevision(config.revision); - if (audren_revision >= 7) { + if (audren_revision >= 5) { response_data.frame_count = 0x10; response_data.total_size += 0x10; }