annotate CloneChannel/plugins/common/DistrhoPluginMaxGen.cpp @ 19:fff7215ba1e8

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