cleanup
This commit is contained in:
@@ -78,6 +78,20 @@ void Synth::process(float* out, uint32_t nFrames, uint32_t sampleRate) {
|
|||||||
bool triggered = false;
|
bool triggered = false;
|
||||||
bool once = false;
|
bool once = false;
|
||||||
|
|
||||||
|
// some things need to be done only once per buffer instead of once per sample
|
||||||
|
|
||||||
|
// find the lowest active voice for scope triggering
|
||||||
|
int lowestVoice = 0;
|
||||||
|
float lowestFreq = 100000.0f;
|
||||||
|
for(int i = 0; i < voices_.size(); i++) {
|
||||||
|
if(!voices_[i].isActive()) continue;
|
||||||
|
float currentFreq = voices_[i].frequency();
|
||||||
|
if(currentFreq < lowestFreq) {
|
||||||
|
lowestVoice = i;
|
||||||
|
lowestFreq = currentFreq;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (uint32_t i = 0; i < nFrames; i++) {
|
for (uint32_t i = 0; i < nFrames; i++) {
|
||||||
|
|
||||||
// updates internal buffered parameters for smoothing
|
// updates internal buffered parameters for smoothing
|
||||||
@@ -89,18 +103,6 @@ void Synth::process(float* out, uint32_t nFrames, uint32_t sampleRate) {
|
|||||||
params[i] = params_[i].current;
|
params[i] = params_[i].current;
|
||||||
} // maybe take this outside the loop if performance is an issue
|
} // maybe take this outside the loop if performance is an issue
|
||||||
|
|
||||||
// find the lowest voice for scope triggering
|
|
||||||
int lowestVoice = 0;
|
|
||||||
float lowestFreq = 100000.0f;
|
|
||||||
for(int i = 0; i < voices_.size(); i++) {
|
|
||||||
if(!voices_[i].isActive()) continue;
|
|
||||||
float currentFreq = voices_[i].frequency();
|
|
||||||
if(currentFreq < lowestFreq) {
|
|
||||||
lowestVoice = i;
|
|
||||||
lowestFreq = currentFreq;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// foreach voice, process...
|
// foreach voice, process...
|
||||||
float mix = 0.0f;
|
float mix = 0.0f;
|
||||||
for(int i = 0; i < voices_.size(); i++) {
|
for(int i = 0; i < voices_.size(); i++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user