diff options
author | liamwhite <liamwhite@users.noreply.github.com> | 2022-07-23 21:20:39 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-23 21:20:39 +0200 |
commit | 97729fd8e9c2f8cabc626ab03a666c9428e01c5e (patch) | |
tree | f6a2f3b6c71b51a646d1502c01a4f6be92a3ed26 /src/audio_core/renderer/sink/device_sink_info.cpp | |
parent | Merge pull request #8629 from Docteh/test_transifex (diff) | |
parent | Project Andio (diff) | |
download | yuzu-97729fd8e9c2f8cabc626ab03a666c9428e01c5e.tar yuzu-97729fd8e9c2f8cabc626ab03a666c9428e01c5e.tar.gz yuzu-97729fd8e9c2f8cabc626ab03a666c9428e01c5e.tar.bz2 yuzu-97729fd8e9c2f8cabc626ab03a666c9428e01c5e.tar.lz yuzu-97729fd8e9c2f8cabc626ab03a666c9428e01c5e.tar.xz yuzu-97729fd8e9c2f8cabc626ab03a666c9428e01c5e.tar.zst yuzu-97729fd8e9c2f8cabc626ab03a666c9428e01c5e.zip |
Diffstat (limited to 'src/audio_core/renderer/sink/device_sink_info.cpp')
-rw-r--r-- | src/audio_core/renderer/sink/device_sink_info.cpp | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/audio_core/renderer/sink/device_sink_info.cpp b/src/audio_core/renderer/sink/device_sink_info.cpp new file mode 100644 index 000000000..b7b3d6f1d --- /dev/null +++ b/src/audio_core/renderer/sink/device_sink_info.cpp @@ -0,0 +1,57 @@ +// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "audio_core/renderer/sink/device_sink_info.h" +#include "audio_core/renderer/upsampler/upsampler_manager.h" + +namespace AudioCore::AudioRenderer { + +DeviceSinkInfo::DeviceSinkInfo() { + state.fill(0); + parameter.fill(0); + type = Type::DeviceSink; +} + +void DeviceSinkInfo::CleanUp() { + auto state_{reinterpret_cast<DeviceState*>(state.data())}; + + if (state_->upsampler_info) { + state_->upsampler_info->manager->Free(state_->upsampler_info); + state_->upsampler_info = nullptr; + } + + parameter.fill(0); + type = Type::Invalid; +} + +void DeviceSinkInfo::Update(BehaviorInfo::ErrorInfo& error_info, OutStatus& out_status, + const InParameter& in_params, + [[maybe_unused]] const PoolMapper& pool_mapper) { + + const auto device_params{reinterpret_cast<const DeviceInParameter*>(&in_params.device)}; + auto current_params{reinterpret_cast<DeviceInParameter*>(parameter.data())}; + + if (in_use == in_params.in_use) { + current_params->downmix_enabled = device_params->downmix_enabled; + current_params->downmix_coeff = device_params->downmix_coeff; + } else { + type = in_params.type; + in_use = in_params.in_use; + node_id = in_params.node_id; + *current_params = *device_params; + } + + auto current_state{reinterpret_cast<DeviceState*>(state.data())}; + + for (size_t i = 0; i < current_state->downmix_coeff.size(); i++) { + current_state->downmix_coeff[i] = current_params->downmix_coeff[i]; + } + + std::memset(&out_status, 0, sizeof(OutStatus)); + error_info.error_code = ResultSuccess; + error_info.address = CpuAddr(0); +} + +void DeviceSinkInfo::UpdateForCommandGeneration() {} + +} // namespace AudioCore::AudioRenderer |