- Needs To Be A Branch

Signed-off-by: Zephyron <zephyron@citron-emu.org>
This commit is contained in:
Zephyron
2025-09-26 16:55:32 +10:00
parent 7acd55a005
commit 5871f4b418
14 changed files with 34 additions and 488 deletions

View File

@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include <ranges>
@@ -11,16 +10,14 @@ namespace AudioCore::Renderer {
VoiceState& VoiceContext::GetDspSharedState(const u32 index) {
if (index >= dsp_states.size()) {
LOG_CRITICAL(Service_Audio, "Attempted to access invalid voice dsp state index {:04X} (max is {})", index, dsp_states.size() > 0 ? dsp_states.size() - 1 : 0);
return dsp_states[0];
LOG_ERROR(Service_Audio, "Invalid voice dsp state index {:04X}", index);
}
return dsp_states[index];
}
VoiceChannelResource& VoiceContext::GetChannelResource(const u32 index) {
if (index >= channel_resources.size()) {
LOG_CRITICAL(Service_Audio, "Attempted to access invalid voice channel resource index {:04X} (max is {})", index, channel_resources.size() > 0 ? channel_resources.size() - 1 : 0);
return channel_resources[0];
LOG_ERROR(Service_Audio, "Invalid voice channel resource index {:04X}", index);
}
return channel_resources[index];
}
@@ -48,16 +45,14 @@ VoiceInfo* VoiceContext::GetSortedInfo(const u32 index) {
VoiceInfo& VoiceContext::GetInfo(const u32 index) {
if (index >= voices.size()) {
LOG_CRITICAL(Service_Audio, "Attempted to access invalid voice info index {:04X} (max is {})", index, voices.size() > 0 ? voices.size() - 1 : 0);
return voices[0];
LOG_ERROR(Service_Audio, "Invalid voice info index {:04X}", index);
}
return voices[index];
}
VoiceState& VoiceContext::GetState(const u32 index) {
if (index >= cpu_states.size()) {
LOG_CRITICAL(Service_Audio, "Attempted to access invalid voice cpu state index {:04X} (max is {})", index, cpu_states.size() > 0 ? cpu_states.size() - 1 : 0);
return cpu_states[0];
LOG_ERROR(Service_Audio, "Invalid voice cpu state index {:04X}", index);
}
return cpu_states[index];
}

View File

@@ -1,8 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include <algorithm>
#include "audio_core/renderer/memory/pool_mapper.h"
#include "audio_core/renderer/voice/voice_context.h"
#include "audio_core/renderer/voice/voice_info.h"
@@ -390,7 +388,7 @@ bool VoiceInfo::UpdateForCommandGeneration(VoiceContext& voice_context) {
is_new = false;
}
for (s8 channel = 0; channel < std::min(channel_count, static_cast<s8>(MaxChannels)); channel++) {
for (s8 channel = 0; channel < channel_count; channel++) {
voice_states[channel] = &voice_context.GetDspSharedState(channel_resource_ids[channel]);
}

View File

@@ -135,14 +135,6 @@ public:
static_assert(sizeof(BiquadFilterParameter) == 0xC,
"VoiceInfo::BiquadFilterParameter has the wrong size!");
struct BiquadFilterParameterFloat {
/* 0x00 */ bool enabled;
/* 0x04 */ std::array<f32, 3> b;
/* 0x10 */ std::array<f32, 2> a;
};
static_assert(sizeof(BiquadFilterParameterFloat) == 0x18,
"VoiceInfo::BiquadFilterParameterFloat has the wrong size!");
struct InParameter {
/* 0x000 */ u32 id;
/* 0x004 */ u32 node_id;
@@ -176,39 +168,6 @@ public:
};
static_assert(sizeof(InParameter) == 0x170, "VoiceInfo::InParameter has the wrong size!");
struct InParameterFloat {
/* 0x000 */ u32 id;
/* 0x004 */ u32 node_id;
/* 0x008 */ bool is_new;
/* 0x009 */ bool in_use;
/* 0x00A */ PlayState play_state;
/* 0x00B */ SampleFormat sample_format;
/* 0x00C */ u32 sample_rate;
/* 0x010 */ s32 priority;
/* 0x014 */ s32 sort_order;
/* 0x018 */ u32 channel_count;
/* 0x01C */ f32 pitch;
/* 0x020 */ f32 volume;
/* 0x024 */ std::array<BiquadFilterParameterFloat, MaxBiquadFilters> biquads;
/* 0x0C4 */ u32 wave_buffer_count;
/* 0x0C8 */ u16 wave_buffer_index;
/* 0x0CA */ char unk0CA[0x6];
/* 0x0D0 */ CpuAddr src_data_address;
/* 0x0D8 */ u64 src_data_size;
/* 0x0E0 */ u32 mix_id;
/* 0x0E4 */ u32 splitter_id;
/* 0x0E8 */ std::array<WaveBufferInternal, MaxWaveBuffers> wave_buffer_internal;
/* 0x1C8 */ std::array<u32, MaxChannels> channel_resource_ids;
/* 0x1E0 */ bool clear_voice_drop;
/* 0x1E1 */ u8 flush_buffer_count;
/* 0x1E2 */ char unk1E2[0x2];
/* 0x1E4 */ Flags flags;
/* 0x1E5 */ char unk1E5[0x1];
/* 0x1E6 */ SrcQuality src_quality;
/* 0x1E7 */ char unk1E7[0x11];
};
// static_assert(sizeof(InParameterFloat) == 0x1F8, "VoiceInfo::InParameterFloat has the wrong size!");
struct OutStatus {
/* 0x00 */ u64 played_sample_count;
/* 0x08 */ u32 wave_buffers_consumed;

View File

@@ -66,6 +66,5 @@ struct VoiceState {
/// Number of times the wavebuffer has looped
s32 loop_count;
};
// static_assert(sizeof(VoiceState) == 0x220, "VoiceState has the wrong size!");
} // namespace AudioCore::Renderer