DSPark 1.8.0
Header-only C++20 DSP for real-time and offline audio
Loading...
Searching...
No Matches
dspark::AudioProcessor Concept Reference

A type that can prepare, process audio blocks, and reset state. More...

#include <ProcessorTraits.h>

Concept definition

template<typename P, typename T>
concept dspark::AudioProcessor = requires(P p, const AudioSpec& spec, AudioBufferView<T> buf) {
{ p.prepare(spec) };
{ p.processBlock(buf) } noexcept;
{ p.reset() } noexcept;
} && !requires(P p, AudioBufferView<const T> c) {
p.processBlock(c);
}
A type that can prepare, process audio blocks, and reset state.

Detailed Description

A type that can prepare, process audio blocks, and reset state.

This is the foundational concept for effects and filters. Processing and resetting must be guaranteed exception-free (noexcept) to be safely executed within the real-time audio thread.

The processor must write its output back into the buffer it is given: an insert replaces what it reads. A read-only analyser is therefore NOT an AudioProcessor, however real-time safe it is, and the last clause is what says so. It rejects any type whose processBlock also accepts an AudioBufferView<const T>, because a type that can take a const view cannot be writing through the view it was handed. That test is about the constness of the SAMPLES, not of the handle: a processor declared processBlock(const AudioBufferView<T>&) is in-place and still satisfies this concept.

Complete-source operations such as dspark::OfflineLeveler and dspark::OfflineEnergyAnalyzer deliberately lack this callback lifecycle; call their analysis/render operations on a worker thread.

Template Parameters
PProcessor type.
TSample type (float or double).

Definition at line 82 of file ProcessorTraits.h.