comparison DPF-Prymula-audioplugins/plugins/common/DistrhoPluginMaxGen.cpp @ 3:84e66ea83026

DPF-Prymula-audioplugins-0.231015-2
author prymula <prymula76@outlook.com>
date Mon, 16 Oct 2023 21:53:34 +0200
parents
children
comparison
equal deleted inserted replaced
2:cf2cb71d31dd 3:84e66ea83026
1 /*
2 * DPF Max Gen
3 * Copyright (C) 2015 Filipe Coelho <falktx@falktx.com>
4 *
5 * Permission to use, copy, modify, and/or distribute this software for any purpose with
6 * or without fee is hereby granted, provided that the above copyright notice and this
7 * permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
10 * TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
11 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
12 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
13 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17 #include "DistrhoPluginMaxGen.hpp"
18
19 #include "gen_exported.cpp"
20
21 namespace gen = gen_exported;
22
23 START_NAMESPACE_DISTRHO
24
25 // -----------------------------------------------------------------------
26
27 DistrhoPluginMaxGen::DistrhoPluginMaxGen()
28 : Plugin(gen::num_params(), 0, 0), // 0 programs, 0 states
29 fGenState((CommonState*)gen::create(getSampleRate(), getBufferSize()))
30 {
31 gen::reset(fGenState);
32 }
33
34 DistrhoPluginMaxGen::~DistrhoPluginMaxGen()
35 {
36 gen::destroy(fGenState);
37 }
38
39 // -----------------------------------------------------------------------
40 // Init
41
42 void DistrhoPluginMaxGen::initParameter(uint32_t index, Parameter& parameter)
43 {
44 ParamInfo& info(fGenState->params[index]);
45
46 parameter.hints = kParameterIsAutomatable;
47 parameter.name = info.name;
48 parameter.symbol = info.name;
49 parameter.unit = info.units;
50 parameter.ranges.def = info.defaultvalue;
51 parameter.ranges.min = info.outputmin;
52 parameter.ranges.max = info.outputmax;
53 }
54
55 // -----------------------------------------------------------------------
56 // Internal data
57
58 float DistrhoPluginMaxGen::getParameterValue(uint32_t index) const
59 {
60 t_param value = 0.0f;
61 gen::getparameter(fGenState, index, &value);
62 return value;
63 }
64
65 void DistrhoPluginMaxGen::setParameterValue(uint32_t index, float value)
66 {
67 gen::setparameter(fGenState, index, value, nullptr);
68 }
69
70 // -----------------------------------------------------------------------
71 // Process
72
73 void DistrhoPluginMaxGen::run(const float** inputs, float** outputs, uint32_t frames)
74 {
75 gen::perform(fGenState, (float**)inputs, gen::gen_kernel_numins, outputs, gen::gen_kernel_numouts, frames);
76 }
77
78 // -----------------------------------------------------------------------
79
80 Plugin* createPlugin()
81 {
82 return new DistrhoPluginMaxGen();
83 }
84
85 // -----------------------------------------------------------------------
86
87 END_NAMESPACE_DISTRHO
88
89 #include "gen_dsp/genlib.cpp"