]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/beaming-pattern.hh
Take invisible beams into account when beaming.
[lilypond.git] / lily / include / beaming-pattern.hh
1 /*
2   beaming-pattern.hh -- declare beaming-pattern.hh
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1999--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
8
9 #ifndef BEAMING_PATTERN_HH
10 #define BEAMING_PATTERN_HH
11
12 #include "std-vector.hh"
13 #include "moment.hh"
14 #include "lily-proto.hh"
15
16 struct Beaming_options
17 {
18   SCM grouping_;
19   bool subdivide_beams_;
20   Moment beat_length_;
21   Moment measure_length_;
22
23   Beaming_options ();
24   void from_context (Context*);  
25 };
26
27 struct Beam_rhythmic_element
28 {
29   Moment start_moment_;
30   Drul_array<int> beam_count_drul_;
31
32   Moment beat_start_;
33   Moment beat_length_;
34   Moment group_start_;
35   bool invisible_;
36   
37   Beam_rhythmic_element (Moment, int, bool);
38   Beam_rhythmic_element ();
39
40   int count (Direction d);
41   void de_grace ();
42 };
43
44 /*
45   Generate beaming given durations of notes. Beam uses this to
46   set_beaming () for each of its stems.
47 */
48 class Beaming_pattern
49 {
50 public:
51   Beaming_pattern ();
52   
53   void beamify (Beaming_options const&);
54   void de_grace ();
55   void add_stem (Moment d, int beams, bool invisible);
56   int beamlet_count (int idx, Direction d) const;
57   
58 private:
59   vector<Beam_rhythmic_element> infos_;
60   void beamify (bool);
61   int beam_extend_count (Direction) const;
62   int best_splitpoint_index (bool *split) const;
63   void unbeam_invisible_stems ();
64   bool is_next_to_invisible_stem (vsize) const;
65 };
66
67 #endif /* BEAMING_PATTERN_HH */