]> git.donarmstrong.com Git - lilypond.git/blob - mi2mu/include/midi-event.hh
df08ce5fed39bd00f9339e100bd259df01983b4c
[lilypond.git] / mi2mu / include / midi-event.hh
1 //
2 // midi-event.hh -- declare midi_event
3 //
4 // copyright 1997 Jan Nieuwenhuizen <jan@digicash.com>
5
6 #ifndef MIDI_EVENT_HH
7 #define MIDI_EVENT_HH
8
9
10 // should these:
11 // * be Midi_items
12 // * be Voice_elements/requests
13 // * get a name-change
14 // ?
15
16 /// (midi_event)
17 class Midi_event {
18 public:
19         Midi_event();
20         
21         virtual String mudela_str( bool command_mode_bo ) = 0;
22         void output_mudela( Lily_stream& lily_stream_r, bool command_mode_bo );
23         virtual Moment mom();
24 };
25
26 class Midi_key : public Midi_event {
27 public:
28         Midi_key( int accidentals_i, int minor_i );
29
30         String notename_str( int pitch_i );
31         virtual String mudela_str( bool command_mode_bo );
32
33 private:
34         int accidentals_i_;
35         int minor_i_;
36         int key_i_;
37 };
38
39 class Midi_note : public Midi_event {
40 public:
41         int const c0_pitch_i_c_ = 60;
42
43         Midi_note( String name_str, Duration dur );
44         virtual Moment mom();
45         virtual String mudela_str( bool command_mode_bo );
46         
47 private:
48         bool const simple_plet_bo_ = false;
49         Duration dur_;
50         String name_str_;
51 };
52
53 class Midi_tempo : public Midi_event {
54 public:
55         Midi_tempo( int useconds_per_4_i );
56
57         int get_tempo_i( Moment moment );
58         virtual String mudela_str( bool command_mode_bo );
59         int useconds_per_4_i();
60
61 private:
62         int useconds_per_4_i_;
63         Real seconds_per_1_f_;
64 };
65
66 class Midi_text : public Midi_event {
67 public:
68         enum Type { 
69                 TEXT = 1, COPYRIGHT, TRACK_NAME, INSTRUMENT_NAME, LYRIC, 
70                 MARKER, CUE_POINT
71         };
72         Midi_text( Midi_text::Type type,  String str );
73         virtual String mudela_str( bool command_mode_bo );
74 private:
75         Type type_;
76         String text_str_;
77 };
78
79 class Midi_time : public Midi_event {
80 public:
81         Midi_time( int num_i, int den_i, int division_4_i, int count_32_i );
82
83         Duration i2_dur( int time_i, int division_1_i );
84         int clocks_1_i();
85         int den_i();
86         int num_i();
87         virtual String mudela_str( bool command_mode_bo );
88         Moment bar_mom();
89
90 private:
91         Real sync_f_;
92         Duration sync_dur_;
93         int clocks_1_i_;
94         int num_i_;
95         int den_i_;
96 };
97
98 #endif // MIDI_EVENT_HH
99