feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change
on this file since c1f0c1d was
158e031,
checked in by Paul Brossier <piem@piem.org>, 11 years ago
|
tests/: add void to prototypes to build with -Wstrict-prototypes
|
-
Property mode set to
100644
|
File size:
988 bytes
|
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 | |
---|
[474a573] | 8 | #define PRINT_ERR(format, args...) fprintf(stderr, "AUBIO-TESTS ERROR: " format , ##args) |
---|
[248da64] | 9 | #define PRINT_MSG(format, args...) fprintf(stdout, format , ##args) |
---|
| 10 | #define PRINT_DBG(format, args...) fprintf(stderr, format , ##args) |
---|
[474a573] | 11 | #define PRINT_WRN(format, args...) fprintf(stderr, "AUBIO-TESTS WARNING: " format, ##args) |
---|
| 12 | |
---|
[06dba46] | 13 | #ifdef HAVE_WIN_HACKS |
---|
| 14 | // http://en.wikipedia.org/wiki/Linear_congruential_generator |
---|
| 15 | // no srandom/random on win32 |
---|
| 16 | |
---|
| 17 | uint_t srandom_seed = 1029; |
---|
| 18 | |
---|
| 19 | void srandom(uint_t new_seed) { |
---|
| 20 | srandom_seed = new_seed; |
---|
| 21 | } |
---|
| 22 | |
---|
| 23 | uint_t random(void) { |
---|
| 24 | srandom_seed = 1664525 * srandom_seed + 1013904223; |
---|
| 25 | return srandom_seed; |
---|
| 26 | } |
---|
| 27 | #endif |
---|
| 28 | |
---|
[158e031] | 29 | void utils_init_random (void); |
---|
| 30 | |
---|
| 31 | void utils_init_random (void) { |
---|
[474a573] | 32 | time_t now = time(0); |
---|
| 33 | struct tm *tm_struct = localtime(&now); |
---|
| 34 | int seed = tm_struct->tm_sec; |
---|
| 35 | //PRINT_WRN("current seed: %d\n", seed); |
---|
| 36 | srandom (seed); |
---|
| 37 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.