aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorMiko Palojärvi <miko.palojarvi@aavamobile.com>2022-05-09 15:50:10 +0300
committerMiko Palojärvi <miko.palojarvi@aavamobile.com>2022-05-09 15:50:10 +0300
commite5d56683935310d02d51952df2a9a89b17d7ce26 (patch)
tree8afdb15382e460e6a7e322488fa7431d0f16b8a6 /utils
parentc127110249967e0722d80bb41e33713accdcff8f (diff)
Fixed bug with main analysis loop
Diffstat (limited to 'utils')
-rw-r--r--utils/tinywavinfo.c4
1 files 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 */