remove obsolete files
This commit is contained in:
@@ -1,93 +0,0 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "audio_core/renderer/effect/effect_aux_info.h"
|
||||
|
||||
namespace AudioCore::AudioRenderer {
|
||||
|
||||
void AuxInfo::Update(BehaviorInfo::ErrorInfo& error_info, const InParameterVersion1& in_params,
|
||||
const PoolMapper& pool_mapper) {
|
||||
auto in_specific{reinterpret_cast<const ParameterVersion1*>(in_params.specific.data())};
|
||||
auto params{reinterpret_cast<ParameterVersion1*>(parameter.data())};
|
||||
|
||||
std::memcpy(params, in_specific, sizeof(ParameterVersion1));
|
||||
mix_id = in_params.mix_id;
|
||||
process_order = in_params.process_order;
|
||||
enabled = in_params.enabled;
|
||||
if (buffer_unmapped || in_params.is_new) {
|
||||
const bool send_unmapped{!pool_mapper.TryAttachBuffer(
|
||||
error_info, workbuffers[0], in_specific->send_buffer_info_address,
|
||||
sizeof(AuxBufferInfo) + in_specific->count_max * sizeof(s32))};
|
||||
const bool return_unmapped{!pool_mapper.TryAttachBuffer(
|
||||
error_info, workbuffers[1], in_specific->return_buffer_info_address,
|
||||
sizeof(AuxBufferInfo) + in_specific->count_max * sizeof(s32))};
|
||||
|
||||
buffer_unmapped = send_unmapped || return_unmapped;
|
||||
|
||||
if (!buffer_unmapped) {
|
||||
auto send{workbuffers[0].GetReference(false)};
|
||||
send_buffer_info = send + sizeof(AuxInfoDsp);
|
||||
send_buffer = send + sizeof(AuxBufferInfo);
|
||||
|
||||
auto ret{workbuffers[1].GetReference(false)};
|
||||
return_buffer_info = ret + sizeof(AuxInfoDsp);
|
||||
return_buffer = ret + sizeof(AuxBufferInfo);
|
||||
}
|
||||
} else {
|
||||
error_info.error_code = ResultSuccess;
|
||||
error_info.address = CpuAddr(0);
|
||||
}
|
||||
}
|
||||
|
||||
void AuxInfo::Update(BehaviorInfo::ErrorInfo& error_info, const InParameterVersion2& in_params,
|
||||
const PoolMapper& pool_mapper) {
|
||||
auto in_specific{reinterpret_cast<const ParameterVersion2*>(in_params.specific.data())};
|
||||
auto params{reinterpret_cast<ParameterVersion2*>(parameter.data())};
|
||||
|
||||
std::memcpy(params, in_specific, sizeof(ParameterVersion2));
|
||||
mix_id = in_params.mix_id;
|
||||
process_order = in_params.process_order;
|
||||
enabled = in_params.enabled;
|
||||
|
||||
if (buffer_unmapped || in_params.is_new) {
|
||||
const bool send_unmapped{!pool_mapper.TryAttachBuffer(
|
||||
error_info, workbuffers[0], params->send_buffer_info_address,
|
||||
sizeof(AuxBufferInfo) + params->count_max * sizeof(s32))};
|
||||
const bool return_unmapped{!pool_mapper.TryAttachBuffer(
|
||||
error_info, workbuffers[1], params->return_buffer_info_address,
|
||||
sizeof(AuxBufferInfo) + params->count_max * sizeof(s32))};
|
||||
|
||||
buffer_unmapped = send_unmapped || return_unmapped;
|
||||
|
||||
if (!buffer_unmapped) {
|
||||
auto send{workbuffers[0].GetReference(false)};
|
||||
send_buffer_info = send + sizeof(AuxInfoDsp);
|
||||
send_buffer = send + sizeof(AuxBufferInfo);
|
||||
|
||||
auto ret{workbuffers[1].GetReference(false)};
|
||||
return_buffer_info = ret + sizeof(AuxInfoDsp);
|
||||
return_buffer = ret + sizeof(AuxBufferInfo);
|
||||
}
|
||||
} else {
|
||||
error_info.error_code = ResultSuccess;
|
||||
error_info.address = CpuAddr(0);
|
||||
}
|
||||
}
|
||||
|
||||
void AuxInfo::UpdateForCommandGeneration() {
|
||||
if (enabled) {
|
||||
usage_state = UsageState::Enabled;
|
||||
} else {
|
||||
usage_state = UsageState::Disabled;
|
||||
}
|
||||
}
|
||||
|
||||
void AuxInfo::InitializeResultState(EffectResultState& result_state) {}
|
||||
|
||||
void AuxInfo::UpdateResultState(EffectResultState& cpu_state, EffectResultState& dsp_state) {}
|
||||
|
||||
CpuAddr AuxInfo::GetWorkbuffer(s32 index) {
|
||||
return workbuffers[index].GetReference(true);
|
||||
}
|
||||
|
||||
} // namespace AudioCore::AudioRenderer
|
@@ -1,123 +0,0 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
|
||||
#include "audio_core/common/common.h"
|
||||
#include "audio_core/renderer/effect/effect_info_base.h"
|
||||
#include "common/common_types.h"
|
||||
|
||||
namespace AudioCore::AudioRenderer {
|
||||
/**
|
||||
* Auxiliary Buffer used for Aux commands.
|
||||
* Send and return buffers are available (names from the game's perspective).
|
||||
* Send is read by the host, containing a buffer of samples to be used for whatever purpose.
|
||||
* Return is written by the host, writing a mix buffer back to the game.
|
||||
* This allows the game to use pre-processed samples skipping the other render processing,
|
||||
* and to examine or modify what the audio renderer has generated.
|
||||
*/
|
||||
class AuxInfo : public EffectInfoBase {
|
||||
public:
|
||||
struct ParameterVersion1 {
|
||||
/* 0x00 */ std::array<s8, MaxMixBuffers> inputs;
|
||||
/* 0x18 */ std::array<s8, MaxMixBuffers> outputs;
|
||||
/* 0x30 */ u32 mix_buffer_count;
|
||||
/* 0x34 */ u32 sample_rate;
|
||||
/* 0x38 */ u32 count_max;
|
||||
/* 0x3C */ u32 mix_buffer_count_max;
|
||||
/* 0x40 */ CpuAddr send_buffer_info_address;
|
||||
/* 0x48 */ CpuAddr send_buffer_address;
|
||||
/* 0x50 */ CpuAddr return_buffer_info_address;
|
||||
/* 0x58 */ CpuAddr return_buffer_address;
|
||||
/* 0x60 */ u32 mix_buffer_sample_size;
|
||||
/* 0x64 */ u32 sample_count;
|
||||
/* 0x68 */ u32 mix_buffer_sample_count;
|
||||
};
|
||||
static_assert(sizeof(ParameterVersion1) <= sizeof(EffectInfoBase::InParameterVersion1),
|
||||
"AuxInfo::ParameterVersion1 has the wrong size!");
|
||||
|
||||
struct ParameterVersion2 {
|
||||
/* 0x00 */ std::array<s8, MaxMixBuffers> inputs;
|
||||
/* 0x18 */ std::array<s8, MaxMixBuffers> outputs;
|
||||
/* 0x30 */ u32 mix_buffer_count;
|
||||
/* 0x34 */ u32 sample_rate;
|
||||
/* 0x38 */ u32 count_max;
|
||||
/* 0x3C */ u32 mix_buffer_count_max;
|
||||
/* 0x40 */ CpuAddr send_buffer_info_address;
|
||||
/* 0x48 */ CpuAddr send_buffer_address;
|
||||
/* 0x50 */ CpuAddr return_buffer_info_address;
|
||||
/* 0x58 */ CpuAddr return_buffer_address;
|
||||
/* 0x60 */ u32 mix_buffer_sample_size;
|
||||
/* 0x64 */ u32 sample_count;
|
||||
/* 0x68 */ u32 mix_buffer_sample_count;
|
||||
};
|
||||
static_assert(sizeof(ParameterVersion2) <= sizeof(EffectInfoBase::InParameterVersion2),
|
||||
"AuxInfo::ParameterVersion2 has the wrong size!");
|
||||
|
||||
struct AuxInfoDsp {
|
||||
/* 0x00 */ u32 read_offset;
|
||||
/* 0x04 */ u32 write_offset;
|
||||
/* 0x08 */ u32 lost_sample_count;
|
||||
/* 0x0C */ u32 total_sample_count;
|
||||
/* 0x10 */ char unk10[0x30];
|
||||
};
|
||||
static_assert(sizeof(AuxInfoDsp) == 0x40, "AuxInfo::AuxInfoDsp has the wrong size!");
|
||||
|
||||
struct AuxBufferInfo {
|
||||
/* 0x00 */ AuxInfoDsp cpu_info;
|
||||
/* 0x40 */ AuxInfoDsp dsp_info;
|
||||
};
|
||||
static_assert(sizeof(AuxBufferInfo) == 0x80, "AuxInfo::AuxBufferInfo has the wrong size!");
|
||||
|
||||
/**
|
||||
* Update the info with new parameters, version 1.
|
||||
*
|
||||
* @param error_info - Used to write call result code.
|
||||
* @param in_params - New parameters to update the info with.
|
||||
* @param pool_mapper - Pool for mapping buffers.
|
||||
*/
|
||||
void Update(BehaviorInfo::ErrorInfo& error_info, const InParameterVersion1& in_params,
|
||||
const PoolMapper& pool_mapper) override;
|
||||
|
||||
/**
|
||||
* Update the info with new parameters, version 2.
|
||||
*
|
||||
* @param error_info - Used to write call result code.
|
||||
* @param in_params - New parameters to update the info with.
|
||||
* @param pool_mapper - Pool for mapping buffers.
|
||||
*/
|
||||
void Update(BehaviorInfo::ErrorInfo& error_info, const InParameterVersion2& in_params,
|
||||
const PoolMapper& pool_mapper) override;
|
||||
|
||||
/**
|
||||
* Update the info after command generation. Usually only changes its state.
|
||||
*/
|
||||
void UpdateForCommandGeneration() override;
|
||||
|
||||
/**
|
||||
* Initialize a new result state. Version 2 only, unused.
|
||||
*
|
||||
* @param result_state - Result state to initialize.
|
||||
*/
|
||||
void InitializeResultState(EffectResultState& result_state) override;
|
||||
|
||||
/**
|
||||
* Update the host-side state with the ADSP-side state. Version 2 only, unused.
|
||||
*
|
||||
* @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.
|
||||
*
|
||||
* @param index - Workbuffer index.
|
||||
* @return Address of the buffer.
|
||||
*/
|
||||
CpuAddr GetWorkbuffer(s32 index) override;
|
||||
};
|
||||
|
||||
} // namespace AudioCore::AudioRenderer
|
@@ -1,52 +0,0 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "audio_core/renderer/effect/effect_biquad_filter_info.h"
|
||||
|
||||
namespace AudioCore::AudioRenderer {
|
||||
|
||||
void BiquadFilterInfo::Update(BehaviorInfo::ErrorInfo& error_info,
|
||||
const InParameterVersion1& in_params, const PoolMapper& pool_mapper) {
|
||||
auto in_specific{reinterpret_cast<const ParameterVersion1*>(in_params.specific.data())};
|
||||
auto params{reinterpret_cast<ParameterVersion1*>(parameter.data())};
|
||||
|
||||
std::memcpy(params, in_specific, sizeof(ParameterVersion1));
|
||||
mix_id = in_params.mix_id;
|
||||
process_order = in_params.process_order;
|
||||
enabled = in_params.enabled;
|
||||
|
||||
error_info.error_code = ResultSuccess;
|
||||
error_info.address = CpuAddr(0);
|
||||
}
|
||||
|
||||
void BiquadFilterInfo::Update(BehaviorInfo::ErrorInfo& error_info,
|
||||
const InParameterVersion2& in_params, const PoolMapper& pool_mapper) {
|
||||
auto in_specific{reinterpret_cast<const ParameterVersion2*>(in_params.specific.data())};
|
||||
auto params{reinterpret_cast<ParameterVersion2*>(parameter.data())};
|
||||
|
||||
std::memcpy(params, in_specific, sizeof(ParameterVersion2));
|
||||
mix_id = in_params.mix_id;
|
||||
process_order = in_params.process_order;
|
||||
enabled = in_params.enabled;
|
||||
|
||||
error_info.error_code = ResultSuccess;
|
||||
error_info.address = CpuAddr(0);
|
||||
}
|
||||
|
||||
void BiquadFilterInfo::UpdateForCommandGeneration() {
|
||||
if (enabled) {
|
||||
usage_state = UsageState::Enabled;
|
||||
} else {
|
||||
usage_state = UsageState::Disabled;
|
||||
}
|
||||
|
||||
auto params{reinterpret_cast<ParameterVersion1*>(parameter.data())};
|
||||
params->state = ParameterState::Updated;
|
||||
}
|
||||
|
||||
void BiquadFilterInfo::InitializeResultState(EffectResultState& result_state) {}
|
||||
|
||||
void BiquadFilterInfo::UpdateResultState(EffectResultState& cpu_state,
|
||||
EffectResultState& dsp_state) {}
|
||||
|
||||
} // namespace AudioCore::AudioRenderer
|
@@ -1,79 +0,0 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
|
||||
#include "audio_core/common/common.h"
|
||||
#include "audio_core/renderer/effect/effect_info_base.h"
|
||||
#include "common/common_types.h"
|
||||
|
||||
namespace AudioCore::AudioRenderer {
|
||||
|
||||
class BiquadFilterInfo : public EffectInfoBase {
|
||||
public:
|
||||
struct ParameterVersion1 {
|
||||
/* 0x00 */ std::array<s8, MaxChannels> inputs;
|
||||
/* 0x06 */ std::array<s8, MaxChannels> outputs;
|
||||
/* 0x0C */ std::array<s16, 3> b;
|
||||
/* 0x12 */ std::array<s16, 2> a;
|
||||
/* 0x16 */ s8 channel_count;
|
||||
/* 0x17 */ ParameterState state;
|
||||
};
|
||||
static_assert(sizeof(ParameterVersion1) <= sizeof(EffectInfoBase::InParameterVersion1),
|
||||
"BiquadFilterInfo::ParameterVersion1 has the wrong size!");
|
||||
|
||||
struct ParameterVersion2 {
|
||||
/* 0x00 */ std::array<s8, MaxChannels> inputs;
|
||||
/* 0x06 */ std::array<s8, MaxChannels> outputs;
|
||||
/* 0x0C */ std::array<s16, 3> b;
|
||||
/* 0x12 */ std::array<s16, 2> a;
|
||||
/* 0x16 */ s8 channel_count;
|
||||
/* 0x17 */ ParameterState state;
|
||||
};
|
||||
static_assert(sizeof(ParameterVersion2) <= sizeof(EffectInfoBase::InParameterVersion2),
|
||||
"BiquadFilterInfo::ParameterVersion2 has the wrong size!");
|
||||
|
||||
/**
|
||||
* Update the info with new parameters, version 1.
|
||||
*
|
||||
* @param error_info - Used to write call result code.
|
||||
* @param in_params - New parameters to update the info with.
|
||||
* @param pool_mapper - Pool for mapping buffers.
|
||||
*/
|
||||
void Update(BehaviorInfo::ErrorInfo& error_info, const InParameterVersion1& in_params,
|
||||
const PoolMapper& pool_mapper) override;
|
||||
|
||||
/**
|
||||
* Update the info with new parameters, version 2.
|
||||
*
|
||||
* @param error_info - Used to write call result code.
|
||||
* @param in_params - New parameters to update the info with.
|
||||
* @param pool_mapper - Pool for mapping buffers.
|
||||
*/
|
||||
void Update(BehaviorInfo::ErrorInfo& error_info, const InParameterVersion2& in_params,
|
||||
const PoolMapper& pool_mapper) override;
|
||||
|
||||
/**
|
||||
* Update the info after command generation. Usually only changes its state.
|
||||
*/
|
||||
void UpdateForCommandGeneration() override;
|
||||
|
||||
/**
|
||||
* Initialize a new result state. Version 2 only, unused.
|
||||
*
|
||||
* @param result_state - Result state to initialize.
|
||||
*/
|
||||
void InitializeResultState(EffectResultState& result_state) override;
|
||||
|
||||
/**
|
||||
* Update the host-side state with the ADSP-side state. Version 2 only, unused.
|
||||
*
|
||||
* @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;
|
||||
};
|
||||
|
||||
} // namespace AudioCore::AudioRenderer
|
@@ -1,49 +0,0 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "audio_core/renderer/effect/effect_buffer_mixer_info.h"
|
||||
|
||||
namespace AudioCore::AudioRenderer {
|
||||
|
||||
void BufferMixerInfo::Update(BehaviorInfo::ErrorInfo& error_info,
|
||||
const InParameterVersion1& in_params, const PoolMapper& pool_mapper) {
|
||||
auto in_specific{reinterpret_cast<const ParameterVersion1*>(in_params.specific.data())};
|
||||
auto params{reinterpret_cast<ParameterVersion1*>(parameter.data())};
|
||||
|
||||
std::memcpy(params, in_specific, sizeof(ParameterVersion1));
|
||||
mix_id = in_params.mix_id;
|
||||
process_order = in_params.process_order;
|
||||
enabled = in_params.enabled;
|
||||
|
||||
error_info.error_code = ResultSuccess;
|
||||
error_info.address = CpuAddr(0);
|
||||
}
|
||||
|
||||
void BufferMixerInfo::Update(BehaviorInfo::ErrorInfo& error_info,
|
||||
const InParameterVersion2& in_params, const PoolMapper& pool_mapper) {
|
||||
auto in_specific{reinterpret_cast<const ParameterVersion2*>(in_params.specific.data())};
|
||||
auto params{reinterpret_cast<ParameterVersion2*>(parameter.data())};
|
||||
|
||||
std::memcpy(params, in_specific, sizeof(ParameterVersion2));
|
||||
mix_id = in_params.mix_id;
|
||||
process_order = in_params.process_order;
|
||||
enabled = in_params.enabled;
|
||||
|
||||
error_info.error_code = ResultSuccess;
|
||||
error_info.address = CpuAddr(0);
|
||||
}
|
||||
|
||||
void BufferMixerInfo::UpdateForCommandGeneration() {
|
||||
if (enabled) {
|
||||
usage_state = UsageState::Enabled;
|
||||
} else {
|
||||
usage_state = UsageState::Disabled;
|
||||
}
|
||||
}
|
||||
|
||||
void BufferMixerInfo::InitializeResultState(EffectResultState& result_state) {}
|
||||
|
||||
void BufferMixerInfo::UpdateResultState(EffectResultState& cpu_state,
|
||||
EffectResultState& dsp_state) {}
|
||||
|
||||
} // namespace AudioCore::AudioRenderer
|
@@ -1,75 +0,0 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
|
||||
#include "audio_core/common/common.h"
|
||||
#include "audio_core/renderer/effect/effect_info_base.h"
|
||||
#include "common/common_types.h"
|
||||
|
||||
namespace AudioCore::AudioRenderer {
|
||||
|
||||
class BufferMixerInfo : public EffectInfoBase {
|
||||
public:
|
||||
struct ParameterVersion1 {
|
||||
/* 0x00 */ std::array<s8, MaxMixBuffers> inputs;
|
||||
/* 0x18 */ std::array<s8, MaxMixBuffers> outputs;
|
||||
/* 0x30 */ std::array<f32, MaxMixBuffers> volumes;
|
||||
/* 0x90 */ u32 mix_count;
|
||||
};
|
||||
static_assert(sizeof(ParameterVersion1) <= sizeof(EffectInfoBase::InParameterVersion1),
|
||||
"BufferMixerInfo::ParameterVersion1 has the wrong size!");
|
||||
|
||||
struct ParameterVersion2 {
|
||||
/* 0x00 */ std::array<s8, MaxMixBuffers> inputs;
|
||||
/* 0x18 */ std::array<s8, MaxMixBuffers> outputs;
|
||||
/* 0x30 */ std::array<f32, MaxMixBuffers> volumes;
|
||||
/* 0x90 */ u32 mix_count;
|
||||
};
|
||||
static_assert(sizeof(ParameterVersion2) <= sizeof(EffectInfoBase::InParameterVersion2),
|
||||
"BufferMixerInfo::ParameterVersion2 has the wrong size!");
|
||||
|
||||
/**
|
||||
* Update the info with new parameters, version 1.
|
||||
*
|
||||
* @param error_info - Used to write call result code.
|
||||
* @param in_params - New parameters to update the info with.
|
||||
* @param pool_mapper - Pool for mapping buffers.
|
||||
*/
|
||||
void Update(BehaviorInfo::ErrorInfo& error_info, const InParameterVersion1& in_params,
|
||||
const PoolMapper& pool_mapper) override;
|
||||
|
||||
/**
|
||||
* Update the info with new parameters, version 2.
|
||||
*
|
||||
* @param error_info - Used to write call result code.
|
||||
* @param in_params - New parameters to update the info with.
|
||||
* @param pool_mapper - Pool for mapping buffers.
|
||||
*/
|
||||
void Update(BehaviorInfo::ErrorInfo& error_info, const InParameterVersion2& in_params,
|
||||
const PoolMapper& pool_mapper) override;
|
||||
|
||||
/**
|
||||
* Update the info after command generation. Usually only changes its state.
|
||||
*/
|
||||
void UpdateForCommandGeneration() override;
|
||||
|
||||
/**
|
||||
* Initialize a new result state. Version 2 only, unused.
|
||||
*
|
||||
* @param result_state - Result state to initialize.
|
||||
*/
|
||||
void InitializeResultState(EffectResultState& result_state) override;
|
||||
|
||||
/**
|
||||
* Update the host-side state with the ADSP-side state. Version 2 only, unused.
|
||||
*
|
||||
* @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;
|
||||
};
|
||||
|
||||
} // namespace AudioCore::AudioRenderer
|
@@ -1,82 +0,0 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "audio_core/renderer/effect/effect_aux_info.h"
|
||||
#include "audio_core/renderer/effect/effect_capture_info.h"
|
||||
|
||||
namespace AudioCore::AudioRenderer {
|
||||
|
||||
void CaptureInfo::Update(BehaviorInfo::ErrorInfo& error_info, const InParameterVersion1& in_params,
|
||||
const PoolMapper& pool_mapper) {
|
||||
auto in_specific{
|
||||
reinterpret_cast<const AuxInfo::ParameterVersion1*>(in_params.specific.data())};
|
||||
auto params{reinterpret_cast<AuxInfo::ParameterVersion1*>(parameter.data())};
|
||||
|
||||
std::memcpy(params, in_specific, sizeof(AuxInfo::ParameterVersion1));
|
||||
mix_id = in_params.mix_id;
|
||||
process_order = in_params.process_order;
|
||||
enabled = in_params.enabled;
|
||||
if (buffer_unmapped || in_params.is_new) {
|
||||
buffer_unmapped = !pool_mapper.TryAttachBuffer(
|
||||
error_info, workbuffers[0], in_specific->send_buffer_info_address,
|
||||
in_specific->count_max * sizeof(s32) + sizeof(AuxInfo::AuxBufferInfo));
|
||||
|
||||
if (!buffer_unmapped) {
|
||||
const auto send_address{workbuffers[0].GetReference(false)};
|
||||
send_buffer_info = send_address + sizeof(AuxInfo::AuxInfoDsp);
|
||||
send_buffer = send_address + sizeof(AuxInfo::AuxBufferInfo);
|
||||
return_buffer_info = 0;
|
||||
return_buffer = 0;
|
||||
}
|
||||
} else {
|
||||
error_info.error_code = ResultSuccess;
|
||||
error_info.address = CpuAddr(0);
|
||||
}
|
||||
}
|
||||
|
||||
void CaptureInfo::Update(BehaviorInfo::ErrorInfo& error_info, const InParameterVersion2& in_params,
|
||||
const PoolMapper& pool_mapper) {
|
||||
auto in_specific{
|
||||
reinterpret_cast<const AuxInfo::ParameterVersion2*>(in_params.specific.data())};
|
||||
auto params{reinterpret_cast<AuxInfo::ParameterVersion2*>(parameter.data())};
|
||||
|
||||
std::memcpy(params, in_specific, sizeof(AuxInfo::ParameterVersion2));
|
||||
mix_id = in_params.mix_id;
|
||||
process_order = in_params.process_order;
|
||||
enabled = in_params.enabled;
|
||||
|
||||
if (buffer_unmapped || in_params.is_new) {
|
||||
buffer_unmapped = !pool_mapper.TryAttachBuffer(
|
||||
error_info, workbuffers[0], params->send_buffer_info_address,
|
||||
params->count_max * sizeof(s32) + sizeof(AuxInfo::AuxBufferInfo));
|
||||
|
||||
if (!buffer_unmapped) {
|
||||
const auto send_address{workbuffers[0].GetReference(false)};
|
||||
send_buffer_info = send_address + sizeof(AuxInfo::AuxInfoDsp);
|
||||
send_buffer = send_address + sizeof(AuxInfo::AuxBufferInfo);
|
||||
return_buffer_info = 0;
|
||||
return_buffer = 0;
|
||||
}
|
||||
} else {
|
||||
error_info.error_code = ResultSuccess;
|
||||
error_info.address = CpuAddr(0);
|
||||
}
|
||||
}
|
||||
|
||||
void CaptureInfo::UpdateForCommandGeneration() {
|
||||
if (enabled) {
|
||||
usage_state = UsageState::Enabled;
|
||||
} else {
|
||||
usage_state = UsageState::Disabled;
|
||||
}
|
||||
}
|
||||
|
||||
void CaptureInfo::InitializeResultState(EffectResultState& result_state) {}
|
||||
|
||||
void CaptureInfo::UpdateResultState(EffectResultState& cpu_state, EffectResultState& dsp_state) {}
|
||||
|
||||
CpuAddr CaptureInfo::GetWorkbuffer(s32 index) {
|
||||
return workbuffers[index].GetReference(true);
|
||||
}
|
||||
|
||||
} // namespace AudioCore::AudioRenderer
|
@@ -1,65 +0,0 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
|
||||
#include "audio_core/common/common.h"
|
||||
#include "audio_core/renderer/effect/effect_info_base.h"
|
||||
#include "common/common_types.h"
|
||||
|
||||
namespace AudioCore::AudioRenderer {
|
||||
|
||||
class CaptureInfo : public EffectInfoBase {
|
||||
public:
|
||||
/**
|
||||
* Update the info with new parameters, version 1.
|
||||
*
|
||||
* @param error_info - Used to write call result code.
|
||||
* @param in_params - New parameters to update the info with.
|
||||
* @param pool_mapper - Pool for mapping buffers.
|
||||
*/
|
||||
void Update(BehaviorInfo::ErrorInfo& error_info, const InParameterVersion1& in_params,
|
||||
const PoolMapper& pool_mapper) override;
|
||||
|
||||
/**
|
||||
* Update the info with new parameters, version 2.
|
||||
*
|
||||
* @param error_info - Used to write call result code.
|
||||
* @param in_params - New parameters to update the info with.
|
||||
* @param pool_mapper - Pool for mapping buffers.
|
||||
*/
|
||||
void Update(BehaviorInfo::ErrorInfo& error_info, const InParameterVersion2& in_params,
|
||||
const PoolMapper& pool_mapper) override;
|
||||
|
||||
/**
|
||||
* Update the info after command generation. Usually only changes its state.
|
||||
*/
|
||||
void UpdateForCommandGeneration() override;
|
||||
|
||||
/**
|
||||
* Initialize a new result state. Version 2 only, unused.
|
||||
*
|
||||
* @param result_state - Result state to initialize.
|
||||
*/
|
||||
void InitializeResultState(EffectResultState& result_state) override;
|
||||
|
||||
/**
|
||||
* Update the host-side state with the ADSP-side state. Version 2 only, unused.
|
||||
*
|
||||
* @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.
|
||||
*
|
||||
* @param index - Workbuffer index.
|
||||
* @return Address of the buffer.
|
||||
*/
|
||||
CpuAddr GetWorkbuffer(s32 index) override;
|
||||
};
|
||||
|
||||
} // namespace AudioCore::AudioRenderer
|
@@ -1,93 +0,0 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "audio_core/renderer/effect/effect_delay_info.h"
|
||||
|
||||
namespace AudioCore::AudioRenderer {
|
||||
|
||||
void DelayInfo::Update(BehaviorInfo::ErrorInfo& error_info, const InParameterVersion1& in_params,
|
||||
const PoolMapper& pool_mapper) {
|
||||
auto in_specific{reinterpret_cast<const ParameterVersion1*>(in_params.specific.data())};
|
||||
auto params{reinterpret_cast<ParameterVersion1*>(parameter.data())};
|
||||
|
||||
if (IsChannelCountValid(in_specific->channel_count_max)) {
|
||||
const auto old_state{params->state};
|
||||
std::memcpy(params, in_specific, sizeof(ParameterVersion1));
|
||||
mix_id = in_params.mix_id;
|
||||
process_order = in_params.process_order;
|
||||
enabled = in_params.enabled;
|
||||
|
||||
if (!IsChannelCountValid(in_specific->channel_count)) {
|
||||
params->channel_count = params->channel_count_max;
|
||||
}
|
||||
|
||||
if (!IsChannelCountValid(in_specific->channel_count) ||
|
||||
old_state != ParameterState::Updated) {
|
||||
params->state = old_state;
|
||||
}
|
||||
|
||||
if (buffer_unmapped || in_params.is_new) {
|
||||
usage_state = UsageState::New;
|
||||
params->state = ParameterState::Initialized;
|
||||
buffer_unmapped = !pool_mapper.TryAttachBuffer(
|
||||
error_info, workbuffers[0], in_params.workbuffer, in_params.workbuffer_size);
|
||||
return;
|
||||
}
|
||||
}
|
||||
error_info.error_code = ResultSuccess;
|
||||
error_info.address = CpuAddr(0);
|
||||
}
|
||||
|
||||
void DelayInfo::Update(BehaviorInfo::ErrorInfo& error_info, const InParameterVersion2& in_params,
|
||||
const PoolMapper& pool_mapper) {
|
||||
auto in_specific{reinterpret_cast<const ParameterVersion1*>(in_params.specific.data())};
|
||||
auto params{reinterpret_cast<ParameterVersion1*>(parameter.data())};
|
||||
|
||||
if (IsChannelCountValid(in_specific->channel_count_max)) {
|
||||
const auto old_state{params->state};
|
||||
std::memcpy(params, in_specific, sizeof(ParameterVersion1));
|
||||
mix_id = in_params.mix_id;
|
||||
process_order = in_params.process_order;
|
||||
enabled = in_params.enabled;
|
||||
|
||||
if (!IsChannelCountValid(in_specific->channel_count)) {
|
||||
params->channel_count = params->channel_count_max;
|
||||
}
|
||||
|
||||
if (!IsChannelCountValid(in_specific->channel_count) ||
|
||||
old_state != ParameterState::Updated) {
|
||||
params->state = old_state;
|
||||
}
|
||||
|
||||
if (buffer_unmapped || in_params.is_new) {
|
||||
usage_state = UsageState::New;
|
||||
params->state = ParameterState::Initialized;
|
||||
buffer_unmapped = !pool_mapper.TryAttachBuffer(
|
||||
error_info, workbuffers[0], in_params.workbuffer, in_params.workbuffer_size);
|
||||
return;
|
||||
}
|
||||
}
|
||||
error_info.error_code = ResultSuccess;
|
||||
error_info.address = CpuAddr(0);
|
||||
}
|
||||
|
||||
void DelayInfo::UpdateForCommandGeneration() {
|
||||
if (enabled) {
|
||||
usage_state = UsageState::Enabled;
|
||||
} else {
|
||||
usage_state = UsageState::Disabled;
|
||||
}
|
||||
|
||||
auto params{reinterpret_cast<ParameterVersion1*>(parameter.data())};
|
||||
params->state = ParameterState::Updated;
|
||||
}
|
||||
|
||||
void DelayInfo::InitializeResultState(EffectResultState& result_state) {}
|
||||
|
||||
void DelayInfo::UpdateResultState(EffectResultState& cpu_state, EffectResultState& dsp_state) {}
|
||||
|
||||
CpuAddr DelayInfo::GetWorkbuffer(s32 index) {
|
||||
return GetSingleBuffer(index);
|
||||
}
|
||||
|
||||
} // namespace AudioCore::AudioRenderer
|
@@ -1,135 +0,0 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <vector>
|
||||
|
||||
#include "audio_core/common/common.h"
|
||||
#include "audio_core/renderer/effect/effect_info_base.h"
|
||||
#include "common/common_types.h"
|
||||
#include "common/fixed_point.h"
|
||||
|
||||
namespace AudioCore::AudioRenderer {
|
||||
|
||||
class DelayInfo : public EffectInfoBase {
|
||||
public:
|
||||
struct ParameterVersion1 {
|
||||
/* 0x00 */ std::array<s8, MaxChannels> inputs;
|
||||
/* 0x06 */ std::array<s8, MaxChannels> outputs;
|
||||
/* 0x0C */ u16 channel_count_max;
|
||||
/* 0x0E */ u16 channel_count;
|
||||
/* 0x10 */ u32 delay_time_max;
|
||||
/* 0x14 */ u32 delay_time;
|
||||
/* 0x18 */ Common::FixedPoint<18, 14> sample_rate;
|
||||
/* 0x1C */ Common::FixedPoint<18, 14> in_gain;
|
||||
/* 0x20 */ Common::FixedPoint<18, 14> feedback_gain;
|
||||
/* 0x24 */ Common::FixedPoint<18, 14> wet_gain;
|
||||
/* 0x28 */ Common::FixedPoint<18, 14> dry_gain;
|
||||
/* 0x2C */ Common::FixedPoint<18, 14> channel_spread;
|
||||
/* 0x30 */ Common::FixedPoint<18, 14> lowpass_amount;
|
||||
/* 0x34 */ ParameterState state;
|
||||
};
|
||||
static_assert(sizeof(ParameterVersion1) <= sizeof(EffectInfoBase::InParameterVersion1),
|
||||
"DelayInfo::ParameterVersion1 has the wrong size!");
|
||||
|
||||
struct ParameterVersion2 {
|
||||
/* 0x00 */ std::array<s8, MaxChannels> inputs;
|
||||
/* 0x06 */ std::array<s8, MaxChannels> outputs;
|
||||
/* 0x0C */ s16 channel_count_max;
|
||||
/* 0x0E */ s16 channel_count;
|
||||
/* 0x10 */ s32 delay_time_max;
|
||||
/* 0x14 */ s32 delay_time;
|
||||
/* 0x18 */ s32 sample_rate;
|
||||
/* 0x1C */ s32 in_gain;
|
||||
/* 0x20 */ s32 feedback_gain;
|
||||
/* 0x24 */ s32 wet_gain;
|
||||
/* 0x28 */ s32 dry_gain;
|
||||
/* 0x2C */ s32 channel_spread;
|
||||
/* 0x30 */ s32 lowpass_amount;
|
||||
/* 0x34 */ ParameterState state;
|
||||
};
|
||||
static_assert(sizeof(ParameterVersion2) <= sizeof(EffectInfoBase::InParameterVersion2),
|
||||
"DelayInfo::ParameterVersion2 has the wrong size!");
|
||||
|
||||
struct DelayLine {
|
||||
Common::FixedPoint<50, 14> Read() const {
|
||||
return buffer[buffer_pos];
|
||||
}
|
||||
|
||||
void Write(const Common::FixedPoint<50, 14> value) {
|
||||
buffer[buffer_pos] = value;
|
||||
buffer_pos = static_cast<u32>((buffer_pos + 1) % buffer.size());
|
||||
}
|
||||
|
||||
s32 sample_count_max{};
|
||||
s32 sample_count{};
|
||||
std::vector<Common::FixedPoint<50, 14>> buffer{};
|
||||
u32 buffer_pos{};
|
||||
Common::FixedPoint<18, 14> decay_rate{};
|
||||
};
|
||||
|
||||
struct State {
|
||||
/* 0x000 */ std::array<s32, 8> unk_000;
|
||||
/* 0x020 */ std::array<DelayLine, MaxChannels> delay_lines;
|
||||
/* 0x0B0 */ Common::FixedPoint<18, 14> feedback_gain;
|
||||
/* 0x0B4 */ Common::FixedPoint<18, 14> delay_feedback_gain;
|
||||
/* 0x0B8 */ Common::FixedPoint<18, 14> delay_feedback_cross_gain;
|
||||
/* 0x0BC */ Common::FixedPoint<18, 14> lowpass_gain;
|
||||
/* 0x0C0 */ Common::FixedPoint<18, 14> lowpass_feedback_gain;
|
||||
/* 0x0C4 */ std::array<Common::FixedPoint<50, 14>, MaxChannels> lowpass_z;
|
||||
};
|
||||
static_assert(sizeof(State) <= sizeof(EffectInfoBase::State),
|
||||
"DelayInfo::State has the wrong size!");
|
||||
|
||||
/**
|
||||
* Update the info with new parameters, version 1.
|
||||
*
|
||||
* @param error_info - Used to write call result code.
|
||||
* @param in_params - New parameters to update the info with.
|
||||
* @param pool_mapper - Pool for mapping buffers.
|
||||
*/
|
||||
void Update(BehaviorInfo::ErrorInfo& error_info, const InParameterVersion1& in_params,
|
||||
const PoolMapper& pool_mapper) override;
|
||||
|
||||
/**
|
||||
* Update the info with new parameters, version 2.
|
||||
*
|
||||
* @param error_info - Used to write call result code.
|
||||
* @param in_params - New parameters to update the info with.
|
||||
* @param pool_mapper - Pool for mapping buffers.
|
||||
*/
|
||||
void Update(BehaviorInfo::ErrorInfo& error_info, const InParameterVersion2& in_params,
|
||||
const PoolMapper& pool_mapper) override;
|
||||
|
||||
/**
|
||||
* Update the info after command generation. Usually only changes its state.
|
||||
*/
|
||||
void UpdateForCommandGeneration() override;
|
||||
|
||||
/**
|
||||
* Initialize a new result state. Version 2 only, unused.
|
||||
*
|
||||
* @param result_state - Result state to initialize.
|
||||
*/
|
||||
void InitializeResultState(EffectResultState& result_state) override;
|
||||
|
||||
/**
|
||||
* Update the host-side state with the ADSP-side state. Version 2 only, unused.
|
||||
*
|
||||
* @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.
|
||||
*
|
||||
* @param index - Workbuffer index.
|
||||
* @return Address of the buffer.
|
||||
*/
|
||||
CpuAddr GetWorkbuffer(s32 index) override;
|
||||
};
|
||||
|
||||
} // namespace AudioCore::AudioRenderer
|
@@ -1,94 +0,0 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "audio_core/renderer/effect/effect_i3dl2_info.h"
|
||||
|
||||
namespace AudioCore::AudioRenderer {
|
||||
|
||||
void I3dl2ReverbInfo::Update(BehaviorInfo::ErrorInfo& error_info,
|
||||
const InParameterVersion1& in_params, const PoolMapper& pool_mapper) {
|
||||
auto in_specific{reinterpret_cast<const ParameterVersion1*>(in_params.specific.data())};
|
||||
auto params{reinterpret_cast<ParameterVersion1*>(parameter.data())};
|
||||
|
||||
if (IsChannelCountValid(in_specific->channel_count_max)) {
|
||||
const auto old_state{params->state};
|
||||
std::memcpy(params, in_specific, sizeof(ParameterVersion1));
|
||||
mix_id = in_params.mix_id;
|
||||
process_order = in_params.process_order;
|
||||
enabled = in_params.enabled;
|
||||
|
||||
if (!IsChannelCountValid(in_specific->channel_count)) {
|
||||
params->channel_count = params->channel_count_max;
|
||||
}
|
||||
|
||||
if (!IsChannelCountValid(in_specific->channel_count) ||
|
||||
old_state != ParameterState::Updated) {
|
||||
params->state = old_state;
|
||||
}
|
||||
|
||||
if (buffer_unmapped || in_params.is_new) {
|
||||
usage_state = UsageState::New;
|
||||
params->state = ParameterState::Initialized;
|
||||
buffer_unmapped = !pool_mapper.TryAttachBuffer(
|
||||
error_info, workbuffers[0], in_params.workbuffer, in_params.workbuffer_size);
|
||||
return;
|
||||
}
|
||||
}
|
||||
error_info.error_code = ResultSuccess;
|
||||
error_info.address = CpuAddr(0);
|
||||
}
|
||||
|
||||
void I3dl2ReverbInfo::Update(BehaviorInfo::ErrorInfo& error_info,
|
||||
const InParameterVersion2& in_params, const PoolMapper& pool_mapper) {
|
||||
auto in_specific{reinterpret_cast<const ParameterVersion1*>(in_params.specific.data())};
|
||||
auto params{reinterpret_cast<ParameterVersion1*>(parameter.data())};
|
||||
|
||||
if (IsChannelCountValid(in_specific->channel_count_max)) {
|
||||
const auto old_state{params->state};
|
||||
std::memcpy(params, in_specific, sizeof(ParameterVersion1));
|
||||
mix_id = in_params.mix_id;
|
||||
process_order = in_params.process_order;
|
||||
enabled = in_params.enabled;
|
||||
|
||||
if (!IsChannelCountValid(in_specific->channel_count)) {
|
||||
params->channel_count = params->channel_count_max;
|
||||
}
|
||||
|
||||
if (!IsChannelCountValid(in_specific->channel_count) ||
|
||||
old_state != ParameterState::Updated) {
|
||||
params->state = old_state;
|
||||
}
|
||||
|
||||
if (buffer_unmapped || in_params.is_new) {
|
||||
usage_state = UsageState::New;
|
||||
params->state = ParameterState::Initialized;
|
||||
buffer_unmapped = !pool_mapper.TryAttachBuffer(
|
||||
error_info, workbuffers[0], in_params.workbuffer, in_params.workbuffer_size);
|
||||
return;
|
||||
}
|
||||
}
|
||||
error_info.error_code = ResultSuccess;
|
||||
error_info.address = CpuAddr(0);
|
||||
}
|
||||
|
||||
void I3dl2ReverbInfo::UpdateForCommandGeneration() {
|
||||
if (enabled) {
|
||||
usage_state = UsageState::Enabled;
|
||||
} else {
|
||||
usage_state = UsageState::Disabled;
|
||||
}
|
||||
|
||||
auto params{reinterpret_cast<ParameterVersion1*>(parameter.data())};
|
||||
params->state = ParameterState::Updated;
|
||||
}
|
||||
|
||||
void I3dl2ReverbInfo::InitializeResultState(EffectResultState& result_state) {}
|
||||
|
||||
void I3dl2ReverbInfo::UpdateResultState(EffectResultState& cpu_state,
|
||||
EffectResultState& dsp_state) {}
|
||||
|
||||
CpuAddr I3dl2ReverbInfo::GetWorkbuffer(s32 index) {
|
||||
return GetSingleBuffer(index);
|
||||
}
|
||||
|
||||
} // namespace AudioCore::AudioRenderer
|
@@ -1,200 +0,0 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <vector>
|
||||
|
||||
#include "audio_core/common/common.h"
|
||||
#include "audio_core/renderer/effect/effect_info_base.h"
|
||||
#include "common/common_types.h"
|
||||
#include "common/fixed_point.h"
|
||||
|
||||
namespace AudioCore::AudioRenderer {
|
||||
|
||||
class I3dl2ReverbInfo : public EffectInfoBase {
|
||||
public:
|
||||
struct ParameterVersion1 {
|
||||
/* 0x00 */ std::array<s8, MaxChannels> inputs;
|
||||
/* 0x06 */ std::array<s8, MaxChannels> outputs;
|
||||
/* 0x0C */ u16 channel_count_max;
|
||||
/* 0x0E */ u16 channel_count;
|
||||
/* 0x10 */ char unk10[0x4];
|
||||
/* 0x14 */ u32 sample_rate;
|
||||
/* 0x18 */ f32 room_HF_gain;
|
||||
/* 0x1C */ f32 reference_HF;
|
||||
/* 0x20 */ f32 late_reverb_decay_time;
|
||||
/* 0x24 */ f32 late_reverb_HF_decay_ratio;
|
||||
/* 0x28 */ f32 room_gain;
|
||||
/* 0x2C */ f32 reflection_gain;
|
||||
/* 0x30 */ f32 reverb_gain;
|
||||
/* 0x34 */ f32 late_reverb_diffusion;
|
||||
/* 0x38 */ f32 reflection_delay;
|
||||
/* 0x3C */ f32 late_reverb_delay_time;
|
||||
/* 0x40 */ f32 late_reverb_density;
|
||||
/* 0x44 */ f32 dry_gain;
|
||||
/* 0x48 */ ParameterState state;
|
||||
/* 0x49 */ char unk49[0x3];
|
||||
};
|
||||
static_assert(sizeof(ParameterVersion1) <= sizeof(EffectInfoBase::InParameterVersion1),
|
||||
"I3dl2ReverbInfo::ParameterVersion1 has the wrong size!");
|
||||
|
||||
struct ParameterVersion2 {
|
||||
/* 0x00 */ std::array<s8, MaxChannels> inputs;
|
||||
/* 0x06 */ std::array<s8, MaxChannels> outputs;
|
||||
/* 0x0C */ u16 channel_count_max;
|
||||
/* 0x0E */ u16 channel_count;
|
||||
/* 0x10 */ char unk10[0x4];
|
||||
/* 0x14 */ u32 sample_rate;
|
||||
/* 0x18 */ f32 room_HF_gain;
|
||||
/* 0x1C */ f32 reference_HF;
|
||||
/* 0x20 */ f32 late_reverb_decay_time;
|
||||
/* 0x24 */ f32 late_reverb_HF_decay_ratio;
|
||||
/* 0x28 */ f32 room_gain;
|
||||
/* 0x2C */ f32 reflection_gain;
|
||||
/* 0x30 */ f32 reverb_gain;
|
||||
/* 0x34 */ f32 late_reverb_diffusion;
|
||||
/* 0x38 */ f32 reflection_delay;
|
||||
/* 0x3C */ f32 late_reverb_delay_time;
|
||||
/* 0x40 */ f32 late_reverb_density;
|
||||
/* 0x44 */ f32 dry_gain;
|
||||
/* 0x48 */ ParameterState state;
|
||||
/* 0x49 */ char unk49[0x3];
|
||||
};
|
||||
static_assert(sizeof(ParameterVersion2) <= sizeof(EffectInfoBase::InParameterVersion2),
|
||||
"I3dl2ReverbInfo::ParameterVersion2 has the wrong size!");
|
||||
|
||||
static constexpr u32 MaxDelayLines = 4;
|
||||
static constexpr u32 MaxDelayTaps = 20;
|
||||
|
||||
struct I3dl2DelayLine {
|
||||
void Initialize(const s32 delay_time) {
|
||||
max_delay = delay_time;
|
||||
buffer.resize(delay_time + 1, 0);
|
||||
buffer_end = &buffer[delay_time];
|
||||
output = &buffer[0];
|
||||
SetDelay(delay_time);
|
||||
wet_gain = 0.0f;
|
||||
}
|
||||
|
||||
void SetDelay(const s32 delay_time) {
|
||||
if (max_delay < delay_time) {
|
||||
return;
|
||||
}
|
||||
delay = delay_time;
|
||||
input = &buffer[(output - buffer.data() + delay) % (max_delay + 1)];
|
||||
}
|
||||
|
||||
Common::FixedPoint<50, 14> Tick(const Common::FixedPoint<50, 14> sample) {
|
||||
Write(sample);
|
||||
|
||||
auto out_sample{Read()};
|
||||
|
||||
output++;
|
||||
if (output >= buffer_end) {
|
||||
output = buffer.data();
|
||||
}
|
||||
|
||||
return out_sample;
|
||||
}
|
||||
|
||||
Common::FixedPoint<50, 14> Read() {
|
||||
return *output;
|
||||
}
|
||||
|
||||
void Write(const Common::FixedPoint<50, 14> sample) {
|
||||
*(input++) = sample;
|
||||
if (input >= buffer_end) {
|
||||
input = buffer.data();
|
||||
}
|
||||
}
|
||||
|
||||
Common::FixedPoint<50, 14> TapOut(const s32 index) {
|
||||
auto out{input - (index + 1)};
|
||||
if (out < buffer.data()) {
|
||||
out += max_delay + 1;
|
||||
}
|
||||
return *out;
|
||||
}
|
||||
|
||||
std::vector<Common::FixedPoint<50, 14>> buffer{};
|
||||
Common::FixedPoint<50, 14>* buffer_end{};
|
||||
s32 max_delay{};
|
||||
Common::FixedPoint<50, 14>* input{};
|
||||
Common::FixedPoint<50, 14>* output{};
|
||||
s32 delay{};
|
||||
f32 wet_gain{};
|
||||
};
|
||||
|
||||
struct State {
|
||||
f32 lowpass_0;
|
||||
f32 lowpass_1;
|
||||
f32 lowpass_2;
|
||||
I3dl2DelayLine early_delay_line;
|
||||
std::array<s32, MaxDelayTaps> early_tap_steps;
|
||||
f32 early_gain;
|
||||
f32 late_gain;
|
||||
s32 early_to_late_taps;
|
||||
std::array<I3dl2DelayLine, MaxDelayLines> fdn_delay_lines;
|
||||
std::array<I3dl2DelayLine, MaxDelayLines> decay_delay_lines0;
|
||||
std::array<I3dl2DelayLine, MaxDelayLines> decay_delay_lines1;
|
||||
f32 last_reverb_echo;
|
||||
I3dl2DelayLine center_delay_line;
|
||||
std::array<std::array<f32, 3>, MaxDelayLines> lowpass_coeff;
|
||||
std::array<f32, MaxDelayLines> shelf_filter;
|
||||
f32 dry_gain;
|
||||
};
|
||||
static_assert(sizeof(State) <= sizeof(EffectInfoBase::State),
|
||||
"I3dl2ReverbInfo::State is too large!");
|
||||
|
||||
/**
|
||||
* Update the info with new parameters, version 1.
|
||||
*
|
||||
* @param error_info - Used to write call result code.
|
||||
* @param in_params - New parameters to update the info with.
|
||||
* @param pool_mapper - Pool for mapping buffers.
|
||||
*/
|
||||
void Update(BehaviorInfo::ErrorInfo& error_info, const InParameterVersion1& in_params,
|
||||
const PoolMapper& pool_mapper) override;
|
||||
|
||||
/**
|
||||
* Update the info with new parameters, version 2.
|
||||
*
|
||||
* @param error_info - Used to write call result code.
|
||||
* @param in_params - New parameters to update the info with.
|
||||
* @param pool_mapper - Pool for mapping buffers.
|
||||
*/
|
||||
void Update(BehaviorInfo::ErrorInfo& error_info, const InParameterVersion2& in_params,
|
||||
const PoolMapper& pool_mapper) override;
|
||||
|
||||
/**
|
||||
* Update the info after command generation. Usually only changes its state.
|
||||
*/
|
||||
void UpdateForCommandGeneration() override;
|
||||
|
||||
/**
|
||||
* Initialize a new result state. Version 2 only, unused.
|
||||
*
|
||||
* @param result_state - Result state to initialize.
|
||||
*/
|
||||
void InitializeResultState(EffectResultState& result_state) override;
|
||||
|
||||
/**
|
||||
* Update the host-side state with the ADSP-side state. Version 2 only, unused.
|
||||
*
|
||||
* @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.
|
||||
*
|
||||
* @param index - Workbuffer index.
|
||||
* @return Address of the buffer.
|
||||
*/
|
||||
CpuAddr GetWorkbuffer(s32 index) override;
|
||||
};
|
||||
|
||||
} // namespace AudioCore::AudioRenderer
|
@@ -1,81 +0,0 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "audio_core/renderer/effect/effect_light_limiter_info.h"
|
||||
|
||||
namespace AudioCore::AudioRenderer {
|
||||
|
||||
void LightLimiterInfo::Update(BehaviorInfo::ErrorInfo& error_info,
|
||||
const InParameterVersion1& in_params, const PoolMapper& pool_mapper) {
|
||||
auto in_specific{reinterpret_cast<const ParameterVersion1*>(in_params.specific.data())};
|
||||
auto params{reinterpret_cast<ParameterVersion1*>(parameter.data())};
|
||||
|
||||
std::memcpy(params, in_specific, sizeof(ParameterVersion1));
|
||||
mix_id = in_params.mix_id;
|
||||
process_order = in_params.process_order;
|
||||
enabled = in_params.enabled;
|
||||
|
||||
if (buffer_unmapped || in_params.is_new) {
|
||||
usage_state = UsageState::New;
|
||||
params->state = ParameterState::Initialized;
|
||||
buffer_unmapped = !pool_mapper.TryAttachBuffer(
|
||||
error_info, workbuffers[0], in_params.workbuffer, in_params.workbuffer_size);
|
||||
} else {
|
||||
error_info.error_code = ResultSuccess;
|
||||
error_info.address = CpuAddr(0);
|
||||
}
|
||||
}
|
||||
|
||||
void LightLimiterInfo::Update(BehaviorInfo::ErrorInfo& error_info,
|
||||
const InParameterVersion2& in_params, const PoolMapper& pool_mapper) {
|
||||
auto in_specific{reinterpret_cast<const ParameterVersion1*>(in_params.specific.data())};
|
||||
auto params{reinterpret_cast<ParameterVersion1*>(parameter.data())};
|
||||
|
||||
std::memcpy(params, in_specific, sizeof(ParameterVersion1));
|
||||
mix_id = in_params.mix_id;
|
||||
process_order = in_params.process_order;
|
||||
enabled = in_params.enabled;
|
||||
|
||||
if (buffer_unmapped || in_params.is_new) {
|
||||
usage_state = UsageState::New;
|
||||
params->state = ParameterState::Initialized;
|
||||
buffer_unmapped = !pool_mapper.TryAttachBuffer(
|
||||
error_info, workbuffers[0], in_params.workbuffer, in_params.workbuffer_size);
|
||||
} else {
|
||||
error_info.error_code = ResultSuccess;
|
||||
error_info.address = CpuAddr(0);
|
||||
}
|
||||
}
|
||||
|
||||
void LightLimiterInfo::UpdateForCommandGeneration() {
|
||||
if (enabled) {
|
||||
usage_state = UsageState::Enabled;
|
||||
} else {
|
||||
usage_state = UsageState::Disabled;
|
||||
}
|
||||
|
||||
auto params{reinterpret_cast<ParameterVersion1*>(parameter.data())};
|
||||
params->state = ParameterState::Updated;
|
||||
params->statistics_reset_required = false;
|
||||
}
|
||||
|
||||
void LightLimiterInfo::InitializeResultState(EffectResultState& result_state) {
|
||||
auto result_state_{reinterpret_cast<StatisticsInternal*>(result_state.state.data())};
|
||||
|
||||
result_state_->channel_max_sample.fill(0);
|
||||
result_state_->channel_compression_gain_min.fill(1.0f);
|
||||
}
|
||||
|
||||
void LightLimiterInfo::UpdateResultState(EffectResultState& cpu_state,
|
||||
EffectResultState& dsp_state) {
|
||||
auto cpu_statistics{reinterpret_cast<StatisticsInternal*>(cpu_state.state.data())};
|
||||
auto dsp_statistics{reinterpret_cast<StatisticsInternal*>(dsp_state.state.data())};
|
||||
|
||||
*cpu_statistics = *dsp_statistics;
|
||||
}
|
||||
|
||||
CpuAddr LightLimiterInfo::GetWorkbuffer(s32 index) {
|
||||
return GetSingleBuffer(index);
|
||||
}
|
||||
|
||||
} // namespace AudioCore::AudioRenderer
|
@@ -1,133 +0,0 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <vector>
|
||||
|
||||
#include "audio_core/common/common.h"
|
||||
#include "audio_core/renderer/effect/effect_info_base.h"
|
||||
#include "common/common_types.h"
|
||||
#include "common/fixed_point.h"
|
||||
|
||||
namespace AudioCore::AudioRenderer {
|
||||
|
||||
class LightLimiterInfo : public EffectInfoBase {
|
||||
public:
|
||||
struct ParameterVersion1 {
|
||||
/* 0x00 */ std::array<s8, MaxChannels> inputs;
|
||||
/* 0x06 */ std::array<s8, MaxChannels> outputs;
|
||||
/* 0x0C */ u16 channel_count_max;
|
||||
/* 0x0E */ u16 channel_count;
|
||||
/* 0x0C */ u32 sample_rate;
|
||||
/* 0x14 */ s32 look_ahead_time_max;
|
||||
/* 0x18 */ s32 attack_time;
|
||||
/* 0x1C */ s32 release_time;
|
||||
/* 0x20 */ s32 look_ahead_time;
|
||||
/* 0x24 */ f32 attack_coeff;
|
||||
/* 0x28 */ f32 release_coeff;
|
||||
/* 0x2C */ f32 threshold;
|
||||
/* 0x30 */ f32 input_gain;
|
||||
/* 0x34 */ f32 output_gain;
|
||||
/* 0x38 */ s32 look_ahead_samples_min;
|
||||
/* 0x3C */ s32 look_ahead_samples_max;
|
||||
/* 0x40 */ ParameterState state;
|
||||
/* 0x41 */ bool statistics_enabled;
|
||||
/* 0x42 */ bool statistics_reset_required;
|
||||
/* 0x43 */ char unk43[0x1];
|
||||
};
|
||||
static_assert(sizeof(ParameterVersion1) <= sizeof(EffectInfoBase::InParameterVersion1),
|
||||
"LightLimiterInfo::ParameterVersion1 has the wrong size!");
|
||||
|
||||
struct ParameterVersion2 {
|
||||
/* 0x00 */ std::array<s8, MaxChannels> inputs;
|
||||
/* 0x06 */ std::array<s8, MaxChannels> outputs;
|
||||
/* 0x0C */ u16 channel_count_max;
|
||||
/* 0x0E */ u16 channel_count;
|
||||
/* 0x0C */ u32 sample_rate;
|
||||
/* 0x14 */ s32 look_ahead_time_max;
|
||||
/* 0x18 */ s32 attack_time;
|
||||
/* 0x1C */ s32 release_time;
|
||||
/* 0x20 */ s32 look_ahead_time;
|
||||
/* 0x24 */ f32 attack_coeff;
|
||||
/* 0x28 */ f32 release_coeff;
|
||||
/* 0x2C */ f32 threshold;
|
||||
/* 0x30 */ f32 input_gain;
|
||||
/* 0x34 */ f32 output_gain;
|
||||
/* 0x38 */ s32 look_ahead_samples_min;
|
||||
/* 0x3C */ s32 look_ahead_samples_max;
|
||||
/* 0x40 */ ParameterState state;
|
||||
/* 0x41 */ bool statistics_enabled;
|
||||
/* 0x42 */ bool statistics_reset_required;
|
||||
/* 0x43 */ char unk43[0x1];
|
||||
};
|
||||
static_assert(sizeof(ParameterVersion2) <= sizeof(EffectInfoBase::InParameterVersion2),
|
||||
"LightLimiterInfo::ParameterVersion2 has the wrong size!");
|
||||
|
||||
struct State {
|
||||
std::array<Common::FixedPoint<49, 15>, MaxChannels> samples_average;
|
||||
std::array<Common::FixedPoint<49, 15>, MaxChannels> compression_gain;
|
||||
std::array<s32, MaxChannels> look_ahead_sample_offsets;
|
||||
std::array<std::vector<Common::FixedPoint<49, 15>>, MaxChannels> look_ahead_sample_buffers;
|
||||
};
|
||||
static_assert(sizeof(State) <= sizeof(EffectInfoBase::State),
|
||||
"LightLimiterInfo::State has the wrong size!");
|
||||
|
||||
struct StatisticsInternal {
|
||||
/* 0x00 */ std::array<f32, MaxChannels> channel_max_sample;
|
||||
/* 0x18 */ std::array<f32, MaxChannels> channel_compression_gain_min;
|
||||
};
|
||||
static_assert(sizeof(StatisticsInternal) == 0x30,
|
||||
"LightLimiterInfo::StatisticsInternal has the wrong size!");
|
||||
|
||||
/**
|
||||
* Update the info with new parameters, version 1.
|
||||
*
|
||||
* @param error_info - Used to write call result code.
|
||||
* @param in_params - New parameters to update the info with.
|
||||
* @param pool_mapper - Pool for mapping buffers.
|
||||
*/
|
||||
void Update(BehaviorInfo::ErrorInfo& error_info, const InParameterVersion1& in_params,
|
||||
const PoolMapper& pool_mapper) override;
|
||||
|
||||
/**
|
||||
* Update the info with new parameters, version 2.
|
||||
*
|
||||
* @param error_info - Used to write call result code.
|
||||
* @param in_params - New parameters to update the info with.
|
||||
* @param pool_mapper - Pool for mapping buffers.
|
||||
*/
|
||||
void Update(BehaviorInfo::ErrorInfo& error_info, const InParameterVersion2& in_params,
|
||||
const PoolMapper& pool_mapper) override;
|
||||
|
||||
/**
|
||||
* Update the info after command generation. Usually only changes its state.
|
||||
*/
|
||||
void UpdateForCommandGeneration() override;
|
||||
|
||||
/**
|
||||
* Initialize a new limiter statistics result state. Version 2 only.
|
||||
*
|
||||
* @param result_state - Result state to initialize.
|
||||
*/
|
||||
void InitializeResultState(EffectResultState& result_state) override;
|
||||
|
||||
/**
|
||||
* Update the host-side limiter 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.
|
||||
*
|
||||
* @param index - Workbuffer index.
|
||||
* @return Address of the buffer.
|
||||
*/
|
||||
CpuAddr GetWorkbuffer(s32 index) override;
|
||||
};
|
||||
|
||||
} // namespace AudioCore::AudioRenderer
|
@@ -1,93 +0,0 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "audio_core/renderer/effect/effect_reverb_info.h"
|
||||
|
||||
namespace AudioCore::AudioRenderer {
|
||||
|
||||
void ReverbInfo::Update(BehaviorInfo::ErrorInfo& error_info, const InParameterVersion1& in_params,
|
||||
const PoolMapper& pool_mapper) {
|
||||
auto in_specific{reinterpret_cast<const ParameterVersion1*>(in_params.specific.data())};
|
||||
auto params{reinterpret_cast<ParameterVersion1*>(parameter.data())};
|
||||
|
||||
if (IsChannelCountValid(in_specific->channel_count_max)) {
|
||||
const auto old_state{params->state};
|
||||
std::memcpy(params, in_specific, sizeof(ParameterVersion1));
|
||||
mix_id = in_params.mix_id;
|
||||
process_order = in_params.process_order;
|
||||
enabled = in_params.enabled;
|
||||
|
||||
if (!IsChannelCountValid(in_specific->channel_count)) {
|
||||
params->channel_count = params->channel_count_max;
|
||||
}
|
||||
|
||||
if (!IsChannelCountValid(in_specific->channel_count) ||
|
||||
old_state != ParameterState::Updated) {
|
||||
params->state = old_state;
|
||||
}
|
||||
|
||||
if (buffer_unmapped || in_params.is_new) {
|
||||
usage_state = UsageState::New;
|
||||
params->state = ParameterState::Initialized;
|
||||
buffer_unmapped = !pool_mapper.TryAttachBuffer(
|
||||
error_info, workbuffers[0], in_params.workbuffer, in_params.workbuffer_size);
|
||||
return;
|
||||
}
|
||||
}
|
||||
error_info.error_code = ResultSuccess;
|
||||
error_info.address = CpuAddr(0);
|
||||
}
|
||||
|
||||
void ReverbInfo::Update(BehaviorInfo::ErrorInfo& error_info, const InParameterVersion2& in_params,
|
||||
const PoolMapper& pool_mapper) {
|
||||
auto in_specific{reinterpret_cast<const ParameterVersion2*>(in_params.specific.data())};
|
||||
auto params{reinterpret_cast<ParameterVersion2*>(parameter.data())};
|
||||
|
||||
if (IsChannelCountValid(in_specific->channel_count_max)) {
|
||||
const auto old_state{params->state};
|
||||
std::memcpy(params, in_specific, sizeof(ParameterVersion2));
|
||||
mix_id = in_params.mix_id;
|
||||
process_order = in_params.process_order;
|
||||
enabled = in_params.enabled;
|
||||
|
||||
if (!IsChannelCountValid(in_specific->channel_count)) {
|
||||
params->channel_count = params->channel_count_max;
|
||||
}
|
||||
|
||||
if (!IsChannelCountValid(in_specific->channel_count) ||
|
||||
old_state != ParameterState::Updated) {
|
||||
params->state = old_state;
|
||||
}
|
||||
|
||||
if (buffer_unmapped || in_params.is_new) {
|
||||
usage_state = UsageState::New;
|
||||
params->state = ParameterState::Initialized;
|
||||
buffer_unmapped = !pool_mapper.TryAttachBuffer(
|
||||
error_info, workbuffers[0], in_params.workbuffer, in_params.workbuffer_size);
|
||||
return;
|
||||
}
|
||||
}
|
||||
error_info.error_code = ResultSuccess;
|
||||
error_info.address = CpuAddr(0);
|
||||
}
|
||||
|
||||
void ReverbInfo::UpdateForCommandGeneration() {
|
||||
if (enabled) {
|
||||
usage_state = UsageState::Enabled;
|
||||
} else {
|
||||
usage_state = UsageState::Disabled;
|
||||
}
|
||||
|
||||
auto params{reinterpret_cast<ParameterVersion1*>(parameter.data())};
|
||||
params->state = ParameterState::Updated;
|
||||
}
|
||||
|
||||
void ReverbInfo::InitializeResultState(EffectResultState& result_state) {}
|
||||
|
||||
void ReverbInfo::UpdateResultState(EffectResultState& cpu_state, EffectResultState& dsp_state) {}
|
||||
|
||||
CpuAddr ReverbInfo::GetWorkbuffer(s32 index) {
|
||||
return GetSingleBuffer(index);
|
||||
}
|
||||
|
||||
} // namespace AudioCore::AudioRenderer
|
@@ -1,190 +0,0 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <vector>
|
||||
|
||||
#include "audio_core/common/common.h"
|
||||
#include "audio_core/renderer/effect/effect_info_base.h"
|
||||
#include "common/common_types.h"
|
||||
#include "common/fixed_point.h"
|
||||
|
||||
namespace AudioCore::AudioRenderer {
|
||||
|
||||
class ReverbInfo : public EffectInfoBase {
|
||||
public:
|
||||
struct ParameterVersion1 {
|
||||
/* 0x00 */ std::array<s8, MaxChannels> inputs;
|
||||
/* 0x06 */ std::array<s8, MaxChannels> outputs;
|
||||
/* 0x0C */ u16 channel_count_max;
|
||||
/* 0x0E */ u16 channel_count;
|
||||
/* 0x10 */ u32 sample_rate;
|
||||
/* 0x14 */ u32 early_mode;
|
||||
/* 0x18 */ s32 early_gain;
|
||||
/* 0x1C */ s32 pre_delay;
|
||||
/* 0x20 */ s32 late_mode;
|
||||
/* 0x24 */ s32 late_gain;
|
||||
/* 0x28 */ s32 decay_time;
|
||||
/* 0x2C */ s32 high_freq_Decay_ratio;
|
||||
/* 0x30 */ s32 colouration;
|
||||
/* 0x34 */ s32 base_gain;
|
||||
/* 0x38 */ s32 wet_gain;
|
||||
/* 0x3C */ s32 dry_gain;
|
||||
/* 0x40 */ ParameterState state;
|
||||
};
|
||||
static_assert(sizeof(ParameterVersion1) <= sizeof(EffectInfoBase::InParameterVersion1),
|
||||
"ReverbInfo::ParameterVersion1 has the wrong size!");
|
||||
|
||||
struct ParameterVersion2 {
|
||||
/* 0x00 */ std::array<s8, MaxChannels> inputs;
|
||||
/* 0x06 */ std::array<s8, MaxChannels> outputs;
|
||||
/* 0x0C */ u16 channel_count_max;
|
||||
/* 0x0E */ u16 channel_count;
|
||||
/* 0x10 */ u32 sample_rate;
|
||||
/* 0x14 */ u32 early_mode;
|
||||
/* 0x18 */ s32 early_gain;
|
||||
/* 0x1C */ s32 pre_delay;
|
||||
/* 0x20 */ s32 late_mode;
|
||||
/* 0x24 */ s32 late_gain;
|
||||
/* 0x28 */ s32 decay_time;
|
||||
/* 0x2C */ s32 high_freq_decay_ratio;
|
||||
/* 0x30 */ s32 colouration;
|
||||
/* 0x34 */ s32 base_gain;
|
||||
/* 0x38 */ s32 wet_gain;
|
||||
/* 0x3C */ s32 dry_gain;
|
||||
/* 0x40 */ ParameterState state;
|
||||
};
|
||||
static_assert(sizeof(ParameterVersion2) <= sizeof(EffectInfoBase::InParameterVersion2),
|
||||
"ReverbInfo::ParameterVersion2 has the wrong size!");
|
||||
|
||||
static constexpr u32 MaxDelayLines = 4;
|
||||
static constexpr u32 MaxDelayTaps = 10;
|
||||
static constexpr u32 NumEarlyModes = 5;
|
||||
static constexpr u32 NumLateModes = 5;
|
||||
|
||||
struct ReverbDelayLine {
|
||||
void Initialize(const s32 delay_time, const f32 decay_rate) {
|
||||
buffer.resize(delay_time + 1, 0);
|
||||
buffer_end = &buffer[delay_time];
|
||||
output = &buffer[0];
|
||||
decay = decay_rate;
|
||||
sample_count_max = delay_time;
|
||||
SetDelay(delay_time);
|
||||
}
|
||||
|
||||
void SetDelay(const s32 delay_time) {
|
||||
if (sample_count_max < delay_time) {
|
||||
return;
|
||||
}
|
||||
sample_count = delay_time;
|
||||
input = &buffer[(output - buffer.data() + sample_count) % (sample_count_max + 1)];
|
||||
}
|
||||
|
||||
Common::FixedPoint<50, 14> Tick(const Common::FixedPoint<50, 14> sample) {
|
||||
Write(sample);
|
||||
|
||||
auto out_sample{Read()};
|
||||
|
||||
output++;
|
||||
if (output >= buffer_end) {
|
||||
output = buffer.data();
|
||||
}
|
||||
|
||||
return out_sample;
|
||||
}
|
||||
|
||||
Common::FixedPoint<50, 14> Read() {
|
||||
return *output;
|
||||
}
|
||||
|
||||
void Write(const Common::FixedPoint<50, 14> sample) {
|
||||
*(input++) = sample;
|
||||
if (input >= buffer_end) {
|
||||
input = buffer.data();
|
||||
}
|
||||
}
|
||||
|
||||
Common::FixedPoint<50, 14> TapOut(const s32 index) {
|
||||
auto out{input - (index + 1)};
|
||||
if (out < buffer.data()) {
|
||||
out += sample_count;
|
||||
}
|
||||
return *out;
|
||||
}
|
||||
|
||||
s32 sample_count{};
|
||||
s32 sample_count_max{};
|
||||
std::vector<Common::FixedPoint<50, 14>> buffer{};
|
||||
Common::FixedPoint<50, 14>* buffer_end;
|
||||
Common::FixedPoint<50, 14>* input{};
|
||||
Common::FixedPoint<50, 14>* output{};
|
||||
Common::FixedPoint<50, 14> decay{};
|
||||
};
|
||||
|
||||
struct State {
|
||||
ReverbDelayLine pre_delay_line;
|
||||
ReverbDelayLine center_delay_line;
|
||||
std::array<s32, MaxDelayTaps> early_delay_times;
|
||||
std::array<Common::FixedPoint<50, 14>, MaxDelayTaps> early_gains;
|
||||
s32 pre_delay_time;
|
||||
std::array<ReverbDelayLine, MaxDelayLines> decay_delay_lines;
|
||||
std::array<ReverbDelayLine, MaxDelayLines> fdn_delay_lines;
|
||||
std::array<Common::FixedPoint<50, 14>, MaxDelayLines> hf_decay_gain;
|
||||
std::array<Common::FixedPoint<50, 14>, MaxDelayLines> hf_decay_prev_gain;
|
||||
std::array<Common::FixedPoint<50, 14>, MaxDelayLines> prev_feedback_output;
|
||||
};
|
||||
static_assert(sizeof(State) <= sizeof(EffectInfoBase::State),
|
||||
"ReverbInfo::State is too large!");
|
||||
|
||||
/**
|
||||
* Update the info with new parameters, version 1.
|
||||
*
|
||||
* @param error_info - Used to write call result code.
|
||||
* @param in_params - New parameters to update the info with.
|
||||
* @param pool_mapper - Pool for mapping buffers.
|
||||
*/
|
||||
void Update(BehaviorInfo::ErrorInfo& error_info, const InParameterVersion1& in_params,
|
||||
const PoolMapper& pool_mapper) override;
|
||||
|
||||
/**
|
||||
* Update the info with new parameters, version 2.
|
||||
*
|
||||
* @param error_info - Used to write call result code.
|
||||
* @param in_params - New parameters to update the info with.
|
||||
* @param pool_mapper - Pool for mapping buffers.
|
||||
*/
|
||||
void Update(BehaviorInfo::ErrorInfo& error_info, const InParameterVersion2& in_params,
|
||||
const PoolMapper& pool_mapper) override;
|
||||
|
||||
/**
|
||||
* Update the info after command generation. Usually only changes its state.
|
||||
*/
|
||||
void UpdateForCommandGeneration() override;
|
||||
|
||||
/**
|
||||
* Initialize a new result state. Version 2 only, unused.
|
||||
*
|
||||
* @param result_state - Result state to initialize.
|
||||
*/
|
||||
void InitializeResultState(EffectResultState& result_state) override;
|
||||
|
||||
/**
|
||||
* Update the host-side state with the ADSP-side state. Version 2 only, unused.
|
||||
*
|
||||
* @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.
|
||||
*
|
||||
* @param index - Workbuffer index.
|
||||
* @return Address of the buffer.
|
||||
*/
|
||||
CpuAddr GetWorkbuffer(s32 index) override;
|
||||
};
|
||||
|
||||
} // namespace AudioCore::AudioRenderer
|
Reference in New Issue
Block a user