From be894c562e356383da9fd87e181e2498d01114b6 Mon Sep 17 00:00:00 2001 From: Gordon JC Pearce Date: Thu, 17 Oct 2024 23:22:08 +0100 Subject: [PATCH] added dpf controls, which are not connected to anything yet --- plugin/Makefile | 1 + plugin/controls.cpp | 296 +++++++++++++++++++++++++++++++++++++++++++- plugin/ic29.cpp | 2 +- plugin/peacock.hpp | 29 ++++- 4 files changed, 322 insertions(+), 6 deletions(-) diff --git a/plugin/Makefile b/plugin/Makefile index 6c0a4ec..2967e1e 100644 --- a/plugin/Makefile +++ b/plugin/Makefile @@ -11,6 +11,7 @@ NAME = peacock FILES_DSP = \ peacock.cpp \ + controls.cpp \ ic1.cpp \ oscillator.cpp \ ic29.cpp diff --git a/plugin/controls.cpp b/plugin/controls.cpp index d0d5f88..8efa7c2 100644 --- a/plugin/controls.cpp +++ b/plugin/controls.cpp @@ -16,8 +16,298 @@ CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include "ic1.hpp" - -#include "ic29.hpp" #include "peacock.hpp" +void Peacock::initParameter(uint32_t index, Parameter& parameter) { + switch (index) { + case p_lfoRate: + parameter.hints = kParameterIsAutomatable; + parameter.name = "LFO Rate"; + parameter.symbol = "pfau_lforate"; + parameter.ranges.min = 0.0f; + parameter.ranges.max = 127.0f; + parameter.ranges.def = 48.0f; + parameter.midiCC = 3; + break; + + case p_lfoDelay: + parameter.hints = kParameterIsAutomatable; + parameter.name = "LFO Delay"; + parameter.symbol = "pfau_lfodelay"; + parameter.ranges.min = 0.0f; + parameter.ranges.max = 127.0f; + parameter.ranges.def = 0.0f; + parameter.midiCC = 9; + break; + + case p_vcoRange: + parameter.hints = kParameterIsAutomatable | kParameterIsInteger; + parameter.name = "Range"; + parameter.symbol = "pfau_vcorange"; + parameter.ranges.min = 0.0f; + parameter.ranges.max = 2.0f; + parameter.ranges.def = 1.0f; + parameter.midiCC = 12; + parameter.enumValues.count = 3; + parameter.enumValues.restrictedMode = true; + { + ParameterEnumerationValue* const enumValues = new ParameterEnumerationValue[3]; + enumValues[0].value = 0.0f; + enumValues[0].label = "16'"; + enumValues[1].value = 1.0f; + enumValues[1].label = "8'"; + enumValues[2].value = 2.0f; + enumValues[2].label = "4'"; + parameter.enumValues.values = enumValues; + } + + break; + + case p_vcoLfoMod: + parameter.hints = kParameterIsAutomatable; + parameter.name = "LFO"; + parameter.symbol = "pfau_lfo"; + parameter.ranges.min = 0.0f; + parameter.ranges.max = 127.0f; + parameter.ranges.def = 10.0f; + parameter.midiCC = 13; + break; + + case p_pwmLfoMod: + parameter.hints = kParameterIsAutomatable; + parameter.name = "PWM"; + parameter.symbol = "pfau_pwm"; + parameter.ranges.min = 0.0f; + parameter.ranges.max = 127.0f; + parameter.ranges.def = 48.0f; + parameter.midiCC = 14; + break; + + case p_pwmMode: + parameter.hints = kParameterIsAutomatable | kParameterIsBoolean; + parameter.name = "PWM Mode"; + parameter.symbol = "pfau_pwmmode"; + parameter.ranges.min = 0.0f; + parameter.ranges.max = 1.0f; + parameter.ranges.def = 1.0f; + parameter.midiCC = 15; + parameter.enumValues.count = 2; + parameter.enumValues.restrictedMode = true; + { + ParameterEnumerationValue* const enumValues = new ParameterEnumerationValue[2]; + enumValues[0].value = 0.0f; + enumValues[0].label = "LFO"; + enumValues[1].value = 1.0f; + enumValues[1].label = "MAN"; + parameter.enumValues.values = enumValues; + } + + break; + + case p_sawOn: + parameter.hints = kParameterIsAutomatable | kParameterIsBoolean; + parameter.name = "Saw"; + parameter.symbol = "pfau_saw"; + parameter.ranges.min = 0.0f; + parameter.ranges.max = 1.0f; + parameter.ranges.def = 1.0f; + parameter.midiCC = 17; + break; + + case p_sqrOn: + parameter.hints = kParameterIsAutomatable | kParameterIsBoolean; + parameter.name = "Square"; + parameter.symbol = "pfau_sqr"; + parameter.ranges.min = 0.0f; + parameter.ranges.max = 1.0f; + parameter.ranges.def = 1.0f; + parameter.midiCC = 16; + break; + + case p_subLevel: + parameter.hints = kParameterIsAutomatable; + parameter.name = "Sub Osc"; + parameter.symbol = "pfau_sub"; + parameter.ranges.min = 0.0f; + parameter.ranges.max = 127.0f; + parameter.ranges.def = 0.0f; + parameter.midiCC = 18; + break; + + case p_noiseLevel: + parameter.hints = kParameterIsAutomatable; + parameter.name = "Noise"; + parameter.symbol = "pfau_noise"; + parameter.ranges.min = 0.0f; + parameter.ranges.max = 127.0f; + parameter.ranges.def = 0.0f; + parameter.midiCC = 19; + break; + + case p_hpfMode: + parameter.hints = kParameterIsAutomatable | kParameterIsInteger; + parameter.name = "HPF"; + parameter.symbol = "pfau_hpf"; + parameter.ranges.min = 0.0f; + parameter.ranges.max = 3.0f; + parameter.ranges.def = 0.0f; + parameter.midiCC = 20; + break; + + case p_vcfCutoff: + parameter.hints = kParameterIsAutomatable; + parameter.name = "Freq"; + parameter.symbol = "pfau_freq"; + parameter.ranges.min = 0.0f; + parameter.ranges.max = 127.0f; + parameter.ranges.def = 60.0f; + parameter.midiCC = 74; + break; + case p_vcfReso: + parameter.hints = kParameterIsAutomatable; + parameter.name = "Res"; + parameter.symbol = "pfau_reso"; + parameter.ranges.min = 0.0f; + parameter.ranges.max = 127.0f; + parameter.ranges.def = 0.0f; + parameter.midiCC = 71; + break; + case p_vcfEnvPol: + parameter.hints = kParameterIsAutomatable | kParameterIsInteger; + parameter.name = "Polarity"; + parameter.symbol = "pfau_vcfmode"; + parameter.ranges.min = 0.0f; + parameter.ranges.max = 1.0f; + parameter.ranges.def = 1.0f; + parameter.midiCC = 21; + parameter.enumValues.count = 2; + parameter.enumValues.restrictedMode = true; + { + ParameterEnumerationValue* const enumValues = new ParameterEnumerationValue[2]; + enumValues[0].value = 0.0f; + enumValues[0].label = "POS"; + enumValues[1].value = 1.0f; + enumValues[1].label = "INV"; + parameter.enumValues.values = enumValues; + } + + break; + case p_vcfEnvMod: + parameter.hints = kParameterIsAutomatable; + parameter.name = "Env"; + parameter.symbol = "pfau_vcfenvmod"; + parameter.ranges.min = 0.0f; + parameter.ranges.max = 127.0f; + parameter.ranges.def = 46.0f; + parameter.midiCC = 22; + break; + case p_vcfLFoMod: + parameter.hints = kParameterIsAutomatable; + parameter.name = "LFO"; + parameter.symbol = "pfau_vcflfomod"; + parameter.ranges.min = 0.0f; + parameter.ranges.max = 127.0f; + parameter.ranges.def = 0.0f; + parameter.midiCC = 23; + break; + case p_vcfKeyTrk: + parameter.hints = kParameterIsAutomatable; + parameter.name = "Kybd"; + parameter.symbol = "pfau_vcfkeymod"; + parameter.ranges.min = 0.0f; + parameter.ranges.max = 127.0f; + parameter.ranges.def = 71.0f; + parameter.midiCC = 24; + break; + + case p_attack: + parameter.hints = kParameterIsAutomatable; + parameter.name = "Attack"; + parameter.symbol = "pfau_attack"; + parameter.ranges.min = 0.0f; + parameter.ranges.max = 127.0f; + parameter.ranges.def = 27.0f; + parameter.midiCC = 73; + break; + + case p_decay: + parameter.hints = kParameterIsAutomatable; + parameter.name = "Decay"; + parameter.symbol = "pfau_decay"; + parameter.ranges.min = 0.0f; + parameter.ranges.max = 127.0f; + parameter.ranges.def = 57.0f; + parameter.midiCC = 75; + break; + + case p_sustain: + parameter.hints = kParameterIsAutomatable; + parameter.name = "Sustain"; + parameter.symbol = "pfau_sustain"; + parameter.ranges.min = 0.0f; + parameter.ranges.max = 127.0f; + parameter.ranges.def = 57.0f; + parameter.midiCC = 27; + break; + + case p_release: + parameter.hints = kParameterIsAutomatable; + parameter.name = "Release"; + parameter.symbol = "pfau_release"; + parameter.ranges.min = 0.0f; + parameter.ranges.max = 127.0f; + parameter.ranges.def = 48.0f; + parameter.midiCC = 72; + break; + + case p_vcaEnvGate: + parameter.hints = kParameterIsAutomatable | kParameterIsInteger; // | kParameterIsBoolean; + parameter.name = "Gate"; + parameter.symbol = "pfau_envgate"; + parameter.ranges.min = 0.0f; + parameter.ranges.max = 1.0f; + parameter.ranges.def = 1.0f; + parameter.midiCC = 25; + parameter.enumValues.count = 2; + parameter.enumValues.restrictedMode = true; + { + ParameterEnumerationValue* const enumValues = new ParameterEnumerationValue[2]; + enumValues[0].value = 0.0f; + enumValues[0].label = "ENV"; + enumValues[1].value = 1.0f; + enumValues[1].label = "GATE"; + parameter.enumValues.values = enumValues; + } + break; + + case p_vcaLevel: + parameter.hints = kParameterIsAutomatable; + parameter.name = "VCA Level"; + parameter.symbol = "pfau_vcalevel"; + parameter.ranges.min = 0.0f; + parameter.ranges.max = 127.0f; + parameter.ranges.def = 40.0f; + parameter.midiCC = 26; + break; + + case p_modWheel: + parameter.hints = kParameterIsAutomatable | kParameterIsHidden; + parameter.name = "Mod wheel"; + parameter.symbol = "pfau_modwheel"; + parameter.ranges.min = 0.0f; + parameter.ranges.max = 127.0f; + parameter.ranges.def = 0.0f; + parameter.midiCC = 1; + break; + case p_holdPedal: + parameter.hints = kParameterIsAutomatable | kParameterIsHidden; + parameter.name = "Hold Pedal"; + parameter.symbol = "pfau_holdpedal"; + parameter.ranges.min = 0.0f; + parameter.ranges.max = 127.0f; + parameter.ranges.def = 0.0f; + parameter.midiCC = 64; + break; + } + // chorus, porta, bend range, key mode still to do +} diff --git a/plugin/ic29.cpp b/plugin/ic29.cpp index 1b998b7..966232e 100644 --- a/plugin/ic29.cpp +++ b/plugin/ic29.cpp @@ -191,7 +191,7 @@ void Voice::update() { void Voice::on(uint8_t key) { voiceState = V_ON; note = key; - env.on(); + env.on(); // FIXME move to synth update code } void Voice::off() { diff --git a/plugin/peacock.hpp b/plugin/peacock.hpp index 4892eaf..04c2d7c 100644 --- a/plugin/peacock.hpp +++ b/plugin/peacock.hpp @@ -28,6 +28,32 @@ START_NAMESPACE_DISTRHO class Peacock : public Plugin { public: enum Parameters { + p_lfoRate, + p_lfoDelay, + p_vcoRange, // 16'/8'/4' + p_vcoLfoMod, + p_pwmLfoMod, + p_pwmMode, // LFO/Fixed + p_sawOn, + p_sqrOn, + p_subLevel, + p_noiseLevel, + p_hpfMode, // 0 = bass boost, 1 = flat, 2 = 170Hz, 3 = 350Hz + p_vcfCutoff, + p_vcfReso, + p_vcfEnvPol, // positive / inverted + p_vcfEnvMod, + p_vcfLFoMod, + p_vcfKeyTrk, + p_vcaEnvGate, // env or gate + p_vcaLevel, + p_attack, + p_decay, + p_sustain, + p_release, + p_chorus, // 0, 1, 2 + p_modWheel, + p_holdPedal, paramCount }; @@ -35,7 +61,6 @@ class Peacock : public Plugin { float sampleRate; protected: - const char *getLabel() const override { return "peacock-8"; } const char *getDescription() const override { return "simple polysynth"; @@ -47,7 +72,7 @@ class Peacock : public Plugin { // Initialisation // void initAudioPort(bool input, uint32_t index, AudioPort &port) override; - // void initParameter(uint32_t index, Parameter ¶meter) override; + void initParameter(uint32_t index, Parameter ¶meter) override; // void setParameterValue(uint32_t index, float value) override; // float getParameterValue(uint32_t index) const override;