|
|
|
@ -58,7 +58,7 @@ static const audio_block_t zeroblock = { |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
#if !defined(_MAPFLOAT) |
|
|
|
|
#ifndef _MAPFLOAT |
|
|
|
|
#define _MAPFLOAT |
|
|
|
|
inline float mapfloat(float val, float in_min, float in_max, float out_min, float out_max) |
|
|
|
|
{ |
|
|
|
@ -68,8 +68,7 @@ inline float mapfloat(float val, float in_min, float in_max, float out_min, floa |
|
|
|
|
|
|
|
|
|
void AudioEffectStereoPanorama::panorama(float p) |
|
|
|
|
{ |
|
|
|
|
pan_r = mapfloat(p, 0.0, 1.0, -1.0, 1.0); |
|
|
|
|
pan_l = mapfloat(p, 0.0, 1.0, 1.0, -1.0); |
|
|
|
|
pan = mapfloat(p, 0.0, 1.0, -1.0, 1.0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void AudioEffectStereoPanorama::update(void) |
|
|
|
@ -95,14 +94,24 @@ void AudioEffectStereoPanorama::update(void) |
|
|
|
|
|
|
|
|
|
for (uint16_t n = 0; n < AUDIO_BLOCK_SAMPLES; n++) |
|
|
|
|
{ |
|
|
|
|
if (pan_r > 0.0) |
|
|
|
|
out_f[0][n] = (pan_r / 2.0 * in_f[1][n]) + ((1.0 - pan_r) / 2.0 * in_f[0][n]); |
|
|
|
|
if (pan != 0.0) |
|
|
|
|
{ |
|
|
|
|
if (pan > 0.0) |
|
|
|
|
{ |
|
|
|
|
out_f[0][n] = (pan / 2.0 * in_f[1][n]) + ((1.0 - pan) / 2.0 * in_f[0][n]); |
|
|
|
|
out_f[1][n] = (1.0 - pan) * in_f[1][n]; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
out_f[0][n] = abs(pan_r) * in_f[0][n]; |
|
|
|
|
if (pan_l > 0.0) |
|
|
|
|
out_f[1][n] = (pan_l / 2.0 * in_f[0][n]) + ((1.0 - pan_l) / 2.0 * in_f[1][n]); |
|
|
|
|
{ |
|
|
|
|
out_f[1][n] = (pan / 2.0 * in_f[0][n]) + ((1.0 - pan) / 2.0 * in_f[1][n]); |
|
|
|
|
out_f[0][n] = (1.0 - pan) * in_f[0][n]; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
out_f[1][n] = abs(pan_l) * in_f[1][n]; |
|
|
|
|
{ |
|
|
|
|
out_f[0][n] = in_f[0][n]; |
|
|
|
|
out_f[1][n] = in_f[1][n]; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
arm_float_to_q15(out_f[0], out[0]->data, AUDIO_BLOCK_SAMPLES); |
|
|
|
|