3 |
* LinuxSampler - modular, streaming capable sampler * |
* LinuxSampler - modular, streaming capable sampler * |
4 |
* * |
* * |
5 |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
6 |
* Copyright (C) 2005 - 2007 Christian Schoenebeck * |
* Copyright (C) 2005 - 2012 Christian Schoenebeck * |
7 |
* * |
* * |
8 |
* This program is free software; you can redistribute it and/or modify * |
* This program is free software; you can redistribute it and/or modify * |
9 |
* it under the terms of the GNU General Public License as published by * |
* it under the terms of the GNU General Public License as published by * |
120 |
return y; |
return y; |
121 |
} |
} |
122 |
|
|
123 |
inline bq_t Apply(biquad_param_t* param, const bq_t x) { |
inline bq_t Apply(const biquad_param_t* __restrict param, const bq_t x) { |
124 |
bq_t y; |
bq_t y; |
125 |
|
|
126 |
y = param->b0 * x + param->b1 * this->x1 + param->b2 * this->x2 + |
y = param->b0 * x + param->b1 * this->x1 + param->b2 * this->x2 + |
238 |
return y; |
return y; |
239 |
} |
} |
240 |
|
|
241 |
inline bq_t ApplyFB(biquad_param_t* param, bq_t x, const bq_t fb) { |
inline bq_t ApplyFB(const biquad_param_t* __restrict param, bq_t x, const bq_t fb) { |
242 |
bq_t y; |
bq_t y; |
243 |
|
|
244 |
x += this->y1 * fb * 0.98; |
x += this->y1 * fb * 0.98; |
474 |
this->a2 = a0r * (alpha - 1.0); |
this->a2 = a0r * (alpha - 1.0); |
475 |
} |
} |
476 |
|
|
477 |
inline void SetParameters(biquad_param_t* param, bq_t fc, bq_t bw, bq_t fs) { |
inline void SetParameters(biquad_param_t* __restrict param, bq_t fc, bq_t bw, bq_t fs) { |
478 |
bq_t omega = 2.0 * M_PI * fc / fs; |
bq_t omega = 2.0 * M_PI * fc / fs; |
479 |
bq_t sn = sin(omega); |
bq_t sn = sin(omega); |
480 |
bq_t cs = cos(omega); |
bq_t cs = cos(omega); |
511 |
this->a2 = a0r * (alpha - 1.0); |
this->a2 = a0r * (alpha - 1.0); |
512 |
} |
} |
513 |
|
|
514 |
inline void SetParameters(biquad_param_t* param, bq_t fc, bq_t bw, bq_t fs) { |
inline void SetParameters(biquad_param_t* __restrict param, bq_t fc, bq_t bw, bq_t fs) { |
515 |
bq_t omega = 2.0 * M_PI * fc / fs; |
bq_t omega = 2.0 * M_PI * fc / fs; |
516 |
bq_t sn = sin(omega); |
bq_t sn = sin(omega); |
517 |
bq_t cs = cos(omega); |
bq_t cs = cos(omega); |
548 |
this->a2 = a0r * (alpha - 1.0); |
this->a2 = a0r * (alpha - 1.0); |
549 |
} |
} |
550 |
|
|
551 |
inline void SetParameters(biquad_param_t* param, bq_t fc, bq_t bw, bq_t fs) { |
inline void SetParameters(biquad_param_t* __restrict param, bq_t fc, bq_t bw, bq_t fs) { |
552 |
bq_t omega = 2.0 * M_PI * fc / fs; |
bq_t omega = 2.0 * M_PI * fc / fs; |
553 |
bq_t sn = sin(omega); |
bq_t sn = sin(omega); |
554 |
bq_t cs = cos(omega); |
bq_t cs = cos(omega); |