]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/music.hh
Merge branch 'translation' of ssh://git.sv.gnu.org/srv/git/lilypond into translation
[lilypond.git] / lily / include / music.hh
1 /*
2   This file is part of LilyPond, the GNU music typesetter.
3
4   Copyright (C) 1997--2012 Han-Wen Nienhuys <hanwen@xs4all.nl>
5
6   LilyPond is free software: you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation, either version 3 of the License, or
9   (at your option) any later version.
10
11   LilyPond is distributed in the hope that it will be useful,
12   but WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   GNU General Public License for more details.
15
16   You should have received a copy of the GNU General Public License
17   along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #ifndef MUSIC_HH
21 #define MUSIC_HH
22
23 #include "smobs.hh"
24 #include "moment.hh"
25 #include "pitch.hh"
26 #include "prob.hh"
27 #include "context.hh"
28
29 #define is_mus_type(x) internal_is_music_type (ly_symbol2scm (x))
30
31 class Music : public Prob
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   bool internal_is_music_type (SCM) const;
42
43   Stream_event *to_event (Context *) const;
44
45   DECLARE_SCHEME_CALLBACK (relative_callback, (SCM, SCM));
46   Pitch to_relative_octave (Pitch);
47   Pitch generic_to_relative_octave (Pitch);
48   Moment get_length () const;
49   Moment start_mom () const;
50   void print () const;
51
52   /// Transpose, with the interval central C to #p#
53   void transpose (Pitch p);
54
55   /// Scale the music in time by #factor#.
56   void compress (Moment factor);
57
58   // Broadcast the event in a context's event-source.
59   void send_to_context (Context *c);
60
61   DECLARE_SCHEME_CALLBACK (duration_length_callback, (SCM));
62
63 protected:
64   virtual SCM copy_mutable_properties () const;
65   virtual void type_check_assignment (SCM, SCM) const;
66   virtual void derived_mark () const;
67 protected:
68   SCM length_callback_;
69   SCM start_callback_;
70   friend SCM ly_extended_make_music (SCM, SCM);
71 };
72
73 Music *unsmob_music (SCM);
74 Music *make_music_by_name (SCM sym);
75 SCM ly_music_deep_copy (SCM);
76 SCM ly_camel_case_2_lisp_identifier (SCM name_sym);
77
78 extern SCM ly_music_p_proc;
79
80 /* common transposition function for music and event */
81 void transpose_mutable (SCM alist, Pitch delta);
82
83 #endif /* MUSIC_HH */