]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/beaming-pattern.hh
Run grand-replace (issue 3765)
[lilypond.git] / lily / include / beaming-pattern.hh
1 /*
2   This file is part of LilyPond, the GNU music typesetter.
3
4   Copyright (C) 1999--2014 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 BEAMING_PATTERN_HH
21 #define BEAMING_PATTERN_HH
22
23 #include "std-vector.hh"
24 #include "moment.hh"
25 #include "lily-proto.hh"
26
27 struct Beaming_options
28 {
29   SCM grouping_;
30   bool subdivide_beams_;
31   bool strict_beat_beaming_;
32   Moment base_moment_;
33   Moment measure_length_;
34
35   Beaming_options ();
36   void from_context (Context *);
37 };
38
39 struct Beam_rhythmic_element
40 {
41   Moment start_moment_;
42   Drul_array<int> beam_count_drul_;
43
44   int rhythmic_importance_;
45   bool invisible_;
46
47   Rational factor_;
48
49   bool tuplet_start_;
50
51   Beam_rhythmic_element (Moment, int, bool, Rational, bool);
52   Beam_rhythmic_element ();
53
54   int count (Direction d) const;
55   void de_grace ();
56 };
57
58 /*
59   Generate beaming given durations of notes. Beam uses this to
60   set_beaming () for each of its stems.
61 */
62 class Beaming_pattern
63 {
64 public:
65   Beaming_pattern ();
66
67   void beamify (Beaming_options const &);
68   void de_grace ();
69   void add_stem (Moment d, int beams, bool invisible, Rational factor, bool tuplet_starrt);
70   int beamlet_count (int idx, Direction d) const;
71   bool invisibility (int idx) const;
72   Rational factor (int idx) const;
73   bool tuplet_start (int idx) const;
74   Moment start_moment (int idx) const;
75   Moment end_moment (int idx) const;
76   Beaming_pattern *split_pattern (int idx);
77
78 private:
79   vector<Beam_rhythmic_element> infos_;
80   Direction flag_direction (Beaming_options const &, vsize) const;
81   void find_rhythmic_importance (Beaming_options const &);
82   void unbeam_invisible_stems ();
83 };
84
85 #endif /* BEAMING_PATTERN_HH */