feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change
on this file since dc08c4f was
dc08c4f,
checked in by Paul Brossier <piem@piem.org>, 8 years ago
|
tests/utils_tests.h: add VA_ARGS versions of variadic macros
|
-
Property mode set to
100644
|
File size:
1.3 KB
|
Rev | Line | |
---|
[474a573] | 1 | #include <time.h> |
---|
[248da64] | 2 | #include <stdlib.h> |
---|
| 3 | #include <stdio.h> |
---|
[474a573] | 4 | #include <math.h> |
---|
| 5 | #include <assert.h> |
---|
[06dba46] | 6 | #include "config.h" |
---|
[248da64] | 7 | |
---|
[dc08c4f] | 8 | #ifdef HAVE_C99_VARARGS_MACROS |
---|
| 9 | #define PRINT_ERR(...) fprintf(stderr, "AUBIO-TESTS ERROR: " __VA_ARGS__) |
---|
| 10 | #define PRINT_MSG(...) fprintf(stdout, __VA_ARGS__) |
---|
| 11 | #define PRINT_DBG(...) fprintf(stderr, __VA_ARGS__) |
---|
| 12 | #define PRINT_WRN(...) fprintf(stderr, "AUBIO-TESTS WARNING: " __VA_ARGS__) |
---|
| 13 | #else |
---|
[474a573] | 14 | #define PRINT_ERR(format, args...) fprintf(stderr, "AUBIO-TESTS ERROR: " format , ##args) |
---|
[248da64] | 15 | #define PRINT_MSG(format, args...) fprintf(stdout, format , ##args) |
---|
| 16 | #define PRINT_DBG(format, args...) fprintf(stderr, format , ##args) |
---|
[474a573] | 17 | #define PRINT_WRN(format, args...) fprintf(stderr, "AUBIO-TESTS WARNING: " format, ##args) |
---|
[dc08c4f] | 18 | #endif |
---|
[474a573] | 19 | |
---|
[06dba46] | 20 | #ifdef HAVE_WIN_HACKS |
---|
| 21 | // http://en.wikipedia.org/wiki/Linear_congruential_generator |
---|
| 22 | // no srandom/random on win32 |
---|
| 23 | |
---|
| 24 | uint_t srandom_seed = 1029; |
---|
| 25 | |
---|
| 26 | void srandom(uint_t new_seed) { |
---|
| 27 | srandom_seed = new_seed; |
---|
| 28 | } |
---|
| 29 | |
---|
| 30 | uint_t random(void) { |
---|
| 31 | srandom_seed = 1664525 * srandom_seed + 1013904223; |
---|
| 32 | return srandom_seed; |
---|
| 33 | } |
---|
| 34 | #endif |
---|
| 35 | |
---|
[158e031] | 36 | void utils_init_random (void); |
---|
| 37 | |
---|
| 38 | void utils_init_random (void) { |
---|
[474a573] | 39 | time_t now = time(0); |
---|
| 40 | struct tm *tm_struct = localtime(&now); |
---|
| 41 | int seed = tm_struct->tm_sec; |
---|
| 42 | //PRINT_WRN("current seed: %d\n", seed); |
---|
| 43 | srandom (seed); |
---|
| 44 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.