DSPark 1.8.0
Header-only C++20 DSP for real-time and offline audio
Loading...
Searching...
No Matches
AudioSpec.h
1// DSPark -- Professional Audio DSP Framework
2// Copyright (c) 2026 Cristian Moresi -- MIT License
3
4#pragma once
5
22#include <limits>
23
24namespace dspark {
25
37{
45 double sampleRate = 0.0;
46
53 int maxBlockSize = 0;
54
58 int numChannels = 0;
59
71 [[nodiscard]] constexpr bool isValid() const noexcept
72 {
73 return sampleRate > 0.0 && sampleRate <= std::numeric_limits<double>::max()
74 && maxBlockSize > 0 && numChannels > 0;
75 }
76
85 constexpr bool operator==(const AudioSpec&) const noexcept = default;
86};
87
88} // namespace dspark
Main namespace for the DSPark framework.
Describes the audio environment for a DSP processor.
Definition AudioSpec.h:37
constexpr bool isValid() const noexcept
Checks if the specification contains valid, processable parameters.
Definition AudioSpec.h:71
constexpr bool operator==(const AudioSpec &) const noexcept=default
Default member-wise equality (C++20).
int numChannels
Number of audio channels (e.g., 1 = mono, 2 = stereo).
Definition AudioSpec.h:58
int maxBlockSize
Maximum number of samples per processing block.
Definition AudioSpec.h:53
double sampleRate
Sample rate in Hz.
Definition AudioSpec.h:45