comparison Plugins/Input/mpg123/equalizer.c @ 1098:b5ae09a6c2f1 trunk

[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
author nenolod
date Mon, 22 May 2006 17:22:34 -0700
parents fa848bd484d8
children
comparison
equal deleted inserted replaced
1097:03dbf5494d40 1098:b5ae09a6c2f1
52 ((a * a * a - a) * y2a[klo] + (b * b * b - b) * y2a[khi]) 52 ((a * a * a - a) * y2a[klo] + (b * b * b - b) * y2a[khi])
53 * (h * h) / 6.0); 53 * (h * h) / 6.0);
54 } 54 }
55 55
56 void 56 void
57 mpg123_set_eq(int on, float preamp, float *b) 57 mpgdec_set_eq(int on, float preamp, float *b)
58 { 58 {
59 float x[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }, yf[10], val, band[10]; 59 float x[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }, yf[10], val, band[10];
60 int bands[] = { 0, 4, 8, 16, 26, 78, 157, 313, 366, 418 }; 60 int bands[] = { 0, 4, 8, 16, 26, 78, 157, 313, 366, 418 };
61 int i, j; 61 int i, j;
62 62
63 mpg123_info->eq_active = on; 63 mpgdec_info->eq_active = on;
64 if (mpg123_info->eq_active) { 64 if (mpgdec_info->eq_active) {
65 for (i = 0; i < 10; i++) { 65 for (i = 0; i < 10; i++) {
66 band[i] = b[i] + preamp; 66 band[i] = b[i] + preamp;
67 } 67 }
68 68
69 init_spline(x, band, 10, yf); 69 init_spline(x, band, 10, yf);
72 val = 72 val =
73 eval_spline(x, band, yf, 10, 73 eval_spline(x, band, yf, 10,
74 i + 74 i +
75 ((float) (j - bands[i]) * 75 ((float) (j - bands[i]) *
76 (1.0 / (bands[i + 1] - bands[i])))); 76 (1.0 / (bands[i + 1] - bands[i]))));
77 mpg123_info->eq_mul[j] = pow(2, val / 10.0); 77 mpgdec_info->eq_mul[j] = pow(2, val / 10.0);
78 } 78 }
79 } 79 }
80 for (i = bands[9]; i < 576; i++) 80 for (i = bands[9]; i < 576; i++)
81 mpg123_info->eq_mul[i] = mpg123_info->eq_mul[bands[9] - 1]; 81 mpgdec_info->eq_mul[i] = mpgdec_info->eq_mul[bands[9] - 1];
82 } 82 }
83 } 83 }