blob: 212f653c1ff437d2862092d6f02d53a3b484be79 (
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
/* 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 EQ_H_
#define EQ_H_
#ifdef __cplusplus
extern "C" {
#endif
/* An EQ is a chain of biquad filters. See Web Audio API spec for details of the
* biquad filters and their parameters. */
#include "biquad.h"
/* Maximum number of biquad filters an EQ can have */
#define MAX_BIQUADS_PER_EQ 10
struct eq;
/* Create an EQ. */
struct eq *eq_new();
/* Free an EQ. */
void eq_free(struct eq *eq);
/* Append a biquad filter to an EQ. An EQ can have at most MAX_BIQUADS_PER_EQ
* biquad filters.
* Args:
* eq - The EQ we want to use.
* type - The type of the biquad filter we want to append.
* frequency - The value should be in the range [0, 1]. It is relative to
* half of the sampling rate.
* Q, gain - The meaning depends on the type of the filter. See Web Audio
* API for details.
* Returns:
* 0 if success. -1 if the eq has no room for more biquads.
*/
int eq_append_biquad(struct eq *eq, enum biquad_type type, float freq, float Q,
float gain);
/* Append a biquad filter to an EQ. An EQ can have at most MAX_BIQUADS_PER_EQ
* biquad filters. This is similar to eq_append_biquad(), but it specifies the
* biquad coefficients directly.
* Args:
* eq - The EQ we want to use.
* biquad - The parameters for the biquad filter.
* Returns:
* 0 if success. -1 if the eq has no room for more biquads.
*/
int eq_append_biquad_direct(struct eq *eq, const struct biquad *biquad);
/* Process a buffer of audio data through the EQ.
* Args:
* eq - The EQ we want to use.
* data - The array of audio samples.
* count - The number of elements in the data array to process.
*/
void eq_process(struct eq *eq, float *data, int count);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* EQ_H_ */
|