2 duration-convert.hh -- declare Duration_convert
4 source file of the LilyPond music typesetter
6 (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
10 #ifndef DURATION_CONVERT_HH
11 #define DURATION_CONVERT_HH
12 #include "duration.hh"
17 Duration_convert handles all conversions to -n fro Duration (dur).
18 That is including (integer + division) representation for MIDI,
19 and conversion from unexact time representation (best guess :-).
21 A Rational (mom) is a Rational that holds the time fraction
22 compared to a whole note (before also called wholes).
25 move all statics to real members, instantiate Duration_convert
28 struct Duration_convert {
32 static bool const midi_as_plet_b_s;
33 static bool no_quantify_b_s;
34 static bool no_double_dots_b_s;
35 static bool no_triplets_b_s;
36 static int no_smaller_than_i_s;
37 static Array<Duration> dur_array_s;
39 /// Return number of ticks in (ticks, division_1) representation
40 static int dur2ticks_i (Duration dur );
42 /// Return the type_i representation of note length i
43 static int i2_type (int i);
45 /// Return the note length corresponding to the type_i representation
46 /// Return 0 if longer than whole note.
47 static int type2_i (int type);
49 /// Return Rational representation (fraction of whole note).
50 static Rational dur2_mom (Duration dur );
52 /// Return Mudela string representation.
53 static String dur2_str (Duration dur );
55 /// Return duration from Rational (fraction of whole) representation.
56 static Duration mom2_dur (Rational mom );
58 /// Return standardised duration, best guess if not exact.
59 static Duration mom2standardised_dur (Rational mom );
61 /// Return plet factor (not a Rational: should use Rational?).
62 static Rational plet_factor_mom (Duration dur );
64 static void set_array ();
66 /** Return synchronisation factor for mom, so that
67 mom2_dur (mom / sync_f ) will return the duration dur.
69 static Real sync_f (Duration dur, Rational mom );
71 /// Return exact duration, in midi-ticks if not-exact.
72 static Duration ticks2_dur (int ticks_i );
74 /// Return standardised duration, best guess if not exact.
75 static Duration ticks2standardised_dur (int ticks_i );
79 #endif // DURATION_CONVERT_HH