From e5d56683935310d02d51952df2a9a89b17d7ce26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=20Paloj=C3=A4rvi?= Date: Mon, 9 May 2022 15:50:10 +0300 Subject: Fixed bug with main analysis loop --- utils/tinywavinfo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/tinywavinfo.c b/utils/tinywavinfo.c index a74ca7d..301f8dc 100644 --- a/utils/tinywavinfo.c +++ b/utils/tinywavinfo.c @@ -185,7 +185,7 @@ void analyse_sample(FILE *file, unsigned int channels, unsigned int bits, if (num_read > 0) { if (2 == bytes_per_sample) { short *buffer_ptr = (short *)buffer; - for (i = 0; i < num_read; i += channels) { + for (i = 0; i < num_read / bytes_per_sample; i += channels) { for (ch = 0; ch < channels; ch++) { int temp = *buffer_ptr++; /* Signal Normalization */ @@ -196,7 +196,7 @@ void analyse_sample(FILE *file, unsigned int channels, unsigned int bits, } if (4 == bytes_per_sample) { int *buffer_ptr = (int *)buffer; - for (i = 0; i < num_read; i += channels) { + for (i = 0; i < num_read / bytes_per_sample; i += channels) { for (ch = 0; ch < channels; ch++) { int temp = *buffer_ptr++; /* Signal Normalization */ -- cgit v1.2.3