diff options
author | bunnei <bunneidev@gmail.com> | 2016-03-31 02:17:52 +0200 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2016-03-31 02:17:52 +0200 |
commit | 644fbbeb13db8147ce74cfbde80f62ee492c201a (patch) | |
tree | 0c9e5ee0a8e9bb98cc2df13d5584f756c7cfeea2 /src/audio_core/hle/common.h | |
parent | Merge pull request #1611 from ObsidianX/cfg-common-fix (diff) | |
parent | DSP: Implement audio filters (simple, biquad) (diff) | |
download | yuzu-644fbbeb13db8147ce74cfbde80f62ee492c201a.tar yuzu-644fbbeb13db8147ce74cfbde80f62ee492c201a.tar.gz yuzu-644fbbeb13db8147ce74cfbde80f62ee492c201a.tar.bz2 yuzu-644fbbeb13db8147ce74cfbde80f62ee492c201a.tar.lz yuzu-644fbbeb13db8147ce74cfbde80f62ee492c201a.tar.xz yuzu-644fbbeb13db8147ce74cfbde80f62ee492c201a.tar.zst yuzu-644fbbeb13db8147ce74cfbde80f62ee492c201a.zip |
Diffstat (limited to 'src/audio_core/hle/common.h')
-rw-r--r-- | src/audio_core/hle/common.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/audio_core/hle/common.h b/src/audio_core/hle/common.h new file mode 100644 index 000000000..37d441eb2 --- /dev/null +++ b/src/audio_core/hle/common.h @@ -0,0 +1,35 @@ +// Copyright 2016 Citra Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include <algorithm> +#include <array> + +#include "audio_core/audio_core.h" + +#include "common/common_types.h" + +namespace DSP { +namespace HLE { + +/// The final output to the speakers is stereo. Preprocessing output in Source is also stereo. +using StereoFrame16 = std::array<std::array<s16, 2>, AudioCore::samples_per_frame>; + +/// The DSP is quadraphonic internally. +using QuadFrame32 = std::array<std::array<s32, 4>, AudioCore::samples_per_frame>; + +/** + * This performs the filter operation defined by FilterT::ProcessSample on the frame in-place. + * FilterT::ProcessSample is called sequentially on the samples. + */ +template<typename FrameT, typename FilterT> +void FilterFrame(FrameT& frame, FilterT& filter) { + std::transform(frame.begin(), frame.end(), frame.begin(), [&filter](const typename FrameT::value_type& sample) { + return filter.ProcessSample(sample); + }); +} + +} // namespace HLE +} // namespace DSP |