source: roaraudio/include/libroardsp/libroardsp.h @ 2638:44b5cbce99a7

Last change on this file since 2638:44b5cbce99a7 was 2638:44b5cbce99a7, checked in by phi, 15 years ago

added vio_transcode.h

File size: 7.9 KB
RevLine 
[651]1//libroardsp.h:
2
[687]3/*
[2316]4 *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008, 2009
[687]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
[651]25#ifndef _LIBROARDSP_H_
26#define _LIBROARDSP_H_
27
[652]28#include <roaraudio.h>
29
[874]30__BEGIN_DECLS
31
[686]32#include "midi.h"
[2425]33#include "synth.h"
[1368]34#include "poly.h"
[2434]35#include "fader.h"
[1371]36#include "convert.h"
[1626]37#include "midside.h"
[2026]38#include "point.h"
[2143]39#include "remove.h"
[2316]40#include "rms.h"
[2169]41#include "transcode.h"
[2638]42#include "vio_transcode.h"
[686]43
[2187]44#ifdef ROAR_HAVE_LIBCELT
45#include "transcode_celt.h"
46#endif
[2294]47#ifdef ROAR_HAVE_LIBSPEEX
48#include "transcode_speex.h"
49#endif
[2187]50
[2386]51#ifdef ROAR_HAVE_LIBSAMPLERATE
52#include <samplerate.h>
53#endif
54
[659]55// defines
56#define ROARDSP_MAX_FILTERS_PER_CHAIN 8
57
[662]58#define ROARDSP_FILTER_NONE           0
59#define ROARDSP_FILTER_AMP            1
60#define ROARDSP_FILTER_LOWP           2
61#define ROARDSP_FILTER_HIGHP          3
[979]62#define ROARDSP_FILTER_MODULATE       4
63#define ROARDSP_FILTER_QUANTIFY       5
64#define ROARDSP_FILTER_CLIP           6
65#define ROARDSP_FILTER_ADD            7
[1004]66#define ROARDSP_FILTER_DOWNMIX        8
[1100]67#define ROARDSP_FILTER_DCBLOCK        9
[1587]68#define ROARDSP_FILTER_SWAP          10
[662]69
[672]70// filter CTLs:
71
72#define ROARDSP_FCTL_FREQ             1
73#define ROARDSP_FCTL_TIME             2
74#define ROARDSP_FCTL_MUL              3
75#define ROARDSP_FCTL_DIV              4
[979]76#define ROARDSP_FCTL_N                5
77#define ROARDSP_FCTL_LIMIT            6
78#define ROARDSP_FCTL_PHASE            7
[1003]79#define ROARDSP_FCTL_Q                8
80#define ROARDSP_FCTL_MODE             9
[672]81
[1131]82// consts for filter(chain) reset:
83#define ROARDSP_RESET_NONE            0
84#define ROARDSP_RESET_FULL            1
85#define ROARDSP_RESET_STATE           2
86
[1004]87// filter specific constants:
88#define ROARDSP_DOWNMIX_LEFT          1
89#define ROARDSP_DOWNMIX_RIGHT         2
90#define ROARDSP_DOWNMIX_ARITHMETIC    3
91#define ROARDSP_DOWNMIX_RMS           4
92
[1100]93#define ROARDSP_DCBLOCK_NUMBLOCKS     100
94
[659]95// types:
96
97struct roardsp_filter {
98 int    channels;
99 int    bits;
[673]100 int    rate;
[659]101 void * inst;
102 int (*calc  )(struct roardsp_filter * filter, void * data, size_t samples);
103 int (*uninit)(struct roardsp_filter * filter);
[672]104 int (*ctl   )(struct roardsp_filter * filter, int cmd, void * data);
[1131]105 int (*reset )(struct roardsp_filter * filter, int what);
[659]106};
107
108struct roardsp_filterchain {
109 int filters;
110 struct roardsp_filter * filter[ROARDSP_MAX_FILTERS_PER_CHAIN];
111};
112
[1105]113#ifdef ROAR_HAVE_LIBM
[659]114struct roardsp_lowp {
115 uint32_t freq; // in mHz (0Hz..4MHz)
116 uint16_t a, b;
117 int32_t  old[ROAR_MAX_CHANNELS];
118};
119
[685]120struct roardsp_highp {
121 uint32_t freq; // in mHz (0Hz..4MHz)
122 int32_t  a, b, c;
123 int32_t  oldout[ROAR_MAX_CHANNELS];
124 int32_t  oldin[ROAR_MAX_CHANNELS];
125};
[1105]126#endif
[685]127
[882]128struct roardsp_amp {
129 int32_t  mul;
130 int32_t  div;
131};
132
[1100]133struct roardsp_dcblock {
134 int cur;
135 int32_t dc[ROARDSP_DCBLOCK_NUMBLOCKS];
136};
137
[1587]138struct roardsp_swap {
139 int map[ROAR_MAX_CHANNELS];
140};
141
[659]142// funcs:
[664]143int    roardsp_filter_str2id(char * str);
144char * roardsp_filter_id2str(int id);
145int    roardsp_filter_init  (struct roardsp_filter * filter, struct roar_stream * stream, int id);
146int    roardsp_filter_uninit(struct roardsp_filter * filter);
147int    roardsp_filter_calc  (struct roardsp_filter * filter, void * data, size_t len);
[672]148int    roardsp_filter_ctl   (struct roardsp_filter * filter, int cmd, void * data);
[1131]149int    roardsp_filter_reset (struct roardsp_filter * filter, int what);
[659]150
151int roardsp_fchain_init  (struct roardsp_filterchain * chain);
152int roardsp_fchain_uninit(struct roardsp_filterchain * chain);
153int roardsp_fchain_add   (struct roardsp_filterchain * chain, struct roardsp_filter * filter);
154int roardsp_fchain_calc  (struct roardsp_filterchain * chain, void * data, size_t len);
[1131]155int roardsp_fchain_reset (struct roardsp_filterchain * chain, int what);
[679]156int roardsp_fchain_num   (struct roardsp_filterchain * chain);
[659]157
[676]158// filter:
159
[1105]160#ifdef ROAR_HAVE_LIBM
[676]161int roardsp_lowp_init  (struct roardsp_filter * filter, struct roar_stream * stream, int id);
162int roardsp_lowp_uninit(struct roardsp_filter * filter);
163int roardsp_lowp_calc16(struct roardsp_filter * filter, void * data, size_t samples);
164int roardsp_lowp_ctl   (struct roardsp_filter * filter, int cmd, void * data);
[1141]165int roardsp_lowp_reset (struct roardsp_filter * filter, int what);
[676]166
[685]167int roardsp_highp_init  (struct roardsp_filter * filter, struct roar_stream * stream, int id);
168int roardsp_highp_uninit(struct roardsp_filter * filter);
169int roardsp_highp_calc16(struct roardsp_filter * filter, void * data, size_t samples);
170int roardsp_highp_ctl   (struct roardsp_filter * filter, int cmd, void * data);
[1141]171int roardsp_highp_reset (struct roardsp_filter * filter, int what);
[1105]172#endif
[676]173
[882]174int roardsp_amp_init  (struct roardsp_filter * filter, struct roar_stream * stream, int id);
175int roardsp_amp_uninit(struct roardsp_filter * filter);
176int roardsp_amp_calc16(struct roardsp_filter * filter, void * data, size_t samples);
177int roardsp_amp_calc8 (struct roardsp_filter * filter, void * data, size_t samples);
178int roardsp_amp_ctl   (struct roardsp_filter * filter, int cmd, void * data);
[1141]179int roardsp_amp_reset (struct roardsp_filter * filter, int what);
[882]180
[979]181int roardsp_add_init  (struct roardsp_filter * filter, struct roar_stream * stream, int id);
182int roardsp_add_calc16(struct roardsp_filter * filter, void * data, size_t samples);
[1141]183int roardsp_add_reset (struct roardsp_filter * filter, int what);
[979]184
185int roardsp_quantify_init  (struct roardsp_filter * filter, struct roar_stream * stream, int id);
186int roardsp_quantify_uninit(struct roardsp_filter * filter);
187int roardsp_quantify_calc16(struct roardsp_filter * filter, void * data, size_t samples);
188int roardsp_quantify_ctl   (struct roardsp_filter * filter, int cmd, void * data);
[1141]189int roardsp_quantify_reset (struct roardsp_filter * filter, int what);
[979]190
191int roardsp_clip_calc16(struct roardsp_filter * filter, void * data, size_t samples);
192int roardsp_clip_ctl   (struct roardsp_filter * filter, int cmd, void * data);
[1141]193int roardsp_clip_reset (struct roardsp_filter * filter, int what);
[979]194
[1004]195int roardsp_downmix_init   (struct roardsp_filter * filter, struct roar_stream * stream, int id);
196int roardsp_downmix_calc162(struct roardsp_filter * filter, void * data, size_t samples);
197int roardsp_downmix_ctl    (struct roardsp_filter * filter, int cmd, void * data);
[1141]198int roardsp_downmix_reset  (struct roardsp_filter * filter, int what);
[1004]199
[1100]200int roardsp_dcblock_init   (struct roardsp_filter * filter, struct roar_stream * stream, int id);
201int roardsp_dcblock_uninit (struct roardsp_filter * filter);
202int roardsp_dcblock_calc16 (struct roardsp_filter * filter, void * data, size_t samples);
[1131]203int roardsp_dcblock_reset  (struct roardsp_filter * filter, int what);
[1100]204
[1587]205int roardsp_swap_init   (struct roardsp_filter * filter, struct roar_stream * stream, int id);
206int roardsp_swap_uninit (struct roardsp_filter * filter);
207int roardsp_swap_calc162(struct roardsp_filter * filter, void * data, size_t samples);
208int roardsp_swap_ctl    (struct roardsp_filter * filter, int cmd, void * data);
209int roardsp_swap_reset  (struct roardsp_filter * filter, int what);
210
[735]211// codecs:
212int roardsp_conv_alaw2pcm16 (int16_t * out, char * in, size_t len);
[816]213int roardsp_conv_pcm162alaw (char * out, int16_t * in, size_t len);
[735]214
[922]215int roardsp_conv_mulaw2pcm16 (int16_t * out, char * in, size_t len);
216int roardsp_conv_pcm162mulaw (char * out, int16_t * in, size_t len);
217
[874]218__END_DECLS
219
[651]220#endif
221
222//ll
Note: See TracBrowser for help on using the repository browser.