1
/* This program is licensed under the GNU Library General Public License,
2
* version 2, a copy of which is included with this program (LICENCE.LGPL).
4
* (c) 2002 Simon Hosie <gumboot@clear.net.nz>
10
* 'Digital Filters', third edition, by R. W. Hamming ISBN 0-486-65088-X
13
* 2002-05-31 ready for the world (or some small section thereof)
17
* zero-crossing clipping in coefficient table
20
#ifndef _RESAMPLE_H_INCLUDED
21
#define _RESAMPLE_H_INCLUDED
27
unsigned int channels, infreq, outfreq, taps;
39
RES_GAIN, /* (double)1.0 */
40
RES_CUTOFF, /* (double)0.80 */
41
RES_TAPS, /* (int)45 */
42
RES_BETA /* (double)16.0 */
45
int res_init(res_state *state, int channels, int outfreq, int infreq, res_parameter op1, ...);
47
* Configure *state to manage a data stream with the specified parameters. The
48
* string 'params' is currently unspecified, but will configure the parameters
51
* This function allocates memory, and requires that res_clear() be called when
52
* the buffer is no longer needed.
55
* All counts/lengths used in the following functions consider only the data in
56
* a single channel, and in numbers of samples rather than bytes, even though
57
* functionality will be mirrored across as many channels as specified here.
61
int res_push_max_input(res_state const *state, size_t maxoutput);
63
* Returns the maximum number of input elements that may be provided without
64
* risk of flooding an output buffer of size maxoutput. maxoutput is
65
* specified in counts of elements, NOT in bytes.
69
int res_push_check(res_state const *state, size_t srclen);
71
* Returns the number of elements that will be returned if the given srclen
72
* is used in the next call to res_push().
76
int res_push(res_state *state, SAMPLE **dstlist, SAMPLE const **srclist, size_t srclen);
77
int res_push_interleaved(res_state *state, SAMPLE *dest, SAMPLE const *source, size_t srclen);
79
* Pushes srclen samples into the front end of the filter, and returns the
80
* number of resulting samples.
82
* res_push(): srclist and dstlist point to lists of pointers, each of which
83
* indicates the beginning of a list of samples.
85
* res_push_interleaved(): source and dest point to the beginning of a list of
86
* interleaved samples.
90
int res_drain(res_state *state, SAMPLE **dstlist);
91
int res_drain_interleaved(res_state *state, SAMPLE *dest);
93
* Recover the remaining elements by flushing the internal pool with 0 values,
94
* and storing the resulting samples.
96
* After either of these functions are called, *state should only re-used in a
97
* final call to res_clear().
101
void res_clear(res_state *state);
103
* Free allocated buffers, etc.