Compare commits

..

No commits in common. "main" and "ic29" have entirely different histories.
main ... ic29

5 changed files with 4 additions and 354 deletions

View File

@ -11,7 +11,6 @@ NAME = peacock
FILES_DSP = \ FILES_DSP = \
peacock.cpp \ peacock.cpp \
controls.cpp \
ic1.cpp \ ic1.cpp \
oscillator.cpp \ oscillator.cpp \
ic29.cpp ic29.cpp

View File

@ -1,313 +0,0 @@
/*
Peacock-8 VA polysynth
Copyright 2024 Gordon JC Pearce <gordonjcp@gjcp.net>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#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
}

View File

@ -191,7 +191,7 @@ void Voice::update() {
void Voice::on(uint8_t key) { void Voice::on(uint8_t key) {
voiceState = V_ON; voiceState = V_ON;
note = key; note = key;
env.on(); // FIXME move to synth update code env.on();
} }
void Voice::off() { void Voice::off() {

View File

@ -28,8 +28,6 @@ Peacock::Peacock() : Plugin(paramCount, 0, 0), sampleRate(getSampleRate()) {
ic29.buildTables(getSampleRate()); ic29.buildTables(getSampleRate());
} }
void Peacock::runMidi(const MidiEvent *ev, uint32_t count, uint32_t timeLimit) { void Peacock::runMidi(const MidiEvent *ev, uint32_t count, uint32_t timeLimit) {
// handle MIDI events, starting at lastEvent and continuing until timeLimit // handle MIDI events, starting at lastEvent and continuing until timeLimit
uint32_t i; uint32_t i;
@ -43,15 +41,6 @@ void Peacock::runMidi(const MidiEvent *ev, uint32_t count, uint32_t timeLimit) {
lastEvent = i; lastEvent = i;
} }
void Peacock::initAudioPort(bool input, uint32_t index, AudioPort &port) {
port.groupId = kPortGroupStereo;
Plugin::initAudioPort(input, index, port);
if (!input && index == 0) port.name = "Left Out";
if (!input && index == 1) port.name = "Right Out";
}
void Peacock::run(const float **, float **outputs, uint32_t frames, const MidiEvent *midiEvents, uint32_t midiEventCount) { void Peacock::run(const float **, float **outputs, uint32_t frames, const MidiEvent *midiEvents, uint32_t midiEventCount) {
// calculate an entire jack period's worth of samples // calculate an entire jack period's worth of samples
// harder than it sounds because for short jack periods there may be many // harder than it sounds because for short jack periods there may be many

View File

@ -28,32 +28,6 @@ START_NAMESPACE_DISTRHO
class Peacock : public Plugin { class Peacock : public Plugin {
public: public:
enum Parameters { 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 paramCount
}; };
@ -61,6 +35,7 @@ class Peacock : public Plugin {
float sampleRate; float sampleRate;
protected: protected:
const char *getLabel() const override { return "peacock-8"; } const char *getLabel() const override { return "peacock-8"; }
const char *getDescription() const override { const char *getDescription() const override {
return "simple polysynth"; return "simple polysynth";
@ -71,8 +46,8 @@ class Peacock : public Plugin {
int64_t getUniqueId() const override { return d_cconst('P', 'f', 'a', 'u'); } int64_t getUniqueId() const override { return d_cconst('P', 'f', 'a', 'u'); }
// Initialisation // Initialisation
void initAudioPort(bool input, uint32_t index, AudioPort &port) override; // void initAudioPort(bool input, uint32_t index, AudioPort &port) override;
void initParameter(uint32_t index, Parameter &parameter) override; // void initParameter(uint32_t index, Parameter &parameter) override;
// void setParameterValue(uint32_t index, float value) override; // void setParameterValue(uint32_t index, float value) override;
// float getParameterValue(uint32_t index) const override; // float getParameterValue(uint32_t index) const override;