]> code.delx.au - pulseaudio/blob - src/modules/echo-cancel/echo-cancel.h
echo-cancel: Add speex preprocessing
[pulseaudio] / src / modules / echo-cancel / echo-cancel.h
1 /***
2 This file is part of PulseAudio.
3
4 Copyright 2010 Arun Raghavan <arun.raghavan@collabora.co.uk>
5
6 PulseAudio is free software; you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as published
8 by the Free Software Foundation; either version 2.1 of the License,
9 or (at your option) any later version.
10
11 PulseAudio is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public License
17 along with PulseAudio; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19 USA.
20 ***/
21
22 #ifdef HAVE_CONFIG_H
23 #include <config.h>
24 #endif
25
26 #include <pulse/sample.h>
27 #include <pulse/channelmap.h>
28 #include <pulsecore/core.h>
29 #include <pulsecore/macro.h>
30
31 #include <speex/speex_echo.h>
32 #include <speex/speex_preprocess.h>
33 #include "adrian.h"
34
35 /* Common data structures */
36
37 typedef struct pa_echo_canceller_params pa_echo_canceller_params;
38
39 struct pa_echo_canceller_params {
40 union {
41 struct {
42 SpeexEchoState *state;
43 } speex;
44 struct {
45 uint32_t blocksize;
46 AEC *aec;
47 } adrian;
48 /* each canceller-specific structure goes here */
49 } priv;
50 };
51
52 typedef struct pa_echo_canceller pa_echo_canceller;
53
54 struct pa_echo_canceller {
55 pa_bool_t (*init) (pa_core *c,
56 pa_echo_canceller *ec,
57 pa_sample_spec *source_ss,
58 pa_channel_map *source_map,
59 pa_sample_spec *sink_ss,
60 pa_channel_map *sink_map,
61 uint32_t *blocksize,
62 const char *args);
63 void (*run) (pa_echo_canceller *ec, const uint8_t *rec, const uint8_t *play, uint8_t *out);
64 void (*done) (pa_echo_canceller *ec);
65
66 pa_echo_canceller_params params;
67
68 pa_bool_t agc;
69 pa_bool_t denoise;
70 pa_bool_t echo_suppress;
71 SpeexPreprocessState *pp_state;
72 };
73
74 /* Speex canceller functions */
75 pa_bool_t pa_speex_ec_init(pa_core *c, pa_echo_canceller *ec,
76 pa_sample_spec *source_ss, pa_channel_map *source_map,
77 pa_sample_spec *sink_ss, pa_channel_map *sink_map,
78 uint32_t *blocksize, const char *args);
79 void pa_speex_ec_run(pa_echo_canceller *ec, const uint8_t *rec, const uint8_t *play, uint8_t *out);
80 void pa_speex_ec_done(pa_echo_canceller *ec);
81
82 /* Adrian Andre's echo canceller */
83 pa_bool_t pa_adrian_ec_init(pa_core *c, pa_echo_canceller *ec,
84 pa_sample_spec *source_ss, pa_channel_map *source_map,
85 pa_sample_spec *sink_ss, pa_channel_map *sink_map,
86 uint32_t *blocksize, const char *args);
87 void pa_adrian_ec_run(pa_echo_canceller *ec, const uint8_t *rec, const uint8_t *play, uint8_t *out);
88 void pa_adrian_ec_done(pa_echo_canceller *ec);