Skip to content

Commit a7cdae0

Browse files
committed
add some presets
1 parent 1683d26 commit a7cdae0

File tree

7 files changed

+96
-41
lines changed

7 files changed

+96
-41
lines changed

plugins/string-machine/DistrhoPluginInfo.h

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,46 @@
1717
#define DISTRHO_PLUGIN_HAS_EMBED_UI 1
1818
#define DISTRHO_PLUGIN_HAS_EXTERNAL_UI 0
1919
#define DISTRHO_PLUGIN_IS_RT_SAFE 1
20-
#define DISTRHO_PLUGIN_WANT_PROGRAMS 0
20+
#define DISTRHO_PLUGIN_WANT_PROGRAMS 1
2121
#define DISTRHO_PLUGIN_WANT_STATE 0
2222
#define DISTRHO_PLUGIN_WANT_FULL_STATE 0
23-
#define DISTRHO_PLUGIN_NUM_PROGRAMS 0
2423

2524
#define DISTRHO_PLUGIN_WANT_DIRECT_ACCESS 1
25+
26+
enum {
27+
pIdOscDetune,
28+
pIdOscHpCutoffUpper,
29+
pIdOscHpCutoffLower,
30+
31+
pIdFltLpCutoffUpper,
32+
pIdFltHpCutoffUpper,
33+
pIdFltLpCutoffLower,
34+
pIdFltHpCutoffLower,
35+
pIdFltHsCutoffEq,
36+
pIdFltHsBoostEq,
37+
38+
pIdMixGainUpper,
39+
pIdMixGainLower,
40+
41+
pIdEnvAttack,
42+
pIdEnvDecay,
43+
pIdEnvSustain,
44+
pIdEnvRelease,
45+
46+
pIdChoEnabled,
47+
pIdChoDepth,
48+
pIdChoRate1,
49+
pIdChoDepth1,
50+
pIdChoRate2,
51+
pIdChoDepth2,
52+
53+
pIdMasterGain,
54+
55+
///
56+
Parameter_Count
57+
};
58+
59+
enum {
60+
///
61+
State_Count,
62+
};

plugins/string-machine/StringMachinePlugin.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
#include "StringMachinePlugin.hpp"
2+
#include "StringMachinePresets.hpp"
23
#include "StringSynthDefs.h"
34
#include "DenormalDisabler.h"
45

56
StringMachinePlugin::StringMachinePlugin()
6-
: Plugin(Parameter_Count, DISTRHO_PLUGIN_NUM_PROGRAMS, State_Count)
7+
: Plugin(Parameter_Count, NumPrograms, State_Count)
78
{
89
double sampleRate = getSampleRate();
910

@@ -207,6 +208,21 @@ void StringMachinePlugin::setParameterValue(uint32_t index, float value)
207208
}
208209
}
209210

211+
void StringMachinePlugin::initProgramName(uint32_t index, String &programName)
212+
{
213+
DISTRHO_SAFE_ASSERT_RETURN(index < NumPrograms, );
214+
215+
programName = "Program " + String(index + 1);
216+
}
217+
218+
void StringMachinePlugin::loadProgram(uint32_t index)
219+
{
220+
DISTRHO_SAFE_ASSERT_RETURN(index < NumPrograms, );
221+
222+
for (unsigned p = 0; p < Parameter_Count; ++p)
223+
setParameterValue(p, Programs[index][p]);
224+
}
225+
210226
void StringMachinePlugin::run(const float **, float **outputs, uint32_t totalFrames,
211227
const MidiEvent *midiEvents, uint32_t midiEventCount)
212228
{

plugins/string-machine/StringMachinePlugin.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ class StringMachinePlugin : public Plugin {
2020
float getParameterValue(uint32_t index) const override;
2121
void setParameterValue(uint32_t index, float value) override;
2222

23+
void initProgramName(uint32_t index, String &programName);
24+
void loadProgram(uint32_t index);
25+
2326
void run(const float **inputs, float **outputs, uint32_t frames,
2427
const MidiEvent *midiEvents, uint32_t midiEventCount) override;
2528

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#pragma once
2+
#include "DistrhoPluginInfo.h"
3+
4+
#if !defined(DECL_IGNORABLE)
5+
#if defined(__GNUC__)
6+
#define DECL_IGNORABLE __attribute__((unused))
7+
#else
8+
#define DECL_IGNORABLE
9+
#endif
10+
#endif
11+
12+
DECL_IGNORABLE static float Programs[][Parameter_Count] = {
13+
{ 0.001600, 8.000000, 8.000000, 5.200000, 12.200000, 16.400000, -0.400000, 24.799999, 6.000000, 0.000000, 0.000000, 0.193900, 10.000000, 0.000000, 3.000000, 1.000000, 1.000000, 5.834600, 0.307100, 0.583500, 0.905500, 3.000000, },
14+
{ 0.027129, 13.751908, 3.550329, 111.940819, 113.698227, 3.230055, 82.139847, 52.353306, -5.268259, -2.033016, -3.028452, 4.115991, 7.773351, -29.139240, 2.758555, 1.000000, 0.780778, 6.670492, 0.139527, 0.740738, 0.618650, 12.60000, },
15+
{ 0.043244, 4.417531, 13.443770, 92.953781, 35.042316, 67.681725, 69.532272, 4.708627, 5.136643, -6.126668, -6.568069, 0.030132, 2.951330, -31.476854, 1.425957, 1.000000, 0.478171, 4.960168, 0.373651, 0.565295, 0.362908, 9.400000, },
16+
{ 0.061616, 6.338297, 0.259514, 116.376091, 87.940025, 22.876650, 51.090611, 115.211327, 11.893587, -2.143300, -17.412321, 3.619872, 7.896935, -27.755318, 6.130506, 1.000000, 0.871913, 5.747424, 0.868623, 0.310636, 0.807798, 4.600000, },
17+
{ 0.042498, 16.680204, 15.141696, 74.672966, 22.302313, 13.043892, 18.159254, 16.107967, 6.970053, -12.131934, -4.881592, 1.052701, 5.903785, -1.617218, 2.134185, 0.000000, 0.155884, 3.132591, 0.838435, 0.587004, 0.813793, 11.00000, },
18+
{ 0.015428, 0.469910, 18.814665, -12.824000, 61.583183, -17.186228, 106.693146, 89.783455, -2.160404, -0.042468, -1.470323, 9.855900, 1.745053, -16.969635, 5.553646, 1.000000, 0.536837, 3.643120, 0.525472, 0.671323, 0.687615, 12.60000, },
19+
{ 0.028021, 9.607654, 16.005123, 50.868580, 66.392921, 91.836090, 86.784729, 72.863167, -16.532845, -15.381107, -2.654770, 0.748022, 4.693394, -29.766455, 4.258525, 1.000000, 0.669624, 6.418504, 0.357346, 0.346988, 0.357405, 12.60000, },
20+
{ 0.015421, 10.124370, 4.642849, 31.348833, 93.655632, 103.735344, 35.569157, 104.340355, 16.077915, -9.120691, -0.399578, 2.514343, 8.863074, -17.196754, 1.585154, 1.000000, 0.949236, 3.057504, 0.841852, 0.389675, 0.900703, 4.600000, },
21+
{ 0.025778, 6.603483, 9.939932, 40.520622, 72.934181, -16.914650, 33.332161, 9.397524, -7.853272, -12.375651, -15.463691, 1.411661, 7.472600, -20.249472, 8.633201, 1.000000, 0.553316, 3.856230, 0.921006, 0.369750, 0.939046, 17.40000, },
22+
{ 0.041039, 1.782128, 3.749014, 76.500214, 112.430672, 84.163147, -7.156106, 20.835140, 3.226208, -16.107695, -6.126067, 1.521947, 1.508980, -13.988508, 9.927961, 1.000000, 0.329778, 3.613224, 0.235064, 0.857304, 0.170591, 11.80000, },
23+
{ 0.011156, 1.333257, 14.318451, 8.265411, 99.357086, 4.534880, 14.566812, 94.055496, 14.924463, -1.453580, -9.598715, 5.995292, 6.723666, -32.200966, 8.461777, 1.000000, 0.271058, 5.494833, 0.012325, 0.460241, 0.411218, 4.600000, },
24+
{ 0.050069, 19.217703, 4.409960, 105.867607, 117.830040, -0.604630, 54.132389, 11.490669, 7.113006, -7.439813, -7.781140, 0.158582, 6.742130, -31.624033, 6.370217, 1.000000, 0.100000, 9.000000, 0.010000, 0.359709, 0.077917, 12.600000, },
25+
};
26+
27+
DECL_IGNORABLE static constexpr unsigned NumPrograms = sizeof(Programs) / sizeof(Programs[0]);

plugins/string-machine/StringMachineShared.hpp

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,41 +3,3 @@
33
#include <cstdint>
44

55
void InitParameter(uint32_t index, Parameter &parameter);
6-
7-
enum {
8-
pIdOscDetune,
9-
pIdOscHpCutoffUpper,
10-
pIdOscHpCutoffLower,
11-
12-
pIdFltLpCutoffUpper,
13-
pIdFltHpCutoffUpper,
14-
pIdFltLpCutoffLower,
15-
pIdFltHpCutoffLower,
16-
pIdFltHsCutoffEq,
17-
pIdFltHsBoostEq,
18-
19-
pIdMixGainUpper,
20-
pIdMixGainLower,
21-
22-
pIdEnvAttack,
23-
pIdEnvDecay,
24-
pIdEnvSustain,
25-
pIdEnvRelease,
26-
27-
pIdChoEnabled,
28-
pIdChoDepth,
29-
pIdChoRate1,
30-
pIdChoDepth1,
31-
pIdChoRate2,
32-
pIdChoDepth2,
33-
34-
pIdMasterGain,
35-
36-
///
37-
Parameter_Count
38-
};
39-
40-
enum {
41-
///
42-
State_Count,
43-
};

plugins/string-machine/StringMachineUI.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "StringMachineUI.hpp"
22
#include "StringMachineUILayouts.hpp"
33
#include "StringMachinePlugin.hpp"
4+
#include "StringMachinePresets.hpp"
45
#include "Artwork.hpp"
56
#include "Window.hpp"
67
#include "ui/components/SkinSlider.hpp"
@@ -295,6 +296,14 @@ void StringMachineUI::parameterChanged(uint32_t index, float value)
295296
updateParameterValue(index, value);
296297
}
297298

299+
void StringMachineUI::programLoaded(uint32_t index)
300+
{
301+
DISTRHO_SAFE_ASSERT_RETURN(index < NumPrograms, );
302+
303+
for (unsigned p = 0; p < Parameter_Count; ++p)
304+
parameterChanged(index, Programs[index][p]);
305+
}
306+
298307
void StringMachineUI::uiIdle()
299308
{
300309
StringMachinePlugin *plugin = (StringMachinePlugin *)getPluginInstancePointer();

plugins/string-machine/StringMachineUI.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class StringMachineUI : public UI {
2424
protected:
2525
void onDisplay() override;
2626
void parameterChanged(uint32_t index, float value) override;
27+
void programLoaded(uint32_t index) override;
2728
void uiIdle() override;
2829

2930
bool onKeyboard(const KeyboardEvent &event) override;

0 commit comments

Comments
 (0)