Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/alexmarsev/soxr.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Sykes <robs@users.sourceforge.net>2015-08-18 23:40:35 +0300
committerRob Sykes <robs@users.sourceforge.net>2015-08-18 23:40:35 +0300
commitd51f3ede7f2e6c5cb08b85df8acd2e616f53059d (patch)
treea691c2d130b9e5b2cfa3ada3379f4ac128b0c026
parentbe33e5d050643c1034ff30c90361798968405ab7 (diff)
fix conversion between differing I/O types, but with no rate-change
-rw-r--r--src/rate.h6
-rwxr-xr-xtests/eg-test27
2 files changed, 27 insertions, 6 deletions
diff --git a/src/rate.h b/src/rate.h
index 81cabff..063c050 100644
--- a/src/rate.h
+++ b/src/rate.h
@@ -1,4 +1,4 @@
-/* SoX Resampler Library Copyright (c) 2007-13 robs@users.sourceforge.net
+/* SoX Resampler Library Copyright (c) 2007-14 robs@users.sourceforge.net
* Licence for this file: LGPL v2.1 See LICENCE for details. */
#include <math.h>
@@ -447,7 +447,7 @@ static char const * rate_init(
p->num_stages = shift + have_pre_stage + have_arb_stage + have_post_stage;
if (!p->num_stages && multiplier != 1) {
- arbL = 0;
+ bits = arbL = 0; /* Use cubic_stage in this case. */
++p->num_stages;
}
p->stages = calloc((size_t)p->num_stages + 1, sizeof(*p->stages));
@@ -483,7 +483,7 @@ static char const * rate_init(
log2_min_dft_size, log2_large_dft_size);
}
- if (!bits && have_arb_stage) { /* Quick and dirty arb stage: */
+ if (!bits && have_arb_stage) { /* `Quick' cubic arb stage: */
arb_stage.type = cubic_stage;
arb_stage.fn = cubic_stage_fn;
arb_stage.mult = multiplier, multiplier = 1;
diff --git a/tests/eg-test b/tests/eg-test
index 797c715..3fa46fc 100755
--- a/tests/eg-test
+++ b/tests/eg-test
@@ -1,12 +1,20 @@
#!/bin/bash
-# SoX Resampler Library Copyright (c) 2007-13 robs@users.sourceforge.net
+set -e
+
+# SoX Resampler Library Copyright (c) 2007-14 robs@users.sourceforge.net
# Licence for this file: LGPL v2.1 See LICENCE for details.
len=8
#vg="valgrind --leak-check=full --show-reachable=yes"
+
+
+# Exercise example 1:
$vg ./1-single-block
+
+
+# Check that examples 2-4 can convert 96k<->44k1 and that results are same for each:
ir=96000
or=44100
for i in 1 2; do
@@ -22,8 +30,21 @@ for i in 1 2; do
done
rm *.f32
-rm ?.png
+
+
+# Check conversion between differing I/O types, but no rate-change:
+for i in 1 2 3; do
+ prev=""
+ sox -n -c $i 0.f32 synth $len gain -.1
+ ./3-options-input-fn 1 1 $i 0 2 < 0.f32 | ./3-options-input-fn 1 1 $i 2 0 > 1.f32
+ cmp [01].f32
+done
+rm *.f32
+
+
+# Exercise VR making sure that varied internal stage reconfigurations occur:
+rm -f ?.png
for n in 0 1 2 3; do
- $vg ./5-variable-rate $n | sox -tf32 -r44100 -c1 - -n spectrogram -hwk -o $n.png -X 50
+ $vg ./5-variable-rate $n | sox -tf32 -r44100 -c1 - -n spectrogram -z130 -hwd -o $n.png -X 50
vg=""
done