Browse Source

Fix delay effect on Teensy 3.5 & 3.6

dds
PaulStoffregen 7 years ago
parent
commit
a0fd10601c
2 changed files with 12 additions and 6 deletions
  1. +5
    -3
      effect_delay.cpp
  2. +7
    -3
      effect_delay.h

+ 5
- 3
effect_delay.cpp View File

tail = tailindex; tail = tailindex;
if (++head >= DELAY_QUEUE_SIZE) head = 0; if (++head >= DELAY_QUEUE_SIZE) head = 0;
if (head == tail) { if (head == tail) {
release(queue[tail]);
if (queue[tail] != NULL) release(queue[tail]);
if (++tail >= DELAY_QUEUE_SIZE) tail = 0; if (++tail >= DELAY_QUEUE_SIZE) tail = 0;
} }
queue[head] = receiveReadOnly(); queue[head] = receiveReadOnly();
if (count > maxblocks) { if (count > maxblocks) {
count -= maxblocks; count -= maxblocks;
do { do {
release(queue[tail]);
queue[tail] = NULL;
if (queue[tail] != NULL) {
release(queue[tail]);
queue[tail] = NULL;
}
if (++tail >= DELAY_QUEUE_SIZE) tail = 0; if (++tail >= DELAY_QUEUE_SIZE) tail = 0;
} while (--count > 0); } while (--count > 0);
} }

+ 7
- 3
effect_delay.h View File

maxblocks = max; maxblocks = max;
} }
uint8_t activemask; // which output channels are active 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 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 *queue[DELAY_QUEUE_SIZE];
audio_block_t *inputQueueArray[1]; audio_block_t *inputQueueArray[1];
}; };

Loading…
Cancel
Save