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