]> git.donarmstrong.com Git - lilypond.git/blob - midi2ly/include/lilypond-item.hh
patch::: 1.3.140.jcn6
[lilypond.git] / midi2ly / include / lilypond-item.hh
1 //
2 // lilypond-item.hh -- declare lilypond_item
3 //
4 // copyright 1997 Jan Nieuwenhuizen <janneke@gnu.org>
5
6 #ifndef LILYPOND_ITEM_HH
7 #define LILYPOND_ITEM_HH
8
9 #include "midi2ly-proto.hh"
10 #include "string.hh"
11 #include "rational.hh"
12 #include "duration.hh"
13
14 // should these:
15 // * be Lilypond_items
16 // * be Voice_elements/requests
17 // * get a name-change
18 // ?
19
20 /// (lilypond_item)
21 class Lilypond_item 
22 {
23 public:
24   Lilypond_item (Lilypond_column* lilypond_column_l);
25   virtual ~Lilypond_item ();
26     
27   virtual Rational at_mom ();
28   virtual Rational duration_mom ();
29   void output (Lilypond_stream& lilypond_stream_r);
30   virtual String str () = 0;
31
32   Lilypond_column* lilypond_column_l_;
33 };
34
35 class Lilypond_key : public Lilypond_item 
36 {
37 public:
38   Lilypond_key (int accidentals_i, int minor_i);
39
40   String notename_str (int pitch_i);
41   virtual String str ();
42
43   //private:
44   int accidentals_i_;
45   int minor_i_;
46 };
47
48 class Lilypond_time_signature : public Lilypond_item 
49 {
50 public:
51   Lilypond_time_signature (int num_i, int den_i, int division_4_i, int count_32_i);
52
53   Duration i2_dur (int time_i, int division_1_i);
54   int clocks_1_i ();
55   int den_i ();
56   int num_i ();
57   virtual String str ();
58   Rational bar_mom ();
59
60 private:
61   Real sync_f_;
62   Duration sync_dur_;
63   int clocks_1_i_;
64   int num_i_;
65   int den_i_;
66 };
67
68 class Lilypond_note : public Lilypond_item 
69 {
70 public:
71   Lilypond_note (Lilypond_column* lilypond_column_l, int channel_i, int pitch_i, int dyn_i);
72
73   Duration duration ();
74   virtual Rational duration_mom ();
75   virtual String str ();
76     
77   //    int const c0_pitch_i_c_ = 60; // huh?
78   static int const c0_pitch_i_c_ = 48;
79
80   static bool const simple_plet_b_s = false;
81   int channel_i_;
82   int pitch_i_;
83   Lilypond_column* end_column_l_;
84 };
85
86 class Lilypond_skip : public Lilypond_item 
87 {
88 public:
89   Lilypond_skip (Lilypond_column* lilypond_column_l, Rational skip_mom);
90
91   Duration duration ();
92   virtual Rational duration_mom ();
93   virtual String str ();
94
95 private:
96   Rational mom_;
97 };
98
99
100 class Lilypond_tempo : public Lilypond_item 
101 {
102 public:
103   Lilypond_tempo (int useconds_per_4_i);
104
105   int get_tempo_i (Rational rational);
106   virtual String str ();
107   int useconds_per_4_i ();
108
109 private:
110   int useconds_per_4_i_;
111   Rational seconds_per_1_mom_;
112 };
113
114 class Lilypond_text : public Lilypond_item 
115 {
116 public:
117   enum Type { 
118     TEXT = 1, COPYRIGHT, TRACK_NAME, INSTRUMENT_NAME, LYRIC, 
119     MARKER, CUE_POINT
120   };
121   Lilypond_text (Lilypond_text::Type type,  String str);
122   virtual String str ();
123
124   //private:
125   Type type_;
126   String text_str_;
127 };
128
129 #endif // LILYPOND_ITEM_HH
130