source: roaraudio/include/libroardsp/libroardsp.h @ 735:aa6ba210e826

Last change on this file since 735:aa6ba210e826 was 735:aa6ba210e826, checked in by phi, 16 years ago

added alaw reading support to libroardsp

File size: 3.5 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#include "midi.h"
31
32// defines
33#define ROARDSP_MAX_FILTERS_PER_CHAIN 8
34
35#define ROARDSP_FILTER_NONE           0
36#define ROARDSP_FILTER_AMP            1
37#define ROARDSP_FILTER_LOWP           2
38#define ROARDSP_FILTER_HIGHP          3
39
40// filter CTLs:
41
42#define ROARDSP_FCTL_FREQ             1
43#define ROARDSP_FCTL_TIME             2
44#define ROARDSP_FCTL_MUL              3
45#define ROARDSP_FCTL_DIV              4
46
47// types:
48
49struct roardsp_filter {
50 int    channels;
51 int    bits;
52 int    rate;
53 void * inst;
54 int (*calc  )(struct roardsp_filter * filter, void * data, size_t samples);
55 int (*uninit)(struct roardsp_filter * filter);
56 int (*ctl   )(struct roardsp_filter * filter, int cmd, void * data);
57};
58
59struct roardsp_filterchain {
60 int filters;
61 struct roardsp_filter * filter[ROARDSP_MAX_FILTERS_PER_CHAIN];
62};
63
64struct roardsp_lowp {
65 uint32_t freq; // in mHz (0Hz..4MHz)
66 uint16_t a, b;
67 int32_t  old[ROAR_MAX_CHANNELS];
68};
69
70struct roardsp_highp {
71 uint32_t freq; // in mHz (0Hz..4MHz)
72 int32_t  a, b, c;
73 int32_t  oldout[ROAR_MAX_CHANNELS];
74 int32_t  oldin[ROAR_MAX_CHANNELS];
75};
76
77// funcs:
78int    roardsp_filter_str2id(char * str);
79char * roardsp_filter_id2str(int id);
80int    roardsp_filter_init  (struct roardsp_filter * filter, struct roar_stream * stream, int id);
81int    roardsp_filter_uninit(struct roardsp_filter * filter);
82int    roardsp_filter_calc  (struct roardsp_filter * filter, void * data, size_t len);
83int    roardsp_filter_ctl   (struct roardsp_filter * filter, int cmd, void * data);
84
85int roardsp_fchain_init  (struct roardsp_filterchain * chain);
86int roardsp_fchain_uninit(struct roardsp_filterchain * chain);
87int roardsp_fchain_add   (struct roardsp_filterchain * chain, struct roardsp_filter * filter);
88int roardsp_fchain_calc  (struct roardsp_filterchain * chain, void * data, size_t len);
89int roardsp_fchain_num   (struct roardsp_filterchain * chain);
90
91// filter:
92
93int roardsp_lowp_init  (struct roardsp_filter * filter, struct roar_stream * stream, int id);
94int roardsp_lowp_uninit(struct roardsp_filter * filter);
95int roardsp_lowp_calc16(struct roardsp_filter * filter, void * data, size_t samples);
96int roardsp_lowp_ctl   (struct roardsp_filter * filter, int cmd, void * data);
97
98int roardsp_highp_init  (struct roardsp_filter * filter, struct roar_stream * stream, int id);
99int roardsp_highp_uninit(struct roardsp_filter * filter);
100int roardsp_highp_calc16(struct roardsp_filter * filter, void * data, size_t samples);
101int roardsp_highp_ctl   (struct roardsp_filter * filter, int cmd, void * data);
102
103// codecs:
104int roardsp_conv_alaw2pcm16 (int16_t * out, char * in, size_t len);
105
106#endif
107
108//ll
Note: See TracBrowser for help on using the repository browser.