49 lines
1.2 KiB
C++
49 lines
1.2 KiB
C++
/* Copyright 2022 Signalsmith Audio Ltd. / Geraint Luff
|
|
Released under the Boost Software License (see LICENSE.txt) */
|
|
#pragma once
|
|
|
|
#include "stfx/stfx-library.h"
|
|
|
|
namespace signalsmith { namespace basics {
|
|
|
|
template<class BaseEffect>
|
|
struct AnalyserSTFX;
|
|
|
|
using AnalyserFloat = stfx::LibraryEffect<float, AnalyserSTFX>;
|
|
using AnalyserDouble = stfx::LibraryEffect<double, AnalyserSTFX>;
|
|
|
|
template<class BaseEffect>
|
|
struct AnalyserSTFX : public BaseEffect {
|
|
using typename BaseEffect::Sample;
|
|
using typename BaseEffect::ParamRange;
|
|
using typename BaseEffect::ParamStepped;
|
|
|
|
template<class Storage>
|
|
void state(Storage &storage) {
|
|
storage.info("[Basics] Analyser", "A Bark-scale spectrum analyser");
|
|
storage.version(0);
|
|
}
|
|
|
|
template<class Config>
|
|
void configureSTFX(Config &config) {
|
|
config.outputChannels = config.inputChannels;
|
|
config.auxInputs = config.auxOutputs = {};
|
|
}
|
|
|
|
void reset() {}
|
|
|
|
template<class Io, class Config, class Block>
|
|
void processSTFX(Io &io, Config &config, Block &block) {
|
|
for (size_t c = 0; c < config.inputChannels; ++c) {
|
|
auto &input = io.input[c];
|
|
auto &output = io.output[c];
|
|
for (size_t i = 0; i < block.length; ++i) {
|
|
output[i] = input[i];
|
|
}
|
|
}
|
|
|
|
}
|
|
};
|
|
|
|
}} // namespace
|