Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "Musimat.h"
00016
00017
00018 Real Rhythm::s_fourQuarters = 4.0;
00019
00020
00021
00022 Real Rhythm::s_tempo = Rhythm::mmInit( 1.0/4.0, 60.0 );
00023
00024
00025 Character Rhythm::s_buf[128];
00026
00027 Void SetTempoScale( Real ts )
00028 {
00029 Rhythm::tempo(ts);
00030 }
00031
00032 Real metronome( Rhythm B, Real T )
00033 {
00034 Return( 1.0 / (4.0 * B.absDuration()) * 60.0 / T );
00035 }
00036
00037 Real Duration( Real x )
00038 {
00039 Rhythm(y);
00040 Return y.duration();
00041 }
00042
00043 Real Duration( Integer n, Integer d)
00044 {
00045 Rhythm y = Rhythm(n, d);
00046 Return y.duration();
00047 }
00048
00049 Real AbsDuration( Real x )
00050 {
00051 Rhythm(y);
00052 Return y.absDuration();
00053 }
00054
00055 Real Duration( Rhythm y )
00056 {
00057 Return y.absDuration();
00058 }
00059
00060 Real AbsDuration( Rhythm y )
00061 {
00062 Return y.absDuration();
00063 }
00064
00065 ostream& operator<<( ostream& os, Rhythm& r )
00066 {
00067 os << r.print();
00068 Return os;
00069 }
00070
00071 istream& operator>>( istream& is, Rhythm& p )
00072 {
00073 char ch;
00074 is >> ch && (ch == '{' || ch == '(')
00075 && is >> p.m_num >> ch && ch == ','
00076 && is >> p.m_den >> ch && (ch == '}' || ch == '(');
00077 Return is;
00078 }
00079
00080 Rhythm Whole = Duration( 1 ),
00081 Half = Duration( 1, 2 ),
00082 Quarter = Duration( 1, 4 ),
00083 Eighth = Duration( 1, 8 ),
00084 Sixteenth = Duration( 1, 16 )
00085 ;
00086