00001 /* $Revision: 1.4 $ $Date: 2006/09/12 17:37:39 $ $Author: dgl $ $Name: $ $Id: _dynamics_8h-source.html,v 1.4 2006/09/12 17:37:39 dgl Exp $ */ 00002 #ifndef DYNAMICS_H 00003 #define DYNAMICS_H 00004 00005 // The Musimat Tutorial © 2006 Gareth Loy 00006 // Derived from Chapter 9 and Appendix B of "Musimathics Vol. 1" © 2006 Gareth Loy 00007 // and published exclusively by The MIT Press. 00008 // This program is released WITHOUT ANY WARRANTY; without even the implied 00009 // warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00010 // For information on usage and redistribution, and for a DISCLAIMER OF ALL 00011 // WARRANTIES, see the file, "LICENSE.txt," in this distribution. 00012 // "Musimathics" is available here: http://mitpress.mit.edu/catalog/item/default.asp?ttype=2&tid=10916 00013 // Gareth Loy's Musimathics website: http://www.musimathics.com/ 00014 // The Musimat website: http://www.musimat.com/ 00015 // This program is released under the terms of the GNU General Public License 00016 // available here: http://www.gnu.org/licenses/gpl.txt 00017 00018 #include <math.h> 00019 00022 00027 00032 template<class Type> inline Type dBCoefficient( Type x, Type ref = 1.0 ) { Return( pow(10.0, x / 20.0 ) / ref); } 00033 00034 00039 template<class Type> inline Type dBSPL( Type x, Type ref = 1.0 ) { Return 20.0 * log10(x / ref); } 00040 00045 template<class Type> inline Type dBSIL( Type x, Type ref = 1.0 ) { Return 10.0 * log10(x / ref); } 00047 00048 00053 00054 Const Real 00055 Fff = dBCoefficient(-10.0), 00056 Ff = dBCoefficient(-18.0), 00057 Forte = dBCoefficient(-24.0), 00058 Mf = dBCoefficient(-32.0), 00059 Mp = dBCoefficient(-40.0), 00060 P = dBCoefficient(-48.0), 00061 Pp = dBCoefficient(-56.0), 00062 Ppp = dBCoefficient(-64.0) 00063 ; 00065 00066 #endif // DYNAMICS_H
1.4.7