Debian Codegraph @

3rdparty/iaxclient/lib/sox/README.sox

raw
1
2 16Apr2003 Steve Kann <[email protected]>
3
4 The code in resample.c/resample.h has been liberally yanked from the SoX
5 distribution, and reworked just a tiny bit to allow compilation outside
6 of SoX.
7
8 Aside from some minor changes to the calling conventions (to use just
9 the private resample data structure, not the larget sox structures), and
10 generic code moves/defines that needed to be localized, the other
11 notable changes are:
12
13 1) st_sample_t is here defined as a 16 bit integer, and not a 32 bit
14 integer, so this code will will be able to operate over 16 bit unsigned
15 samples (the resample effect works with floating point internally
16 anyway, so it was a small change in the code).
17
18 2) The "getopts" call is not necessary (nor, at this point helpful,
19 since the options are set to their default now ad the beginning of
20 start).
21
22 3) start now takes two additional parameters, "inrate" and "outrate"
23
24 To use this, the basic idea is:
25
26
27 st_resample_t resampler;
28
29 st_resample_start(&resampler, inrate, outrate);
30
31 while(you have input data)
32 {
33 iNum = (number of Input samples we have);
34 oNum = (size of Output buffer available)
35 iBuf = input buffer;
36 oBuf = output buffer;
37 if(st_resample_flow(&resampler, ibuf, obuf, &iNum, &oNum) != ST_SUCCESS)
38 {
39 handle error.
40 }
41
42 (after calling, iNum, oNum will the the count of buffers
43 read/written)
44 }
45
46 finally, you call st_sample_drain, to get the "last" output;
47
48 if(st_sample_drain(&resampler, obuf, &oNum) != ST_SUCCESS)
49 {
50 error
51 }
52
53 Then, call st_sample_stop, to free resources:
54 st_sample_stop(&resampler);
55
56 For a discussion on this and other resampling algorithms, see this page for a
57 great analysis by K. Bradley and Andreas Wilde at:
58 http://leute.server.de/wilde/resample.html
59