|
|
|
@ -364,32 +364,37 @@ void CommandGenerator::GenerateAuxCommand(const s16 buffer_offset, EffectInfoBas |
|
|
|
void CommandGenerator::GenerateBiquadFilterEffectCommand(const s16 buffer_offset, |
|
|
|
EffectInfoBase& effect_info, |
|
|
|
const s32 node_id) { |
|
|
|
EffectInfoBase::ParameterState param_state{}; |
|
|
|
s8 channel_count = 0; |
|
|
|
|
|
|
|
if (render_context.behavior->IsEffectInfoVersion2Supported()) { |
|
|
|
const auto& parameter_v2{ |
|
|
|
*reinterpret_cast<BiquadFilterInfo::ParameterVersion2*>(effect_info.GetParameter())}; |
|
|
|
const bool needs_init = false; |
|
|
|
const bool use_float_processing = render_context.behavior->UseBiquadFilterFloatProcessing(); |
|
|
|
const s8 channels = parameter_v2.channel_count > 0 ? parameter_v2.channel_count : 2; |
|
|
|
if (effect_info.IsEnabled()) { |
|
|
|
for (s8 channel = 0; channel < channels; channel++) { |
|
|
|
command_buffer.GenerateBiquadFilterCommand( |
|
|
|
node_id, effect_info, buffer_offset, channel, needs_init, use_float_processing); |
|
|
|
const auto* parameter = |
|
|
|
reinterpret_cast<const BiquadFilterInfo::ParameterVersion2*>(effect_info.GetParameter()); |
|
|
|
if (!parameter) { |
|
|
|
LOG_ERROR(Service_Audio, "Biquad filter parameter is null"); |
|
|
|
return; |
|
|
|
} |
|
|
|
param_state = parameter->state; |
|
|
|
channel_count = parameter->channel_count; |
|
|
|
} else { |
|
|
|
for (s8 channel = 0; channel < channels; channel++) { |
|
|
|
command_buffer.GenerateCopyMixBufferCommand(node_id, effect_info, buffer_offset, |
|
|
|
channel); |
|
|
|
const auto* parameter = |
|
|
|
reinterpret_cast<const BiquadFilterInfo::ParameterVersion1*>(effect_info.GetParameter()); |
|
|
|
if (!parameter) { |
|
|
|
LOG_ERROR(Service_Audio, "Biquad filter parameter is null"); |
|
|
|
return; |
|
|
|
} |
|
|
|
param_state = parameter->state; |
|
|
|
channel_count = parameter->channel_count; |
|
|
|
} |
|
|
|
|
|
|
|
if (channel_count <= 0) { |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
const auto& parameter{ |
|
|
|
*reinterpret_cast<BiquadFilterInfo::ParameterVersion1*>(effect_info.GetParameter())}; |
|
|
|
if (effect_info.IsEnabled()) { |
|
|
|
bool needs_init{false}; |
|
|
|
|
|
|
|
switch (parameter.state) { |
|
|
|
switch (param_state) { |
|
|
|
case EffectInfoBase::ParameterState::Initialized: |
|
|
|
needs_init = true; |
|
|
|
break; |
|
|
|
@ -398,22 +403,26 @@ void CommandGenerator::GenerateBiquadFilterEffectCommand(const s16 buffer_offset |
|
|
|
if (render_context.behavior->IsBiquadFilterEffectStateClearBugFixed()) { |
|
|
|
needs_init = false; |
|
|
|
} else { |
|
|
|
needs_init = parameter.state == EffectInfoBase::ParameterState::Updating; |
|
|
|
needs_init = param_state == EffectInfoBase::ParameterState::Updating; |
|
|
|
} |
|
|
|
break; |
|
|
|
default: |
|
|
|
LOG_ERROR(Service_Audio, "Invalid biquad parameter state {}", |
|
|
|
static_cast<u32>(parameter.state)); |
|
|
|
LOG_ERROR(Service_Audio, |
|
|
|
"Invalid biquad parameter state {}, treating as uninitialized", |
|
|
|
static_cast<u32>(param_state)); |
|
|
|
needs_init = true; |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
for (s8 channel = 0; channel < parameter.channel_count; channel++) { |
|
|
|
command_buffer.GenerateBiquadFilterCommand( |
|
|
|
node_id, effect_info, buffer_offset, channel, needs_init, |
|
|
|
render_context.behavior->UseBiquadFilterFloatProcessing()); |
|
|
|
const bool use_float_processing = |
|
|
|
render_context.behavior->UseBiquadFilterFloatProcessing(); |
|
|
|
|
|
|
|
for (s8 channel = 0; channel < channel_count; channel++) { |
|
|
|
command_buffer.GenerateBiquadFilterCommand(node_id, effect_info, buffer_offset, channel, |
|
|
|
needs_init, use_float_processing); |
|
|
|
} |
|
|
|
} else { |
|
|
|
for (s8 channel = 0; channel < parameter.channel_count; channel++) { |
|
|
|
for (s8 channel = 0; channel < channel_count; channel++) { |
|
|
|
command_buffer.GenerateCopyMixBufferCommand(node_id, effect_info, buffer_offset, |
|
|
|
channel); |
|
|
|
} |
|
|
|
|