/[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 324 by senkov, Sat Dec 18 18:54:46 2004 UTC revision 685 by persson, Tue Jul 5 19:30:37 2005 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                              *
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 25  Line 26 
26    
27  #include <math.h>  #include <math.h>
28    
29    #include "../../common/global.h"
30    
31  /// ln(2) / 2  /// ln(2) / 2
32  #define LN_2_2                  0.34657359f  #define LN_2_2                  0.34657359f
33    
# Line 69  namespace LinuxSampler { Line 72  namespace LinuxSampler {
72              bq_t y1;              bq_t y1;
73              bq_t y2;              bq_t y2;
74    
75    #if __GNUC__ >= 4
76                float fbc;
77    #else
78              const static float fbc = 0.98;              const static float fbc = 0.98;
79    #endif
80    
81              /**              /**
82               * 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 84  namespace LinuxSampler { Line 91  namespace LinuxSampler {
91          public:          public:
92              BiquadFilter() {              BiquadFilter() {
93                  Reset();                  Reset();
94    #if __GNUC__ >= 4
95                    fbc = 0.98f;
96    #endif
97              }              }
98    
99              void Reset() {              void Reset() {
# Line 121  namespace LinuxSampler { Line 131  namespace LinuxSampler {
131                  return y;                  return y;
132              }              }
133    
134    #if CONFIG_ASM && ARCH_X86
135              // 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
136              inline void Apply4StepsSSE(biquad_param_t* param) {              inline void Apply4StepsSSE(biquad_param_t* param) {
137                  __asm__ __volatile__ (                  __asm__ __volatile__ (
# Line 207  namespace LinuxSampler { Line 218  namespace LinuxSampler {
218                        "r" (&param->b0)  /* %2 */                        "r" (&param->b0)  /* %2 */
219                  );                  );
220              }              }
221    #endif // CONFIG_ASM && ARCH_X86
222    
223              inline bq_t ApplyFB(bq_t x, const bq_t fb) {              inline bq_t ApplyFB(bq_t x, const bq_t fb) {
224                  bq_t y;                  bq_t y;
# Line 238  namespace LinuxSampler { Line 250  namespace LinuxSampler {
250                  return y;                  return y;
251              }              }
252    
253    #if CONFIG_ASM && ARCH_X86
254              // 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
255              inline void ApplyFB4StepsSSE(biquad_param_t* param, const bq_t &fb) {              inline void ApplyFB4StepsSSE(biquad_param_t* param, const bq_t &fb) {
256                  float xs, ys;                  float xs, ys;
# Line 433  namespace LinuxSampler { Line 446  namespace LinuxSampler {
446                      ::                      ::
447                  );                  );
448              }              }
449    #endif // CONFIG_ASM && ARCH_X86
450      };      };
451    
452        /** @brief Lowpass Filter
453         *
454         * Lowpass filter based on biquad filter implementation.
455         */
456      class LowpassFilter : public BiquadFilter {      class LowpassFilter : public BiquadFilter {
457          public:          public:
458              inline LowpassFilter() : BiquadFilter() {}              inline LowpassFilter() : BiquadFilter() {}
# Line 468  namespace LinuxSampler { Line 486  namespace LinuxSampler {
486              }              }
487      };      };
488    
489        /** @brief Bandpass Filter
490         *
491         * Bandpass filter based on biquad filter implementation.
492         */
493      class BandpassFilter : public BiquadFilter {      class BandpassFilter : public BiquadFilter {
494          public:          public:
495              inline BandpassFilter() : BiquadFilter() {}              inline BandpassFilter() : BiquadFilter() {}
# Line 501  namespace LinuxSampler { Line 523  namespace LinuxSampler {
523              }              }
524      };      };
525    
526        /** @brief Highpass Filter
527         *
528         * Highpass filter based on biquad filter implementation.
529         */
530      class HighpassFilter : public BiquadFilter {      class HighpassFilter : public BiquadFilter {
531          public:          public:
532              inline HighpassFilter() : BiquadFilter() {}              inline HighpassFilter() : BiquadFilter() {}

Legend:
Removed from v.324  
changed lines
  Added in v.685

  ViewVC Help
Powered by ViewVC