瀏覽代碼

Fix delay effect on Teensy 3.5 & 3.6

dds
PaulStoffregen 7 年之前
父節點
當前提交
a0fd10601c
共有 2 個文件被更改,包括 12 次插入6 次删除
  1. +5
    -3
      effect_delay.cpp
  2. +7
    -3
      effect_delay.h

+ 5
- 3
effect_delay.cpp 查看文件

@@ -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 查看文件

@@ -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];
};

Loading…
取消
儲存