/[svn]/linuxsampler/trunk/src/engines/common/BiquadFilter.h
ViewVC logotype

Diff of /linuxsampler/trunk/src/engines/common/BiquadFilter.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 617 by schoenebeck, Wed Jun 8 21:00:06 2005 UTC revision 1259 by schoenebeck, Tue Jun 26 21:41:09 2007 UTC
# Line 3  Line 3 
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 Christian Schoenebeck                              *   *   Copyright (C) 2005 - 2007 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  *
# Line 21  Line 21 
21   *   MA  02111-1307  USA                                                   *   *   MA  02111-1307  USA                                                   *
22   ***************************************************************************/   ***************************************************************************/
23    
24    // Note: the assembly code is currently disabled, as it doesn't fit into
25    // the new synthesis core introduced by LS 0.4.0
26    
27  #ifndef __LS_BIQUADFILTER_H__  #ifndef __LS_BIQUADFILTER_H__
28  #define __LS_BIQUADFILTER_H__  #define __LS_BIQUADFILTER_H__
29    
# Line 72  namespace LinuxSampler { Line 75  namespace LinuxSampler {
75              bq_t y1;              bq_t y1;
76              bq_t y2;              bq_t y2;
77    
78    #if __GNUC__ >= 4
79                float fbc;
80    #else
81              const static float fbc = 0.98;              const static float fbc = 0.98;
82    #endif
83    
84              /**              /**
85               * Prevent \a f from going into denormal mode which would slow down               * Prevent \a f from going into denormal mode which would slow down
# Line 87  namespace LinuxSampler { Line 94  namespace LinuxSampler {
94          public:          public:
95              BiquadFilter() {              BiquadFilter() {
96                  Reset();                  Reset();
97    #if __GNUC__ >= 4
98                    fbc = 0.98f;
99    #endif
100              }              }
101    
102              void Reset() {              void Reset() {
# Line 124  namespace LinuxSampler { Line 134  namespace LinuxSampler {
134                  return y;                  return y;
135              }              }
136    
137  #if CONFIG_ASM && ARCH_X86  #if 0 // CONFIG_ASM && ARCH_X86
138              // expects to find input in xmm0 (xmm0 stays unmodified) and finally leaves output in xmm6              // expects to find input in xmm0 (xmm0 stays unmodified) and finally leaves output in xmm6
139              inline void Apply4StepsSSE(biquad_param_t* param) {              inline void Apply4StepsSSE(biquad_param_t* param) {
140                  __asm__ __volatile__ (                  __asm__ __volatile__ (
# Line 243  namespace LinuxSampler { Line 253  namespace LinuxSampler {
253                  return y;                  return y;
254              }              }
255    
256  #if CONFIG_ASM && ARCH_X86  #if 0 // CONFIG_ASM && ARCH_X86
257              // expects to find input in xmm0 (xmm0 stays unmodified) and finally leaves output in xmm7              // expects to find input in xmm0 (xmm0 stays unmodified) and finally leaves output in xmm7
258              inline void ApplyFB4StepsSSE(biquad_param_t* param, const bq_t &fb) {              inline void ApplyFB4StepsSSE(biquad_param_t* param, const bq_t &fb) {
259                  float xs, ys;                  float xs, ys;
# Line 494  namespace LinuxSampler { Line 504  namespace LinuxSampler {
504                  bq_t alpha = sn * sinh(M_LN2 / 2.0 * bw * omega / sn);                  bq_t alpha = sn * sinh(M_LN2 / 2.0 * bw * omega / sn);
505    
506                  const float a0r = 1.0 / (1.0 + alpha);                  const float a0r = 1.0 / (1.0 + alpha);
507                  this->b0 = a0r * alpha;                  this->b0 = a0r * sn * 0.71;
508                  this->b1 = 0.0;                  this->b1 = 0.0;
509                  this->b2 = a0r * -alpha;                  this->b2 = a0r * -sn * 0.71;
510                  this->a1 = a0r * (2.0 * cs);                  this->a1 = a0r * (2.0 * cs);
511                  this->a2 = a0r * (alpha - 1.0);                  this->a2 = a0r * (alpha - 1.0);
512              }              }
# Line 508  namespace LinuxSampler { Line 518  namespace LinuxSampler {
518                  bq_t alpha = sn * sinh(M_LN2 / 2.0 * bw * omega / sn);                  bq_t alpha = sn * sinh(M_LN2 / 2.0 * bw * omega / sn);
519    
520                  const float a0r = 1.0 / (1.0 + alpha);                  const float a0r = 1.0 / (1.0 + alpha);
521                  param->b0 = a0r * alpha;                  param->b0 = a0r * sn * 0.71;
522                  param->b1 = 0.0;                  param->b1 = 0.0;
523                  param->b2 = a0r * -alpha;                  param->b2 = a0r * -sn * 0.71;
524                  param->a1 = a0r * (2.0 * cs);                  param->a1 = a0r * (2.0 * cs);
525                  param->a2 = a0r * (alpha - 1.0);                  param->a2 = a0r * (alpha - 1.0);
526              }              }

Legend:
Removed from v.617  
changed lines
  Added in v.1259

  ViewVC Help
Powered by ViewVC