annotate base/LogRange.h @ 282:d9319859a4cf tip

(none)
author benoitrigolleau
date Fri, 31 Oct 2008 11:00:24 +0000
parents fc9323a41f5a
children
rev   line source
lbajardsilogic@0 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
lbajardsilogic@0 2
lbajardsilogic@0 3 /*
lbajardsilogic@0 4 Sonic Visualiser
lbajardsilogic@0 5 An audio file viewer and annotation editor.
lbajardsilogic@0 6 Centre for Digital Music, Queen Mary, University of London.
lbajardsilogic@0 7 This file copyright 2006 Chris Cannam.
lbajardsilogic@0 8
lbajardsilogic@0 9 This program is free software; you can redistribute it and/or
lbajardsilogic@0 10 modify it under the terms of the GNU General Public License as
lbajardsilogic@0 11 published by the Free Software Foundation; either version 2 of the
lbajardsilogic@0 12 License, or (at your option) any later version. See the file
lbajardsilogic@0 13 COPYING included with this distribution for more information.
lbajardsilogic@0 14 */
lbajardsilogic@0 15
lbajardsilogic@0 16 #ifndef _LOG_RANGE_H_
lbajardsilogic@0 17 #define _LOG_RANGE_H_
lbajardsilogic@0 18
lbajardsilogic@0 19 class LogRange
lbajardsilogic@0 20 {
lbajardsilogic@0 21 public:
lbajardsilogic@0 22 /**
lbajardsilogic@0 23 * Map a linear range onto a logarithmic range. min and max are
lbajardsilogic@0 24 * passed as the extents of the linear range and returned as the
lbajardsilogic@0 25 * extents of the logarithmic range. thresh is the minimum value
lbajardsilogic@0 26 * for the log range, to be used if the linear range spans zero.
lbajardsilogic@0 27 */
lbajardsilogic@0 28 static void mapRange(float &min, float &max, float thresh = -10);
lbajardsilogic@0 29
lbajardsilogic@0 30 /**
lbajardsilogic@0 31 * Map a value onto a logarithmic range. This just means taking
lbajardsilogic@0 32 * the base-10 log of the absolute value, or using the threshold
lbajardsilogic@0 33 * value if the absolute value is zero.
lbajardsilogic@0 34 */
lbajardsilogic@0 35 static float map(float value, float thresh = -10);
lbajardsilogic@0 36 };
lbajardsilogic@0 37
lbajardsilogic@0 38 #endif