feat(audio): Add REV13 audio renderer support

- Implement compressor statistics collection and tracking
- Add explicit splitter volume reset functionality
- Implement REV13 audio device notification commands
- Update feature support system to revision 13
- Maintain backward compatibility with older revisions

Resolves REV13 audio renderer feature requirements with proper
Nintendo Switch development practices and SwitchBrew compatibility.

REF: a2c0035013
Signed-off-by: Zephyron <zephyron@citron-emu.org>
This commit is contained in:
Zephyron
2025-09-27 10:13:32 +10:00
parent 0001539f4a
commit 2fa3501ff4
13 changed files with 263 additions and 8 deletions

View File

@@ -31,6 +31,18 @@ void CompressorInfo::UpdateForCommandGeneration() {
auto params{reinterpret_cast<ParameterVersion1*>(parameter.data())};
params->state = ParameterState::Updated;
params->statistics_reset_required = false;
}
void CompressorInfo::InitializeResultState(EffectResultState& result_state) {
auto statistics{reinterpret_cast<StatisticsInternal*>(result_state.state.data())};
statistics->maximum_mean = 0.0f;
statistics->minimum_gain = 1.0f;
statistics->last_samples.fill(0.0f);
}
void CompressorInfo::UpdateResultState(EffectResultState& cpu_state, EffectResultState& dsp_state) {
cpu_state = dsp_state;
}
CpuAddr CompressorInfo::GetWorkbuffer(s32 index) {

View File

@@ -30,6 +30,8 @@ public:
/* 0x30 */ f32 out_gain;
/* 0x34 */ ParameterState state;
/* 0x35 */ bool makeup_gain_enabled;
/* 0x36 */ bool statistics_enabled;
/* 0x37 */ bool statistics_reset_required;
};
static_assert(sizeof(ParameterVersion1) <= sizeof(EffectInfoBase::InParameterVersion1),
"CompressorInfo::ParameterVersion1 has the wrong size!");
@@ -50,6 +52,8 @@ public:
/* 0x30 */ f32 out_gain;
/* 0x34 */ ParameterState state;
/* 0x35 */ bool makeup_gain_enabled;
/* 0x36 */ bool statistics_enabled;
/* 0x37 */ bool statistics_reset_required;
};
static_assert(sizeof(ParameterVersion2) <= sizeof(EffectInfoBase::InParameterVersion2),
"CompressorInfo::ParameterVersion2 has the wrong size!");
@@ -69,6 +73,14 @@ public:
static_assert(sizeof(State) <= sizeof(EffectInfoBase::State),
"CompressorInfo::State has the wrong size!");
struct StatisticsInternal {
/* 0x00 */ f32 maximum_mean;
/* 0x04 */ f32 minimum_gain;
/* 0x08 */ std::array<f32, MaxChannels> last_samples;
};
static_assert(sizeof(StatisticsInternal) == 0x20,
"CompressorInfo::StatisticsInternal has the wrong size!");
/**
* Update the info with new parameters, version 1.
*
@@ -94,6 +106,21 @@ public:
*/
void UpdateForCommandGeneration() override;
/**
* Initialize a new compressor statistics result state. Version 2 only.
*
* @param result_state - Result state to initialize.
*/
void InitializeResultState(EffectResultState& result_state) override;
/**
* Update the host-side compressor statistics with the ADSP-side one. Version 2 only.
*
* @param cpu_state - Host-side result state to update.
* @param dsp_state - AudioRenderer-side result state to update from.
*/
void UpdateResultState(EffectResultState& cpu_state, EffectResultState& dsp_state) override;
/**
* Get a workbuffer assigned to this effect with the given index.
*