Quellcode durchsuchen

Simplify pitch shift start logic

dds
PaulStoffregen vor 6 Jahren
Ursprung
Commit
cf81588168
2 geänderte Dateien mit 5 neuen und 11 gelöschten Zeilen
  1. +5
    -10
      effect_granular.cpp
  2. +0
    -1
      effect_granular.h

+ 5
- 10
effect_granular.cpp Datei anzeigen

@@ -151,19 +151,14 @@ void AudioEffectGranular::update(void)
for (int k = 0; k < AUDIO_BLOCK_SAMPLES; k++) {
int16_t current_input = block->data[k];
// only start recording when the audio is crossing zero to minimize pops

// TODO: simplify this logic... and check sample_req first for efficiency
if (current_input < 0 && prev_input >= 0) {
zero_cross_down = true;
} else {
zero_cross_down = false;
if (sample_req) {
if ((current_input < 0 && prev_input >= 0) ||
(current_input >= 0 && prev_input < 0)) {
write_en = true;
}
}

prev_input = current_input;

if (zero_cross_down && sample_req) {
write_en = true;
}
if (write_en) {
sample_req = false;
allow_len_change = true; // Reduces noise by not allowing the

+ 0
- 1
effect_granular.h Datei anzeigen

@@ -50,7 +50,6 @@ private:
bool allow_len_change;
bool sample_loaded;
bool write_en;
bool zero_cross_down; // redundant?
bool sample_req;
};


Laden…
Abbrechen
Speichern