much cleanup, more params
This commit is contained in:
parent
a12bbfbda7
commit
b04304f242
1
Makefile
1
Makefile
|
|
@ -9,7 +9,6 @@
|
||||||
|
|
||||||
include dpf/Makefile.base.mk
|
include dpf/Makefile.base.mk
|
||||||
|
|
||||||
CFLAGS += -ggdb
|
|
||||||
all: plugins gen
|
all: plugins gen
|
||||||
|
|
||||||
plugins:
|
plugins:
|
||||||
|
|
|
||||||
|
|
@ -65,16 +65,7 @@
|
||||||
|
|
||||||
pChorus,
|
pChorus,
|
||||||
|
|
||||||
parameterCount,
|
parameterCount
|
||||||
|
|
||||||
btn16,
|
|
||||||
btn8,
|
|
||||||
btn4,
|
|
||||||
btnPls,
|
|
||||||
btnSaw,
|
|
||||||
btnCh0,
|
|
||||||
btnCh1,
|
|
||||||
btnCh2
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,14 +44,12 @@ void Module::run(Voice* voice) {
|
||||||
else
|
else
|
||||||
lfo = (lfoPhase & 0x3fff) - 0x1fff;
|
lfo = (lfoPhase & 0x3fff) - 0x1fff;
|
||||||
|
|
||||||
pw = 0.5- ((0x2000 + lfo) * patchRam.pwmLfo) / (32768.0f*128);
|
pw = 0.5 - ((0x2000 + lfo) * patchRam.pwmLfo) / (32768.0f * 128);
|
||||||
|
pw = (patchRam.switch2 & 0x01) ? 0.5 - (patchRam.pwmLfo / 256.0f) : pw;
|
||||||
// printf("%5d\n", (lfo * lfoDepthTable[patchRam.vcoLfo])>>8);
|
|
||||||
|
|
||||||
int16_t vcf = (patchRam.vcfEnv << 7) * ((patchRam.switch2 & 0x02) ? -1 : 1);
|
int16_t vcf = (patchRam.vcfEnv << 7) * ((patchRam.switch2 & 0x02) ? -1 : 1);
|
||||||
|
|
||||||
int16_t pitchBase = 0x1818;
|
int16_t pitchBase = 0x1818;
|
||||||
|
|
||||||
pitchBase += (lfo * lfoDepthTable[patchRam.vcoLfo]) >> 9;
|
pitchBase += (lfo * lfoDepthTable[patchRam.vcoLfo]) >> 9;
|
||||||
|
|
||||||
for (uint32_t i = 0; i < NUM_VOICES; i++) {
|
for (uint32_t i = 0; i < NUM_VOICES; i++) {
|
||||||
|
|
@ -81,7 +79,7 @@ void Module::run(Voice* voice) {
|
||||||
float p1 = pitchTable[semi], p2 = pitchTable[semi + 1];
|
float p1 = pitchTable[semi], p2 = pitchTable[semi + 1];
|
||||||
int16_t px = ((p2 - p1) * frac + p1);
|
int16_t px = ((p2 - p1) * frac + p1);
|
||||||
|
|
||||||
px <<= (patchRam.switch1 & 0x03);
|
px *= (patchRam.switch1 & 0x07);
|
||||||
|
|
||||||
v->omega = px / 192000.0f; // fixme use proper scaler
|
v->omega = px / 192000.0f; // fixme use proper scaler
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ class Module {
|
||||||
uint8_t vcoLfo = 0x00;
|
uint8_t vcoLfo = 0x00;
|
||||||
uint8_t pwmLfo = 0x60;
|
uint8_t pwmLfo = 0x60;
|
||||||
uint8_t noise = 0x00;
|
uint8_t noise = 0x00;
|
||||||
uint8_t vcfFreq = 0x10;//1c; // 0x3f80
|
uint8_t vcfFreq = 0x30;//1c; // 0x3f80
|
||||||
uint8_t vcfReso = 0x00;
|
uint8_t vcfReso = 0x00;
|
||||||
uint8_t vcfEnv = 0x40;//4e;
|
uint8_t vcfEnv = 0x40;//4e;
|
||||||
uint8_t vcfLfo = 0;
|
uint8_t vcfLfo = 0;
|
||||||
|
|
@ -60,8 +60,8 @@ class Module {
|
||||||
uint8_t env_s = 0x30; // 0x3f80
|
uint8_t env_s = 0x30; // 0x3f80
|
||||||
uint8_t env_r = 0x30;
|
uint8_t env_r = 0x30;
|
||||||
uint8_t sub = 0x40;
|
uint8_t sub = 0x40;
|
||||||
uint8_t switch1 = 0x1a;
|
uint8_t switch1 = 0x19;
|
||||||
uint8_t switch2 = 0x08;
|
uint8_t switch2 = 0x018;
|
||||||
} patchRam;
|
} patchRam;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -367,7 +367,7 @@ void Peacock::setParameterValue(uint32_t index, float value) {
|
||||||
case pVCORange: // bits 0-2 of switch 1
|
case pVCORange: // bits 0-2 of switch 1
|
||||||
// doesn't look great in Carla because of odd behaviour with small integer knobs
|
// doesn't look great in Carla because of odd behaviour with small integer knobs
|
||||||
m->patchRam.switch1 &= 0xf8;
|
m->patchRam.switch1 &= 0xf8;
|
||||||
m->patchRam.switch1 |= (1 << (int)(value - 1));
|
m->patchRam.switch1 |= (1 << (int)(value));
|
||||||
break;
|
break;
|
||||||
case pSqr: // bit 3 of switch 1
|
case pSqr: // bit 3 of switch 1
|
||||||
m->patchRam.switch1 &= 0xf7;
|
m->patchRam.switch1 &= 0xf7;
|
||||||
|
|
@ -398,7 +398,6 @@ void Peacock::setParameterValue(uint32_t index, float value) {
|
||||||
|
|
||||||
case pHPF: // bits 3-4 of switch 2
|
case pHPF: // bits 3-4 of switch 2
|
||||||
// doesn't look great in Carla because of odd behaviour with small integer knobs
|
// doesn't look great in Carla because of odd behaviour with small integer knobs
|
||||||
printf("setPV %d %f\n", index, value);
|
|
||||||
if (value > 3) value = 3;
|
if (value > 3) value = 3;
|
||||||
m->patchRam.switch2 &= 0xe7;
|
m->patchRam.switch2 &= 0xe7;
|
||||||
m->patchRam.switch2 |= (3-(int)value )<< 3;
|
m->patchRam.switch2 |= (3-(int)value )<< 3;
|
||||||
|
|
|
||||||
|
|
@ -66,29 +66,24 @@ void Peacock::run(const float**, float** outputs, uint32_t frames, const MidiEve
|
||||||
|
|
||||||
// if there were any events that happen between now and the end of this block, process them
|
// if there were any events that happen between now and the end of this block, process them
|
||||||
lastEvent = 0;
|
lastEvent = 0;
|
||||||
//printf("in run(), %d samples left in block\n", blockLeft);
|
|
||||||
runMidi(midiEvents, midiEventCount, blockLeft);
|
runMidi(midiEvents, midiEventCount, blockLeft);
|
||||||
|
|
||||||
while (framePos < frames) {
|
while (framePos < frames) {
|
||||||
if (blockLeft == 0) {
|
if (blockLeft == 0) {
|
||||||
// no more samples to calculate in this update period
|
// no more samples to calculate in this update period
|
||||||
blockLeft = sampleRate / 238; // update rate in Hz
|
blockLeft = sampleRate / 238; // update rate in Hz
|
||||||
//printf("no more samples in block, resetting to %d at %d\n", blockLeft, framePos);
|
|
||||||
runMidi(midiEvents, midiEventCount, framePos + blockLeft);
|
runMidi(midiEvents, midiEventCount, framePos + blockLeft);
|
||||||
|
|
||||||
// FIXME run one IC29 loop
|
|
||||||
m->run(voice);
|
m->run(voice);
|
||||||
}
|
}
|
||||||
|
|
||||||
// how many frames to do? Are we about to run off an update block
|
// how many frames to do? Are we about to run off an update block
|
||||||
sizeThisTime = (framesLeft < blockLeft) ? framesLeft : blockLeft;
|
sizeThisTime = (framesLeft < blockLeft) ? framesLeft : blockLeft;
|
||||||
|
|
||||||
//printf("running voices for %d at %d\n", sizeThisTime, framePos);
|
|
||||||
// now run all the voices for this chunk of samples
|
// now run all the voices for this chunk of samples
|
||||||
for (uint32_t i = 0; i < NUM_VOICES; i++) {
|
for (uint32_t i = 0; i < NUM_VOICES; i++) {
|
||||||
voice[i].run(m, outputs[0] + framePos, sizeThisTime);
|
voice[i].run(m, outputs[0] + framePos, sizeThisTime);
|
||||||
}
|
}
|
||||||
//printf("\n");
|
|
||||||
|
|
||||||
framePos += sizeThisTime;
|
framePos += sizeThisTime;
|
||||||
framesLeft -= sizeThisTime;
|
framesLeft -= sizeThisTime;
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ DistrhoUIPeacock::DistrhoUIPeacock() : UI(Art::backgroundWidth, Art::backgroundH
|
||||||
xSliderRls->setCallback(this);
|
xSliderRls->setCallback(this);
|
||||||
|
|
||||||
xSwitchPWM = new ImageSlider(this, switchSlider);
|
xSwitchPWM = new ImageSlider(this, switchSlider);
|
||||||
prepSwitch(xSwitchPWM, pPWMDepth, 380, 103);
|
prepSwitch(xSwitchPWM, pPWMMode, 380, 103);
|
||||||
xSwitchPWM->setCallback(this);
|
xSwitchPWM->setCallback(this);
|
||||||
|
|
||||||
xSwitchEnv = new ImageSlider(this, switchSlider);
|
xSwitchEnv = new ImageSlider(this, switchSlider);
|
||||||
|
|
@ -190,9 +190,9 @@ void DistrhoUIPeacock::programLoaded(uint32_t index) {
|
||||||
xSliderLFORate->setValue(63);
|
xSliderLFORate->setValue(63);
|
||||||
xSliderLFODelay->setValue(94);
|
xSliderLFODelay->setValue(94);
|
||||||
|
|
||||||
}*/
|
}
|
||||||
|
*/
|
||||||
void DistrhoUIPeacock::parameterChanged(uint32_t index, float value) {
|
void DistrhoUIPeacock::parameterChanged(uint32_t index, float value) {
|
||||||
printf("Parameter has changed\n");
|
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case pLFORate:
|
case pLFORate:
|
||||||
xSliderLFORate->setValue(value);
|
xSliderLFORate->setValue(value);
|
||||||
|
|
@ -283,13 +283,11 @@ void DistrhoUIPeacock::imageSliderDragFinished(ImageSlider* slider) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DistrhoUIPeacock::imageSliderValueChanged(ImageSlider* slider, float value) {
|
void DistrhoUIPeacock::imageSliderValueChanged(ImageSlider* slider, float value) {
|
||||||
// printf("setting %d to %f\n", slider->getId(), value);
|
|
||||||
setParameterValue(slider->getId(), value);
|
setParameterValue(slider->getId(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DistrhoUIPeacock::imageButtonClicked(ImageButton* imgBtn, int) {
|
void DistrhoUIPeacock::imageButtonClicked(ImageButton* imgBtn, int) {
|
||||||
int id = imgBtn->getId();
|
int id = imgBtn->getId();
|
||||||
// printf("imagebutton %d\n", id);
|
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case btn16:
|
case btn16:
|
||||||
sw1 &= 0xf8;
|
sw1 &= 0xf8;
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,19 @@ class DistrhoUIPeacock : public UI,
|
||||||
ScopedPointer<ImageButton> xBtn16ft, xBtn8ft, xBtn4ft, xBtnPls, xBtnSaw, xBtnCh0, xBtnCh1, xBtnCh2;
|
ScopedPointer<ImageButton> xBtn16ft, xBtn8ft, xBtn4ft, xBtnPls, xBtnSaw, xBtnCh0, xBtnCh1, xBtnCh2;
|
||||||
|
|
||||||
uint8_t sw1 = 0, sw2 = 0;
|
uint8_t sw1 = 0, sw2 = 0;
|
||||||
|
|
||||||
|
enum Buttons {
|
||||||
|
btn16 = parameterCount+1,
|
||||||
|
btn8,
|
||||||
|
btn4,
|
||||||
|
btnPls,
|
||||||
|
btnSaw,
|
||||||
|
btnCh0,
|
||||||
|
btnCh1,
|
||||||
|
btnCh2
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DistrhoUIPeacock)
|
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DistrhoUIPeacock)
|
||||||
// ImageAboutWindow fAboutWindow;
|
// ImageAboutWindow fAboutWindow;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue