Skip to content

Commit

Permalink
🐛 Fix result graph error when modulation is applied
Browse files Browse the repository at this point in the history
  • Loading branch information
rubiefawn committed Sep 18, 2019
1 parent 4bcfe82 commit f8dfb32
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions plugins/Synchro/SynchroSynth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,14 @@ void SynchroSynth::generalChanged()
int octaveDiff = m_carrierDetune.value() - m_modulatorDetune.value();
float pitchDifference = powf(2, octaveDiff);
float phase = (float)i / (float)SYNCHRO_GRAPH_SAMPLES * F_2PI;
while (phase >= F_2PI) { phase -= F_2PI; }
float phaseMod = SynchroWaveform(phase, m_modulatorDrive.value(),
m_modulatorSync.value(), m_modulatorChop.value(),
m_harmonics.value()) * m_modulationStrength.value()
* m_modulation.value() * SYNCHRO_PM_CONST;
m_resultGraph.setSampleAt(i, SynchroWaveform(phase + phaseMod *
pitchDifference, m_carrierDrive.value(), m_carrierSync.value(),
phase = phase + phaseMod * pitchDifference;
while (phase >= F_2PI) { phase -= F_2PI; }
m_resultGraph.setSampleAt(i, SynchroWaveform(phase, m_carrierDrive.value(), m_carrierSync.value(),
m_carrierChop.value(), 0));
}
}
Expand Down

0 comments on commit f8dfb32

Please sign in to comment.