2016-03-26 03:20:34 +01:00
|
|
|
// 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 "common/common_types.h"
|
|
|
|
|
|
|
|
namespace DSP {
|
|
|
|
namespace HLE {
|
|
|
|
|
2016-04-24 14:20:13 +02:00
|
|
|
constexpr int num_sources = 24;
|
2016-09-18 02:38:01 +02:00
|
|
|
constexpr int samples_per_frame = 160; ///< Samples per audio frame at native sample rate
|
2016-04-24 14:20:13 +02:00
|
|
|
|
2016-03-26 03:20:34 +01:00
|
|
|
/// The final output to the speakers is stereo. Preprocessing output in Source is also stereo.
|
2016-04-24 14:20:13 +02:00
|
|
|
using StereoFrame16 = std::array<std::array<s16, 2>, samples_per_frame>;
|
2016-03-26 03:20:34 +01:00
|
|
|
|
|
|
|
/// The DSP is quadraphonic internally.
|
2016-09-18 02:38:01 +02:00
|
|
|
using QuadFrame32 = std::array<std::array<s32, 4>, samples_per_frame>;
|
2016-03-26 03:20:34 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This performs the filter operation defined by FilterT::ProcessSample on the frame in-place.
|
|
|
|
* FilterT::ProcessSample is called sequentially on the samples.
|
|
|
|
*/
|
2016-09-18 02:38:01 +02:00
|
|
|
template <typename FrameT, typename FilterT>
|
2016-03-26 03:20:34 +01:00
|
|
|
void FilterFrame(FrameT& frame, FilterT& filter) {
|
2016-09-18 02:38:01 +02:00
|
|
|
std::transform(frame.begin(), frame.end(), frame.begin(),
|
|
|
|
[&filter](const auto& sample) { return filter.ProcessSample(sample); });
|
2016-03-26 03:20:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace HLE
|
|
|
|
} // namespace DSP
|