comparison src/Modules/Output/Graphics/Scale/ScaleLogScaled.h @ 227:73c6d61440ad

- First add of a lot of graphics code from the old version. Not working yet, not even compiling yet.
author tomwalters
date Fri, 15 Oct 2010 05:40:53 +0000
parents 9d880fb93c39
children 82e0dc3dfd16
comparison
equal deleted inserted replaced
226:eaeba1fd41e6 227:73c6d61440ad
12 #ifndef __MODULE_SCALE_LOGSCALED_H__ 12 #ifndef __MODULE_SCALE_LOGSCALED_H__
13 #define __MODULE_SCALE_LOGSCALED_H__ 13 #define __MODULE_SCALE_LOGSCALED_H__
14 14
15 #include <math.h> 15 #include <math.h>
16 16
17 #include "Modules/Output/Graphics/Scale/Scale.h" 17 #include "Modules/Scale/Scale.h"
18
19 namespace aimc {
20 18
21 /*! 19 /*!
22 * \class ScaleERB "Modules/Scale/ScaleERB.h" 20 * \class ScaleERB "Modules/Scale/ScaleERB.h"
23 * \brief ERB frequency scale for generating filter banks and their frequencies 21 * \brief ERB frequency scale for generating filter banks and their frequencies
24 * 22 *
28 * - J. Smith and J. Abel (1999), "Bark and ERB bilinear transforms" 26 * - J. Smith and J. Abel (1999), "Bark and ERB bilinear transforms"
29 * http://www-ccrma.stanford.edu/~jos/bbt/ 27 * http://www-ccrma.stanford.edu/~jos/bbt/
30 */ 28 */
31 class ScaleLogScaled : public Scale { 29 class ScaleLogScaled : public Scale {
32 public: 30 public:
33 ScaleLogScaled(unsigned int min, unsigned int max, float density) 31 ScaleLogScaled(unsigned int min, unsigned int max, float density)
34 : Scale(min, max, density) { m_iType = SCALE_ERB; m_sName = "logscaled"; }; 32 : Scale(min, max, density) { m_iType = SCALE_ERB; m_sName = "logscaled"; };
35 33
36 float FromLinear(float fFreq) { 34 float FromLinear(float fFreq) {
37 return 21.4f*log10(0.00437f*fFreq); 35 return 21.4f*log10(0.00437f*fFreq);
38 }; 36 };
39 37
40 float ToLinear(float fFreq) { 38 float ToLinear(float fFreq) {
41 return (pow(10, fFreq/21.4f))/0.00437f; 39 return (pow(10, fFreq/21.4f))/0.00437f;
42 }; 40 };
43 }; 41 };
44 } // namespace aimc 42
45 #endif /* __MODULE_SCALE_ERB_H__ */ 43 #endif /* __MODULE_SCALE_ERB_H__ */