# HG changeset patch # User Chris Cannam # Date 1389948001 0 # Node ID 8e44c7302cf37ad78a0610d5cec38a261f61b396 # Parent 7bdfbaa8d93ff87a1781635f197b01f416f5b70c Indentation only diff -r 7bdfbaa8d93f -r 8e44c7302cf3 audioio/ContinuousSynth.cpp --- a/audioio/ContinuousSynth.cpp Thu Jan 16 18:02:16 2014 -0500 +++ b/audioio/ContinuousSynth.cpp Fri Jan 17 08:40:01 2014 +0000 @@ -25,7 +25,7 @@ m_blockSize(blockSize), m_prevF0(-1.f), m_phase(0.0), - m_wavetype(waveType) // 0: 3 sinusoids, 1: 1 sinusoid, 2: sawtooth, 3: square + m_wavetype(waveType) // 0: 3 sinusoids, 1: 1 sinusoid, 2: sawtooth, 3: square { } @@ -83,49 +83,49 @@ if (harmonics < 1) harmonics = 1; switch (m_wavetype) { - case 1: - harmonics = 1; - break; - case 2: - break; - case 3: - break; - default: - harmonics = 3; - break; + case 1: + harmonics = 1; + break; + case 2: + break; + case 3: + break; + default: + harmonics = 3; + break; } for (int h = 0; h < harmonics; ++h) { - double v = 0; - double hn = 0; - double hp = 0; + double v = 0; + double hn = 0; + double hp = 0; - switch (m_wavetype) { - case 1: // single sinusoid - v = sin(m_phase); - break; - case 2: // sawtooth - if (h != 0) { - hn = h + 1; - hp = m_phase * hn; - v = -(1.0 / M_PI) * sin(hp) / hn; - } else { - v = 0.5; - } - break; - case 3: // square - hn = h*2 + 1; - hp = m_phase * hn; - v = sin(hp) / hn; - break; - default: // 3 sinusoids + switch (m_wavetype) { + case 1: // single sinusoid + v = sin(m_phase); + break; + case 2: // sawtooth + if (h != 0) { hn = h + 1; hp = m_phase * hn; - v = sin(hp) / hn; - break; - } + v = -(1.0 / M_PI) * sin(hp) / hn; + } else { + v = 0.5; + } + break; + case 3: // square + hn = h*2 + 1; + hp = m_phase * hn; + v = sin(hp) / hn; + break; + default: // 3 sinusoids + hn = h + 1; + hp = m_phase * hn; + v = sin(hp) / hn; + break; + } if (!wasOn && i < fadeLength) { // fade in