00001 /* $Revision: 1.4 $ $Date: 2006/09/12 17:37:40 $ $Author: dgl $ $Name: $ $Id: _musimat_8h-source.html,v 1.4 2006/09/12 17:37:40 dgl Exp $ */ 00002 #ifndef MUSIMAT_H 00003 #define MUSIMAT_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 00020 00021 #include "Aliases.h" 00022 #include "MathFuns.h" 00023 #include "Complex.h" 00024 #include "List.h" 00025 #include "Matrix.h" 00026 #include "Rational.h" 00027 #include "Rhythm.h" 00028 #include "Pitch.h" 00029 00032 extern Const Real Pi; 00033 00038 00040 typedef List<Integer> IntegerList; 00041 00043 typedef List<Real> RealList; 00044 00046 typedef List<String> StringList; 00047 00049 typedef List<Complex> ComplexList; 00050 00052 typedef List<Pitch> PitchList; 00053 00055 typedef List<Rational> RationalList; 00056 00058 typedef List<Rhythm> RhythmList; 00060 00064 00066 typedef Matrix<Integer> IntegerMatrix; 00067 00069 typedef Matrix<Real> RealMatrix; 00070 00072 typedef Matrix<String> StringMatrix; 00073 00075 typedef Matrix<Complex> ComplexMatrix; 00076 00078 typedef Matrix<Pitch> PitchMatrix; 00079 00081 typedef Matrix<Rational> RationalMatrix; 00082 00084 typedef Matrix<Rhythm> RhythmMatrix; 00085 00087 00088 00089 #include "Random.h" 00090 #include "Dynamics.h" 00091 #include "Pitches.h" 00092 #include "Row.h" 00093 00099 00102 template<class ListType> inline Real Max( ListType L ) { Return( L.max() ); } 00103 inline Complex Max( ComplexList L ) { Return( L.max() ); } 00104 inline Integer Max( IntegerList L ) { Return( L.max() ); } 00105 inline Rhythm Max( RhythmList L ) { Return( L.max() ); } 00106 inline Rational Max( RationalList L ) { Return( L.max() ); } 00107 inline Pitch Max( PitchList L ) { Return( L.max() ); } 00108 00111 template<class ListType> inline Integer MaxPos( ListType L ) { Return( L.maxPos() ); } 00112 00115 template<class Type> inline Real Min( Type L ) { Return( L.min() ); } 00116 inline Complex Min( ComplexList L ) { Return( L.min() ); } 00117 inline Integer Min( IntegerList L ) { Return( L.min() ); } 00118 inline Rhythm Min( RhythmList L ) { Return( L.min() ); } 00119 inline Rational Min( RationalList L ) { Return( L.min() ); } 00120 inline Pitch Min( PitchList L ) { Return( L.min() ); } 00121 00124 template<class Type> inline Integer MinPos( Type L ) { Return( L.minPos() ); } 00126 00131 00134 template<class Type> Void Print(Type i) { cout << i << endl; } 00135 00138 template<class Type> Void Print(String s, Type i) { cout << s << i << endl; } 00140 00145 00148 Integer Length( RhythmList Reference L ); 00149 00153 Integer Length( String s ); 00155 00159 RationalList RealListToRationalList( RealList R ); 00160 00164 inline PitchList IntegerListToPitchList( IntegerList Reference L ) 00165 { 00166 PitchList P; 00167 For( Integer i = 0; i < Length( L ); i++ ) 00168 P[i] = L[i]; 00169 Return P; 00170 } 00171 00175 inline IntegerList PitchListToIntegerList( PitchList Reference P ) 00176 { 00177 IntegerList L; 00178 For( Integer i = 0; i < Length( P ); i++ ) 00179 L[i] = P[i]; 00180 Return L; 00181 } 00182 00183 #endif // MUSIMAT_H 00184
1.4.7