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

Diff of /linuxsampler/trunk/src/common/RTMath.h

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

revision 737 by schoenebeck, Tue Aug 16 16:50:00 2005 UTC revision 829 by schoenebeck, Sat Jan 14 14:07:47 2006 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, 2006 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 75  class RTMathBase { Line 75  class RTMathBase {
75              return pCentsToFreqTable[index_int] + index_fract * (pCentsToFreqTable[index_int+1] - pCentsToFreqTable[index_int]);              return pCentsToFreqTable[index_int] + index_fract * (pCentsToFreqTable[index_int+1] - pCentsToFreqTable[index_int]);
76          }          }
77    
78            /**
79             * Inverse function to CentsToFreqRatio(). This function is a bit
80             * slow, so it should not be called too frequently.
81             */
82            static double FreqRatioToCents(double FreqRatio) {
83                return log(FreqRatio) / log(TWELVEHUNDREDTH_ROOT_OF_TWO);
84            }
85    
86      private:      private:
87          static float  CentsToFreqTable[CONFIG_MAX_PITCH * 1200 * 2 + 1];          static float  CentsToFreqTable[CONFIG_MAX_PITCH * 1200 * 2 + 1];
88          static float* pCentsToFreqTable;          static float* pCentsToFreqTable;
# Line 260  class __RTMath : public RTMathBase { Line 268  class __RTMath : public RTMathBase {
268                  }                  }
269                  #endif // CONFIG_ASM && ARCH_X86                  #endif // CONFIG_ASM && ARCH_X86
270                  default: {                  default: {
271                      return (b < a) ? b : a;                      return std::min(a, b);
272                  }                  }
273              }              }
274          }          }
275    
276          template<class T_a, class T_b> inline static T_a Min(const T_a a, const T_b b) {          template<class T_a, class T_b> inline static T_a Min(const T_a a, const T_b b) {
             #if __GNUC__  
             return b <? a;  
             #else  
277              return (b < a) ? b : a;              return (b < a) ? b : a;
             #endif  
278          }          }
279    
280          inline static float Max(const float a, const float b) {          inline static float Max(const float a, const float b) {
# Line 289  class __RTMath : public RTMathBase { Line 293  class __RTMath : public RTMathBase {
293                  }                  }
294                  #endif // CONFIG_ASM && ARCH_X86                  #endif // CONFIG_ASM && ARCH_X86
295                  default: {                  default: {
296                      return (b > a) ? b : a;                      return std::max(a, b);
297                  }                  }
298              }              }
299          }          }
300    
301          template<class T_a, class T_b> inline static T_a Max(const T_a a, const T_b b) {          template<class T_a, class T_b> inline static T_a Max(const T_a a, const T_b b) {
             #if __GNUC__  
             return b >? a;  
             #else  
302              return (b > a) ? b : a;              return (b > a) ? b : a;
             #endif  
303          }          }
304    
305          inline static float Fmodf(const float &a, const float &b) {          inline static float Fmodf(const float &a, const float &b) {

Legend:
Removed from v.737  
changed lines
  Added in v.829

  ViewVC Help
Powered by ViewVC