diff options
author | Benjamin Otte <otte@gnome.org> | 2008-12-28 20:23:54 +0100 |
---|---|---|
committer | Benjamin Otte <otte@gnome.org> | 2008-12-28 20:23:54 +0100 |
commit | 15b71e8c41ee617c0b7003efcc1a8e35e6da4022 (patch) | |
tree | 1e09c04fd0ddd106b93b1bb00077f218ce2273d9 | |
parent | d279c9d1b5de636f577ffd08860e2dfd9d111cc1 (diff) |
fix downsample file to a) work and b) not emit warnings
-rw-r--r-- | test/sound/downsample.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/test/sound/downsample.c b/test/sound/downsample.c index f8619cdc..3f7692fc 100644 --- a/test/sound/downsample.c +++ b/test/sound/downsample.c @@ -82,22 +82,20 @@ cut_silence (char *data, guint length, guint steps) { guint i, new; - new = length * steps; - while (new > 0) { + for (new = length; new > 0; new--) { for (i = 0; i < steps; i++) { - if (data[new - 1 - i] != 0) + if (data[new * steps - 1 - i] != 0) goto out; } - new -= steps; } out: - if (new / steps < length) { - g_print ("Info: Cut %u zero sample(s) at end of file\n", length - new / steps); + if (new < length) { + g_print ("Info: Cut %u zero sample(s) at end of file\n", length - new); } else { g_print ("Info: No zero samples cut at end of file\n"); } - return length; + return length - new; } int |