Thom Johansen | a8cc6a7 | 2006-01-29 02:10:28 +0000 | [diff] [blame] | 1 | /*************************************************************************** |
| 2 | * __________ __ ___. |
| 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
| 4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
| 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
| 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
| 7 | * \/ \/ \/ \/ \/ |
| 8 | * $Id$ |
| 9 | * |
Thom Johansen | a7fabf0 | 2007-02-26 00:41:26 +0000 | [diff] [blame] | 10 | * Copyright (C) 2006-2007 Thom Johansen |
Thom Johansen | a8cc6a7 | 2006-01-29 02:10:28 +0000 | [diff] [blame] | 11 | * |
Daniel Stenberg | 2acc0ac | 2008-06-28 18:10:04 +0000 | [diff] [blame^] | 12 | * 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 Johansen | a8cc6a7 | 2006-01-29 02:10:28 +0000 | [diff] [blame] | 16 | * |
| 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 Johansen | ea4ccb5 | 2006-03-19 16:31:45 +0000 | [diff] [blame] | 25 | #include <inttypes.h> |
| 26 | |
Thom Johansen | a8cc6a7 | 2006-01-29 02:10:28 +0000 | [diff] [blame] | 27 | /* These depend on the fixed point formats used by the different filter types |
| 28 | and need to be changed when they change. |
| 29 | */ |
Thom Johansen | a7fabf0 | 2007-02-26 00:41:26 +0000 | [diff] [blame] | 30 | #define FILTER_BISHELF_SHIFT 5 |
Thom Johansen | 7df51ad | 2006-02-01 09:48:47 +0000 | [diff] [blame] | 31 | #define EQ_PEAK_SHIFT 4 |
Thom Johansen | 48b4ac3 | 2006-10-18 22:45:39 +0000 | [diff] [blame] | 32 | #define EQ_SHELF_SHIFT 6 |
Thom Johansen | a8cc6a7 | 2006-01-29 02:10:28 +0000 | [diff] [blame] | 33 | |
| 34 | struct eqfilter { |
Thom Johansen | ea4ccb5 | 2006-03-19 16:31:45 +0000 | [diff] [blame] | 35 | int32_t coefs[5]; /* Order is b0, b1, b2, a1, a2 */ |
| 36 | int32_t history[2][4]; |
Thom Johansen | a8cc6a7 | 2006-01-29 02:10:28 +0000 | [diff] [blame] | 37 | }; |
| 38 | |
Thom Johansen | 8e6e290 | 2007-03-07 15:06:33 +0000 | [diff] [blame] | 39 | void filter_shelf_coefs(unsigned long cutoff, long A, bool low, int32_t *c); |
Thom Johansen | a7fabf0 | 2007-02-26 00:41:26 +0000 | [diff] [blame] | 40 | void filter_bishelf_coefs(unsigned long cutoff_low, unsigned long cutoff_high, |
| 41 | long A_low, long A_high, long A, int32_t *c); |
Thom Johansen | c00ec11 | 2006-03-21 01:09:53 +0000 | [diff] [blame] | 42 | void eq_pk_coefs(unsigned long cutoff, unsigned long Q, long db, int32_t *c); |
| 43 | void eq_ls_coefs(unsigned long cutoff, unsigned long Q, long db, int32_t *c); |
| 44 | void eq_hs_coefs(unsigned long cutoff, unsigned long Q, long db, int32_t *c); |
Thom Johansen | ea4ccb5 | 2006-03-19 16:31:45 +0000 | [diff] [blame] | 45 | void eq_filter(int32_t **x, struct eqfilter *f, unsigned num, |
Thom Johansen | 147cfe9 | 2006-01-31 18:34:39 +0000 | [diff] [blame] | 46 | unsigned channels, unsigned shift); |
Thom Johansen | a8cc6a7 | 2006-01-29 02:10:28 +0000 | [diff] [blame] | 47 | |
| 48 | #endif |
| 49 | |