|
-
-
- #include <Arduino.h>
- #include "effect_rectifier.h"
- #include "utility/dspinst.h"
-
- void AudioEffectRectifier::update(void)
- {
- audio_block_t *block = receiveWritable();
- if (!block) return;
-
- int16_t *p = block->data;
- int16_t *end = block->data + AUDIO_BLOCK_SAMPLES;
- while (p < end) {
- int b = *p;
- int t = *(p + 1);
- if (b < 0) b = -b;
- if (t < 0) t = -t;
- b = signed_saturate_rshift(b, 16, 0);
- t = signed_saturate_rshift(t, 16, 0);
- *(uint32_t *)p = pack_16b_16b(t, b);
- p += 2;
- }
- transmit(block);
- release(block);
- }
|