]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/music.hh
* lily/include/music.hh (class Music): replace Music::start_mom()
[lilypond.git] / lily / include / music.hh
1 /*
2   music.hh -- declare Music
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9 #ifndef MUSIC_HH
10 #define MUSIC_HH
11
12 #include "virtual-methods.hh"
13 #include "minterval.hh"
14 #include "music-constructor.hh"
15
16 #define is_mus_type(x) internal_is_music_type (ly_symbol2scm (x))
17
18 /** Music is anything that has duration and supports both time compression and
19   transposition.
20   
21   In Lily, everything that can be thought to have a length and a pitch
22  (which has a duration which can be transposed) is considered "music",
23
24   Music is hierarchical: 
25
26   @see Music_sequence
27
28
29   TODO: make a equalp function for general music. 
30   */
31 class Music
32 {
33 public:
34   Music (SCM init);
35   Music (Music const &m);
36   VIRTUAL_COPY_CONSTRUCTOR (Music, Music);
37
38   Input *origin () const; 
39   void set_spot (Input);
40
41   SCM internal_get_property (SCM) const;
42   void internal_set_property (SCM , SCM val);
43   SCM get_property_alist (bool mut) const;
44   bool internal_is_music_type (SCM) const;
45   int duration_log () const;
46   
47   virtual Pitch to_relative_octave (Pitch);
48   String name () const;
49   Moment get_length () const;
50   Moment start_mom () const;
51   void print () const;
52   /// Transpose, with the interval central C to #p#
53   virtual void transpose (Pitch p);
54
55   /// Scale the music in time by #factor#.
56   virtual void compress (Moment factor);
57   
58 protected:
59   DECLARE_SMOBS (Music,);
60   SCM immutable_property_alist_;
61   SCM mutable_property_alist_;
62 protected:
63   SCM length_callback_;
64   SCM start_callback_;
65   friend SCM ly_extended_make_music (SCM, SCM);
66 };
67
68 DECLARE_TYPE_P(Music);
69 DECLARE_UNSMOB(Music,music);
70
71 Music *make_music_by_name (SCM sym);
72 SCM ly_music_deep_copy (SCM);
73 SCM ly_music_scorify (SCM, SCM);
74
75 #endif /* MUSIC_HH */