1 /* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
2  * Use of this source code is governed by a BSD-style license that can be
3  * found in the LICENSE file.
4  */
5 
6 #ifndef DCBLOCK_H_
7 #define DCBLOCK_H_
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 /* A DC blocking filter. */
14 
15 struct dcblock;
16 
17 /*
18  * Create a DC blocking filter.
19  *
20  * Transfer fn: (1 - z^-1) / (1 - R * z^-1)
21  * Args:
22  *    R - DC block filter coefficient.
23  *    sample_rate - The sample rate, in Hz.
24  */
25 struct dcblock *dcblock_new(float R, unsigned long sample_rate);
26 
27 /* Free a DC blocking filter. */
28 void dcblock_free(struct dcblock *dcblock);
29 
30 /* Process a buffer of audio data through the filter.
31  * Args:
32  *    dcblock - The filter we want to use.
33  *    data - The array of audio samples.
34  *    count - The number of elements in the data array to process.
35  */
36 void dcblock_process(struct dcblock *dcblock, float *data, int count);
37 
38 #ifdef __cplusplus
39 } /* extern "C" */
40 #endif
41 
42 #endif /* DCBLOCK_H_ */
43