DSPark 1.6.1
Header-only audio DSP framework in pure C++20 — zero dependencies
Loading...
Searching...
No Matches
ProcessorTraits.h File Reference

C++20 concepts defining the strictly real-time DSP processor contract. More...

#include "AudioSpec.h"
#include "AudioBuffer.h"
#include <concepts>
Include dependency graph for ProcessorTraits.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  dspark
 Main namespace for the DSPark framework.
 

Concepts

concept  dspark::AudioProcessor
 A type that can prepare, process audio blocks, and reset state.
 
concept  dspark::SampleProcessor
 An AudioProcessor that additionally supports scalar per-sample processing.
 
concept  dspark::GeneratorProcessor
 A real-time safe source processor (oscillators, noise, LFOs).
 

Detailed Description

C++20 concepts defining the strictly real-time DSP processor contract.

Provides compile-time concepts that formalise what it means to be a DSP processor in this framework. Any class that satisfies these concepts can be used with ProcessorChain and other generic utilities.

Architecture Principles Enforced:

  • No virtual dispatch (resolved at compile time).
  • Real-time safety: All hot-path methods MUST be natively noexcept.
  • Strict type matching (std::same_as) to prevent implicit casting overhead.
  • Generators must support block processing as well as per-sample pulls.
Concept Required methods
AudioProcessor prepare(AudioSpec), processBlock(View) noexcept, reset() noexcept
SampleProcessor Above + processSample(T, int) noexcept -> T
GeneratorProcessor prepare(AudioSpec), generateBlock(View) noexcept, reset() noexcept, getSample() noexcept -> T

Scope note: the contract targets in-place single-buffer inserts and self-contained generators. Multi-buffer or per-call-parameterised utilities (Crossfade, CrossoverFilter, MidSide, AutoGain, the Delay building block, Phasor) intentionally do not model these concepts; wrap them in a small insert class if you need them inside a ProcessorChain.

Dependencies: AudioSpec.h, AudioBuffer.h.

Definition in file ProcessorTraits.h.