Ver código fonte

Fix delay effect on Teensy 3.5 & 3.6

dds
PaulStoffregen 7 anos atrás
pai
commit
a0fd10601c
2 arquivos alterados com 12 adições e 6 exclusões
  1. +5
    -3
      effect_delay.cpp
  2. +7
    -3
      effect_delay.h

+ 5
- 3
effect_delay.cpp Ver arquivo

@@ -38,7 +38,7 @@ void AudioEffectDelay::update(void)
tail = tailindex;
if (++head >= DELAY_QUEUE_SIZE) head = 0;
if (head == tail) {
release(queue[tail]);
if (queue[tail] != NULL) release(queue[tail]);
if (++tail >= DELAY_QUEUE_SIZE) tail = 0;
}
queue[head] = receiveReadOnly();
@@ -70,8 +70,10 @@ void AudioEffectDelay::update(void)
if (count > maxblocks) {
count -= maxblocks;
do {
release(queue[tail]);
queue[tail] = NULL;
if (queue[tail] != NULL) {
release(queue[tail]);
queue[tail] = NULL;
}
if (++tail >= DELAY_QUEUE_SIZE) tail = 0;
} while (--count > 0);
}

+ 7
- 3
effect_delay.h Ver arquivo

@@ -100,10 +100,14 @@ private:
maxblocks = max;
}
uint8_t activemask; // which output channels are active
uint8_t headindex; // head index (incoming) data in quueu
uint8_t tailindex; // tail index (outgoing) data from queue
uint8_t maxblocks; // number of blocks needed in queue
uint16_t headindex; // head index (incoming) data in quueu
uint16_t tailindex; // tail index (outgoing) data from queue
uint16_t maxblocks; // number of blocks needed in queue
#if DELAY_QUEUE_SIZE * AUDIO_BLOCK_SAMPLES < 65535
uint16_t position[8]; // # of sample delay for each channel
#else
uint32_t position[8]; // # of sample delay for each channel
#endif
audio_block_t *queue[DELAY_QUEUE_SIZE];
audio_block_t *inputQueueArray[1];
};

Carregando…
Cancelar
Salvar