|
|
|
@ -246,7 +246,7 @@ void AudioEffectFreeverbFloat::update() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AudioEffectFreeverbStereoFloat::AudioEffectFreeverbStereoFloat() : AudioStream(1, inputQueueArray) |
|
|
|
|
AudioEffectFreeverbStereoFloat::AudioEffectFreeverbStereoFloat() : AudioStream(2, inputQueueArray) |
|
|
|
|
{ |
|
|
|
|
for (unsigned int i = 0; i < sizeof(comb1bufL) / sizeof(float); i++) comb1bufL[i] = 0.0; |
|
|
|
|
for (unsigned int i = 0; i < sizeof(comb2bufL) / sizeof(float); i++) comb2bufL[i] = 0.0; |
|
|
|
@ -320,76 +320,82 @@ AudioEffectFreeverbStereoFloat::AudioEffectFreeverbStereoFloat() : AudioStream(1 |
|
|
|
|
void AudioEffectFreeverbStereoFloat::update() |
|
|
|
|
{ |
|
|
|
|
#if defined(__ARM_ARCH_7EM__) |
|
|
|
|
const audio_block_t *block; |
|
|
|
|
const audio_block_t *blockL; |
|
|
|
|
const audio_block_t *blockR; |
|
|
|
|
audio_block_t *outblockL; |
|
|
|
|
audio_block_t *outblockR; |
|
|
|
|
int i; |
|
|
|
|
float input, bufout, outputL, outputR; |
|
|
|
|
float inputL, inputR, bufout, outputL, outputR; |
|
|
|
|
float sum; |
|
|
|
|
|
|
|
|
|
block = receiveReadOnly(0); |
|
|
|
|
blockL = receiveReadOnly(0); |
|
|
|
|
blockR = receiveReadOnly(0); |
|
|
|
|
|
|
|
|
|
outblockL = allocate(); |
|
|
|
|
outblockR = allocate(); |
|
|
|
|
if (!outblockL || !outblockR) { |
|
|
|
|
if (outblockL) release(outblockL); |
|
|
|
|
if (outblockR) release(outblockR); |
|
|
|
|
if (block) release((audio_block_t *)block); |
|
|
|
|
if (blockL) release((audio_block_t *)blockL); |
|
|
|
|
if (blockR) release((audio_block_t *)blockR); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (!block) block = &zeroblock; |
|
|
|
|
if (!blockL) blockL = &zeroblock; |
|
|
|
|
if (!blockR) blockR = &zeroblock; |
|
|
|
|
|
|
|
|
|
for (i = 0; i < AUDIO_BLOCK_SAMPLES; i++) { |
|
|
|
|
// TODO: scale numerical range depending on roomsize & damping
|
|
|
|
|
//input = sat16(block->data[i] * 8738.0, 17); // for numerical headroom
|
|
|
|
|
input = block->data[i] / 32768.0; |
|
|
|
|
inputL = blockL->data[i] / 32768.0; |
|
|
|
|
inputR = blockR->data[i] / 32768.0; |
|
|
|
|
sum = 0; |
|
|
|
|
|
|
|
|
|
bufout = comb1bufL[comb1indexL]; |
|
|
|
|
sum += bufout; |
|
|
|
|
comb1filterL = bufout * combdamp2 + comb1filterL * combdamp1; |
|
|
|
|
comb1bufL[comb1indexL] = input + comb1filterL * combfeeback; |
|
|
|
|
comb1bufL[comb1indexL] = inputL + comb1filterL * combfeeback; |
|
|
|
|
if (++comb1indexL >= sizeof(comb1bufL) / sizeof(float)) comb1indexL = 0; |
|
|
|
|
|
|
|
|
|
bufout = comb2bufL[comb2indexL]; |
|
|
|
|
sum += bufout; |
|
|
|
|
comb2filterL = bufout * combdamp2 + comb2filterL * combdamp1; |
|
|
|
|
comb2bufL[comb2indexL] = input + comb2filterL * combfeeback; |
|
|
|
|
comb2bufL[comb2indexL] = inputL + comb2filterL * combfeeback; |
|
|
|
|
if (++comb2indexL >= sizeof(comb2bufL) / sizeof(float)) comb2indexL = 0; |
|
|
|
|
|
|
|
|
|
bufout = comb3bufL[comb3indexL]; |
|
|
|
|
sum += bufout; |
|
|
|
|
comb3filterL = bufout * combdamp2 + comb3filterL * combdamp1; |
|
|
|
|
comb3bufL[comb3indexL] = input + comb3filterL * combfeeback; |
|
|
|
|
comb3bufL[comb3indexL] = inputL + comb3filterL * combfeeback; |
|
|
|
|
if (++comb3indexL >= sizeof(comb3bufL) / sizeof(float)) comb3indexL = 0; |
|
|
|
|
|
|
|
|
|
bufout = comb4bufL[comb4indexL]; |
|
|
|
|
sum += bufout; |
|
|
|
|
comb4filterL = bufout * combdamp2 + comb4filterL * combdamp1; |
|
|
|
|
comb4bufL[comb4indexL] = input + comb4filterL * combfeeback; |
|
|
|
|
comb4bufL[comb4indexL] = inputL + comb4filterL * combfeeback; |
|
|
|
|
if (++comb4indexL >= sizeof(comb4bufL) / sizeof(float)) comb4indexL = 0; |
|
|
|
|
|
|
|
|
|
bufout = comb5bufL[comb5indexL]; |
|
|
|
|
sum += bufout; |
|
|
|
|
comb5filterL = bufout * combdamp2 + comb5filterL * combdamp1; |
|
|
|
|
comb5bufL[comb5indexL] = input + comb5filterL * combfeeback; |
|
|
|
|
comb5bufL[comb5indexL] = inputL + comb5filterL * combfeeback; |
|
|
|
|
if (++comb5indexL >= sizeof(comb5bufL) / sizeof(float)) comb5indexL = 0; |
|
|
|
|
|
|
|
|
|
bufout = comb6bufL[comb6indexL]; |
|
|
|
|
sum += bufout; |
|
|
|
|
comb6filterL = bufout * combdamp2 + comb6filterL * combdamp1; |
|
|
|
|
comb6bufL[comb6indexL] = input + comb6filterL * combfeeback; |
|
|
|
|
comb6bufL[comb6indexL] = inputL + comb6filterL * combfeeback; |
|
|
|
|
if (++comb6indexL >= sizeof(comb6bufL) / sizeof(float)) comb6indexL = 0; |
|
|
|
|
|
|
|
|
|
bufout = comb7bufL[comb7indexL]; |
|
|
|
|
sum += bufout; |
|
|
|
|
comb7filterL = bufout * combdamp2 + comb7filterL * combdamp1; |
|
|
|
|
comb7bufL[comb7indexL] = input + comb7filterL * combfeeback; |
|
|
|
|
comb7bufL[comb7indexL] = inputL + comb7filterL * combfeeback; |
|
|
|
|
if (++comb7indexL >= sizeof(comb7bufL) / sizeof(float)) comb7indexL = 0; |
|
|
|
|
|
|
|
|
|
bufout = comb8bufL[comb8indexL]; |
|
|
|
|
sum += bufout; |
|
|
|
|
comb8filterL = bufout * combdamp2 + comb8filterL * combdamp1; |
|
|
|
|
comb8bufL[comb8indexL] = input + comb8filterL * combfeeback; |
|
|
|
|
comb8bufL[comb8indexL] = inputL + comb8filterL * combfeeback; |
|
|
|
|
if (++comb8indexL >= sizeof(comb8bufL) / sizeof(float)) comb8indexL = 0; |
|
|
|
|
|
|
|
|
|
//outputL = sat16(sum * 31457, 17);
|
|
|
|
@ -400,49 +406,49 @@ void AudioEffectFreeverbStereoFloat::update() |
|
|
|
|
bufout = comb1bufR[comb1indexR]; |
|
|
|
|
sum += bufout; |
|
|
|
|
comb1filterR = bufout * combdamp2 + comb1filterR * combdamp1; |
|
|
|
|
comb1bufR[comb1indexR] = input + comb1filterR * combfeeback; |
|
|
|
|
comb1bufR[comb1indexR] = inputR + comb1filterR * combfeeback; |
|
|
|
|
if (++comb1indexR >= sizeof(comb1bufR) / sizeof(float)) comb1indexR = 0; |
|
|
|
|
|
|
|
|
|
bufout = comb2bufR[comb2indexR]; |
|
|
|
|
sum += bufout; |
|
|
|
|
comb2filterR = bufout * combdamp2 + comb2filterR * combdamp1; |
|
|
|
|
comb2bufR[comb2indexR] = input + comb2filterR * combfeeback; |
|
|
|
|
comb2bufR[comb2indexR] = inputR + comb2filterR * combfeeback; |
|
|
|
|
if (++comb2indexR >= sizeof(comb2bufR) / sizeof(float)) comb2indexR = 0; |
|
|
|
|
|
|
|
|
|
bufout = comb3bufR[comb3indexR]; |
|
|
|
|
sum += bufout; |
|
|
|
|
comb3filterR = bufout * combdamp2 + comb3filterR * combdamp1; |
|
|
|
|
comb3bufR[comb3indexR] = input + comb3filterR * combfeeback; |
|
|
|
|
comb3bufR[comb3indexR] = inputR + comb3filterR * combfeeback; |
|
|
|
|
if (++comb3indexR >= sizeof(comb3bufR) / sizeof(float)) comb3indexR = 0; |
|
|
|
|
|
|
|
|
|
bufout = comb4bufR[comb4indexR]; |
|
|
|
|
sum += bufout; |
|
|
|
|
comb4filterR = bufout * combdamp2 + comb4filterR * combdamp1; |
|
|
|
|
comb4bufR[comb4indexR] = input + comb4filterR * combfeeback; |
|
|
|
|
comb4bufR[comb4indexR] = inputR + comb4filterR * combfeeback; |
|
|
|
|
if (++comb4indexR >= sizeof(comb4bufR) / sizeof(float)) comb4indexR = 0; |
|
|
|
|
|
|
|
|
|
bufout = comb5bufR[comb5indexR]; |
|
|
|
|
sum += bufout; |
|
|
|
|
comb5filterR = bufout * combdamp2 + comb5filterR * combdamp1; |
|
|
|
|
comb5bufR[comb5indexR] = input + comb5filterR * combfeeback; |
|
|
|
|
comb5bufR[comb5indexR] = inputR + comb5filterR * combfeeback; |
|
|
|
|
if (++comb5indexR >= sizeof(comb5bufR) / sizeof(float)) comb5indexR = 0; |
|
|
|
|
|
|
|
|
|
bufout = comb6bufR[comb6indexR]; |
|
|
|
|
sum += bufout; |
|
|
|
|
comb6filterR = bufout * combdamp2 + comb6filterR * combdamp1; |
|
|
|
|
comb6bufR[comb6indexR] = input + comb6filterR * combfeeback; |
|
|
|
|
comb6bufR[comb6indexR] = inputR + comb6filterR * combfeeback; |
|
|
|
|
if (++comb6indexR >= sizeof(comb6bufR) / sizeof(float)) comb6indexR = 0; |
|
|
|
|
|
|
|
|
|
bufout = comb7bufR[comb7indexR]; |
|
|
|
|
sum += bufout; |
|
|
|
|
comb7filterR = bufout * combdamp2 + comb7filterR * combdamp1; |
|
|
|
|
comb7bufR[comb7indexR] = input + comb7filterR * combfeeback; |
|
|
|
|
comb7bufR[comb7indexR] = inputR + comb7filterR * combfeeback; |
|
|
|
|
if (++comb7indexR >= sizeof(comb7bufR) / sizeof(float)) comb7indexR = 0; |
|
|
|
|
|
|
|
|
|
bufout = comb8bufR[comb8indexR]; |
|
|
|
|
sum += bufout; |
|
|
|
|
comb8filterR = bufout * combdamp2 + comb8filterR * combdamp1; |
|
|
|
|
comb8bufR[comb8indexR] = input + comb8filterR * combfeeback; |
|
|
|
|
comb8bufR[comb8indexR] = inputR + comb8filterR * combfeeback; |
|
|
|
|
if (++comb8indexR >= sizeof(comb8bufR) / sizeof(float)) comb8indexR = 0; |
|
|
|
|
|
|
|
|
|
//outputR = sat16(sum * 31457, 17);
|
|
|
|
@ -500,7 +506,8 @@ void AudioEffectFreeverbStereoFloat::update() |
|
|
|
|
transmit(outblockR, 1); |
|
|
|
|
release(outblockL); |
|
|
|
|
release(outblockR); |
|
|
|
|
if (block != &zeroblock) release((audio_block_t *)block); |
|
|
|
|
if (blockL != &zeroblock) release((audio_block_t *)blockL); |
|
|
|
|
if (blockR != &zeroblock) release((audio_block_t *)blockR); |
|
|
|
|
|
|
|
|
|
#elif defined(KINETISL) |
|
|
|
|
audio_block_t *block; |
|
|
|
|