Debian Codegraph @

src/tests/resample_total.c

raw
1 // Those select the specific syn123 functions, without
2 // this, the native wrapper is used, hopefully matching off_t.
3 //#define _FILE_OFFSET_BITS 64
4 //#define _FILE_OFFSET_BITS 32
5 #define SYN123_PORTABLE_API
6 #include "config.h"
7 #include <syn123.h>
8
9 #include <inttypes.h>
10
11
12 #ifdef SYN123_PORTABLE_API
13 typedef int64_t synoff;
14 typedef int64_t synprint;
15 #define SYNPRINT PRIi64
16 #else
17 typedef off_t synoff;
18 typedef intmax_t synprint;
19 #define SYNPRINT PRIiMAX
20 #endif
21
22 #include <stdio.h>
23
24 const long arate = 8000;
25 const long brate = 48000;
26 const synoff ins = 12637;
27 const synoff outs = 75822;
28
29 int main()
30 {
31 #ifdef SYN123_PORTABLE_API
32 synoff outs2 = syn123_resample_total64(arate,brate,ins);
33 synoff ins2 = syn123_resample_intotal64(arate,brate,outs);
34 #else
35 synoff outs2 = syn123_resample_total(arate,brate,ins);
36 synoff ins2 = syn123_resample_intotal(arate,brate,outs);
37 #endif
38 int err = 0;
39 if(outs2 != outs && ++err)
40 fprintf(stderr, "total mismatch: %" SYNPRINT " != %" SYNPRINT "\n"
41 , (synprint)outs2, (synprint)outs );
42 if(ins2 != ins && ++err)
43 fprintf(stderr, "intotal mismatch: %" SYNPRINT " != %" SYNPRINT "\n"
44 , (synprint)ins2, (synprint)ins );
45 printf("%s\n", err ? "FAIL" : "PASS");
46 return err;
47 }