]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/music.hh
* lily/parser.yy (command_element): move clef stuff into Scheme.
[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--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9
10
11 #ifndef MUSIC_HH
12 #define MUSIC_HH
13
14 #include "virtual-methods.hh"
15 #include "minterval.hh"
16 #include "lily-proto.hh"
17 #include "string.hh"
18 #include "smobs.hh"
19 #include "music-constructor.hh"
20
21
22 #define get_mus_property(x) internal_get_mus_property(ly_symbol2scm(x))
23 #define set_mus_property(x,y) internal_set_mus_property(ly_symbol2scm (x), y)
24 #define is_mus_type(x) internal_is_music_type(ly_symbol2scm (x))
25
26 /** Music is anything that has duration and supports both time compression and
27   transposition.
28   
29   In Lily, everything that can be thought to have a length and a pitch
30  (which has a duration which can be transposed) is considered "music",
31
32   Music is hierarchical: 
33
34   @see Music_sequence
35
36
37   TODO: make a equalp function for general music. 
38   */
39 class Music {
40 public:
41   Input *origin () const; 
42   void set_spot (Input);  
43
44   SCM internal_get_mus_property (SCM) const;
45   void internal_set_mus_property (SCM , SCM val);
46   SCM get_property_alist (bool mut) const;
47   bool internal_is_music_type (SCM) const;
48   
49   virtual Pitch to_relative_octave (Pitch);
50
51   /// The duration of this piece of music
52   virtual Moment get_length () const;
53   virtual Moment start_mom () const;
54   void print () const;
55   /// Transpose, with the interval central C to #p#
56   virtual void transpose (Pitch p);
57
58   /// Scale the music in time by #factor#.
59   virtual void compress (Moment factor);
60   VIRTUAL_COPY_CONS (Music);
61   Music ();
62   Music (Music const &m);
63 protected:
64   DECLARE_SMOBS (Music,);
65   SCM immutable_property_alist_;
66   SCM mutable_property_alist_;
67   friend SCM ly_extended_make_music(SCM,SCM);
68 };
69
70
71 DECLARE_UNSMOB(Music,music);
72
73 Music* make_music_by_name (SCM sym);
74
75
76 #endif // MUSIC_HH