]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/music.hh
Release: bump Welcome versions.
[lilypond.git] / lily / include / music.hh
1 /*
2   This file is part of LilyPond, the GNU music typesetter.
3
4   Copyright (C) 1997--2015 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
28 #define is_mus_type(x) internal_is_music_type (ly_symbol2scm (x))
29
30 struct Preinit_Music {
31   SCM length_callback_;
32   SCM start_callback_;
33   Preinit_Music ();
34 };
35
36 class Music : Preinit_Music, public Prob
37 {
38 public:
39   Music (SCM init);
40   Music (Music const &m);
41   VIRTUAL_COPY_CONSTRUCTOR (Music, Music);
42
43   Input *origin () const;
44   void set_spot (Input);
45
46   bool internal_is_music_type (SCM) const;
47
48   Stream_event *to_event () const;
49
50   DECLARE_SCHEME_CALLBACK (relative_callback, (SCM, SCM));
51   Pitch to_relative_octave (Pitch);
52   Pitch generic_to_relative_octave (Pitch);
53   Moment get_length () const;
54   Moment start_mom () const;
55   void print () const;
56
57   /// Scale the music in time by #factor#.
58   void compress (Moment factor);
59
60   // Broadcast the event in a context's event-source.
61   void send_to_context (Context *c);
62
63   DECLARE_SCHEME_CALLBACK (duration_length_callback, (SCM));
64
65 protected:
66   virtual SCM copy_mutable_properties () const;
67   virtual void type_check_assignment (SCM, SCM) const;
68   virtual void derived_mark () const;
69 protected:
70   friend SCM ly_extended_make_music (SCM, SCM);
71 };
72
73 Music *make_music_by_name (SCM sym);
74 SCM music_deep_copy (SCM m);
75 void set_origin (SCM m, SCM origin);
76
77 SCM ly_camel_case_2_lisp_identifier (SCM name_sym);
78
79 extern SCM ly_music_p_proc;
80
81 #endif /* MUSIC_HH */