summaryrefslogtreecommitdiff
path: root/cras/src/dsp/dcblock.h
blob: a2ac427d34d9270b20a159f43199fe7cb47a8833 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef DCBLOCK_H_
#define DCBLOCK_H_

#ifdef __cplusplus
extern "C" {
#endif

/* A DC blocking filter. */

struct dcblock;

/*
 * Create a DC blocking filter.
 *
 * Transfer fn: (1 - z^-1) / (1 - R * z^-1)
 * Args:
 *    R - DC block filter coefficient.
 *    sample_rate - The sample rate, in Hz.
 */
struct dcblock *dcblock_new(float R, unsigned long sample_rate);

/* Free a DC blocking filter. */
void dcblock_free(struct dcblock *dcblock);

/* Process a buffer of audio data through the filter.
 * Args:
 *    dcblock - The filter we want to use.
 *    data - The array of audio samples.
 *    count - The number of elements in the data array to process.
 */
void dcblock_process(struct dcblock *dcblock, float *data, int count);

#ifdef __cplusplus
} /* extern "C" */
#endif

#endif /* DCBLOCK_H_ */