Parcourir la source

Simplify pitch shift start logic

dds
PaulStoffregen il y a 6 ans
Parent
révision
cf81588168
2 fichiers modifiés avec 5 ajouts et 11 suppressions
  1. +5
    -10
      effect_granular.cpp
  2. +0
    -1
      effect_granular.h

+ 5
- 10
effect_granular.cpp Voir le fichier

@@ -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 Voir le fichier

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


Chargement…
Annuler
Enregistrer