Unified · Split
| @@ -37,7 +37,7 @@ · 36 unmodified lines | |||
| 37 | #include "util.h" | 37 | #include "util.h" |
| 38 | 38 | ||
| 39 | #define MAX_FREQS 4 | 39 | #define MAX_FREQS 4 |
| 40 | #define BUFFER_LEN 40000 | 40 | #define BUFFER_LEN 80000 |
| 41 | 41 | ||
| 42 | #define SAFE_STRNCAT(dest,src,len) \ | 42 | #define SAFE_STRNCAT(dest,src,len) \ |
| 43 | { int safe_strncat_count ; \ | 43 | { int safe_strncat_count ; \ |
| @@ -78,7 +78,7 @@ main (int argc, char *argv []) · 34 unmodified lines | |||
| 78 | { { "sndfile-resample", | 78 | { { "sndfile-resample", |
| 79 | "examples/sndfile-resample --version", | 79 | "examples/sndfile-resample --version", |
| 80 | "libsamplerate", | 80 | "libsamplerate", |
| 81 | "examples/sndfile-resample --max-speed -c 2 -to %d source.wav destination.wav", | 81 | "examples/sndfile-resample --max-speed -c 0 -to %d source.wav destination.wav", |
| 82 | SF_FORMAT_WAV | SF_FORMAT_PCM_32 | 82 | SF_FORMAT_WAV | SF_FORMAT_PCM_32 |
| 83 | }, | 83 | }, |
| 84 | { "sox", | 84 | { "sox", |
| @@ -282,7 +282,7 @@ generate_source_wav (const char *filename, const double *freqs, int freq_count, · 197 unmodified lines | |||
| 282 | 282 | ||
| 283 | static double | 283 | static double |
| 284 | measure_destination_wav (char *filename, int *output_samples, int expected_peaks) | 284 | measure_destination_wav (char *filename, int *output_samples, int expected_peaks) |
| 285 | { static float buffer [124000] ; | 285 | { static float buffer [250000] ; |
| 286 | 286 | ||
| 287 | SNDFILE *sndfile ; | 287 | SNDFILE *sndfile ; |
| 288 | SF_INFO sfinfo ; | 288 | SF_INFO sfinfo ; |
| @@ -299,7 +299,7 @@ measure_destination_wav (char *filename, int *output_samples, int expected_peaks · 10 unmodified lines | |||
| 299 | } ; | 299 | } ; |
| 300 | 300 | ||
| 301 | if (sfinfo.frames > ARRAY_LEN (buffer)) | 301 | if (sfinfo.frames > ARRAY_LEN (buffer)) |
| 302 | { printf ("Line %d : Too many frames of data in file.\n", __LINE__) ; | 302 | { printf ("Line %d : Too many frames (%ld) of data in file.\n", __LINE__, (long) sfinfo.frames) ; |
| 303 | exit (1) ; | 303 | exit (1) ; |
| 304 | } ; | 304 | } ; |
| 305 | 305 | ||
| @@ -328,6 +328,7 @@ measure_snr (const RESAMPLE_PROG *prog, int *output_samples, int verbose) · 22 unmodified lines | |||
| 328 | { 1, { 0.011111111111 }, 13231, 1, 1.0 }, | 328 | { 1, { 0.011111111111 }, 13231, 1, 1.0 }, |
| 329 | { 1, { 0.011111111111 }, 44101, 1, 1.0 }, | 329 | { 1, { 0.011111111111 }, 44101, 1, 1.0 }, |
| 330 | { 2, { 0.311111, 0.49 }, 78199, 2, 1.0 }, | 330 | { 2, { 0.311111, 0.49 }, 78199, 2, 1.0 }, |
| 331 | { 2, { 0.011111, 0.49 }, 12345, 1, 0.5 }, | ||
| 331 | { 2, { 0.0123456, 0.4 }, 20143, 1, 0.5 }, | 332 | { 2, { 0.0123456, 0.4 }, 20143, 1, 0.5 }, |
| 332 | { 2, { 0.0111111, 0.4 }, 26461, 1, 0.5 }, | 333 | { 2, { 0.0111111, 0.4 }, 26461, 1, 0.5 }, |
| 333 | { 1, { 0.381111111111 }, 58661, 1, 1.0 } | 334 | { 1, { 0.381111111111 }, 58661, 1, 1.0 } |
| @@ -349,7 +350,7 @@ measure_snr (const RESAMPLE_PROG *prog, int *output_samples, int verbose) · 15 unmodified lines | |||
| 349 | generate_source_wav ("source.wav", snr_test [k].freqs, snr_test [k].freq_count, prog->format) ; | 350 | generate_source_wav ("source.wav", snr_test [k].freqs, snr_test [k].freq_count, prog->format) ; |
| 350 | 351 | ||
| 351 | snprintf (command, sizeof (command), prog->convert_cmd, snr_test [k].output_samplerate) ; | 352 | snprintf (command, sizeof (command), prog->convert_cmd, snr_test [k].output_samplerate) ; |
| 352 | SAFE_STRNCAT (command, " >/dev/null", sizeof (command)) ; | 353 | SAFE_STRNCAT (command, " >/dev/null 2>&1", sizeof (command)) ; |
| 353 | if ((retval = system (command)) != 0) | 354 | if ((retval = system (command)) != 0) |
| 354 | printf ("system returned %d\n", retval) ; | 355 | printf ("system returned %d\n", retval) ; |
| 355 | 356 | ||
| @@ -421,7 +422,7 @@ find_attenuation (double freq, const RESAMPLE_PROG *prog, int verbose) · 65 unmodified lines | |||
| 421 | remove (filename) ; | 422 | remove (filename) ; |
| 422 | 423 | ||
| 423 | snprintf (command, sizeof (command), prog->convert_cmd, 88189) ; | 424 | snprintf (command, sizeof (command), prog->convert_cmd, 88189) ; |
| 424 | SAFE_STRNCAT (command, " >/dev/null", sizeof (command)) ; | 425 | SAFE_STRNCAT (command, " >/dev/null 2>&1", sizeof (command)) ; |
| 425 | if ((retval = system (command)) != 0) | 426 | if ((retval = system (command)) != 0) |
| 426 | printf ("system returned %d\n", retval) ; | 427 | printf ("system returned %d\n", retval) ; |
| 427 | 428 | ||