fsh::stk
fantastic spatial holophonic synthesis toolkit
Loading...
Searching...
No Matches
BufferProtector.h
1/***************************************************************************************************
2 ██████ █████ █████ █████
3 ███░░███ ░░███ ░░███ ░░███
4 ░███ ░░░ █████ ░███████ ██ ██ █████ ███████ ░███ █████
5 ███████ ███░░ ░███░░███ ░░ ░░ ███░░ ░░░███░ ░███░░███
6 ░░░███░ ░░█████ ░███ ░███ ░░█████ ░███ ░██████░
7 ░███ ░░░░███ ░███ ░███ ░░░░███ ░███ ███ ░███░░███
8 █████ ██████ ████ █████ ██ ██ ██████ ░░█████ ████ █████
9 ░░░░░ ░░░░░░ ░░░░ ░░░░░ ░░ ░░ ░░░░░░ ░░░░░ ░░░░ ░░░░░
10
11 fantastic spatial holophonic synthesis tool kit
12
13 copyright (c) fabian hummel
14 www.github.com/fshstk
15 www.fshstk.com
16
17 this file is part of the fantastic spatial holophonic software toolkit (fsh::stk)
18 fsh::stk is free software: it is provided under the terms of the gnu general public license v3.0
19 www.gnu.org/licenses/gpl-3.0
20***************************************************************************************************/
21
22#pragma once
23#include <juce_audio_basics/juce_audio_basics.h>
24
25namespace fsh::util
26{
33{
34public:
36 struct Params
37 {
40 float maxDb = +6.0f;
41 bool allowNaNs = false;
42 };
43
45 void setParams(const Params&);
46
48 void process(juce::AudioBuffer<float>) const;
49
50private:
51 Params _params;
52};
53} // namespace fsh::util
Protect an AudioBuffer by clamping its samples to a given range and/or replacing NaNs with 0....
Definition BufferProtector.h:33
void setParams(const Params &)
Set the parameters for the buffer protector.
Definition BufferProtector.cpp:27
void process(juce::AudioBuffer< float >) const
Process the given buffer according to the current parameters.
Definition BufferProtector.cpp:32
Parameters for the buffer protector.
Definition BufferProtector.h:37
bool allowNaNs
Replace NaNs with 0.0f in the buffer.
Definition BufferProtector.h:41
float maxDb
Clamp all buffer samples to +/- this value (in dB).
Definition BufferProtector.h:40