mirror of
https://codeberg.org/armin/rmx-19.git
synced 2026-10-11 16:51:55 +02:00
Initial commit: RMX-19 rack sound module (VST3/AU) with dot-matrix LCD UI
This commit is contained in:
commit
c72c0216fd
16 changed files with 2170 additions and 0 deletions
151
Source/PresetBank.cpp
Normal file
151
Source/PresetBank.cpp
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
#include "PresetBank.h"
|
||||
|
||||
// Oscillator wave indices (see prm::waveName)
|
||||
enum { O_SIN = 0, O_TRI, O_SAW, O_PUL, O_NOI };
|
||||
|
||||
// Parameter order matches the prm::desc table:
|
||||
// 0 osc1Wave 1 osc2Wave 2 detune 3 oscMix
|
||||
// 4 fltType 5 fltCutoff 6 fltRes 7 fltEnv 8 fltKey
|
||||
// 9 ampA 10 ampD 11 ampS 12 ampR
|
||||
// 13 fenvA 14 fenvD 15 fenvS 16 fenvR
|
||||
// 17 lfoRate 18 lfoShape 19 lfoDepth 20 lfoTarget
|
||||
// 21 fxType 22 fxAmt 23 fxTime
|
||||
// 24 vol 25 pan 26 poly 27 glide 28 tune
|
||||
|
||||
static const Patch defs[] = {
|
||||
// 1 Warm Pad ---------------------------------------------------------
|
||||
{ "Warm Pad", "POLY PAD", { O_SAW, O_SAW, 8, 55, 1, 2600, 0.20f, 60, 35,
|
||||
0.60f, 1.6f, 0.80f, 1.20f,
|
||||
0.40f, 0.9f, 0.35f, 0.5f,
|
||||
4.0f, 0, 0.18f, 0,
|
||||
1, 0.32f, 0.30f,
|
||||
0.82f, 0.0f, 12, 0.10f, 0 } },
|
||||
// 2 Glass Pad --------------------------------------------------------
|
||||
{ "Glass Pad", "POLY PAD", { O_TRI, O_TRI, 12, 60, 2, 1400, 0.55f, 75, 30,
|
||||
0.80f, 1.8f, 0.90f, 1.60f,
|
||||
0.50f, 1.2f, 0.40f, 0.8f,
|
||||
5.2f, 0, 0.16f, 2,
|
||||
3, 0.38f, 0.40f,
|
||||
0.80f, 0.0f, 12, 0.10f, 0 } },
|
||||
// 3 Dream Pad --------------------------------------------------------
|
||||
{ "Dream Pad", "POLY PAD", { O_SAW, O_PUL, -7, 50, 1, 3000, 0.25f, 70, 40,
|
||||
1.10f, 2.4f, 0.85f, 1.80f,
|
||||
0.60f, 1.4f, 0.30f, 0.9f,
|
||||
0.35f, 1, 0.20f, 0,
|
||||
1, 0.40f, 0.50f,
|
||||
0.80f, 0.0f, 12, 0.15f, 0 } },
|
||||
// 4 Movie Strings ----------------------------------------------------
|
||||
{ "Movie Strings", "POLY PAD", { O_SAW, O_SAW, 6, 45, 1, 2200, 0.15f, 65, 55,
|
||||
0.50f, 1.2f, 0.80f, 0.70f,
|
||||
0.40f, 0.8f, 0.35f, 0.5f,
|
||||
3.1f, 0, 0.10f, 0,
|
||||
3, 0.28f, 0.45f,
|
||||
0.82f, 0.0f, 12, 0.08f, 0 } },
|
||||
// 5 Electric Piano ---------------------------------------------------
|
||||
{ "Electric Piano", "KEY", { O_PUL, O_TRI, 5, 62, 1, 2800, 0.25f, 45, 40,
|
||||
0.004f, 1.4f, 0.30f, 0.40f,
|
||||
0.004f, 0.2f, 0.10f, 0.3f,
|
||||
6.0f, 0, 0.05f, 2,
|
||||
1, 0.35f, 0.30f,
|
||||
0.80f, 0.0f, 12, 0.0f, 0 } },
|
||||
// 6 Acoustic Piano ---------------------------------------------------
|
||||
{ "Acoustic Piano", "KEY", { O_SAW, O_TRI, 3, 55, 1, 5200, 0.18f, 30, 60,
|
||||
0.003f, 2.2f, 0.25f, 0.50f,
|
||||
0.002f, 0.25f, 0.05f, 0.35f,
|
||||
4.0f, 0, 0.03f, 2,
|
||||
1, 0.22f, 0.30f,
|
||||
0.80f, 0.0f, 12, 0.0f, 0 } },
|
||||
// 7 Toy Piano --------------------------------------------------------
|
||||
{ "Toy Piano", "KEY", { O_PUL, O_PUL, 0, 70, 2, 2100, 0.50f, 30, 45,
|
||||
0.002f, 0.35f, 0.0f, 0.18f,
|
||||
0.002f, 0.05f, 0.02f, 0.08f,
|
||||
5.0f, 0, 0.03f, 2,
|
||||
2, 0.18f, 0.17f,
|
||||
0.78f, 0.0f, 12, 0.0f, 0 } },
|
||||
// 8 Clavinet 70 ------------------------------------------------------
|
||||
{ "Clavinet 70", "KEY", { O_PUL, O_PUL, 0, 40, 2, 1500, 0.40f, 60, 30,
|
||||
0.002f, 0.50f, 0.45f, 0.12f,
|
||||
0.001f, 0.05f, 0.05f, 0.10f,
|
||||
4.0f, 0, 0.05f, 0,
|
||||
1, 0.30f, 0.28f,
|
||||
0.84f, 0.0f, 12, 0.0f, 0 } },
|
||||
// 9 Organ Drawbar ----------------------------------------------------
|
||||
{ "Organ Drawbar", "KEY", { O_SAW, O_SAW, 0, 50, 1, 10000, 0.10f, 20, 80,
|
||||
0.010f, 0.10f, 0.98f, 0.10f,
|
||||
0.010f, 0.10f, 0.50f, 0.10f,
|
||||
8.0f, 3, 0.03f, 1,
|
||||
1, 0.20f, 0.28f,
|
||||
0.82f, 0.0f, 8, 0.0f, 0 } },
|
||||
// 10 FM E.Piano ------------------------------------------------------
|
||||
{ "FM E.Piano", "KEY", { O_SIN, O_TRI, 0, 30, 1, 4000, 0.12f, 50, 50,
|
||||
0.002f, 1.0f, 0.50f, 0.30f,
|
||||
0.002f, 0.20f, 0.10f, 0.25f,
|
||||
4.5f, 0, 0.04f, 2,
|
||||
1, 0.40f, 0.30f,
|
||||
0.78f, 0.0f, 12, 0.0f, 0 } },
|
||||
// 11 Analog Bass -----------------------------------------------------
|
||||
{ "Analog Bass", "BASS", { O_PUL, O_SIN, 0, 80, 1, 700, 0.35f, 35, 10,
|
||||
0.002f, 0.30f, 0.82f, 0.12f,
|
||||
0.002f, 0.10f, 0.15f, 0.10f,
|
||||
3.0f, 0, 0.05f, 0,
|
||||
0, 0.0f, 0.30f,
|
||||
0.90f, 0.0f, 1, 0.04f, 0 } },
|
||||
// 12 Sub Rez Bass ----------------------------------------------------
|
||||
{ "Sub Rez Bass", "BASS", { O_SAW, O_PUL, -4, 45, 1, 520, 0.70f, 55, 15,
|
||||
0.004f, 0.40f, 0.70f, 0.10f,
|
||||
0.004f, 0.15f, 0.25f, 0.10f,
|
||||
2.4f, 3, 0.30f, 0,
|
||||
0, 0.0f, 0.30f,
|
||||
0.90f, 0.0f, 2, 0.03f, 0 } },
|
||||
// 13 Saw Lead --------------------------------------------------------
|
||||
{ "Saw Lead", "LEAD", { O_SAW, O_SAW, 14, 50, 1, 3800, 0.25f, 30, 60,
|
||||
0.005f, 0.30f, 0.80f, 0.20f,
|
||||
0.005f, 0.15f, 0.30f, 0.15f,
|
||||
5.4f, 0, 0.14f, 1,
|
||||
0, 0.0f, 0.28f,
|
||||
0.86f, 0.0f, 4, 0.06f, 0 } },
|
||||
// 14 Mr. Square ------------------------------------------------------
|
||||
{ "Mr. Square", "LEAD", { O_PUL, O_PUL, 7, 60, 1, 2400, 0.22f, 20, 70,
|
||||
0.003f, 0.25f, 0.72f, 0.18f,
|
||||
0.003f, 0.12f, 0.25f, 0.12f,
|
||||
6.6f, 0, 0.10f, 1,
|
||||
0, 0.0f, 0.25f,
|
||||
0.84f, 0.0f, 4, 0.05f, 0 } },
|
||||
// 15 Choir Layered ---------------------------------------------------
|
||||
{ "Choir Layered", "POLY PAD",{ O_SAW, O_PUL, 9, 48, 1, 2600, 0.14f, 62, 45,
|
||||
0.35f, 0.80f, 0.85f, 1.10f,
|
||||
0.30f, 0.60f, 0.35f, 0.60f,
|
||||
3.4f, 1, 0.12f, 0,
|
||||
1, 0.38f, 0.42f,
|
||||
0.82f, 0.0f, 12, 0.08f, 0 } },
|
||||
// 16 8-bit Chiptune --------------------------------------------------
|
||||
{ "8bit Chiptune", "LEAD", { O_PUL, O_PUL, 0, 30, 1, 9000, 0.10f, 10, 70,
|
||||
0.003f, 0.12f, 0.90f, 0.12f,
|
||||
0.003f, 0.06f, 0.10f, 0.08f,
|
||||
9.0f, 0, 0.05f, 0,
|
||||
0, 0.0f, 0.20f,
|
||||
0.80f, 0.0f, 6, 0.0f, 0 } },
|
||||
};
|
||||
|
||||
PresetBank::PresetBank()
|
||||
{
|
||||
patches.assign (defs, defs + juce::numElementsInArray (defs));
|
||||
}
|
||||
|
||||
int PresetBank::findByName (const juce::String& name) const
|
||||
{
|
||||
for (int i = 0; i < patches.size(); ++i)
|
||||
if (juce::String (patches[i].name) == name)
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
void PresetBank::writeTo (int i, juce::AudioProcessorValueTreeState& apvts) const
|
||||
{
|
||||
const int n = (int) patches.size();
|
||||
i = juce::jlimit (0, n - 1, i);
|
||||
const Patch& p = patches[i];
|
||||
for (int k = 0; k < prm::num; ++k)
|
||||
if (auto* par = apvts.getParameter (prm::desc (static_cast<prm::Id> (k)).id))
|
||||
par->setValueNotifyingHost (par->convertTo0to1 (p.v[k]));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue