|
-
-
- #include <Arduino.h>
- #include "effect_multiply.h"
-
- void AudioEffectMultiply::update(void)
- {
- #if defined(__ARM_ARCH_7EM__)
- audio_block_t *blocka, *blockb;
- uint32_t *pa, *pb, *end;
- uint32_t a12, a34;
- uint32_t b12, b34;
-
- blocka = receiveWritable(0);
- blockb = receiveReadOnly(1);
- if (!blocka) {
- if (blockb) release(blockb);
- return;
- }
- if (!blockb) {
- release(blocka);
- return;
- }
- pa = (uint32_t *)(blocka->data);
- pb = (uint32_t *)(blockb->data);
- end = pa + AUDIO_BLOCK_SAMPLES/2;
- while (pa < end) {
- a12 = *pa;
- a34 = *(pa+1);
-
-
- b12 = *pb++;
- b34 = *pb++;
-
-
- a12 = pack_16b_16b(
- signed_saturate_rshift(multiply_16tx16t(a12, b12), 16, 15),
- signed_saturate_rshift(multiply_16bx16b(a12, b12), 16, 15));
- a34 = pack_16b_16b(
- signed_saturate_rshift(multiply_16tx16t(a34, b34), 16, 15),
- signed_saturate_rshift(multiply_16bx16b(a34, b34), 16, 15));
-
-
-
-
-
-
- *pa++ = a12;
- *pa++ = a34;
-
-
- }
- transmit(blocka);
- release(blocka);
- release(blockb);
-
- #elif defined(KINETISL)
- audio_block_t *block;
-
- block = receiveReadOnly(0);
- if (block) release(block);
- block = receiveReadOnly(1);
- if (block) release(block);
- #endif
- }
|