continue decoding, even if volume too low

it's amazing but one bit is actually enough to decode at 44100Hz
This commit is contained in:
Ahmet Inan 2015-02-13 17:24:52 +01:00
parent 7c6689f126
commit 14a5c7b185

View file

@ -249,10 +249,8 @@ void decode(int samples) {
for (int sample = 0; sample < samples; ++sample, ++buffer_pos) {
int amp = audio_buffer[sample];
float avg_pow = filter(&avg_power, amp * amp);
float avg_amp = min(sqrt(2.0f * avg_pow), 32767.0f);
float avg_amp = clamp(sqrt(2.0f * avg_pow), 1.0f, 32767.0f);
*volume = avg_amp / 32767.0f;
if (avg_amp < 16.0f)
continue;
float norm_amp = (127 * amp) / avg_amp;
spectrum_analyzer(norm_amp);