Ver código fonte

Simplify pitch shift start logic

dds
PaulStoffregen 6 anos atrás
pai
commit
cf81588168
2 arquivos alterados com 5 adições e 11 exclusões
  1. +5
    -10
      effect_granular.cpp
  2. +0
    -1
      effect_granular.h

+ 5
- 10
effect_granular.cpp Ver arquivo

@@ -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 Ver arquivo

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


Carregando…
Cancelar
Salvar