Explorar el Código

Simplify pitch shift start logic

dds
PaulStoffregen hace 7 años
padre
commit
cf81588168
Se han modificado 2 ficheros con 5 adiciones y 11 borrados
  1. +5
    -10
      effect_granular.cpp
  2. +0
    -1
      effect_granular.h

+ 5
- 10
effect_granular.cpp Ver fichero

for (int k = 0; k < AUDIO_BLOCK_SAMPLES; k++) { for (int k = 0; k < AUDIO_BLOCK_SAMPLES; k++) {
int16_t current_input = block->data[k]; int16_t current_input = block->data[k];
// only start recording when the audio is crossing zero to minimize pops // 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; prev_input = current_input;


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

+ 0
- 1
effect_granular.h Ver fichero

bool allow_len_change; bool allow_len_change;
bool sample_loaded; bool sample_loaded;
bool write_en; bool write_en;
bool zero_cross_down; // redundant?
bool sample_req; bool sample_req;
}; };



Cargando…
Cancelar
Guardar