/[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 319 by schoenebeck, Mon Dec 13 00:46:42 2004 UTC revision 617 by schoenebeck, Wed Jun 8 21:00:06 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 44  namespace LinuxSampler { Line 47  namespace LinuxSampler {
47       * between multiple filters.       * between multiple filters.
48       */       */
49      struct biquad_param_t {      struct biquad_param_t {
         bq_t a1;  
         bq_t a2;  
50          bq_t b0;          bq_t b0;
51          bq_t b1;          bq_t b1;
52          bq_t b2;          bq_t b2;
53            bq_t a1;
54            bq_t a2;
55      };      };
56    
57      /**      /**
# Line 58  namespace LinuxSampler { Line 61  namespace LinuxSampler {
61      class BiquadFilter {      class BiquadFilter {
62          protected:          protected:
63              // following five variables are only used if no external biquad_param_t reference is used              // following five variables are only used if no external biquad_param_t reference is used
             bq_t a1;  
             bq_t a2;  
64              bq_t b0;              bq_t b0;
65              bq_t b1;              bq_t b1;
66              bq_t b2;              bq_t b2;
67                bq_t a1;
68                bq_t a2;
69              // following four variables are used to buffer the feedback              // following four variables are used to buffer the feedback
70              bq_t x1;              bq_t x1;
71              bq_t x2;              bq_t x2;
# Line 121  namespace LinuxSampler { Line 124  namespace LinuxSampler {
124                  return y;                  return y;
125              }              }
126    
127    #if CONFIG_ASM && ARCH_X86
128              // 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
129              inline void Apply4StepsSSE(biquad_param_t* param) {              inline void Apply4StepsSSE(biquad_param_t* param) {
130                  __asm__ __volatile__ (                  __asm__ __volatile__ (
# Line 207  namespace LinuxSampler { Line 211  namespace LinuxSampler {
211                        "r" (&param->b0)  /* %2 */                        "r" (&param->b0)  /* %2 */
212                  );                  );
213              }              }
214    #endif // CONFIG_ASM && ARCH_X86
215    
216              inline bq_t ApplyFB(bq_t x, const bq_t fb) {              inline bq_t ApplyFB(bq_t x, const bq_t fb) {
217                  bq_t y;                  bq_t y;
# Line 238  namespace LinuxSampler { Line 243  namespace LinuxSampler {
243                  return y;                  return y;
244              }              }
245    
246    #if CONFIG_ASM && ARCH_X86
247              // 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
248              inline void ApplyFB4StepsSSE(biquad_param_t* param, const bq_t &fb) {              inline void ApplyFB4StepsSSE(biquad_param_t* param, const bq_t &fb) {
249                  float xs, ys;                  float xs, ys;
# Line 433  namespace LinuxSampler { Line 439  namespace LinuxSampler {
439                      ::                      ::
440                  );                  );
441              }              }
442    #endif // CONFIG_ASM && ARCH_X86
443      };      };
444    
445        /** @brief Lowpass Filter
446         *
447         * Lowpass filter based on biquad filter implementation.
448         */
449      class LowpassFilter : public BiquadFilter {      class LowpassFilter : public BiquadFilter {
450          public:          public:
451              inline LowpassFilter() : BiquadFilter() {}              inline LowpassFilter() : BiquadFilter() {}
# Line 468  namespace LinuxSampler { Line 479  namespace LinuxSampler {
479              }              }
480      };      };
481    
482        /** @brief Bandpass Filter
483         *
484         * Bandpass filter based on biquad filter implementation.
485         */
486      class BandpassFilter : public BiquadFilter {      class BandpassFilter : public BiquadFilter {
487          public:          public:
488              inline BandpassFilter() : BiquadFilter() {}              inline BandpassFilter() : BiquadFilter() {}
# Line 501  namespace LinuxSampler { Line 516  namespace LinuxSampler {
516              }              }
517      };      };
518    
519        /** @brief Highpass Filter
520         *
521         * Highpass filter based on biquad filter implementation.
522         */
523      class HighpassFilter : public BiquadFilter {      class HighpassFilter : public BiquadFilter {
524          public:          public:
525              inline HighpassFilter() : BiquadFilter() {}              inline HighpassFilter() : BiquadFilter() {}

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

  ViewVC Help
Powered by ViewVC