File: noise_generator.h

package info (click to toggle)
lsp-plugins 1.2.5-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 91,856 kB
  • sloc: cpp: 427,831; xml: 57,779; makefile: 9,961; php: 1,005; sh: 18
file content (159 lines) | stat: -rw-r--r-- 6,432 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
/*
 * Copyright (C) 2022 Linux Studio Plugins Project <https://lsp-plug.in/>
 *           (C) 2022 Stefano Tronci <stefano.tronci@protonmail.com>
 *
 * This file is part of lsp-plugins
 * Created on: 27 Feb 2022
 *
 * lsp-plugins is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 *
 * lsp-plugins is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with lsp-plugins. If not, see <https://www.gnu.org/licenses/>.
 */

#ifndef PRIVATE_META_NOISE_GENERATOR_H_
#define PRIVATE_META_NOISE_GENERATOR_H_

#include <lsp-plug.in/dsp-units/misc/envelope.h>
#include <lsp-plug.in/dsp-units/misc/windows.h>
#include <lsp-plug.in/plug-fw/meta/types.h>
#include <lsp-plug.in/plug-fw/const.h>

namespace lsp
{
    //-------------------------------------------------------------------------
    // Plugin metadata
    namespace meta
    {
        typedef struct noise_generator_metadata
        {
            static constexpr float  ZOOM_MIN                    = GAIN_AMP_M_36_DB;
            static constexpr float  ZOOM_MAX                    = GAIN_AMP_0_DB;
            static constexpr float  ZOOM_DFL                    = GAIN_AMP_0_DB;
            static constexpr float  ZOOM_STEP                   = 0.025f;

            static constexpr float  VELVET_WINDOW_DURATION_MIN	= 0.0f;
            static constexpr float  VELVET_WINDOW_DURATION_MAX  = 0.1f;
            static constexpr float  VELVET_WINDOW_DURATION_DFL 	= 0.0f;
            static constexpr float  VELVET_WINDOW_DURATION_STEP	= 1.0e-3f;

            static constexpr float  VELVET_ARN_DELTA_MIN		= 0.0f;
            static constexpr float  VELVET_ARN_DELTA_MAX  		= 1.0f;
            static constexpr float  VELVET_ARN_DELTA_DFL 		= 0.5f;
            static constexpr float  VELVET_ARN_DELTA_STEP		= 1.0e-3f;

            static constexpr float  VELVET_CRUSH_PROB_MIN		= 0.0f;
            static constexpr float  VELVET_CRUSH_PROB_MAX  		= 100.0f;
            static constexpr float  VELVET_CRUSH_PROB_DFL 		= 50.0f;
            static constexpr float  VELVET_CRUSH_PROB_STEP		= 1.0e-2f;

            static constexpr float  NOISE_COLOR_SLOPE_NPN_MIN	= -3.0f;
            static constexpr float  NOISE_COLOR_SLOPE_NPN_MAX	= 3.0f;
            static constexpr float  NOISE_COLOR_SLOPE_NPN_DFL 	= -0.5f;  // Pink
            static constexpr float  NOISE_COLOR_SLOPE_NPN_STEP	= 1.0e-3f;

            static constexpr float  NOISE_COLOR_SLOPE_DBO_MIN	= -18.0f;
            static constexpr float  NOISE_COLOR_SLOPE_DBO_MAX	= 18.0f;
            static constexpr float  NOISE_COLOR_SLOPE_DBO_DFL 	= -3.0f;  // Pink
            static constexpr float  NOISE_COLOR_SLOPE_DBO_STEP	= 2.0e-3f;

            static constexpr float  NOISE_COLOR_SLOPE_DBD_MIN	= -60.0f;
            static constexpr float  NOISE_COLOR_SLOPE_DBD_MAX	= 60.0f;
            static constexpr float  NOISE_COLOR_SLOPE_DBD_DFL 	= -10.0f;  // Pink
            static constexpr float  NOISE_COLOR_SLOPE_DBD_STEP	= 1.0e-2f;

            static constexpr float  IN_GAIN_DFL                 = 1.0f;
            static constexpr float  OUT_GAIN_DFL                = 1.0f;

            static constexpr size_t FFT_RANK                    = 13;
            static constexpr size_t FFT_ITEMS                   = 1 << FFT_RANK;
            static constexpr size_t FFT_WINDOW                  = lsp::dspu::windows::HANN;
            static constexpr size_t FFT_ENVELOPE                = lsp::dspu::envelope::WHITE_NOISE;
            static constexpr size_t FFT_REFRESH_RATE            = 20;
            static constexpr float  FFT_REACT_TIME_MIN          = 0.000f;
            static constexpr float  FFT_REACT_TIME_MAX          = 1.000f;
            static constexpr float  FFT_REACT_TIME_DFL          = 0.200f;
            static constexpr float  FFT_REACT_TIME_STEP         = 0.001f;

            static constexpr float  NOISE_AMPLITUDE_DFL			= 1.0f;

            static constexpr float  NOISE_OFFSET_MIN			= -10.0f;
            static constexpr float  NOISE_OFFSET_MAX  			= 10.0f;
            static constexpr float  NOISE_OFFSET_DFL 			= 0.0f;
            static constexpr float  NOISE_OFFSET_STEP			= 0.1f;

            static constexpr size_t CHANNELS_MAX                = 4;
            static constexpr size_t NUM_GENERATORS              = 4;
            static constexpr size_t MESH_POINTS                 = 640;

            enum noise_type_selector_t
            {
                NOISE_TYPE_OFF,
                NOISE_TYPE_MLS,
                NOISE_TYPE_LCG,
                NOISE_TYPE_VELVET,

                NOISE_TYPE_DFL  = NOISE_TYPE_LCG
            };

            enum noise_color_selector_t
            {
                NOISE_COLOR_WHITE,
                NOISE_COLOR_PINK,
                NOISE_COLOR_RED,
                NOISE_COLOR_BLUE,
                NOISE_COLOR_VIOLET,
                NOISE_COLOR_ARBITRARY_NPN,
                NOISE_COLOR_ARBITRARY_DBO,
                NOISE_COLOR_ARBITRARY_DBD,

                NOISE_COLOR_DFL = NOISE_COLOR_WHITE
            };

            enum lcg_dist_selector_t
            {
                NOISE_LCG_UNIFORM,
                NOISE_LCG_EXPONENTIAL,
                NOISE_LCG_TRIANGULAR,
                NOISE_LCG_GAUSSIAN,

                NOISE_LCG_DFL = NOISE_LCG_UNIFORM
            };

            enum velvet_type_selector_t
            {
                NOISE_VELVET_OVN,
                NOISE_VELVET_OVNA,
                NOISE_VELVET_ARN,
                NOISE_VELVET_TRN,

                NOISE_VELVET_DFL = NOISE_VELVET_OVN
            };

        	enum noise_mode_selector_t
			{
        		CHANNEL_MODE_OVERWRITE,
        		CHANNEL_MODE_ADD,
        		CHANNEL_MODE_MULT,

        		CHANNEL_MODE_DFL = CHANNEL_MODE_ADD
			};

        } noise_generator;

        // Plugin type metadata
        extern const plugin_t noise_generator_x1;
        extern const plugin_t noise_generator_x2;
        extern const plugin_t noise_generator_x4;
    }
}

#endif /* PRIVATE_META_NOISE_GENERATOR_H_ */