|
|
|
@ -38,23 +38,19 @@ void AudioEffectStereoMono::update(void) |
|
|
|
|
{ |
|
|
|
|
audio_block_t *block[2]; |
|
|
|
|
|
|
|
|
|
block[0] = receiveWritable(0); |
|
|
|
|
block[1] = receiveWritable(1); |
|
|
|
|
|
|
|
|
|
if (_enabled == true) |
|
|
|
|
{ |
|
|
|
|
block[0] = receiveWritable(0); |
|
|
|
|
block[1] = receiveReadOnly(1); |
|
|
|
|
|
|
|
|
|
if (block[0] && block[1]) |
|
|
|
|
{ |
|
|
|
|
int16_t *bp[2] = { block[0]->data, block[1]->data }; |
|
|
|
|
|
|
|
|
|
for (uint16_t i = 0; i < AUDIO_BLOCK_SAMPLES; i++) |
|
|
|
|
{ |
|
|
|
|
*bp[0] = (long(*bp[0]) + *bp[1]) >> 1; |
|
|
|
|
*bp[1] = *bp[0]; |
|
|
|
|
|
|
|
|
|
// push the pointers forward
|
|
|
|
|
bp[0]++; // next audio data
|
|
|
|
|
bp[1]++; // next audio data
|
|
|
|
|
*bp[0]++ = *bp[0] >> 1 + *bp[1] >> 1; |
|
|
|
|
*bp[1]++ = *bp[0]; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -66,7 +62,7 @@ void AudioEffectStereoMono::update(void) |
|
|
|
|
} |
|
|
|
|
if (block[1]) |
|
|
|
|
{ |
|
|
|
|
transmit(block[1], 0); |
|
|
|
|
transmit(block[1], 1); |
|
|
|
|
release(block[1]); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|