/
PhaserPlugin.hpp
103 lines (79 loc) · 2.63 KB
/
PhaserPlugin.hpp
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
/*
* Stone phaser audio effect based on DISTRHO Plugin Framework (DPF)
*
* SPDX-License-Identifier: BSL-1.0
*
* Copyright (C) 2019 Jean Pierre Cimalando <jp-dev@inbox.ru>
*/
#pragma once
#include "DistrhoPlugin.hpp"
#include "StonePhaserDsp.hpp"
#include <memory>
// -----------------------------------------------------------------------
class PhaserPlugin : public DISTRHO::Plugin {
public:
PhaserPlugin();
~PhaserPlugin();
protected:
// -------------------------------------------------------------------
// Information
const char *getLabel() const noexcept override
{
#if DISTRHO_PLUGIN_NUM_INPUTS == 1
return "stone-phaser";
#elif DISTRHO_PLUGIN_NUM_INPUTS == 2
return "stone-phaser-stereo";
#endif
}
const char *getDescription() const noexcept override
{
#if DISTRHO_PLUGIN_NUM_INPUTS == 1
return "A classic analog phaser effect";
#elif DISTRHO_PLUGIN_NUM_INPUTS == 2
return "A classic analog phaser effect (stereo)";
#endif
}
const char *getMaker() const noexcept override
{
return "Jean Pierre Cimalando";
}
const char *getHomePage() const noexcept override
{
return "https://github.com/jpcima/stone-phaser";
}
const char *getLicense() const noexcept override
{
return "https://spdx.org/licenses/BSL-1.0";
}
uint32_t getVersion() const noexcept override
{
return d_version(0, 1, 2);
}
int64_t getUniqueId() const noexcept override
{
#if DISTRHO_PLUGIN_NUM_INPUTS == 1
return d_cconst('s', 's', 'p', '1');
#elif DISTRHO_PLUGIN_NUM_INPUTS == 2
return d_cconst('s', 's', 'p', '2');
#endif
}
// -------------------------------------------------------------------
// Init
void initParameter(uint32_t index, DISTRHO::Parameter ¶meter) override;
// -------------------------------------------------------------------
// Internal data
float getParameterValue(uint32_t index) const override;
void setParameterValue(uint32_t index, float value) override;
// -------------------------------------------------------------------
// Optional
// Optional callback to inform the plugin about a sample rate change.
void sampleRateChanged(double newSampleRate) override;
// -------------------------------------------------------------------
// Process
void activate() override;
void run(const float **inputs, float **outputs, uint32_t frames) override;
// -------------------------------------------------------------------
private:
StonePhaserDsp fDsp;
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(PhaserPlugin)
};