bunch of stuff to do with controls
This commit is contained in:
parent
d0a259a960
commit
4bf634a767
|
|
@ -61,8 +61,10 @@ void Assigner::handleMidi(MidiEvent* ev) {
|
|||
break;
|
||||
case 0xb0:
|
||||
switch (ev->data[1]) {
|
||||
case 0x01: // modwheel
|
||||
printf("mod wheel %02x\n", ev->data[2]);
|
||||
m->modWheel = ev->data[2];
|
||||
// handle the following
|
||||
// CC 1 - modwheel
|
||||
// CC 64 - sustain // FIXME sustain not implemented
|
||||
// possibly JU-06 CC values
|
||||
default:
|
||||
|
|
@ -72,8 +74,7 @@ void Assigner::handleMidi(MidiEvent* ev) {
|
|||
case 0xc0: // program change
|
||||
break;
|
||||
case 0xe0: // pitch bend
|
||||
m->bend = (int)(ev->data[1] + (ev->data[2]<<7))/2.6667;
|
||||
//printf("pitch bend %04x\n", (ev->data[1] + (ev->data[2]<<7)));
|
||||
m->bend = ((ev->data[1] + (ev->data[2]<<7))>>5)-0x100;
|
||||
break;
|
||||
case 0xf0: // sysex
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ void Module::runLFO() {
|
|||
|
||||
pw = (lfoState & 0x02) ? lfoPhase + 0x2000 : 0x2000 - lfoPhase; // PW LFO is unipolar
|
||||
pw = (patchRam.switch2 & 0x01) ? 0x3fff : pw; // either LFO or "all on"
|
||||
pw = 0x3fff - ((pw * (int)(patchRam.pwmLfo * 1.45)) >> 7); // FIXME tidy up this bit
|
||||
pw = 0x3fff - ((pw * (int)(patchRam.pwmLfo*0.9125)) >> 7); // FIXME tidy up this bit
|
||||
}
|
||||
|
||||
void Module::run(Voice* voices, uint32_t blockSize) {
|
||||
|
|
@ -101,9 +101,6 @@ void Module::run(Voice* voices, uint32_t blockSize) {
|
|||
|
||||
master = powf(2, (patchRam.vca / 31.75 - 4.0f)) * 0.1;
|
||||
|
||||
// originally I had 0.28, 0.36, 0.4
|
||||
// measurement suggests that saw and square are around 100mV each with sub 160mV
|
||||
|
||||
square = (patchRam.switch1 & 0x08) ? 1 : 0;
|
||||
saw = (patchRam.switch1 & 0x10) ? 1 : 0;
|
||||
sub = (patchRam.sub / 127.0f) * 1.4;
|
||||
|
|
@ -132,19 +129,21 @@ void Module::run(Voice* voices, uint32_t blockSize) {
|
|||
}
|
||||
|
||||
lfoToVco = (lfoDepthTable[patchRam.vcoLfo] * lfoDelay) >> 8; // lookup table is 0-255
|
||||
lfoToVco += /* lfo from modwheel FIXME */ 0;
|
||||
lfoToVco += ((int)(modWheel * modDepth));
|
||||
|
||||
if (lfoToVco > 0xff) lfoToVco = 0xff;
|
||||
lfoToVco = (lfo * lfoToVco) >> 11; // 8 for normalisation plus three additional DSLR EA
|
||||
|
||||
lfoToVcf = (patchRam.vcfLfo * lfoDelay) >> 7; // value is 0-127
|
||||
lfoToVcf = (lfo * lfoToVcf) >> 9; // 8 for normalisation plus one additional DSLR EA
|
||||
|
||||
int16_t pitchBase = 0x0c18, vcfBase = 0;
|
||||
int16_t pitchBase = 0x1818, vcfBase = 0;
|
||||
pitchBase += lfoToVco;
|
||||
pitchBase += bend;
|
||||
pitchBase += vcoBendDepth * bend;
|
||||
|
||||
vcfBase = (patchRam.vcfFreq << 7) + /* vcf bend FIXME */ 0;
|
||||
vcfBase = (patchRam.vcfFreq << 7);
|
||||
vcfBase += lfoToVcf;
|
||||
vcfBase += vcfBendDepth * bend;
|
||||
if (vcfBase > 0x3fff) vcfBase = 0x3fff;
|
||||
if (vcfBase < 0x0000) vcfBase = 0x0000;
|
||||
|
||||
|
|
@ -192,7 +191,7 @@ void Module::run(Voice* voices, uint32_t blockSize) {
|
|||
// per voice we need to calculate the key follow amount and envelope amount
|
||||
v->vcfCut = vcfBase + (((v->env * patchRam.vcfEnv) >> 7) * ((patchRam.switch2 & 0x02) ? -1 : 1));
|
||||
|
||||
v->vcfCut += (int)((v->note - 36) * (patchRam.vcfKey << 1) * 0.375);
|
||||
v->vcfCut += (int)((v->note - 60) * (patchRam.vcfKey << 1) * 0.375);
|
||||
|
||||
if (v->vcfCut > 0x3fff) v->vcfCut = 0x3fff;
|
||||
if (v->vcfCut < 0) v->vcfCut = 0;
|
||||
|
|
|
|||
|
|
@ -43,8 +43,8 @@ class Module {
|
|||
uint16_t a, d, s, r;
|
||||
|
||||
float saw = 0, square = 0, sub = 0, noise = 0, master = 0;
|
||||
int16_t bend = 0x0c00;
|
||||
|
||||
int16_t bend = 0, modWheel=0;
|
||||
float vcoBendDepth = 4, vcfBendDepth=1.5, modDepth=.5;
|
||||
struct {
|
||||
uint8_t lfoRate = 0x1f;
|
||||
uint8_t lfoDelay = 0x00;
|
||||
|
|
|
|||
|
|
@ -309,19 +309,35 @@ void Peacock::initParameter(uint32_t index, Parameter& parameter) {
|
|||
enumValues[2].label = "Fast";
|
||||
parameter.enumValues.values = enumValues;
|
||||
}
|
||||
/*
|
||||
case pModWheel:
|
||||
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;
|
||||
*/
|
||||
break;
|
||||
|
||||
case pVcoBend:
|
||||
parameter.hints = kParameterIsAutomatable;
|
||||
parameter.name = "VCO Bend";
|
||||
parameter.symbol = "pfau_vcobend";
|
||||
parameter.ranges.min = 0.0f;
|
||||
parameter.ranges.max = 12.0f;
|
||||
parameter.ranges.def = 4.0f;
|
||||
break;
|
||||
|
||||
case pVcfBend:
|
||||
parameter.hints = kParameterIsAutomatable;
|
||||
parameter.name = "VCF Bend";
|
||||
parameter.symbol = "pfau_vcfbend";
|
||||
parameter.ranges.min = 0.0f;
|
||||
parameter.ranges.max = 42.0f;
|
||||
parameter.ranges.def = 4.0f;
|
||||
break;
|
||||
|
||||
case pModDepth:
|
||||
parameter.hints = kParameterIsAutomatable;
|
||||
parameter.name = "Mod Depth";
|
||||
parameter.symbol = "pfau_moddepth";
|
||||
parameter.ranges.min = 0.0f;
|
||||
parameter.ranges.max = 4.0f;
|
||||
parameter.ranges.def = 0.5f;
|
||||
break;
|
||||
}
|
||||
// chorus, porta, bend range, key mode still to do
|
||||
}
|
||||
|
||||
void Peacock::setParameterValue(uint32_t index, float value) {
|
||||
|
|
@ -341,7 +357,7 @@ void Peacock::setParameterValue(uint32_t index, float value) {
|
|||
m->patchRam.vcoLfo = value;
|
||||
break;
|
||||
case pPWMDepth:
|
||||
m->patchRam.pwmLfo = value / 1.27;
|
||||
m->patchRam.pwmLfo = value;
|
||||
break;
|
||||
case pSubLevel:
|
||||
m->patchRam.sub = value;
|
||||
|
|
@ -434,10 +450,15 @@ void Peacock::setParameterValue(uint32_t index, float value) {
|
|||
m->patchRam.switch2 &= 0xe7;
|
||||
m->patchRam.switch2 |= (3 - (int)value) << 3;
|
||||
break;
|
||||
/*
|
||||
case pModWheel:
|
||||
//s.ff64 = (int)value << 1;
|
||||
break;*/
|
||||
case pVcoBend:
|
||||
m->vcoBendDepth = value;
|
||||
break;
|
||||
case pVcfBend:
|
||||
m->vcfBendDepth = value / 2.66f;
|
||||
break;
|
||||
case pModDepth:
|
||||
m->modDepth = value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -466,7 +487,7 @@ float Peacock::getParameterValue(uint32_t index) const {
|
|||
return m->patchRam.vcoLfo;
|
||||
break;
|
||||
case pPWMDepth:
|
||||
return m->patchRam.pwmLfo * 1.27f;
|
||||
return m->patchRam.pwmLfo;
|
||||
break;
|
||||
|
||||
case pPWMMode:
|
||||
|
|
@ -536,6 +557,16 @@ float Peacock::getParameterValue(uint32_t index) const {
|
|||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case pVcoBend:
|
||||
return m->vcoBendDepth;
|
||||
break;
|
||||
case pVcfBend:
|
||||
return m->vcfBendDepth * 2.66f;
|
||||
break;
|
||||
case pModDepth:
|
||||
return m->modDepth;
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ Peacock::Peacock() : Plugin(parameterCount, 0, 0) {
|
|||
|
||||
sampleRate = getSampleRate();
|
||||
bufferSize = getBufferSize();
|
||||
|
||||
chorus = new Chorus();
|
||||
m = new Module();
|
||||
ic1 = new Assigner;
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ void Voice::run(Module* m, float* buffer, uint32_t framePos, uint32_t samples) {
|
|||
cut = cut / (1 + cut); // correct tuning warp
|
||||
if (cut > 0.7) cut = 0.7;
|
||||
|
||||
float r = 5 * m->res;
|
||||
float r = 6 * m->res;
|
||||
|
||||
float amp = vcaEnv / 32768.0f;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue