mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-07-04 23:31:19 +01:00
audio_core: Make shadowing and unused parameters errors
Moves the audio code closer to enabling warnings as errors in general.
This commit is contained in:
parent
dcfa1992ea
commit
1ea6bdef05
29 changed files with 163 additions and 154 deletions
|
@ -51,6 +51,8 @@ if (NOT MSVC)
|
||||||
-Werror=implicit-fallthrough
|
-Werror=implicit-fallthrough
|
||||||
-Werror=reorder
|
-Werror=reorder
|
||||||
-Werror=sign-compare
|
-Werror=sign-compare
|
||||||
|
-Werror=shadow
|
||||||
|
-Werror=unused-parameter
|
||||||
-Werror=unused-variable
|
-Werror=unused-variable
|
||||||
|
|
||||||
$<$<CXX_COMPILER_ID:GNU>:-Werror=unused-but-set-parameter>
|
$<$<CXX_COMPILER_ID:GNU>:-Werror=unused-but-set-parameter>
|
||||||
|
|
|
@ -31,8 +31,8 @@ Filter Filter::LowPass(double cutoff, double Q) {
|
||||||
|
|
||||||
Filter::Filter() : Filter(1.0, 0.0, 0.0, 1.0, 0.0, 0.0) {}
|
Filter::Filter() : Filter(1.0, 0.0, 0.0, 1.0, 0.0, 0.0) {}
|
||||||
|
|
||||||
Filter::Filter(double a0, double a1, double a2, double b0, double b1, double b2)
|
Filter::Filter(double a0_, double a1_, double a2_, double b0_, double b1_, double b2_)
|
||||||
: a1(a1 / a0), a2(a2 / a0), b0(b0 / a0), b1(b1 / a0), b2(b2 / a0) {}
|
: a1(a1_ / a0_), a2(a2_ / a0_), b0(b0_ / a0_), b1(b1_ / a0_), b2(b2_ / a0_) {}
|
||||||
|
|
||||||
void Filter::Process(std::vector<s16>& signal) {
|
void Filter::Process(std::vector<s16>& signal) {
|
||||||
const std::size_t num_frames = signal.size() / 2;
|
const std::size_t num_frames = signal.size() / 2;
|
||||||
|
@ -69,7 +69,7 @@ CascadingFilter CascadingFilter::LowPass(double cutoff, std::size_t cascade_size
|
||||||
}
|
}
|
||||||
|
|
||||||
CascadingFilter::CascadingFilter() = default;
|
CascadingFilter::CascadingFilter() = default;
|
||||||
CascadingFilter::CascadingFilter(std::vector<Filter> filters) : filters(std::move(filters)) {}
|
CascadingFilter::CascadingFilter(std::vector<Filter> filters_) : filters(std::move(filters_)) {}
|
||||||
|
|
||||||
void CascadingFilter::Process(std::vector<s16>& signal) {
|
void CascadingFilter::Process(std::vector<s16>& signal) {
|
||||||
for (auto& filter : filters) {
|
for (auto& filter : filters) {
|
||||||
|
|
|
@ -25,7 +25,7 @@ public:
|
||||||
/// Passthrough filter.
|
/// Passthrough filter.
|
||||||
Filter();
|
Filter();
|
||||||
|
|
||||||
Filter(double a0, double a1, double a2, double b0, double b1, double b2);
|
Filter(double a0_, double a1_, double a2_, double b0_, double b1_, double b2_);
|
||||||
|
|
||||||
void Process(std::vector<s16>& signal);
|
void Process(std::vector<s16>& signal);
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ public:
|
||||||
/// Passthrough.
|
/// Passthrough.
|
||||||
CascadingFilter();
|
CascadingFilter();
|
||||||
|
|
||||||
explicit CascadingFilter(std::vector<Filter> filters);
|
explicit CascadingFilter(std::vector<Filter> filters_);
|
||||||
|
|
||||||
void Process(std::vector<s16>& signal);
|
void Process(std::vector<s16>& signal);
|
||||||
|
|
||||||
|
|
|
@ -71,9 +71,9 @@ namespace {
|
||||||
namespace AudioCore {
|
namespace AudioCore {
|
||||||
AudioRenderer::AudioRenderer(Core::Timing::CoreTiming& core_timing, Core::Memory::Memory& memory_,
|
AudioRenderer::AudioRenderer(Core::Timing::CoreTiming& core_timing, Core::Memory::Memory& memory_,
|
||||||
AudioCommon::AudioRendererParameter params,
|
AudioCommon::AudioRendererParameter params,
|
||||||
std::shared_ptr<Kernel::WritableEvent> buffer_event,
|
std::shared_ptr<Kernel::WritableEvent> buffer_event_,
|
||||||
std::size_t instance_number)
|
std::size_t instance_number)
|
||||||
: worker_params{params}, buffer_event{buffer_event},
|
: worker_params{params}, buffer_event{buffer_event_},
|
||||||
memory_pool_info(params.effect_count + params.voice_count * 4),
|
memory_pool_info(params.effect_count + params.voice_count * 4),
|
||||||
voice_context(params.voice_count), effect_context(params.effect_count), mix_context(),
|
voice_context(params.voice_count), effect_context(params.effect_count), mix_context(),
|
||||||
sink_context(params.sink_count), splitter_context(),
|
sink_context(params.sink_count), splitter_context(),
|
||||||
|
@ -89,7 +89,7 @@ AudioRenderer::AudioRenderer(Core::Timing::CoreTiming& core_timing, Core::Memory
|
||||||
stream =
|
stream =
|
||||||
audio_out->OpenStream(core_timing, params.sample_rate, AudioCommon::STREAM_NUM_CHANNELS,
|
audio_out->OpenStream(core_timing, params.sample_rate, AudioCommon::STREAM_NUM_CHANNELS,
|
||||||
fmt::format("AudioRenderer-Instance{}", instance_number),
|
fmt::format("AudioRenderer-Instance{}", instance_number),
|
||||||
[=]() { buffer_event->Signal(); });
|
[=]() { buffer_event_->Signal(); });
|
||||||
audio_out->StartStream(stream);
|
audio_out->StartStream(stream);
|
||||||
|
|
||||||
QueueMixedBuffer(0);
|
QueueMixedBuffer(0);
|
||||||
|
|
|
@ -44,7 +44,8 @@ class AudioRenderer {
|
||||||
public:
|
public:
|
||||||
AudioRenderer(Core::Timing::CoreTiming& core_timing, Core::Memory::Memory& memory_,
|
AudioRenderer(Core::Timing::CoreTiming& core_timing, Core::Memory::Memory& memory_,
|
||||||
AudioCommon::AudioRendererParameter params,
|
AudioCommon::AudioRendererParameter params,
|
||||||
std::shared_ptr<Kernel::WritableEvent> buffer_event, std::size_t instance_number);
|
std::shared_ptr<Kernel::WritableEvent> buffer_event_,
|
||||||
|
std::size_t instance_number);
|
||||||
~AudioRenderer();
|
~AudioRenderer();
|
||||||
|
|
||||||
[[nodiscard]] ResultCode UpdateAudioRenderer(const std::vector<u8>& input_params,
|
[[nodiscard]] ResultCode UpdateAudioRenderer(const std::vector<u8>& input_params,
|
||||||
|
|
|
@ -18,7 +18,7 @@ class Buffer {
|
||||||
public:
|
public:
|
||||||
using Tag = u64;
|
using Tag = u64;
|
||||||
|
|
||||||
Buffer(Tag tag, std::vector<s16>&& samples) : tag{tag}, samples{std::move(samples)} {}
|
Buffer(Tag tag_, std::vector<s16>&& samples_) : tag{tag_}, samples{std::move(samples_)} {}
|
||||||
|
|
||||||
/// Returns the raw audio data for the buffer
|
/// Returns the raw audio data for the buffer
|
||||||
std::vector<s16>& GetSamples() {
|
std::vector<s16>& GetSamples() {
|
||||||
|
|
|
@ -67,12 +67,12 @@ s32 ApplyMixDepop(s32* output, s32 first_sample, s32 delta, s32 sample_count) {
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
CommandGenerator::CommandGenerator(AudioCommon::AudioRendererParameter& worker_params,
|
CommandGenerator::CommandGenerator(AudioCommon::AudioRendererParameter& worker_params_,
|
||||||
VoiceContext& voice_context, MixContext& mix_context,
|
VoiceContext& voice_context_, MixContext& mix_context_,
|
||||||
SplitterContext& splitter_context, EffectContext& effect_context,
|
SplitterContext& splitter_context_,
|
||||||
Core::Memory::Memory& memory)
|
EffectContext& effect_context_, Core::Memory::Memory& memory_)
|
||||||
: worker_params(worker_params), voice_context(voice_context), mix_context(mix_context),
|
: worker_params(worker_params_), voice_context(voice_context_), mix_context(mix_context_),
|
||||||
splitter_context(splitter_context), effect_context(effect_context), memory(memory),
|
splitter_context(splitter_context_), effect_context(effect_context_), memory(memory_),
|
||||||
mix_buffer((worker_params.mix_buffer_count + AudioCommon::MAX_CHANNEL_COUNT) *
|
mix_buffer((worker_params.mix_buffer_count + AudioCommon::MAX_CHANNEL_COUNT) *
|
||||||
worker_params.sample_count),
|
worker_params.sample_count),
|
||||||
sample_buffer(MIX_BUFFER_SIZE),
|
sample_buffer(MIX_BUFFER_SIZE),
|
||||||
|
@ -255,7 +255,8 @@ void CommandGenerator::GenerateDataSourceCommand(ServerVoiceInfo& voice_info, Vo
|
||||||
|
|
||||||
void CommandGenerator::GenerateBiquadFilterCommandForVoice(ServerVoiceInfo& voice_info,
|
void CommandGenerator::GenerateBiquadFilterCommandForVoice(ServerVoiceInfo& voice_info,
|
||||||
VoiceState& dsp_state,
|
VoiceState& dsp_state,
|
||||||
s32 mix_buffer_count, s32 channel) {
|
[[maybe_unused]] s32 mix_buffer_count,
|
||||||
|
[[maybe_unused]] s32 channel) {
|
||||||
for (std::size_t i = 0; i < AudioCommon::MAX_BIQUAD_FILTERS; i++) {
|
for (std::size_t i = 0; i < AudioCommon::MAX_BIQUAD_FILTERS; i++) {
|
||||||
const auto& in_params = voice_info.GetInParams();
|
const auto& in_params = voice_info.GetInParams();
|
||||||
auto& biquad_filter = in_params.biquad_filter[i];
|
auto& biquad_filter = in_params.biquad_filter[i];
|
||||||
|
@ -278,9 +279,12 @@ void CommandGenerator::GenerateBiquadFilterCommandForVoice(ServerVoiceInfo& voic
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioCore::CommandGenerator::GenerateBiquadFilterCommand(
|
void CommandGenerator::GenerateBiquadFilterCommand([[maybe_unused]] s32 mix_buffer_id,
|
||||||
s32 mix_buffer, const BiquadFilterParameter& params, std::array<s64, 2>& state,
|
const BiquadFilterParameter& params,
|
||||||
std::size_t input_offset, std::size_t output_offset, s32 sample_count, s32 node_id) {
|
std::array<s64, 2>& state,
|
||||||
|
std::size_t input_offset,
|
||||||
|
std::size_t output_offset, s32 sample_count,
|
||||||
|
s32 node_id) {
|
||||||
if (dumping_frame) {
|
if (dumping_frame) {
|
||||||
LOG_DEBUG(Audio,
|
LOG_DEBUG(Audio,
|
||||||
"(DSP_TRACE) GenerateBiquadFilterCommand node_id={}, "
|
"(DSP_TRACE) GenerateBiquadFilterCommand node_id={}, "
|
||||||
|
@ -714,7 +718,8 @@ s32 CommandGenerator::DecodePcm16(ServerVoiceInfo& voice_info, VoiceState& dsp_s
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 CommandGenerator::DecodeAdpcm(ServerVoiceInfo& voice_info, VoiceState& dsp_state,
|
s32 CommandGenerator::DecodeAdpcm(ServerVoiceInfo& voice_info, VoiceState& dsp_state,
|
||||||
s32 sample_count, s32 channel, std::size_t mix_offset) {
|
s32 sample_count, [[maybe_unused]] s32 channel,
|
||||||
|
std::size_t mix_offset) {
|
||||||
const auto& in_params = voice_info.GetInParams();
|
const auto& in_params = voice_info.GetInParams();
|
||||||
const auto& wave_buffer = in_params.wave_buffer[dsp_state.wave_buffer_index];
|
const auto& wave_buffer = in_params.wave_buffer[dsp_state.wave_buffer_index];
|
||||||
if (wave_buffer.buffer_address == 0) {
|
if (wave_buffer.buffer_address == 0) {
|
||||||
|
|
|
@ -25,10 +25,10 @@ using MixVolumeBuffer = std::array<float, AudioCommon::MAX_MIX_BUFFERS>;
|
||||||
|
|
||||||
class CommandGenerator {
|
class CommandGenerator {
|
||||||
public:
|
public:
|
||||||
explicit CommandGenerator(AudioCommon::AudioRendererParameter& worker_params,
|
explicit CommandGenerator(AudioCommon::AudioRendererParameter& worker_params_,
|
||||||
VoiceContext& voice_context, MixContext& mix_context,
|
VoiceContext& voice_context_, MixContext& mix_context_,
|
||||||
SplitterContext& splitter_context, EffectContext& effect_context,
|
SplitterContext& splitter_context_, EffectContext& effect_context_,
|
||||||
Core::Memory::Memory& memory);
|
Core::Memory::Memory& memory_);
|
||||||
~CommandGenerator();
|
~CommandGenerator();
|
||||||
|
|
||||||
void ClearMixBuffers();
|
void ClearMixBuffers();
|
||||||
|
|
|
@ -21,9 +21,9 @@ namespace AudioCore {
|
||||||
|
|
||||||
class CubebSinkStream final : public SinkStream {
|
class CubebSinkStream final : public SinkStream {
|
||||||
public:
|
public:
|
||||||
CubebSinkStream(cubeb* ctx, u32 sample_rate, u32 num_channels_, cubeb_devid output_device,
|
CubebSinkStream(cubeb* ctx_, u32 sample_rate, u32 num_channels_, cubeb_devid output_device,
|
||||||
const std::string& name)
|
const std::string& name)
|
||||||
: ctx{ctx}, num_channels{std::min(num_channels_, 6u)}, time_stretch{sample_rate,
|
: ctx{ctx_}, num_channels{std::min(num_channels_, 6u)}, time_stretch{sample_rate,
|
||||||
num_channels} {
|
num_channels} {
|
||||||
|
|
||||||
cubeb_stream_params params{};
|
cubeb_stream_params params{};
|
||||||
|
@ -192,8 +192,9 @@ SinkStream& CubebSink::AcquireSinkStream(u32 sample_rate, u32 num_channels,
|
||||||
return *sink_streams.back();
|
return *sink_streams.back();
|
||||||
}
|
}
|
||||||
|
|
||||||
long CubebSinkStream::DataCallback(cubeb_stream* stream, void* user_data, const void* input_buffer,
|
long CubebSinkStream::DataCallback([[maybe_unused]] cubeb_stream* stream, void* user_data,
|
||||||
void* output_buffer, long num_frames) {
|
[[maybe_unused]] const void* input_buffer, void* output_buffer,
|
||||||
|
long num_frames) {
|
||||||
auto* impl = static_cast<CubebSinkStream*>(user_data);
|
auto* impl = static_cast<CubebSinkStream*>(user_data);
|
||||||
auto* buffer = static_cast<u8*>(output_buffer);
|
auto* buffer = static_cast<u8*>(output_buffer);
|
||||||
|
|
||||||
|
@ -236,7 +237,9 @@ long CubebSinkStream::DataCallback(cubeb_stream* stream, void* user_data, const
|
||||||
return num_frames;
|
return num_frames;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CubebSinkStream::StateCallback(cubeb_stream* stream, void* user_data, cubeb_state state) {}
|
void CubebSinkStream::StateCallback([[maybe_unused]] cubeb_stream* stream,
|
||||||
|
[[maybe_unused]] void* user_data,
|
||||||
|
[[maybe_unused]] cubeb_state state) {}
|
||||||
|
|
||||||
std::vector<std::string> ListCubebSinkDevices() {
|
std::vector<std::string> ListCubebSinkDevices() {
|
||||||
std::vector<std::string> device_list;
|
std::vector<std::string> device_list;
|
||||||
|
|
|
@ -12,7 +12,7 @@ bool ValidChannelCountForEffect(s32 channel_count) {
|
||||||
}
|
}
|
||||||
} // namespace
|
} // 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);
|
effects.reserve(effect_count);
|
||||||
std::generate_n(std::back_inserter(effects), effect_count,
|
std::generate_n(std::back_inserter(effects), effect_count,
|
||||||
[] { return std::make_unique<EffectStubbed>(); });
|
[] { return std::make_unique<EffectStubbed>(); });
|
||||||
|
@ -61,13 +61,13 @@ const EffectBase* EffectContext::GetInfo(std::size_t i) const {
|
||||||
return effects.at(i).get();
|
return effects.at(i).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
EffectStubbed::EffectStubbed() : EffectBase::EffectBase(EffectType::Invalid) {}
|
EffectStubbed::EffectStubbed() : EffectBase(EffectType::Invalid) {}
|
||||||
EffectStubbed::~EffectStubbed() = default;
|
EffectStubbed::~EffectStubbed() = default;
|
||||||
|
|
||||||
void EffectStubbed::Update(EffectInfo::InParams& in_params) {}
|
void EffectStubbed::Update([[maybe_unused]] EffectInfo::InParams& in_params) {}
|
||||||
void EffectStubbed::UpdateForCommandGeneration() {}
|
void EffectStubbed::UpdateForCommandGeneration() {}
|
||||||
|
|
||||||
EffectBase::EffectBase(EffectType effect_type) : effect_type(effect_type) {}
|
EffectBase::EffectBase(EffectType effect_type_) : effect_type(effect_type_) {}
|
||||||
EffectBase::~EffectBase() = default;
|
EffectBase::~EffectBase() = default;
|
||||||
|
|
||||||
UsageState EffectBase::GetUsage() const {
|
UsageState EffectBase::GetUsage() const {
|
||||||
|
@ -90,32 +90,32 @@ s32 EffectBase::GetProcessingOrder() const {
|
||||||
return processing_order;
|
return processing_order;
|
||||||
}
|
}
|
||||||
|
|
||||||
EffectI3dl2Reverb::EffectI3dl2Reverb() : EffectGeneric::EffectGeneric(EffectType::I3dl2Reverb) {}
|
EffectI3dl2Reverb::EffectI3dl2Reverb() : EffectGeneric(EffectType::I3dl2Reverb) {}
|
||||||
EffectI3dl2Reverb::~EffectI3dl2Reverb() = default;
|
EffectI3dl2Reverb::~EffectI3dl2Reverb() = default;
|
||||||
|
|
||||||
void EffectI3dl2Reverb::Update(EffectInfo::InParams& in_params) {
|
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());
|
const auto* reverb_params = reinterpret_cast<I3dl2ReverbParams*>(in_params.raw.data());
|
||||||
if (!ValidChannelCountForEffect(reverb_params->max_channels)) {
|
if (!ValidChannelCountForEffect(reverb_params->max_channels)) {
|
||||||
UNREACHABLE_MSG("Invalid reverb max channel count {}", reverb_params->max_channels);
|
UNREACHABLE_MSG("Invalid reverb max channel count {}", reverb_params->max_channels);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto last_status = internal_params.status;
|
const auto last_status = params.status;
|
||||||
mix_id = in_params.mix_id;
|
mix_id = in_params.mix_id;
|
||||||
processing_order = in_params.processing_order;
|
processing_order = in_params.processing_order;
|
||||||
internal_params = *reverb_params;
|
params = *reverb_params;
|
||||||
if (!ValidChannelCountForEffect(reverb_params->channel_count)) {
|
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;
|
enabled = in_params.is_enabled;
|
||||||
if (last_status != ParameterStatus::Updated) {
|
if (last_status != ParameterStatus::Updated) {
|
||||||
internal_params.status = last_status;
|
params.status = last_status;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_params.is_new || skipped) {
|
if (in_params.is_new || skipped) {
|
||||||
usage = UsageState::Initialized;
|
usage = UsageState::Initialized;
|
||||||
internal_params.status = ParameterStatus::Initialized;
|
params.status = ParameterStatus::Initialized;
|
||||||
skipped = in_params.buffer_address == 0 || in_params.buffer_size == 0;
|
skipped = in_params.buffer_address == 0 || in_params.buffer_size == 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -129,15 +129,15 @@ void EffectI3dl2Reverb::UpdateForCommandGeneration() {
|
||||||
GetParams().status = ParameterStatus::Updated;
|
GetParams().status = ParameterStatus::Updated;
|
||||||
}
|
}
|
||||||
|
|
||||||
EffectBiquadFilter::EffectBiquadFilter() : EffectGeneric::EffectGeneric(EffectType::BiquadFilter) {}
|
EffectBiquadFilter::EffectBiquadFilter() : EffectGeneric(EffectType::BiquadFilter) {}
|
||||||
EffectBiquadFilter::~EffectBiquadFilter() = default;
|
EffectBiquadFilter::~EffectBiquadFilter() = default;
|
||||||
|
|
||||||
void EffectBiquadFilter::Update(EffectInfo::InParams& in_params) {
|
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());
|
const auto* biquad_params = reinterpret_cast<BiquadFilterParams*>(in_params.raw.data());
|
||||||
mix_id = in_params.mix_id;
|
mix_id = in_params.mix_id;
|
||||||
processing_order = in_params.processing_order;
|
processing_order = in_params.processing_order;
|
||||||
internal_params = *biquad_params;
|
params = *biquad_params;
|
||||||
enabled = in_params.is_enabled;
|
enabled = in_params.is_enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ void EffectBiquadFilter::UpdateForCommandGeneration() {
|
||||||
GetParams().status = ParameterStatus::Updated;
|
GetParams().status = ParameterStatus::Updated;
|
||||||
}
|
}
|
||||||
|
|
||||||
EffectAuxInfo::EffectAuxInfo() : EffectGeneric::EffectGeneric(EffectType::Aux) {}
|
EffectAuxInfo::EffectAuxInfo() : EffectGeneric(EffectType::Aux) {}
|
||||||
EffectAuxInfo::~EffectAuxInfo() = default;
|
EffectAuxInfo::~EffectAuxInfo() = default;
|
||||||
|
|
||||||
void EffectAuxInfo::Update(EffectInfo::InParams& in_params) {
|
void EffectAuxInfo::Update(EffectInfo::InParams& in_params) {
|
||||||
|
@ -200,32 +200,32 @@ VAddr EffectAuxInfo::GetRecvBuffer() const {
|
||||||
return recv_buffer;
|
return recv_buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
EffectDelay::EffectDelay() : EffectGeneric::EffectGeneric(EffectType::Delay) {}
|
EffectDelay::EffectDelay() : EffectGeneric(EffectType::Delay) {}
|
||||||
EffectDelay::~EffectDelay() = default;
|
EffectDelay::~EffectDelay() = default;
|
||||||
|
|
||||||
void EffectDelay::Update(EffectInfo::InParams& in_params) {
|
void EffectDelay::Update(EffectInfo::InParams& in_params) {
|
||||||
const auto* delay_params = reinterpret_cast<DelayParams*>(in_params.raw.data());
|
const auto* delay_params = reinterpret_cast<DelayParams*>(in_params.raw.data());
|
||||||
auto& internal_params = GetParams();
|
auto& params = GetParams();
|
||||||
if (!ValidChannelCountForEffect(delay_params->max_channels)) {
|
if (!ValidChannelCountForEffect(delay_params->max_channels)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto last_status = internal_params.status;
|
const auto last_status = params.status;
|
||||||
mix_id = in_params.mix_id;
|
mix_id = in_params.mix_id;
|
||||||
processing_order = in_params.processing_order;
|
processing_order = in_params.processing_order;
|
||||||
internal_params = *delay_params;
|
params = *delay_params;
|
||||||
if (!ValidChannelCountForEffect(delay_params->channels)) {
|
if (!ValidChannelCountForEffect(delay_params->channels)) {
|
||||||
internal_params.channels = internal_params.max_channels;
|
params.channels = params.max_channels;
|
||||||
}
|
}
|
||||||
enabled = in_params.is_enabled;
|
enabled = in_params.is_enabled;
|
||||||
|
|
||||||
if (last_status != ParameterStatus::Updated) {
|
if (last_status != ParameterStatus::Updated) {
|
||||||
internal_params.status = last_status;
|
params.status = last_status;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_params.is_new || skipped) {
|
if (in_params.is_new || skipped) {
|
||||||
usage = UsageState::Initialized;
|
usage = UsageState::Initialized;
|
||||||
internal_params.status = ParameterStatus::Initialized;
|
params.status = ParameterStatus::Initialized;
|
||||||
skipped = in_params.buffer_address == 0 || in_params.buffer_size == 0;
|
skipped = in_params.buffer_address == 0 || in_params.buffer_size == 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -239,7 +239,7 @@ void EffectDelay::UpdateForCommandGeneration() {
|
||||||
GetParams().status = ParameterStatus::Updated;
|
GetParams().status = ParameterStatus::Updated;
|
||||||
}
|
}
|
||||||
|
|
||||||
EffectBufferMixer::EffectBufferMixer() : EffectGeneric::EffectGeneric(EffectType::BufferMixer) {}
|
EffectBufferMixer::EffectBufferMixer() : EffectGeneric(EffectType::BufferMixer) {}
|
||||||
EffectBufferMixer::~EffectBufferMixer() = default;
|
EffectBufferMixer::~EffectBufferMixer() = default;
|
||||||
|
|
||||||
void EffectBufferMixer::Update(EffectInfo::InParams& in_params) {
|
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;
|
EffectReverb::~EffectReverb() = default;
|
||||||
|
|
||||||
void EffectReverb::Update(EffectInfo::InParams& in_params) {
|
void EffectReverb::Update(EffectInfo::InParams& in_params) {
|
||||||
const auto* reverb_params = reinterpret_cast<ReverbParams*>(in_params.raw.data());
|
const auto* reverb_params = reinterpret_cast<ReverbParams*>(in_params.raw.data());
|
||||||
auto& internal_params = GetParams();
|
auto& params = GetParams();
|
||||||
if (!ValidChannelCountForEffect(reverb_params->max_channels)) {
|
if (!ValidChannelCountForEffect(reverb_params->max_channels)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto last_status = internal_params.status;
|
const auto last_status = params.status;
|
||||||
mix_id = in_params.mix_id;
|
mix_id = in_params.mix_id;
|
||||||
processing_order = in_params.processing_order;
|
processing_order = in_params.processing_order;
|
||||||
internal_params = *reverb_params;
|
params = *reverb_params;
|
||||||
if (!ValidChannelCountForEffect(reverb_params->channels)) {
|
if (!ValidChannelCountForEffect(reverb_params->channels)) {
|
||||||
internal_params.channels = internal_params.max_channels;
|
params.channels = params.max_channels;
|
||||||
}
|
}
|
||||||
enabled = in_params.is_enabled;
|
enabled = in_params.is_enabled;
|
||||||
|
|
||||||
if (last_status != ParameterStatus::Updated) {
|
if (last_status != ParameterStatus::Updated) {
|
||||||
internal_params.status = last_status;
|
params.status = last_status;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_params.is_new || skipped) {
|
if (in_params.is_new || skipped) {
|
||||||
usage = UsageState::Initialized;
|
usage = UsageState::Initialized;
|
||||||
internal_params.status = ParameterStatus::Initialized;
|
params.status = ParameterStatus::Initialized;
|
||||||
skipped = in_params.buffer_address == 0 || in_params.buffer_size == 0;
|
skipped = in_params.buffer_address == 0 || in_params.buffer_size == 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -184,7 +184,7 @@ struct AuxAddress {
|
||||||
|
|
||||||
class EffectBase {
|
class EffectBase {
|
||||||
public:
|
public:
|
||||||
explicit EffectBase(EffectType effect_type);
|
explicit EffectBase(EffectType effect_type_);
|
||||||
virtual ~EffectBase();
|
virtual ~EffectBase();
|
||||||
|
|
||||||
virtual void Update(EffectInfo::InParams& in_params) = 0;
|
virtual void Update(EffectInfo::InParams& in_params) = 0;
|
||||||
|
@ -206,7 +206,7 @@ protected:
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class EffectGeneric : public EffectBase {
|
class EffectGeneric : public EffectBase {
|
||||||
public:
|
public:
|
||||||
explicit EffectGeneric(EffectType effect_type) : EffectBase(effect_type) {}
|
explicit EffectGeneric(EffectType effect_type_) : EffectBase(effect_type_) {}
|
||||||
|
|
||||||
T& GetParams() {
|
T& GetParams() {
|
||||||
return internal_params;
|
return internal_params;
|
||||||
|
@ -306,7 +306,7 @@ private:
|
||||||
|
|
||||||
class EffectContext {
|
class EffectContext {
|
||||||
public:
|
public:
|
||||||
explicit EffectContext(std::size_t effect_count);
|
explicit EffectContext(std::size_t effect_count_);
|
||||||
~EffectContext();
|
~EffectContext();
|
||||||
|
|
||||||
[[nodiscard]] std::size_t GetCount() const;
|
[[nodiscard]] std::size_t GetCount() const;
|
||||||
|
|
|
@ -14,9 +14,9 @@
|
||||||
|
|
||||||
namespace AudioCore {
|
namespace AudioCore {
|
||||||
|
|
||||||
InfoUpdater::InfoUpdater(const std::vector<u8>& in_params, std::vector<u8>& out_params,
|
InfoUpdater::InfoUpdater(const std::vector<u8>& in_params_, std::vector<u8>& out_params_,
|
||||||
BehaviorInfo& behavior_info)
|
BehaviorInfo& behavior_info_)
|
||||||
: in_params(in_params), out_params(out_params), behavior_info(behavior_info) {
|
: in_params(in_params_), out_params(out_params_), behavior_info(behavior_info_) {
|
||||||
ASSERT(
|
ASSERT(
|
||||||
AudioCommon::CanConsumeBuffer(in_params.size(), 0, sizeof(AudioCommon::UpdateDataHeader)));
|
AudioCommon::CanConsumeBuffer(in_params.size(), 0, sizeof(AudioCommon::UpdateDataHeader)));
|
||||||
std::memcpy(&input_header, in_params.data(), sizeof(AudioCommon::UpdateDataHeader));
|
std::memcpy(&input_header, in_params.data(), sizeof(AudioCommon::UpdateDataHeader));
|
||||||
|
@ -135,8 +135,8 @@ bool InfoUpdater::UpdateVoiceChannelResources(VoiceContext& voice_context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InfoUpdater::UpdateVoices(VoiceContext& voice_context,
|
bool InfoUpdater::UpdateVoices(VoiceContext& voice_context,
|
||||||
std::vector<ServerMemoryPoolInfo>& memory_pool_info,
|
[[maybe_unused]] std::vector<ServerMemoryPoolInfo>& memory_pool_info,
|
||||||
VAddr audio_codec_dsp_addr) {
|
[[maybe_unused]] VAddr audio_codec_dsp_addr) {
|
||||||
const auto voice_count = voice_context.GetVoiceCount();
|
const auto voice_count = voice_context.GetVoiceCount();
|
||||||
std::vector<VoiceInfo::InParams> voice_in(voice_count);
|
std::vector<VoiceInfo::InParams> voice_in(voice_count);
|
||||||
std::vector<VoiceInfo::OutParams> voice_out(voice_count);
|
std::vector<VoiceInfo::OutParams> voice_out(voice_count);
|
||||||
|
@ -165,28 +165,28 @@ bool InfoUpdater::UpdateVoices(VoiceContext& voice_context,
|
||||||
|
|
||||||
// Update our voices
|
// Update our voices
|
||||||
for (std::size_t i = 0; i < voice_count; i++) {
|
for (std::size_t i = 0; i < voice_count; i++) {
|
||||||
auto& in_params = voice_in[i];
|
auto& voice_in_params = voice_in[i];
|
||||||
const auto channel_count = static_cast<std::size_t>(in_params.channel_count);
|
const auto channel_count = static_cast<std::size_t>(voice_in_params.channel_count);
|
||||||
// Skip if it's not currently in use
|
// Skip if it's not currently in use
|
||||||
if (!in_params.is_in_use) {
|
if (!voice_in_params.is_in_use) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Voice states for each channel
|
// Voice states for each channel
|
||||||
std::array<VoiceState*, AudioCommon::MAX_CHANNEL_COUNT> voice_states{};
|
std::array<VoiceState*, AudioCommon::MAX_CHANNEL_COUNT> voice_states{};
|
||||||
ASSERT(static_cast<std::size_t>(in_params.id) < voice_count);
|
ASSERT(static_cast<std::size_t>(voice_in_params.id) < voice_count);
|
||||||
|
|
||||||
// Grab our current voice info
|
// Grab our current voice info
|
||||||
auto& voice_info = voice_context.GetInfo(static_cast<std::size_t>(in_params.id));
|
auto& voice_info = voice_context.GetInfo(static_cast<std::size_t>(voice_in_params.id));
|
||||||
|
|
||||||
ASSERT(channel_count <= AudioCommon::MAX_CHANNEL_COUNT);
|
ASSERT(channel_count <= AudioCommon::MAX_CHANNEL_COUNT);
|
||||||
|
|
||||||
// Get all our channel voice states
|
// Get all our channel voice states
|
||||||
for (std::size_t channel = 0; channel < channel_count; channel++) {
|
for (std::size_t channel = 0; channel < channel_count; channel++) {
|
||||||
voice_states[channel] =
|
voice_states[channel] =
|
||||||
&voice_context.GetState(in_params.voice_channel_resource_ids[channel]);
|
&voice_context.GetState(voice_in_params.voice_channel_resource_ids[channel]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_params.is_new) {
|
if (voice_in_params.is_new) {
|
||||||
// Default our values for our voice
|
// Default our values for our voice
|
||||||
voice_info.Initialize();
|
voice_info.Initialize();
|
||||||
if (channel_count == 0 || channel_count > AudioCommon::MAX_CHANNEL_COUNT) {
|
if (channel_count == 0 || channel_count > AudioCommon::MAX_CHANNEL_COUNT) {
|
||||||
|
@ -200,12 +200,12 @@ bool InfoUpdater::UpdateVoices(VoiceContext& voice_context,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update our voice
|
// Update our voice
|
||||||
voice_info.UpdateParameters(in_params, behavior_info);
|
voice_info.UpdateParameters(voice_in_params, behavior_info);
|
||||||
// TODO(ogniK): Handle mapping errors with behavior info based on in params response
|
// TODO(ogniK): Handle mapping errors with behavior info based on in params response
|
||||||
|
|
||||||
// Update our wave buffers
|
// Update our wave buffers
|
||||||
voice_info.UpdateWaveBuffers(in_params, voice_states, behavior_info);
|
voice_info.UpdateWaveBuffers(voice_in_params, voice_states, behavior_info);
|
||||||
voice_info.WriteOutStatus(voice_out[i], in_params, voice_states);
|
voice_info.WriteOutStatus(voice_out[i], voice_in_params, voice_states);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!AudioCommon::CanConsumeBuffer(out_params.size(), output_offset, voice_out_size)) {
|
if (!AudioCommon::CanConsumeBuffer(out_params.size(), output_offset, voice_out_size)) {
|
||||||
|
@ -445,7 +445,7 @@ bool InfoUpdater::UpdatePerformanceBuffer() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InfoUpdater::UpdateErrorInfo(BehaviorInfo& in_behavior_info) {
|
bool InfoUpdater::UpdateErrorInfo([[maybe_unused]] BehaviorInfo& in_behavior_info) {
|
||||||
const auto total_beahvior_info_out = sizeof(BehaviorInfo::OutParams);
|
const auto total_beahvior_info_out = sizeof(BehaviorInfo::OutParams);
|
||||||
|
|
||||||
if (!AudioCommon::CanConsumeBuffer(out_params.size(), output_offset, total_beahvior_info_out)) {
|
if (!AudioCommon::CanConsumeBuffer(out_params.size(), output_offset, total_beahvior_info_out)) {
|
||||||
|
|
|
@ -21,8 +21,8 @@ class SplitterContext;
|
||||||
class InfoUpdater {
|
class InfoUpdater {
|
||||||
public:
|
public:
|
||||||
// TODO(ogniK): Pass process handle when we support it
|
// TODO(ogniK): Pass process handle when we support it
|
||||||
InfoUpdater(const std::vector<u8>& in_params, std::vector<u8>& out_params,
|
InfoUpdater(const std::vector<u8>& in_params_, std::vector<u8>& out_params_,
|
||||||
BehaviorInfo& behavior_info);
|
BehaviorInfo& behavior_info_);
|
||||||
~InfoUpdater();
|
~InfoUpdater();
|
||||||
|
|
||||||
bool UpdateBehaviorInfo(BehaviorInfo& in_behavior_info);
|
bool UpdateBehaviorInfo(BehaviorInfo& in_behavior_info);
|
||||||
|
|
|
@ -10,11 +10,10 @@ namespace AudioCore {
|
||||||
|
|
||||||
ServerMemoryPoolInfo::ServerMemoryPoolInfo() = default;
|
ServerMemoryPoolInfo::ServerMemoryPoolInfo() = default;
|
||||||
ServerMemoryPoolInfo::~ServerMemoryPoolInfo() = default;
|
ServerMemoryPoolInfo::~ServerMemoryPoolInfo() = default;
|
||||||
bool ServerMemoryPoolInfo::Update(const ServerMemoryPoolInfo::InParams& in_params,
|
|
||||||
ServerMemoryPoolInfo::OutParams& out_params) {
|
bool ServerMemoryPoolInfo::Update(const InParams& in_params, OutParams& out_params) {
|
||||||
// Our state does not need to be changed
|
// Our state does not need to be changed
|
||||||
if (in_params.state != ServerMemoryPoolInfo::State::RequestAttach &&
|
if (in_params.state != State::RequestAttach && in_params.state != State::RequestDetach) {
|
||||||
in_params.state != ServerMemoryPoolInfo::State::RequestDetach) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,11 +31,11 @@ bool ServerMemoryPoolInfo::Update(const ServerMemoryPoolInfo::InParams& in_param
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_params.state == ServerMemoryPoolInfo::State::RequestAttach) {
|
if (in_params.state == State::RequestAttach) {
|
||||||
cpu_address = in_params.address;
|
cpu_address = in_params.address;
|
||||||
size = in_params.size;
|
size = in_params.size;
|
||||||
used = true;
|
used = true;
|
||||||
out_params.state = ServerMemoryPoolInfo::State::Attached;
|
out_params.state = State::Attached;
|
||||||
} else {
|
} else {
|
||||||
// Unexpected address
|
// Unexpected address
|
||||||
if (cpu_address != in_params.address) {
|
if (cpu_address != in_params.address) {
|
||||||
|
@ -54,7 +53,7 @@ bool ServerMemoryPoolInfo::Update(const ServerMemoryPoolInfo::InParams& in_param
|
||||||
cpu_address = 0;
|
cpu_address = 0;
|
||||||
size = 0;
|
size = 0;
|
||||||
used = false;
|
used = false;
|
||||||
out_params.state = ServerMemoryPoolInfo::State::Detached;
|
out_params.state = State::Detached;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,19 +28,18 @@ public:
|
||||||
struct InParams {
|
struct InParams {
|
||||||
u64_le address{};
|
u64_le address{};
|
||||||
u64_le size{};
|
u64_le size{};
|
||||||
ServerMemoryPoolInfo::State state{};
|
State state{};
|
||||||
INSERT_PADDING_WORDS(3);
|
INSERT_PADDING_WORDS(3);
|
||||||
};
|
};
|
||||||
static_assert(sizeof(ServerMemoryPoolInfo::InParams) == 0x20, "InParams are an invalid size");
|
static_assert(sizeof(InParams) == 0x20, "InParams are an invalid size");
|
||||||
|
|
||||||
struct OutParams {
|
struct OutParams {
|
||||||
ServerMemoryPoolInfo::State state{};
|
State state{};
|
||||||
INSERT_PADDING_WORDS(3);
|
INSERT_PADDING_WORDS(3);
|
||||||
};
|
};
|
||||||
static_assert(sizeof(ServerMemoryPoolInfo::OutParams) == 0x10, "OutParams are an invalid size");
|
static_assert(sizeof(OutParams) == 0x10, "OutParams are an invalid size");
|
||||||
|
|
||||||
bool Update(const ServerMemoryPoolInfo::InParams& in_params,
|
bool Update(const InParams& in_params, OutParams& out_params);
|
||||||
ServerMemoryPoolInfo::OutParams& out_params);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// There's another entry here which is the DSP address, however since we're not talking to the
|
// There's another entry here which is the DSP address, however since we're not talking to the
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include "audio_core/sink_context.h"
|
#include "audio_core/sink_context.h"
|
||||||
|
|
||||||
namespace AudioCore {
|
namespace AudioCore {
|
||||||
SinkContext::SinkContext(std::size_t sink_count) : sink_count(sink_count) {}
|
SinkContext::SinkContext(std::size_t sink_count_) : sink_count{sink_count_} {}
|
||||||
SinkContext::~SinkContext() = default;
|
SinkContext::~SinkContext() = default;
|
||||||
|
|
||||||
std::size_t SinkContext::GetCount() const {
|
std::size_t SinkContext::GetCount() const {
|
||||||
|
|
|
@ -42,7 +42,7 @@ public:
|
||||||
bool in_use;
|
bool in_use;
|
||||||
INSERT_UNION_PADDING_BYTES(5);
|
INSERT_UNION_PADDING_BYTES(5);
|
||||||
};
|
};
|
||||||
static_assert(sizeof(SinkInfo::CircularBufferIn) == 0x28,
|
static_assert(sizeof(CircularBufferIn) == 0x28,
|
||||||
"SinkInfo::CircularBufferIn is in invalid size");
|
"SinkInfo::CircularBufferIn is in invalid size");
|
||||||
|
|
||||||
struct DeviceIn {
|
struct DeviceIn {
|
||||||
|
@ -54,7 +54,7 @@ public:
|
||||||
bool down_matrix_enabled;
|
bool down_matrix_enabled;
|
||||||
DownmixCoefficients down_matrix_coef;
|
DownmixCoefficients down_matrix_coef;
|
||||||
};
|
};
|
||||||
static_assert(sizeof(SinkInfo::DeviceIn) == 0x11c, "SinkInfo::DeviceIn is an invalid size");
|
static_assert(sizeof(DeviceIn) == 0x11c, "SinkInfo::DeviceIn is an invalid size");
|
||||||
|
|
||||||
struct InParams {
|
struct InParams {
|
||||||
SinkTypes type{};
|
SinkTypes type{};
|
||||||
|
@ -64,16 +64,16 @@ public:
|
||||||
INSERT_PADDING_WORDS(6);
|
INSERT_PADDING_WORDS(6);
|
||||||
union {
|
union {
|
||||||
// std::array<u8, 0x120> raw{};
|
// std::array<u8, 0x120> raw{};
|
||||||
SinkInfo::DeviceIn device;
|
DeviceIn device;
|
||||||
SinkInfo::CircularBufferIn circular_buffer;
|
CircularBufferIn circular_buffer;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
static_assert(sizeof(SinkInfo::InParams) == 0x140, "SinkInfo::InParams are an invalid size!");
|
static_assert(sizeof(InParams) == 0x140, "SinkInfo::InParams are an invalid size!");
|
||||||
};
|
};
|
||||||
|
|
||||||
class SinkContext {
|
class SinkContext {
|
||||||
public:
|
public:
|
||||||
explicit SinkContext(std::size_t sink_count);
|
explicit SinkContext(std::size_t sink_count_);
|
||||||
~SinkContext();
|
~SinkContext();
|
||||||
|
|
||||||
[[nodiscard]] std::size_t GetCount() const;
|
[[nodiscard]] std::size_t GetCount() const;
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
namespace AudioCore {
|
namespace AudioCore {
|
||||||
|
|
||||||
ServerSplitterDestinationData::ServerSplitterDestinationData(s32 id) : id(id) {}
|
ServerSplitterDestinationData::ServerSplitterDestinationData(s32 id_) : id{id_} {}
|
||||||
ServerSplitterDestinationData::~ServerSplitterDestinationData() = default;
|
ServerSplitterDestinationData::~ServerSplitterDestinationData() = default;
|
||||||
|
|
||||||
void ServerSplitterDestinationData::Update(SplitterInfo::InDestinationParams& header) {
|
void ServerSplitterDestinationData::Update(SplitterInfo::InDestinationParams& header) {
|
||||||
|
@ -87,7 +87,7 @@ void ServerSplitterDestinationData::UpdateInternalState() {
|
||||||
needs_update = false;
|
needs_update = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerSplitterInfo::ServerSplitterInfo(s32 id) : id(id) {}
|
ServerSplitterInfo::ServerSplitterInfo(s32 id_) : id(id_) {}
|
||||||
ServerSplitterInfo::~ServerSplitterInfo() = default;
|
ServerSplitterInfo::~ServerSplitterInfo() = default;
|
||||||
|
|
||||||
void ServerSplitterInfo::InitializeInfos() {
|
void ServerSplitterInfo::InitializeInfos() {
|
||||||
|
@ -121,7 +121,7 @@ const ServerSplitterDestinationData* ServerSplitterInfo::GetHead() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerSplitterDestinationData* ServerSplitterInfo::GetData(std::size_t depth) {
|
ServerSplitterDestinationData* ServerSplitterInfo::GetData(std::size_t depth) {
|
||||||
auto current_head = head;
|
auto* current_head = head;
|
||||||
for (std::size_t i = 0; i < depth; i++) {
|
for (std::size_t i = 0; i < depth; i++) {
|
||||||
if (current_head == nullptr) {
|
if (current_head == nullptr) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -132,7 +132,7 @@ ServerSplitterDestinationData* ServerSplitterInfo::GetData(std::size_t depth) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const ServerSplitterDestinationData* ServerSplitterInfo::GetData(std::size_t depth) const {
|
const ServerSplitterDestinationData* ServerSplitterInfo::GetData(std::size_t depth) const {
|
||||||
auto current_head = head;
|
auto* current_head = head;
|
||||||
for (std::size_t i = 0; i < depth; i++) {
|
for (std::size_t i = 0; i < depth; i++) {
|
||||||
if (current_head == nullptr) {
|
if (current_head == nullptr) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -245,7 +245,7 @@ ServerSplitterDestinationData* SplitterContext::GetDestinationData(std::size_t i
|
||||||
const ServerSplitterDestinationData* SplitterContext::GetDestinationData(std::size_t info,
|
const ServerSplitterDestinationData* SplitterContext::GetDestinationData(std::size_t info,
|
||||||
std::size_t data) const {
|
std::size_t data) const {
|
||||||
ASSERT(info < info_count);
|
ASSERT(info < info_count);
|
||||||
auto& cur_info = GetInfo(info);
|
const auto& cur_info = GetInfo(info);
|
||||||
return cur_info.GetData(data);
|
return cur_info.GetData(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,11 +267,11 @@ std::size_t SplitterContext::GetDataCount() const {
|
||||||
return data_count;
|
return data_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SplitterContext::Setup(std::size_t _info_count, std::size_t _data_count,
|
void SplitterContext::Setup(std::size_t info_count_, std::size_t data_count_,
|
||||||
bool is_splitter_bug_fixed) {
|
bool is_splitter_bug_fixed) {
|
||||||
|
|
||||||
info_count = _info_count;
|
info_count = info_count_;
|
||||||
data_count = _data_count;
|
data_count = data_count_;
|
||||||
|
|
||||||
for (std::size_t i = 0; i < info_count; i++) {
|
for (std::size_t i = 0; i < info_count; i++) {
|
||||||
auto& splitter = infos.emplace_back(static_cast<s32>(i));
|
auto& splitter = infos.emplace_back(static_cast<s32>(i));
|
||||||
|
@ -364,7 +364,7 @@ bool SplitterContext::RecomposeDestination(ServerSplitterInfo& info,
|
||||||
// Clear our current destinations
|
// Clear our current destinations
|
||||||
auto* current_head = info.GetHead();
|
auto* current_head = info.GetHead();
|
||||||
while (current_head != nullptr) {
|
while (current_head != nullptr) {
|
||||||
auto next_head = current_head->GetNextDestination();
|
auto* next_head = current_head->GetNextDestination();
|
||||||
current_head->SetNextDestination(nullptr);
|
current_head->SetNextDestination(nullptr);
|
||||||
current_head = next_head;
|
current_head = next_head;
|
||||||
}
|
}
|
||||||
|
@ -471,8 +471,8 @@ bool NodeStates::DepthFirstSearch(EdgeMatrix& edge_matrix) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto node_count = edge_matrix.GetNodeCount();
|
const auto edge_node_count = edge_matrix.GetNodeCount();
|
||||||
for (s32 j = 0; j < static_cast<s32>(node_count); j++) {
|
for (s32 j = 0; j < static_cast<s32>(edge_node_count); j++) {
|
||||||
// Check if our node is connected to our edge matrix
|
// Check if our node is connected to our edge matrix
|
||||||
if (!edge_matrix.Connected(current_stack_index, j)) {
|
if (!edge_matrix.Connected(current_stack_index, j)) {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -63,7 +63,7 @@ public:
|
||||||
NodeStates();
|
NodeStates();
|
||||||
~NodeStates();
|
~NodeStates();
|
||||||
|
|
||||||
void Initialize(std::size_t _node_count);
|
void Initialize(std::size_t node_count_);
|
||||||
bool Tsort(EdgeMatrix& edge_matrix);
|
bool Tsort(EdgeMatrix& edge_matrix);
|
||||||
std::size_t GetIndexPos() const;
|
std::size_t GetIndexPos() const;
|
||||||
const std::vector<s32>& GetIndexList() const;
|
const std::vector<s32>& GetIndexList() const;
|
||||||
|
@ -72,15 +72,15 @@ private:
|
||||||
void PushTsortResult(s32 index);
|
void PushTsortResult(s32 index);
|
||||||
bool DepthFirstSearch(EdgeMatrix& edge_matrix);
|
bool DepthFirstSearch(EdgeMatrix& edge_matrix);
|
||||||
void ResetState();
|
void ResetState();
|
||||||
void UpdateState(NodeStates::State state, std::size_t i);
|
void UpdateState(State state, std::size_t i);
|
||||||
NodeStates::State GetState(std::size_t i);
|
State GetState(std::size_t i);
|
||||||
|
|
||||||
std::size_t node_count{};
|
std::size_t node_count{};
|
||||||
std::vector<bool> was_node_found{};
|
std::vector<bool> was_node_found{};
|
||||||
std::vector<bool> was_node_completed{};
|
std::vector<bool> was_node_completed{};
|
||||||
std::size_t index_pos{};
|
std::size_t index_pos{};
|
||||||
std::vector<s32> index_list{};
|
std::vector<s32> index_list{};
|
||||||
NodeStates::Stack index_stack{};
|
Stack index_stack{};
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class SplitterMagic : u32_le {
|
enum class SplitterMagic : u32_le {
|
||||||
|
@ -97,8 +97,7 @@ public:
|
||||||
s32_le data_count{};
|
s32_le data_count{};
|
||||||
INSERT_PADDING_WORDS(5);
|
INSERT_PADDING_WORDS(5);
|
||||||
};
|
};
|
||||||
static_assert(sizeof(SplitterInfo::InHeader) == 0x20,
|
static_assert(sizeof(InHeader) == 0x20, "SplitterInfo::InHeader is an invalid size");
|
||||||
"SplitterInfo::InHeader is an invalid size");
|
|
||||||
|
|
||||||
struct InInfoPrams {
|
struct InInfoPrams {
|
||||||
SplitterMagic magic{};
|
SplitterMagic magic{};
|
||||||
|
@ -107,8 +106,7 @@ public:
|
||||||
s32_le length{};
|
s32_le length{};
|
||||||
s32_le resource_id_base{};
|
s32_le resource_id_base{};
|
||||||
};
|
};
|
||||||
static_assert(sizeof(SplitterInfo::InInfoPrams) == 0x14,
|
static_assert(sizeof(InInfoPrams) == 0x14, "SplitterInfo::InInfoPrams is an invalid size");
|
||||||
"SplitterInfo::InInfoPrams is an invalid size");
|
|
||||||
|
|
||||||
struct InDestinationParams {
|
struct InDestinationParams {
|
||||||
SplitterMagic magic{};
|
SplitterMagic magic{};
|
||||||
|
@ -118,13 +116,13 @@ public:
|
||||||
bool in_use{};
|
bool in_use{};
|
||||||
INSERT_PADDING_BYTES(3);
|
INSERT_PADDING_BYTES(3);
|
||||||
};
|
};
|
||||||
static_assert(sizeof(SplitterInfo::InDestinationParams) == 0x70,
|
static_assert(sizeof(InDestinationParams) == 0x70,
|
||||||
"SplitterInfo::InDestinationParams is an invalid size");
|
"SplitterInfo::InDestinationParams is an invalid size");
|
||||||
};
|
};
|
||||||
|
|
||||||
class ServerSplitterDestinationData {
|
class ServerSplitterDestinationData {
|
||||||
public:
|
public:
|
||||||
explicit ServerSplitterDestinationData(s32 id);
|
explicit ServerSplitterDestinationData(s32 id_);
|
||||||
~ServerSplitterDestinationData();
|
~ServerSplitterDestinationData();
|
||||||
|
|
||||||
void Update(SplitterInfo::InDestinationParams& header);
|
void Update(SplitterInfo::InDestinationParams& header);
|
||||||
|
@ -153,7 +151,7 @@ private:
|
||||||
|
|
||||||
class ServerSplitterInfo {
|
class ServerSplitterInfo {
|
||||||
public:
|
public:
|
||||||
explicit ServerSplitterInfo(s32 id);
|
explicit ServerSplitterInfo(s32 id_);
|
||||||
~ServerSplitterInfo();
|
~ServerSplitterInfo();
|
||||||
|
|
||||||
void InitializeInfos();
|
void InitializeInfos();
|
||||||
|
|
|
@ -31,10 +31,10 @@ u32 Stream::GetNumChannels() const {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream::Stream(Core::Timing::CoreTiming& core_timing, u32 sample_rate, Format format,
|
Stream::Stream(Core::Timing::CoreTiming& core_timing_, u32 sample_rate_, Format format_,
|
||||||
ReleaseCallback&& release_callback, SinkStream& sink_stream, std::string&& name_)
|
ReleaseCallback&& release_callback_, SinkStream& sink_stream_, std::string&& name_)
|
||||||
: sample_rate{sample_rate}, format{format}, release_callback{std::move(release_callback)},
|
: sample_rate{sample_rate_}, format{format_}, release_callback{std::move(release_callback_)},
|
||||||
sink_stream{sink_stream}, core_timing{core_timing}, name{std::move(name_)} {
|
sink_stream{sink_stream_}, core_timing{core_timing_}, name{std::move(name_)} {
|
||||||
release_event =
|
release_event =
|
||||||
Core::Timing::CreateEvent(name, [this](std::uintptr_t, std::chrono::nanoseconds ns_late) {
|
Core::Timing::CreateEvent(name, [this](std::uintptr_t, std::chrono::nanoseconds ns_late) {
|
||||||
ReleaseActiveBuffer(ns_late);
|
ReleaseActiveBuffer(ns_late);
|
||||||
|
@ -122,7 +122,7 @@ bool Stream::QueueBuffer(BufferPtr&& buffer) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Stream::ContainsBuffer(Buffer::Tag tag) const {
|
bool Stream::ContainsBuffer([[maybe_unused]] Buffer::Tag tag) const {
|
||||||
UNIMPLEMENTED();
|
UNIMPLEMENTED();
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,8 +44,8 @@ public:
|
||||||
/// Callback function type, used to change guest state on a buffer being released
|
/// Callback function type, used to change guest state on a buffer being released
|
||||||
using ReleaseCallback = std::function<void()>;
|
using ReleaseCallback = std::function<void()>;
|
||||||
|
|
||||||
Stream(Core::Timing::CoreTiming& core_timing, u32 sample_rate, Format format,
|
Stream(Core::Timing::CoreTiming& core_timing_, u32 sample_rate_, Format format_,
|
||||||
ReleaseCallback&& release_callback, SinkStream& sink_stream, std::string&& name_);
|
ReleaseCallback&& release_callback_, SinkStream& sink_stream_, std::string&& name_);
|
||||||
|
|
||||||
/// Plays the audio stream
|
/// Plays the audio stream
|
||||||
void Play();
|
void Play();
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
namespace AudioCore {
|
namespace AudioCore {
|
||||||
|
|
||||||
ServerVoiceChannelResource::ServerVoiceChannelResource(s32 id) : id(id) {}
|
ServerVoiceChannelResource::ServerVoiceChannelResource(s32 id_) : id(id_) {}
|
||||||
ServerVoiceChannelResource::~ServerVoiceChannelResource() = default;
|
ServerVoiceChannelResource::~ServerVoiceChannelResource() = default;
|
||||||
|
|
||||||
bool ServerVoiceChannelResource::InUse() const {
|
bool ServerVoiceChannelResource::InUse() const {
|
||||||
|
@ -209,7 +209,8 @@ void ServerVoiceInfo::UpdateWaveBuffers(
|
||||||
|
|
||||||
void ServerVoiceInfo::UpdateWaveBuffer(ServerWaveBuffer& out_wavebuffer,
|
void ServerVoiceInfo::UpdateWaveBuffer(ServerWaveBuffer& out_wavebuffer,
|
||||||
const WaveBuffer& in_wave_buffer, SampleFormat sample_format,
|
const WaveBuffer& in_wave_buffer, SampleFormat sample_format,
|
||||||
bool is_buffer_valid, BehaviorInfo& behavior_info) {
|
bool is_buffer_valid,
|
||||||
|
[[maybe_unused]] BehaviorInfo& behavior_info) {
|
||||||
if (!is_buffer_valid && out_wavebuffer.sent_to_dsp) {
|
if (!is_buffer_valid && out_wavebuffer.sent_to_dsp) {
|
||||||
out_wavebuffer.buffer_address = 0;
|
out_wavebuffer.buffer_address = 0;
|
||||||
out_wavebuffer.buffer_size = 0;
|
out_wavebuffer.buffer_size = 0;
|
||||||
|
@ -400,7 +401,7 @@ bool ServerVoiceInfo::HasValidWaveBuffer(const VoiceState* state) const {
|
||||||
return std::find(valid_wb.begin(), valid_wb.end(), true) != valid_wb.end();
|
return std::find(valid_wb.begin(), valid_wb.end(), true) != valid_wb.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
VoiceContext::VoiceContext(std::size_t voice_count) : voice_count(voice_count) {
|
VoiceContext::VoiceContext(std::size_t voice_count_) : voice_count{voice_count_} {
|
||||||
for (std::size_t i = 0; i < voice_count; i++) {
|
for (std::size_t i = 0; i < voice_count; i++) {
|
||||||
voice_channel_resources.emplace_back(static_cast<s32>(i));
|
voice_channel_resources.emplace_back(static_cast<s32>(i));
|
||||||
sorted_voice_info.push_back(&voice_info.emplace_back());
|
sorted_voice_info.push_back(&voice_info.emplace_back());
|
||||||
|
|
|
@ -118,12 +118,12 @@ public:
|
||||||
bool in_use{};
|
bool in_use{};
|
||||||
INSERT_PADDING_BYTES(11);
|
INSERT_PADDING_BYTES(11);
|
||||||
};
|
};
|
||||||
static_assert(sizeof(VoiceChannelResource::InParams) == 0x70, "InParams is an invalid size");
|
static_assert(sizeof(InParams) == 0x70, "InParams is an invalid size");
|
||||||
};
|
};
|
||||||
|
|
||||||
class ServerVoiceChannelResource {
|
class ServerVoiceChannelResource {
|
||||||
public:
|
public:
|
||||||
explicit ServerVoiceChannelResource(s32 id);
|
explicit ServerVoiceChannelResource(s32 id_);
|
||||||
~ServerVoiceChannelResource();
|
~ServerVoiceChannelResource();
|
||||||
|
|
||||||
bool InUse() const;
|
bool InUse() const;
|
||||||
|
@ -174,7 +174,7 @@ public:
|
||||||
BehaviorFlags behavior_flags{};
|
BehaviorFlags behavior_flags{};
|
||||||
INSERT_PADDING_BYTES(16);
|
INSERT_PADDING_BYTES(16);
|
||||||
};
|
};
|
||||||
static_assert(sizeof(VoiceInfo::InParams) == 0x170, "InParams is an invalid size");
|
static_assert(sizeof(InParams) == 0x170, "InParams is an invalid size");
|
||||||
|
|
||||||
struct OutParams {
|
struct OutParams {
|
||||||
u64_le played_sample_count{};
|
u64_le played_sample_count{};
|
||||||
|
@ -182,7 +182,7 @@ public:
|
||||||
u8 voice_dropped{};
|
u8 voice_dropped{};
|
||||||
INSERT_PADDING_BYTES(3);
|
INSERT_PADDING_BYTES(3);
|
||||||
};
|
};
|
||||||
static_assert(sizeof(VoiceInfo::OutParams) == 0x10, "OutParams is an invalid size");
|
static_assert(sizeof(OutParams) == 0x10, "OutParams is an invalid size");
|
||||||
};
|
};
|
||||||
|
|
||||||
class ServerVoiceInfo {
|
class ServerVoiceInfo {
|
||||||
|
@ -263,7 +263,7 @@ private:
|
||||||
|
|
||||||
class VoiceContext {
|
class VoiceContext {
|
||||||
public:
|
public:
|
||||||
VoiceContext(std::size_t voice_count);
|
explicit VoiceContext(std::size_t voice_count_);
|
||||||
~VoiceContext();
|
~VoiceContext();
|
||||||
|
|
||||||
std::size_t GetVoiceCount() const;
|
std::size_t GetVoiceCount() const;
|
||||||
|
|
|
@ -17,8 +17,8 @@ using base_time_point = std::chrono::time_point<base_timer>;
|
||||||
|
|
||||||
class StandardWallClock final : public WallClock {
|
class StandardWallClock final : public WallClock {
|
||||||
public:
|
public:
|
||||||
StandardWallClock(u64 emulated_cpu_frequency, u64 emulated_clock_frequency)
|
explicit StandardWallClock(u64 emulated_cpu_frequency_, u64 emulated_clock_frequency_)
|
||||||
: WallClock(emulated_cpu_frequency, emulated_clock_frequency, false) {
|
: WallClock(emulated_cpu_frequency_, emulated_clock_frequency_, false) {
|
||||||
start_time = base_timer::now();
|
start_time = base_timer::now();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,9 +38,9 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
WallClock(u64 emulated_cpu_frequency, u64 emulated_clock_frequency, bool is_native)
|
explicit WallClock(u64 emulated_cpu_frequency_, u64 emulated_clock_frequency_, bool is_native_)
|
||||||
: emulated_cpu_frequency{emulated_cpu_frequency},
|
: emulated_cpu_frequency{emulated_cpu_frequency_},
|
||||||
emulated_clock_frequency{emulated_clock_frequency}, is_native{is_native} {}
|
emulated_clock_frequency{emulated_clock_frequency_}, is_native{is_native_} {}
|
||||||
|
|
||||||
u64 emulated_cpu_frequency;
|
u64 emulated_cpu_frequency;
|
||||||
u64 emulated_clock_frequency;
|
u64 emulated_clock_frequency;
|
||||||
|
|
|
@ -43,10 +43,10 @@ u64 EstimateRDTSCFrequency() {
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace X64 {
|
namespace X64 {
|
||||||
NativeClock::NativeClock(u64 emulated_cpu_frequency, u64 emulated_clock_frequency,
|
NativeClock::NativeClock(u64 emulated_cpu_frequency_, u64 emulated_clock_frequency_,
|
||||||
u64 rtsc_frequency)
|
u64 rtsc_frequency_)
|
||||||
: WallClock(emulated_cpu_frequency, emulated_clock_frequency, true), rtsc_frequency{
|
: WallClock(emulated_cpu_frequency_, emulated_clock_frequency_, true), rtsc_frequency{
|
||||||
rtsc_frequency} {
|
rtsc_frequency_} {
|
||||||
_mm_mfence();
|
_mm_mfence();
|
||||||
last_measure = __rdtsc();
|
last_measure = __rdtsc();
|
||||||
accumulated_ticks = 0U;
|
accumulated_ticks = 0U;
|
||||||
|
|
|
@ -14,7 +14,8 @@ namespace Common {
|
||||||
namespace X64 {
|
namespace X64 {
|
||||||
class NativeClock final : public WallClock {
|
class NativeClock final : public WallClock {
|
||||||
public:
|
public:
|
||||||
NativeClock(u64 emulated_cpu_frequency, u64 emulated_clock_frequency, u64 rtsc_frequency);
|
explicit NativeClock(u64 emulated_cpu_frequency_, u64 emulated_clock_frequency_,
|
||||||
|
u64 rtsc_frequency_);
|
||||||
|
|
||||||
std::chrono::nanoseconds GetTimeNS() override;
|
std::chrono::nanoseconds GetTimeNS() override;
|
||||||
|
|
||||||
|
|
|
@ -27,8 +27,8 @@ using TimedCallback =
|
||||||
|
|
||||||
/// Contains the characteristics of a particular event.
|
/// Contains the characteristics of a particular event.
|
||||||
struct EventType {
|
struct EventType {
|
||||||
EventType(TimedCallback&& callback, std::string&& name)
|
explicit EventType(TimedCallback&& callback_, std::string&& name_)
|
||||||
: callback{std::move(callback)}, name{std::move(name)} {}
|
: callback{std::move(callback_)}, name{std::move(name_)} {}
|
||||||
|
|
||||||
/// The event's callback function.
|
/// The event's callback function.
|
||||||
TimedCallback callback;
|
TimedCallback callback;
|
||||||
|
@ -67,8 +67,8 @@ public:
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
|
|
||||||
/// Sets if emulation is multicore or single core, must be set before Initialize
|
/// Sets if emulation is multicore or single core, must be set before Initialize
|
||||||
void SetMulticore(bool is_multicore) {
|
void SetMulticore(bool is_multicore_) {
|
||||||
this->is_multicore = is_multicore;
|
is_multicore = is_multicore_;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Check if it's using host timing.
|
/// Check if it's using host timing.
|
||||||
|
|
|
@ -119,7 +119,7 @@ union ResultCode {
|
||||||
BitField<0, 9, ErrorModule> module;
|
BitField<0, 9, ErrorModule> module;
|
||||||
BitField<9, 13, u32> description;
|
BitField<9, 13, u32> description;
|
||||||
|
|
||||||
constexpr explicit ResultCode(u32 raw) : raw(raw) {}
|
constexpr explicit ResultCode(u32 raw_) : raw(raw_) {}
|
||||||
|
|
||||||
constexpr ResultCode(ErrorModule module_, u32 description_)
|
constexpr ResultCode(ErrorModule module_, u32 description_)
|
||||||
: raw(module.FormatValue(module_) | description.FormatValue(description_)) {}
|
: raw(module.FormatValue(module_) | description.FormatValue(description_)) {}
|
||||||
|
|
Loading…
Reference in a new issue