|
|
|
@ -12,7 +12,7 @@ bool ValidChannelCountForEffect(s32 channel_count) {
|
|
|
|
|
}
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
|
|
EffectContext::EffectContext(std::size_t effect_count) : effect_count(effect_count) {
|
|
|
|
|
EffectContext::EffectContext(std::size_t effect_count_) : effect_count(effect_count_) {
|
|
|
|
|
effects.reserve(effect_count);
|
|
|
|
|
std::generate_n(std::back_inserter(effects), effect_count,
|
|
|
|
|
[] { return std::make_unique<EffectStubbed>(); });
|
|
|
|
@ -61,13 +61,13 @@ const EffectBase* EffectContext::GetInfo(std::size_t i) const {
|
|
|
|
|
return effects.at(i).get();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
EffectStubbed::EffectStubbed() : EffectBase::EffectBase(EffectType::Invalid) {}
|
|
|
|
|
EffectStubbed::EffectStubbed() : EffectBase(EffectType::Invalid) {}
|
|
|
|
|
EffectStubbed::~EffectStubbed() = default;
|
|
|
|
|
|
|
|
|
|
void EffectStubbed::Update(EffectInfo::InParams& in_params) {}
|
|
|
|
|
void EffectStubbed::Update([[maybe_unused]] EffectInfo::InParams& in_params) {}
|
|
|
|
|
void EffectStubbed::UpdateForCommandGeneration() {}
|
|
|
|
|
|
|
|
|
|
EffectBase::EffectBase(EffectType effect_type) : effect_type(effect_type) {}
|
|
|
|
|
EffectBase::EffectBase(EffectType effect_type_) : effect_type(effect_type_) {}
|
|
|
|
|
EffectBase::~EffectBase() = default;
|
|
|
|
|
|
|
|
|
|
UsageState EffectBase::GetUsage() const {
|
|
|
|
@ -90,32 +90,32 @@ s32 EffectBase::GetProcessingOrder() const {
|
|
|
|
|
return processing_order;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
EffectI3dl2Reverb::EffectI3dl2Reverb() : EffectGeneric::EffectGeneric(EffectType::I3dl2Reverb) {}
|
|
|
|
|
EffectI3dl2Reverb::EffectI3dl2Reverb() : EffectGeneric(EffectType::I3dl2Reverb) {}
|
|
|
|
|
EffectI3dl2Reverb::~EffectI3dl2Reverb() = default;
|
|
|
|
|
|
|
|
|
|
void EffectI3dl2Reverb::Update(EffectInfo::InParams& in_params) {
|
|
|
|
|
auto& internal_params = GetParams();
|
|
|
|
|
auto& params = GetParams();
|
|
|
|
|
const auto* reverb_params = reinterpret_cast<I3dl2ReverbParams*>(in_params.raw.data());
|
|
|
|
|
if (!ValidChannelCountForEffect(reverb_params->max_channels)) {
|
|
|
|
|
UNREACHABLE_MSG("Invalid reverb max channel count {}", reverb_params->max_channels);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const auto last_status = internal_params.status;
|
|
|
|
|
const auto last_status = params.status;
|
|
|
|
|
mix_id = in_params.mix_id;
|
|
|
|
|
processing_order = in_params.processing_order;
|
|
|
|
|
internal_params = *reverb_params;
|
|
|
|
|
params = *reverb_params;
|
|
|
|
|
if (!ValidChannelCountForEffect(reverb_params->channel_count)) {
|
|
|
|
|
internal_params.channel_count = internal_params.max_channels;
|
|
|
|
|
params.channel_count = params.max_channels;
|
|
|
|
|
}
|
|
|
|
|
enabled = in_params.is_enabled;
|
|
|
|
|
if (last_status != ParameterStatus::Updated) {
|
|
|
|
|
internal_params.status = last_status;
|
|
|
|
|
params.status = last_status;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (in_params.is_new || skipped) {
|
|
|
|
|
usage = UsageState::Initialized;
|
|
|
|
|
internal_params.status = ParameterStatus::Initialized;
|
|
|
|
|
params.status = ParameterStatus::Initialized;
|
|
|
|
|
skipped = in_params.buffer_address == 0 || in_params.buffer_size == 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -129,15 +129,15 @@ void EffectI3dl2Reverb::UpdateForCommandGeneration() {
|
|
|
|
|
GetParams().status = ParameterStatus::Updated;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
EffectBiquadFilter::EffectBiquadFilter() : EffectGeneric::EffectGeneric(EffectType::BiquadFilter) {}
|
|
|
|
|
EffectBiquadFilter::EffectBiquadFilter() : EffectGeneric(EffectType::BiquadFilter) {}
|
|
|
|
|
EffectBiquadFilter::~EffectBiquadFilter() = default;
|
|
|
|
|
|
|
|
|
|
void EffectBiquadFilter::Update(EffectInfo::InParams& in_params) {
|
|
|
|
|
auto& internal_params = GetParams();
|
|
|
|
|
auto& params = GetParams();
|
|
|
|
|
const auto* biquad_params = reinterpret_cast<BiquadFilterParams*>(in_params.raw.data());
|
|
|
|
|
mix_id = in_params.mix_id;
|
|
|
|
|
processing_order = in_params.processing_order;
|
|
|
|
|
internal_params = *biquad_params;
|
|
|
|
|
params = *biquad_params;
|
|
|
|
|
enabled = in_params.is_enabled;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -150,7 +150,7 @@ void EffectBiquadFilter::UpdateForCommandGeneration() {
|
|
|
|
|
GetParams().status = ParameterStatus::Updated;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
EffectAuxInfo::EffectAuxInfo() : EffectGeneric::EffectGeneric(EffectType::Aux) {}
|
|
|
|
|
EffectAuxInfo::EffectAuxInfo() : EffectGeneric(EffectType::Aux) {}
|
|
|
|
|
EffectAuxInfo::~EffectAuxInfo() = default;
|
|
|
|
|
|
|
|
|
|
void EffectAuxInfo::Update(EffectInfo::InParams& in_params) {
|
|
|
|
@ -200,32 +200,32 @@ VAddr EffectAuxInfo::GetRecvBuffer() const {
|
|
|
|
|
return recv_buffer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
EffectDelay::EffectDelay() : EffectGeneric::EffectGeneric(EffectType::Delay) {}
|
|
|
|
|
EffectDelay::EffectDelay() : EffectGeneric(EffectType::Delay) {}
|
|
|
|
|
EffectDelay::~EffectDelay() = default;
|
|
|
|
|
|
|
|
|
|
void EffectDelay::Update(EffectInfo::InParams& in_params) {
|
|
|
|
|
const auto* delay_params = reinterpret_cast<DelayParams*>(in_params.raw.data());
|
|
|
|
|
auto& internal_params = GetParams();
|
|
|
|
|
auto& params = GetParams();
|
|
|
|
|
if (!ValidChannelCountForEffect(delay_params->max_channels)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const auto last_status = internal_params.status;
|
|
|
|
|
const auto last_status = params.status;
|
|
|
|
|
mix_id = in_params.mix_id;
|
|
|
|
|
processing_order = in_params.processing_order;
|
|
|
|
|
internal_params = *delay_params;
|
|
|
|
|
params = *delay_params;
|
|
|
|
|
if (!ValidChannelCountForEffect(delay_params->channels)) {
|
|
|
|
|
internal_params.channels = internal_params.max_channels;
|
|
|
|
|
params.channels = params.max_channels;
|
|
|
|
|
}
|
|
|
|
|
enabled = in_params.is_enabled;
|
|
|
|
|
|
|
|
|
|
if (last_status != ParameterStatus::Updated) {
|
|
|
|
|
internal_params.status = last_status;
|
|
|
|
|
params.status = last_status;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (in_params.is_new || skipped) {
|
|
|
|
|
usage = UsageState::Initialized;
|
|
|
|
|
internal_params.status = ParameterStatus::Initialized;
|
|
|
|
|
params.status = ParameterStatus::Initialized;
|
|
|
|
|
skipped = in_params.buffer_address == 0 || in_params.buffer_size == 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -239,7 +239,7 @@ void EffectDelay::UpdateForCommandGeneration() {
|
|
|
|
|
GetParams().status = ParameterStatus::Updated;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
EffectBufferMixer::EffectBufferMixer() : EffectGeneric::EffectGeneric(EffectType::BufferMixer) {}
|
|
|
|
|
EffectBufferMixer::EffectBufferMixer() : EffectGeneric(EffectType::BufferMixer) {}
|
|
|
|
|
EffectBufferMixer::~EffectBufferMixer() = default;
|
|
|
|
|
|
|
|
|
|
void EffectBufferMixer::Update(EffectInfo::InParams& in_params) {
|
|
|
|
@ -257,32 +257,32 @@ void EffectBufferMixer::UpdateForCommandGeneration() {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
EffectReverb::EffectReverb() : EffectGeneric::EffectGeneric(EffectType::Reverb) {}
|
|
|
|
|
EffectReverb::EffectReverb() : EffectGeneric(EffectType::Reverb) {}
|
|
|
|
|
EffectReverb::~EffectReverb() = default;
|
|
|
|
|
|
|
|
|
|
void EffectReverb::Update(EffectInfo::InParams& in_params) {
|
|
|
|
|
const auto* reverb_params = reinterpret_cast<ReverbParams*>(in_params.raw.data());
|
|
|
|
|
auto& internal_params = GetParams();
|
|
|
|
|
auto& params = GetParams();
|
|
|
|
|
if (!ValidChannelCountForEffect(reverb_params->max_channels)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const auto last_status = internal_params.status;
|
|
|
|
|
const auto last_status = params.status;
|
|
|
|
|
mix_id = in_params.mix_id;
|
|
|
|
|
processing_order = in_params.processing_order;
|
|
|
|
|
internal_params = *reverb_params;
|
|
|
|
|
params = *reverb_params;
|
|
|
|
|
if (!ValidChannelCountForEffect(reverb_params->channels)) {
|
|
|
|
|
internal_params.channels = internal_params.max_channels;
|
|
|
|
|
params.channels = params.max_channels;
|
|
|
|
|
}
|
|
|
|
|
enabled = in_params.is_enabled;
|
|
|
|
|
|
|
|
|
|
if (last_status != ParameterStatus::Updated) {
|
|
|
|
|
internal_params.status = last_status;
|
|
|
|
|
params.status = last_status;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (in_params.is_new || skipped) {
|
|
|
|
|
usage = UsageState::Initialized;
|
|
|
|
|
internal_params.status = ParameterStatus::Initialized;
|
|
|
|
|
params.status = ParameterStatus::Initialized;
|
|
|
|
|
skipped = in_params.buffer_address == 0 || in_params.buffer_size == 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|