feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/timestretchfix/ffmpeg5
Last change
on this file since bf3f09b was
332487b,
checked in by Paul Brossier <piem@piem.org>, 11 years ago
|
tests/src: clean up includes
|
-
Property mode set to
100644
|
File size:
1.3 KB
|
Line | |
---|
1 | #include "aubio.h" |
---|
2 | #include "utils_tests.h" |
---|
3 | |
---|
4 | int main (void) |
---|
5 | { |
---|
6 | uint_t i, window_size = 16; // window size |
---|
7 | cvec_t * complex_vector = new_cvec (window_size); // input buffer |
---|
8 | uint_t rand_times = 4; |
---|
9 | |
---|
10 | utils_init_random(); |
---|
11 | |
---|
12 | while (rand_times -- ) { |
---|
13 | // fill with random phas and norm |
---|
14 | for ( i = 0; i < complex_vector->length; i++ ) { |
---|
15 | complex_vector->norm[i] = ( 2. / RAND_MAX * random() - 1. ); |
---|
16 | complex_vector->phas[i] = ( 2. / RAND_MAX * random() - 1. ) * M_PI; |
---|
17 | } |
---|
18 | // print the vector |
---|
19 | cvec_print(complex_vector); |
---|
20 | } |
---|
21 | |
---|
22 | // set all vector elements to `0` |
---|
23 | cvec_norm_zeros(complex_vector); |
---|
24 | for ( i = 0; i < complex_vector->length; i++ ) { |
---|
25 | assert( complex_vector->norm[i] == 0. ); |
---|
26 | // assert( complex_vector->phas[i] == 0 ); |
---|
27 | } |
---|
28 | cvec_print(complex_vector); |
---|
29 | |
---|
30 | // set all vector elements to `1` |
---|
31 | cvec_norm_ones(complex_vector); |
---|
32 | for ( i = 0; i < complex_vector->length; i++ ) { |
---|
33 | assert( complex_vector->norm[i] == 1. ); |
---|
34 | // assert( complex_vector->phas[i] == 0 ); |
---|
35 | } |
---|
36 | cvec_print(complex_vector); |
---|
37 | |
---|
38 | cvec_zeros(complex_vector); |
---|
39 | cvec_phas_zeros(complex_vector); |
---|
40 | cvec_norm_zeros(complex_vector); |
---|
41 | cvec_norm_ones(complex_vector); |
---|
42 | cvec_phas_ones(complex_vector); |
---|
43 | cvec_copy(complex_vector, complex_vector); |
---|
44 | |
---|
45 | // destroy it |
---|
46 | del_cvec(complex_vector); |
---|
47 | return 0; |
---|
48 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.