Mercurial > hg > aimc
view src/Modules/Output/Graphics/Scale/Scale.cc @ 119:9d880fb93c39
- Well, most of the graphics stuff at least compiles now. Next step is getting it running.
M Modules/Output/Graphics/GraphicsView.h
M Modules/Output/Graphics/Devices/GraphicsOutputDeviceMovieDirect.cc
M Modules/Output/Graphics/Devices/GraphicsOutputDeviceMovieDirect.h
M Modules/Output/Graphics/Devices/GraphicsOutputDeviceCairo.cc
M Modules/Output/Graphics/Devices/GraphicsOutputDeviceCairo.h
M Modules/Output/Graphics/Devices/GraphicsOutputDeviceMovie.cc
M Modules/Output/Graphics/Devices/GraphicsOutputDeviceMovie.h
M Modules/Output/Graphics/Scale/ScaleLog.h
M Modules/Output/Graphics/Scale/ScaleERB.h
M Modules/Output/Graphics/Scale/ScaleLinear.h
M Modules/Output/Graphics/Scale/ScaleLogScaled.h
M Modules/Output/Graphics/Scale/Scale.cc
M Modules/Output/Graphics/Scale/Scale.h
M Support/Common.h
author | tom@acousticscale.org |
---|---|
date | Sat, 16 Oct 2010 23:05:26 +0000 |
parents | 18237d55e346 |
children | 73c6d61440ad |
line wrap: on
line source
/*! * \file * \brief Frequency scale for generating filter banks and their frequencies * * \author Willem van Engen <cnbh@willem.engen.nl> * \date created 2006/09/28 * \version \$Id: Scale.cpp 459 2007-11-08 11:50:04Z tom $ */ /* (c) 2006, University of Cambridge, Medical Research Council * http://www.pdn.cam.ac.uk/groups/cnbh/aimmanual */ #include "Support/Common.h" #include "Modules/Output/Graphics/Scale/Scale.h" #include "Modules/Output/Graphics/Scale/ScaleLinear.h" #include "Modules/Output/Graphics/Scale/ScaleERB.h" #include "Modules/Output/Graphics/Scale/ScaleLog.h" #include "Modules/Output/Graphics/Scale/ScaleLogScaled.h" namespace aimc { Scale *Scale::Create(ScaleType iType, unsigned int min, unsigned int max, float density) { switch(iType) { case SCALE_LINEAR: return static_cast<Scale*>(new ScaleLinear(min, max, density)); case SCALE_ERB: return static_cast<Scale*>(new ScaleERB(min, max, density)); case SCALE_LOG: return static_cast<Scale*>(new ScaleLog(min, max, density)); case SCALE_LOGSCALED: return static_cast<Scale*>(new ScaleLogScaled(min, max, density)); default: AIM_ASSERT(0); break; } // Unreachable code AIM_ASSERT(0); return NULL; } Scale *Scale::Create(ScaleType iType) { return Create(iType, 0, 0, 0); } Scale *Scale::Clone() { Scale *pScale = Create(m_iType, m_iMin, m_iMax, m_fDensity); AIM_ASSERT(pScale); pScale->m_fScaledCurHalfSum = m_fScaledCurHalfSum; pScale->m_fScaledCurDiff = m_fScaledCurDiff; return pScale; } float Scale::FromLinearScaled(float fVal) { /*! This function returns * ( FromLinear(fVal) - (fMinScaled+fMaxScaled)/2 ) / (fMaxScaled-fMinScaled) */ float fValScaled = FromLinear(fVal); return (fValScaled - m_fScaledCurHalfSum) / m_fScaledCurDiff; } void Scale::FromLinearScaledExtrema(float fMin, float fMax) { float fMinScaled = FromLinear(fMin); float fMaxScaled = FromLinear(fMax); m_fScaledCurHalfSum = (fMinScaled+fMaxScaled)/2; m_fScaledCurDiff = fMaxScaled-fMinScaled; m_fMin = fMin; m_fMax = fMax; } void Scale::FromLinearScaledExtrema(Scale *pScale) { AIM_ASSERT(pScale); FromLinearScaledExtrema(pScale->m_fMin, pScale->m_fMax); } } // namespace aimc