]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/music.hh
c307d07ff99d2e0cedb7f88f7d000be16b35b93e
[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--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
8
9 #ifndef MUSIC_HH
10 #define MUSIC_HH
11
12 #include "virtual-methods.hh"
13 #include "smobs.hh"
14 #include "moment.hh"
15 #include "pitch.hh"
16 #include "prob.hh"
17
18 #define is_mus_type(x) internal_is_music_type (ly_symbol2scm (x))
19
20 class Music : public Prob
21 {
22 public:
23   Music (SCM init);
24   Music (Music const &m);
25   VIRTUAL_COPY_CONSTRUCTOR (Music, Music);
26
27   Input *origin () const;
28   void set_spot (Input);
29
30   bool internal_is_music_type (SCM) const;
31
32   Stream_event *to_event () const;
33
34   DECLARE_SCHEME_CALLBACK (relative_callback, (SCM, SCM));
35   Pitch to_relative_octave (Pitch);
36   Pitch generic_to_relative_octave (Pitch);
37   Moment get_length () const;
38   Moment start_mom () const;
39   void print () const;
40
41   /// Transpose, with the interval central C to #p#
42   void transpose (Pitch p);
43
44   /// Scale the music in time by #factor#.
45   void compress (Moment factor);
46   
47   // Broadcast the event in a context's event-source.
48   void send_to_context (Context *c);
49
50   DECLARE_SCHEME_CALLBACK (duration_length_callback, (SCM));
51  
52 protected:
53   virtual SCM copy_mutable_properties () const;
54   virtual void type_check_assignment (SCM, SCM) const;
55   virtual void derived_mark () const;
56 protected:
57   SCM length_callback_;
58   SCM start_callback_;
59   friend SCM ly_extended_make_music (SCM, SCM);
60 };
61
62 Music *unsmob_music (SCM);
63 Music *make_music_by_name (SCM sym);
64 SCM ly_music_deep_copy (SCM);
65 extern SCM ly_music_p_proc;
66
67 /* common transposition function for music and event */
68 SCM transpose_mutable (SCM alist, Pitch delta);
69
70 #endif /* MUSIC_HH */