fix module being updated at the wrong time causing incorrect LFO speed
This commit is contained in:
parent
8d987fa5b0
commit
ffe4026b18
|
|
@ -76,8 +76,8 @@ void Module::runLFO() {
|
||||||
else
|
else
|
||||||
lfo = (lfoPhase & 0x3fff) - 0x1fff;
|
lfo = (lfoPhase & 0x3fff) - 0x1fff;
|
||||||
|
|
||||||
pw = 0x3fff-(((0x2000 + lfo) * patchRam.pwmLfo) >> 7);
|
pw = 0x3fff - (((0x2000 + lfo) * patchRam.pwmLfo) >> 7);
|
||||||
pw = (patchRam.switch2 & 0x01) ? 0x3fff - (patchRam.pwmLfo << 7 ) : pw;
|
pw = (patchRam.switch2 & 0x01) ? 0x3fff - (patchRam.pwmLfo << 7) : pw;
|
||||||
lfo = (lfo * lfoDelay) >> 14;
|
lfo = (lfo * lfoDelay) >> 14;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -94,7 +94,7 @@ void Module::run(Voice* voices, uint32_t blockSize) {
|
||||||
|
|
||||||
// originally I had 0.28, 0.36, 0.4
|
// originally I had 0.28, 0.36, 0.4
|
||||||
// measurement suggests that saw and square are around 100mV each with sub 160mV
|
// measurement suggests that saw and square are around 100mV each with sub 160mV
|
||||||
|
|
||||||
square = (patchRam.switch1 & 0x08) ? 0.3 : 0;
|
square = (patchRam.switch1 & 0x08) ? 0.3 : 0;
|
||||||
saw = (patchRam.switch1 & 0x10) ? .3 : 0;
|
saw = (patchRam.switch1 & 0x10) ? .3 : 0;
|
||||||
sub = (patchRam.sub / 127.0f) * 0.48;
|
sub = (patchRam.sub / 127.0f) * 0.48;
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ class Module {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
uint8_t lfoRate = 0x00;
|
uint8_t lfoRate = 0x1f;
|
||||||
uint8_t lfoDelay = 0x00;
|
uint8_t lfoDelay = 0x00;
|
||||||
uint8_t vcoLfo = 0x00;
|
uint8_t vcoLfo = 0x00;
|
||||||
uint8_t pwmLfo = 0x3c;
|
uint8_t pwmLfo = 0x3c;
|
||||||
|
|
@ -124,6 +124,7 @@ class Module {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void runLFO();
|
void runLFO();
|
||||||
|
|
||||||
// precalculated coefficients for RC networks
|
// precalculated coefficients for RC networks
|
||||||
float pwmTC = 0, subTC = 0, mVcaTC = 0;
|
float pwmTC = 0, subTC = 0, mVcaTC = 0;
|
||||||
float pwmRC = 0, subRC = 0, vcaRC = 0;
|
float pwmRC = 0, subRC = 0, vcaRC = 0;
|
||||||
|
|
|
||||||
|
|
@ -80,16 +80,14 @@ void Peacock::run(const float**, float** outputs, uint32_t frames, const MidiEve
|
||||||
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 / 233.5; // update rate in Hz, measured
|
||||||
runMidi(midiEvents, midiEventCount, framePos + blockLeft);
|
runMidi(midiEvents, midiEventCount, framePos + blockLeft);
|
||||||
|
m->run(voice, blockLeft);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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;
|
||||||
|
|
||||||
// update the module board for this block
|
|
||||||
m->run(voice, sizeThisTime);
|
|
||||||
|
|
||||||
// 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);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue