blob: 1c3efe50e93d8c5cf85b933411eb58235e6221bb [file] [log] [blame]
Thom Johansena8cc6a72006-01-29 02:10:28 +00001/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
Thom Johansena7fabf02007-02-26 00:41:26 +000010 * Copyright (C) 2006-2007 Thom Johansen
Thom Johansena8cc6a72006-01-29 02:10:28 +000011 *
Daniel Stenberg2acc0ac2008-06-28 18:10:04 +000012 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
Thom Johansena8cc6a72006-01-29 02:10:28 +000016 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22#ifndef _EQ_H
23#define _EQ_H
24
Thom Johansenea4ccb52006-03-19 16:31:45 +000025#include <inttypes.h>
26
Thom Johansena8cc6a72006-01-29 02:10:28 +000027/* These depend on the fixed point formats used by the different filter types
28 and need to be changed when they change.
29 */
Thom Johansena7fabf02007-02-26 00:41:26 +000030#define FILTER_BISHELF_SHIFT 5
Thom Johansen7df51ad2006-02-01 09:48:47 +000031#define EQ_PEAK_SHIFT 4
Thom Johansen48b4ac32006-10-18 22:45:39 +000032#define EQ_SHELF_SHIFT 6
Thom Johansena8cc6a72006-01-29 02:10:28 +000033
34struct eqfilter {
Thom Johansenea4ccb52006-03-19 16:31:45 +000035 int32_t coefs[5]; /* Order is b0, b1, b2, a1, a2 */
36 int32_t history[2][4];
Thom Johansena8cc6a72006-01-29 02:10:28 +000037};
38
Thom Johansen8e6e2902007-03-07 15:06:33 +000039void filter_shelf_coefs(unsigned long cutoff, long A, bool low, int32_t *c);
Thom Johansena7fabf02007-02-26 00:41:26 +000040void filter_bishelf_coefs(unsigned long cutoff_low, unsigned long cutoff_high,
41 long A_low, long A_high, long A, int32_t *c);
Thom Johansenc00ec112006-03-21 01:09:53 +000042void eq_pk_coefs(unsigned long cutoff, unsigned long Q, long db, int32_t *c);
43void eq_ls_coefs(unsigned long cutoff, unsigned long Q, long db, int32_t *c);
44void eq_hs_coefs(unsigned long cutoff, unsigned long Q, long db, int32_t *c);
Thom Johansenea4ccb52006-03-19 16:31:45 +000045void eq_filter(int32_t **x, struct eqfilter *f, unsigned num,
Thom Johansen147cfe92006-01-31 18:34:39 +000046 unsigned channels, unsigned shift);
Thom Johansena8cc6a72006-01-29 02:10:28 +000047
48#endif
49