Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
ditherer.h
1// SPDX-FileCopyrightText: © 2024 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3// clang-format off
4/*
5 * This file incorporates work covered by the following copyright and
6 * permission notice:
7 *
8 * ---
9 *
10 * ,--. ,--. ,--. ,--.
11 ,-' '-.,--.--.,--,--.,---.| |,-.,-' '-.`--' ,---. ,--,--, Copyright 2018
12 '-. .-'| .--' ,-. | .--'| /'-. .-',--.| .-. || \ Tracktion Software
13 | | | | \ '-' \ `--.| \ \ | | | |' '-' '| || | Corporation
14 `---' `--' `--`--'`---'`--'`--' `---' `--' `---' `--''--' www.tracktion.com
15 *
16 * Tracktion Engine is published under a dual [GPL3 (or later)](https://www.gnu.org/licenses/gpl-3.0.en.html)/[Commercial license](https://www.tracktion.com/develop/tracktion-engine).
17 *
18 * ---
19 */
20// clang-format on
21
22#ifndef ZRYTHM_DSP_DITHER_H
23#define ZRYTHM_DSP_DITHER_H
24
25namespace zrythm::dsp
26{
27
33{
34public:
35 void reset (int numBits) noexcept;
36
37 void process (float * samps, int num) noexcept;
38
39private:
40 int random1_ = 0, random2_ = 0;
41 float amp_ = 0, offset_ = 0;
42 float s1_ = 0, s2_ = 0;
43};
44
45} // namespace zrythm::dsp
46
47#endif
An extremely naive ditherer.
Definition ditherer.h:33