annotate src/Modules/Output/Graphics/Scale/ScaleLog.h @ 263:07dc1f7047f5

Debug output for audio_example and added a write function for aimc_data
author hamel.phil
date Thu, 06 Jan 2011 20:11:41 +0000
parents 2aa72aa8a0d4
children
rev   line source
tomwalters@116 1 /*!
tomwalters@116 2 * \file
tomwalters@116 3 * \brief Logarithmic frequency scale for generating filter banks and their frequencies
tomwalters@116 4 *
tomwalters@116 5 * \author Willem van Engen <cnbh@willem.engen.nl>
tomwalters@116 6 * \date created 2006/09/28
tomwalters@116 7 * \version \$Id: ScaleLog.h 459 2007-11-08 11:50:04Z tom $
tomwalters@116 8 */
tomwalters@116 9 /* (c) 2006, University of Cambridge, Medical Research Council
tomwalters@116 10 * http://www.pdn.cam.ac.uk/groups/cnbh/aimmanual
tomwalters@116 11 */
tomwalters@116 12 #ifndef __MODULE_SCALE_LOG_H__
tomwalters@116 13 #define __MODULE_SCALE_LOG_H__
tomwalters@116 14
tomwalters@116 15 #include <math.h>
tomwalters@116 16
tom@230 17 #include "Modules/Output/Graphics/Scale/Scale.h"
tom@230 18
tom@230 19 namespace aimc {
tomwalters@116 20
tomwalters@116 21 /*!
tomwalters@116 22 * \class ScaleLog "Modules/Scale/ScaleLog.h"
tomwalters@116 23 * \brief Logarithmic frequency scale for generating filter banks and their frequencies
tomwalters@116 24 *
tomwalters@116 25 * It is very advisable to use Scale::Create() to an instance of this scale.
tomwalters@116 26 */
tomwalters@116 27 class ScaleLog : public Scale {
tomwalters@116 28 public:
tomwalters@228 29 ScaleLog(unsigned int min, unsigned int max, float density)
tomwalters@228 30 : Scale(min, max, density) { m_iType = SCALE_LOG; m_sName="log"; };
tomwalters@116 31
tomwalters@228 32 /*! The log scale has a problem, because log(0)=inf, so all values below
tomwalters@228 33 * 1e-5 are truncated to 1e-5. */
tomwalters@228 34 float FromLinear(float fFreq) {
tomwalters@228 35 if (fFreq<1e-5f) fFreq=1e-5f;
tomwalters@228 36 return log(fFreq);
tomwalters@228 37 };
tomwalters@116 38
tomwalters@228 39 float ToLinear(float fFreq) {
tomwalters@228 40 return exp(fFreq);
tomwalters@228 41 };
tomwalters@116 42 };
tom@230 43 } // namespace aimc
tomwalters@116 44 #endif /* __MODULE_SCALE_LOG_H__ */