comparison audioio/ContinuousSynth.cpp @ 418:8d2112977aa0 tonioni

Don't clear ring buffers & regenerate when adding a model that is muted anyway
author Chris Cannam
date Tue, 11 Nov 2014 16:34:22 +0000
parents d2c13ec0f148
children aa6fb3516e28
comparison
equal deleted inserted replaced
417:d62a622a0e40 418:8d2112977aa0
46 46
47 bool wasOn = (m_prevF0 > 0.f); 47 bool wasOn = (m_prevF0 > 0.f);
48 bool nowOn = (f0 > 0.f); 48 bool nowOn = (f0 > 0.f);
49 49
50 if (!nowOn && !wasOn) { 50 if (!nowOn && !wasOn) {
51 m_phase = 0; 51 m_phase = 0;
52 return; 52 return;
53 } 53 }
54 54
55 int fadeLength = 100; // samples 55 int fadeLength = 100; // samples
56 56
57 float *levels = new float[m_channels]; 57 float *levels = new float[m_channels];
58 58
59 for (int c = 0; c < m_channels; ++c) { 59 for (int c = 0; c < m_channels; ++c) {
60 levels[c] = gain * 0.5; // scale gain otherwise too loud compared to source 60 levels[c] = gain * 0.5; // scale gain otherwise too loud compared to source
61 } 61 }
62 if (pan != 0.0 && m_channels == 2) { 62 if (pan != 0.0 && m_channels == 2) {
63 levels[0] *= 1.0 - pan; 63 levels[0] *= 1.0 - pan;
64 levels[1] *= pan + 1.0; 64 levels[1] *= pan + 1.0;
65 } 65 }
66 66
67 // cerr << "ContinuousSynth::mix: f0 = " << f0 << " (from " << m_prevF0 << "), phase = " << m_phase << endl; 67 // cerr << "ContinuousSynth::mix: f0 = " << f0 << " (from " << m_prevF0 << "), phase = " << m_phase << endl;
68 68
69 for (int i = 0; i < m_blockSize; ++i) { 69 for (int i = 0; i < m_blockSize; ++i) {