X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=libsamplerate%2Ftests%2Futil.h;fp=libsamplerate%2Ftests%2Futil.h;h=3ea764f69fb149931e135a9ce8ba54e2631c9beb;hb=8529da432e52c7903e8ef3488e60725a099e6e63;hp=0000000000000000000000000000000000000000;hpb=27013d8f68878b8ed2d3f747e26f562d08d7d678;p=audio-libsamplerate.git diff --git a/libsamplerate/tests/util.h b/libsamplerate/tests/util.h new file mode 100644 index 0000000..3ea764f --- /dev/null +++ b/libsamplerate/tests/util.h @@ -0,0 +1,40 @@ +/* +** Copyright (c) 2002-2016, Erik de Castro Lopo +** All rights reserved. +** +** This code is released under 2-clause BSD license. Please see the +** file at : https://github.com/erikd/libsamplerate/blob/master/COPYING +*/ + +#define ABS(a) (((a) < 0) ? - (a) : (a)) +#define MIN(a,b) (((a) < (b)) ? (a) : (b)) +#define MAX(a,b) (((a) >= (b)) ? (a) : (b)) + +#define ARRAY_LEN(x) ((int) (sizeof (x) / sizeof ((x) [0]))) + +void gen_windowed_sines (int freq_count, const double *freqs, double max, float *output, int output_len) ; + +void save_oct_float (char *filename, float *input, int in_len, float *output, int out_len) ; +void save_oct_double (char *filename, double *input, int in_len, double *output, int out_len) ; + +void interleave_data (const float *in, float *out, int frames, int channels) ; + +void deinterleave_data (const float *in, float *out, int frames, int channels) ; + +void reverse_data (float *data, int datalen) ; + +double calculate_snr (float *data, int len, int expected_peaks) ; + +const char * get_cpu_name (void) ; + +#if OS_IS_WIN32 +/* +** Extra Win32 hacks. +** +** Despite Microsoft claim of windows being POSIX compatibile it has '_sleep' +** instead of 'sleep'. +*/ + +#define sleep _sleep +#endif +