2012-07-24 10:16:56 +02:00
|
|
|
/***
|
|
|
|
|
Copyright 2012 Peter Meerwald <p.meerwald@bct-electronic.com>
|
|
|
|
|
|
|
|
|
|
PulseAudio is free software; you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU Lesser General Public License as published
|
|
|
|
|
by the Free Software Foundation; either version 2.1 of the License,
|
|
|
|
|
or (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
PulseAudio is distributed in the hope that it will be useful, but
|
|
|
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
General Public License for more details.
|
|
|
|
|
|
|
|
|
|
***/
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
|
#include <config.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include <pulse/cdecl.h>
|
|
|
|
|
|
|
|
|
|
PA_C_DECL_BEGIN
|
|
|
|
|
#include <pulsecore/core-util.h>
|
|
|
|
|
#include <pulsecore/modargs.h>
|
|
|
|
|
#include "echo-cancel.h"
|
|
|
|
|
PA_C_DECL_END
|
|
|
|
|
|
2013-06-27 19:28:09 +02:00
|
|
|
bool pa_null_ec_init(pa_core *c, pa_echo_canceller *ec,
|
2013-06-28 01:03:47 +02:00
|
|
|
pa_sample_spec *rec_ss, pa_channel_map *rec_map,
|
|
|
|
|
pa_sample_spec *play_ss, pa_channel_map *play_map,
|
|
|
|
|
pa_sample_spec *out_ss, pa_channel_map *out_map,
|
|
|
|
|
uint32_t *nframes, const char *args) {
|
2012-12-20 11:33:05 +01:00
|
|
|
char strss_source[PA_SAMPLE_SPEC_SNPRINT_MAX];
|
|
|
|
|
char strss_sink[PA_SAMPLE_SPEC_SNPRINT_MAX];
|
2012-12-04 14:55:01 +01:00
|
|
|
|
2012-12-20 11:33:05 +01:00
|
|
|
*nframes = 256;
|
2016-02-17 19:47:06 +05:30
|
|
|
ec->params.null.out_ss = *out_ss;
|
echo-cancel: Enable different sample specs for rec and out stream
Enable advanced AEC methods to use different specs (i.e., number of
channels) for rec and out stream. A typical application is beam forming
resp. multi-channel AEC, which takes multiple record channels to produce
an echo-canceled output stream.
This commit alters the EC API as follows: the EC's init() used to get
source and sink's sample spec/channel map. The new interface renamed
source to rec and sink to play and additionally passes sample spec and
channel map of the out stream. The new parameter names of init()
{rec,play,out}_{ss,map} are more intuitive and also resemble to the
parameter names known from run(). Both rec_{ss,map} and out_{ss,map} are
initialized as we knew it from source_{ss,map} before being passed to
init(). The previous EC implementations only require trivial changes,
i.e., setting rec_{ss,map} to out_{ss,map} at the end of init() in case
that out_{ss,map} is modified in init().
2013-02-18 16:31:03 +01:00
|
|
|
|
|
|
|
|
*rec_ss = *out_ss;
|
|
|
|
|
*rec_map = *out_map;
|
2012-07-24 10:16:56 +02:00
|
|
|
|
2012-12-20 11:33:05 +01:00
|
|
|
pa_log_debug("null AEC: nframes=%u, sample spec source=%s, sample spec sink=%s", *nframes,
|
echo-cancel: Enable different sample specs for rec and out stream
Enable advanced AEC methods to use different specs (i.e., number of
channels) for rec and out stream. A typical application is beam forming
resp. multi-channel AEC, which takes multiple record channels to produce
an echo-canceled output stream.
This commit alters the EC API as follows: the EC's init() used to get
source and sink's sample spec/channel map. The new interface renamed
source to rec and sink to play and additionally passes sample spec and
channel map of the out stream. The new parameter names of init()
{rec,play,out}_{ss,map} are more intuitive and also resemble to the
parameter names known from run(). Both rec_{ss,map} and out_{ss,map} are
initialized as we knew it from source_{ss,map} before being passed to
init(). The previous EC implementations only require trivial changes,
i.e., setting rec_{ss,map} to out_{ss,map} at the end of init() in case
that out_{ss,map} is modified in init().
2013-02-18 16:31:03 +01:00
|
|
|
pa_sample_spec_snprint(strss_source, sizeof(strss_source), out_ss),
|
|
|
|
|
pa_sample_spec_snprint(strss_sink, sizeof(strss_sink), play_ss));
|
2012-07-24 10:16:56 +02:00
|
|
|
|
2013-06-27 19:28:09 +02:00
|
|
|
return true;
|
2012-07-24 10:16:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void pa_null_ec_run(pa_echo_canceller *ec, const uint8_t *rec, const uint8_t *play, uint8_t *out) {
|
2012-12-20 11:33:05 +01:00
|
|
|
/* The null implementation simply copies the recorded buffer to the output
|
|
|
|
|
buffer and ignores the play buffer. */
|
2016-02-17 19:47:06 +05:30
|
|
|
memcpy(out, rec, 256 * pa_frame_size(&ec->params.null.out_ss));
|
2012-07-24 10:16:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void pa_null_ec_done(pa_echo_canceller *ec) {
|
|
|
|
|
}
|