git ssb

0+

kode54 / syntrax-c



Tree: 6c0343ff56f76e49059e1846db515584125768f3

Files: 6c0343ff56f76e49059e1846db515584125768f3 / src / syntrax / resampler.h

2668 bytesRaw
1#ifndef _RESAMPLER_H_
2#define _RESAMPLER_H_
3
4/* Copyright (C) 2004-2008 Shay Green.
5 Copyright (C) 2015 Christopher Snowhill. This module is free software; you
6can redistribute it and/or modify it under the terms of the GNU Lesser
7General Public License as published by the Free Software Foundation; either
8version 2.1 of the License, or (at your option) any later version. This
9module is distributed in the hope that it will be useful, but WITHOUT ANY
10WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12details. You should have received a copy of the GNU Lesser General Public
13License along with this module; if not, write to the Free Software Foundation,
14Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
15
16#define RESAMPLER_BITS 32
17#define RESAMPLER_DECORATE syntrax
18
19#ifdef RESAMPLER_DECORATE
20#undef PASTE
21#undef EVALUATE
22#define PASTE(a,b) a ## b
23#define EVALUATE(a,b) PASTE(a,b)
24#define resampler_create EVALUATE(RESAMPLER_DECORATE,_resampler_create)
25#define resampler_dup EVALUATE(RESAMPLER_DECORATE,_resampler_dup)
26#define resampler_dup_inplace EVALUATE(RESAMPLER_DECORATE,_resampler_dup_inplace)
27#define resampler_destroy EVALUATE(RESAMPLER_DECORATE,_resampler_destroy)
28#define resampler_clear EVALUATE(RESAMPLER_DECORATE,_resampler_clear)
29#define resampler_set_rate EVALUATE(RESAMPLER_DECORATE,_resampler_set_rate)
30#define resampler_get_free EVALUATE(RESAMPLER_DECORATE,_resampler_get_free)
31#define resampler_get_min_fill EVALUATE(RESAMPLER_DECORATE,_resampler_get_min_fill)
32#define resampler_write_sample EVALUATE(RESAMPLER_DECORATE,_resampler_write_sample)
33#define resampler_get_avail EVALUATE(RESAMPLER_DECORATE,_resampler_get_avail)
34#define resampler_read_sample EVALUATE(RESAMPLER_DECORATE,_resampler_read_sample)
35#define resampler_peek_sample EVALUATE(RESAMPLER_DECORATE,_resampler_peek_sample)
36#endif
37
38#include <stdint.h>
39
40#if RESAMPLER_BITS == 16
41typedef int16_t sample_t;
42#elif RESAMPLER_BITS == 32
43typedef int32_t sample_t;
44#else
45#error Choose a bit depth!
46#endif
47
48#ifdef __cplusplus
49extern "C" {
50#endif
51
52void * resampler_create();
53void * resampler_dup(const void *);
54void resampler_dup_inplace(void *, const void *);
55void resampler_destroy(void *);
56
57void resampler_clear(void *);
58
59void resampler_set_rate( void *, double new_factor );
60
61int resampler_get_free(void *);
62int resampler_get_min_fill(void *);
63
64void resampler_write_sample(void *, sample_t s);
65
66int resampler_get_avail(void *);
67
68void resampler_read_sample( void *, sample_t *s );
69void resampler_peek_sample( void *, sample_t *s );
70
71#ifdef __cplusplus
72}
73#endif
74
75#endif
76

Built with git-ssb-web