]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/duration.hh
Merge branch 'master' of git+ssh://jneem@git.sv.gnu.org/srv/git/lilypond
[lilypond.git] / lily / include / duration.hh
1 /*
2   duration.hh -- declare Duration
3
4   source file of the LilyPond music typesetter
5
6   (c) 1997--2007 Jan Nieuwenhuizen <janneke@gnu.org>
7 */
8
9 #ifndef DURATION_HH
10 #define DURATION_HH
11
12 #include "moment.hh"
13
14 /**
15    A musical duration.
16 */
17 struct Duration
18 {
19 public:
20
21   Duration ();
22   Duration (int, int);
23   string to_string () const;
24
25   Duration compressed (Rational) const;
26   Rational get_length () const;
27   Rational factor () const { return factor_; }
28   int duration_log () const;
29   int dot_count () const;
30
31   static int compare (Duration const &, Duration const &);
32
33   DECLARE_SCHEME_CALLBACK (less_p, (SCM a, SCM b));
34   DECLARE_SIMPLE_SMOBS (Duration);
35
36 private:
37   /// Logarithm of the base duration.
38   int durlog_;
39   int dots_;
40
41   Rational factor_;
42 };
43
44 INSTANTIATE_COMPARE (Duration, Duration::compare);
45 DECLARE_UNSMOB (Duration, duration);
46
47 #endif // DURATION_HH
48