1 #include "soundpipe.h"
2 #include "md5.h"
3 #include "tap.h"
4 #include "test.h"
5 
6 typedef struct {
7     sp_noise *ns;
8     sp_tone *tn;
9 } UserData;
10 
t_tone(sp_test * tst,sp_data * sp,const char * hash)11 int t_tone(sp_test *tst, sp_data *sp, const char *hash)
12 {
13     uint32_t n;
14     int fail = 0;
15 
16     UserData ud;
17     sp_noise_create(&ud.ns);
18     sp_tone_create(&ud.tn);
19     sp_noise_init(sp, ud.ns);
20     sp_tone_init(sp, ud.tn);
21 
22     SPFLOAT in;
23 
24     for(n = 0; n < tst->size; n++) {
25         sp_noise_compute(sp, ud.ns, NULL, &in);
26         sp_tone_compute(sp, ud.tn, &in, &sp->out[0]);
27         sp_test_add_sample(tst, sp->out[0]);
28     }
29 
30     fail = sp_test_verify(tst, hash);
31 
32     sp_tone_destroy(&ud.tn);
33     sp_noise_destroy(&ud.ns);
34 
35     if(fail) return SP_NOT_OK;
36     else return SP_OK;
37 }
38