source: roaraudio/include/libroardsp/libroardsp.h @ 1003:ddf048d9f930

Last change on this file since 1003:ddf048d9f930 was 1003:ddf048d9f930, checked in by phi, 15 years ago

added new ROARDSP_FCTL_Q and ROARDSP_FCTL_MODE

File size: 5.3 KB
Line 
1//libroardsp.h:
2
3/*
4 *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - August 2008
5 *
6 *  This file is part of libroardsp a part of RoarAudio,
7 *  a cross-platform sound system for both, home and professional use.
8 *  See README for details.
9 *
10 *  This file is free software; you can redistribute it and/or modify
11 *  it under the terms of the GNU General Public License version 3
12 *  as published by the Free Software Foundation.
13 *
14 *  libroardsp is distributed in the hope that it will be useful,
15 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 *  GNU General Public License for more details.
18 *
19 *  You should have received a copy of the GNU General Public License
20 *  along with this software; see the file COPYING.  If not, write to
21 *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
22 *
23 */
24
25#ifndef _LIBROARDSP_H_
26#define _LIBROARDSP_H_
27
28#include <roaraudio.h>
29
30__BEGIN_DECLS
31
32#include "midi.h"
33
34// defines
35#define ROARDSP_MAX_FILTERS_PER_CHAIN 8
36
37#define ROARDSP_FILTER_NONE           0
38#define ROARDSP_FILTER_AMP            1
39#define ROARDSP_FILTER_LOWP           2
40#define ROARDSP_FILTER_HIGHP          3
41#define ROARDSP_FILTER_MODULATE       4
42#define ROARDSP_FILTER_QUANTIFY       5
43#define ROARDSP_FILTER_CLIP           6
44#define ROARDSP_FILTER_ADD            7
45
46// filter CTLs:
47
48#define ROARDSP_FCTL_FREQ             1
49#define ROARDSP_FCTL_TIME             2
50#define ROARDSP_FCTL_MUL              3
51#define ROARDSP_FCTL_DIV              4
52#define ROARDSP_FCTL_N                5
53#define ROARDSP_FCTL_LIMIT            6
54#define ROARDSP_FCTL_PHASE            7
55#define ROARDSP_FCTL_Q                8
56#define ROARDSP_FCTL_MODE             9
57
58// types:
59
60struct roardsp_filter {
61 int    channels;
62 int    bits;
63 int    rate;
64 void * inst;
65 int (*calc  )(struct roardsp_filter * filter, void * data, size_t samples);
66 int (*uninit)(struct roardsp_filter * filter);
67 int (*ctl   )(struct roardsp_filter * filter, int cmd, void * data);
68};
69
70struct roardsp_filterchain {
71 int filters;
72 struct roardsp_filter * filter[ROARDSP_MAX_FILTERS_PER_CHAIN];
73};
74
75struct roardsp_lowp {
76 uint32_t freq; // in mHz (0Hz..4MHz)
77 uint16_t a, b;
78 int32_t  old[ROAR_MAX_CHANNELS];
79};
80
81struct roardsp_highp {
82 uint32_t freq; // in mHz (0Hz..4MHz)
83 int32_t  a, b, c;
84 int32_t  oldout[ROAR_MAX_CHANNELS];
85 int32_t  oldin[ROAR_MAX_CHANNELS];
86};
87
88struct roardsp_amp {
89 int32_t  mul;
90 int32_t  div;
91};
92
93// funcs:
94int    roardsp_filter_str2id(char * str);
95char * roardsp_filter_id2str(int id);
96int    roardsp_filter_init  (struct roardsp_filter * filter, struct roar_stream * stream, int id);
97int    roardsp_filter_uninit(struct roardsp_filter * filter);
98int    roardsp_filter_calc  (struct roardsp_filter * filter, void * data, size_t len);
99int    roardsp_filter_ctl   (struct roardsp_filter * filter, int cmd, void * data);
100
101int roardsp_fchain_init  (struct roardsp_filterchain * chain);
102int roardsp_fchain_uninit(struct roardsp_filterchain * chain);
103int roardsp_fchain_add   (struct roardsp_filterchain * chain, struct roardsp_filter * filter);
104int roardsp_fchain_calc  (struct roardsp_filterchain * chain, void * data, size_t len);
105int roardsp_fchain_num   (struct roardsp_filterchain * chain);
106
107// filter:
108
109int roardsp_lowp_init  (struct roardsp_filter * filter, struct roar_stream * stream, int id);
110int roardsp_lowp_uninit(struct roardsp_filter * filter);
111int roardsp_lowp_calc16(struct roardsp_filter * filter, void * data, size_t samples);
112int roardsp_lowp_ctl   (struct roardsp_filter * filter, int cmd, void * data);
113
114int roardsp_highp_init  (struct roardsp_filter * filter, struct roar_stream * stream, int id);
115int roardsp_highp_uninit(struct roardsp_filter * filter);
116int roardsp_highp_calc16(struct roardsp_filter * filter, void * data, size_t samples);
117int roardsp_highp_ctl   (struct roardsp_filter * filter, int cmd, void * data);
118
119int roardsp_amp_init  (struct roardsp_filter * filter, struct roar_stream * stream, int id);
120int roardsp_amp_uninit(struct roardsp_filter * filter);
121int roardsp_amp_calc16(struct roardsp_filter * filter, void * data, size_t samples);
122int roardsp_amp_calc8 (struct roardsp_filter * filter, void * data, size_t samples);
123int roardsp_amp_ctl   (struct roardsp_filter * filter, int cmd, void * data);
124
125int roardsp_add_init  (struct roardsp_filter * filter, struct roar_stream * stream, int id);
126int roardsp_add_calc16(struct roardsp_filter * filter, void * data, size_t samples);
127
128int roardsp_quantify_init  (struct roardsp_filter * filter, struct roar_stream * stream, int id);
129int roardsp_quantify_uninit(struct roardsp_filter * filter);
130int roardsp_quantify_calc16(struct roardsp_filter * filter, void * data, size_t samples);
131int roardsp_quantify_ctl   (struct roardsp_filter * filter, int cmd, void * data);
132
133int roardsp_clip_init  (struct roardsp_filter * filter, struct roar_stream * stream, int id);
134int roardsp_clip_calc16(struct roardsp_filter * filter, void * data, size_t samples);
135int roardsp_clip_ctl   (struct roardsp_filter * filter, int cmd, void * data);
136
137// codecs:
138int roardsp_conv_alaw2pcm16 (int16_t * out, char * in, size_t len);
139int roardsp_conv_pcm162alaw (char * out, int16_t * in, size_t len);
140
141int roardsp_conv_mulaw2pcm16 (int16_t * out, char * in, size_t len);
142int roardsp_conv_pcm162mulaw (char * out, int16_t * in, size_t len);
143
144__END_DECLS
145
146#endif
147
148//ll
Note: See TracBrowser for help on using the repository browser.