Mercurial > audlegacy
annotate src/audacious/iir.c @ 3395:df609e7e7bcf
updated romanian translation
| author | Cristi Magherusan <majeru@atheme-project.org> |
|---|---|
| date | Sun, 26 Aug 2007 03:06:40 +0300 |
| parents | 3b6d316f8b09 |
| children | 154f21dcd61e |
| rev | line source |
|---|---|
| 2313 | 1 /* |
| 2 * PCM time-domain equalizer | |
| 3 * | |
| 4 * Copyright (C) 2002-2005 Felipe Rivera <liebremx at users sourceforge net> | |
| 5 * | |
| 6 * This program is free software; you can redistribute it and/or modify | |
| 7 * it under the terms of the GNU General Public License as published by | |
|
3121
3b6d316f8b09
GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents:
2313
diff
changeset
|
8 * the Free Software Foundation; either version 3 of the License, or |
| 2313 | 9 * (at your option) any later version. |
| 10 * | |
| 11 * This program is distributed in the hope that it will be useful, | |
| 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14 * GNU General Public License for more details. | |
| 15 * | |
| 16 * You should have received a copy of the GNU General Public License | |
|
3121
3b6d316f8b09
GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents:
2313
diff
changeset
|
17 * along with this program. If not, see <http://www.gnu.org/licenses>. |
| 2313 | 18 * |
| 19 * $Id: iir.c,v 1.15 2005/10/17 01:57:59 liebremx Exp $ | |
| 20 */ | |
| 21 | |
| 22 #include <math.h> | |
| 23 #include "iir.h" | |
| 24 | |
| 25 /* Coefficients */ | |
| 26 sIIRCoefficients *iir_cf; | |
| 27 | |
| 28 /* Volume gain | |
| 29 * values should be between 0.0 and 1.0 | |
| 30 * Use the preamp from XMMS for now | |
| 31 * */ | |
| 32 float preamp[EQ_CHANNELS]; | |
| 33 | |
| 34 #ifdef BENCHMARK | |
| 35 #include "benchmark.h" | |
| 36 double timex = 0.0; | |
| 37 int count = 0; | |
| 38 unsigned int blength = 0; | |
| 39 #endif | |
| 40 | |
| 41 /* | |
| 42 * Global vars | |
| 43 */ | |
| 44 gint rate; | |
| 45 int band_count; | |
| 46 | |
| 47 void set_preamp(gint chn, float val) | |
| 48 { | |
| 49 preamp[chn] = val; | |
| 50 } | |
| 51 | |
| 52 /* Init the filters */ | |
| 53 void init_iir() | |
| 54 { | |
| 55 calc_coeffs(); | |
| 56 #if 0 | |
| 57 band_count = cfg.band_num; | |
| 58 #endif | |
| 59 | |
| 60 band_count = 10; | |
| 61 | |
| 62 rate = 44100; | |
| 63 | |
| 64 iir_cf = get_coeffs(&band_count, rate, TRUE); | |
| 65 clean_history(); | |
| 66 } | |
| 67 | |
| 68 #ifdef ARCH_X86 | |
| 69 /* Round function provided by Frank Klemm which saves around 100K | |
| 70 * CPU cycles in my PIII for each call to the IIR function with 4K samples | |
| 71 */ | |
| 72 __inline__ int round_trick(float floatvalue_to_round) | |
| 73 { | |
| 74 float floattmp ; | |
| 75 int rounded_value ; | |
| 76 | |
| 77 floattmp = (int) 0x00FD8000L + (floatvalue_to_round); | |
| 78 rounded_value = *(int*)(&floattmp) - (int)0x4B7D8000L; | |
| 79 | |
| 80 if ( rounded_value != (short) rounded_value ) | |
| 81 rounded_value = ( rounded_value >> 31 ) ^ 0x7FFF; | |
| 82 return rounded_value; | |
| 83 } | |
| 84 #endif |
