]> git.donarmstrong.com Git - lilypond.git/blob - mi2mu/include/midi-event.hh
partial: 0.1.8.jcn
[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; // huh?
42         int const c0_pitch_i_c_ = 48;
43
44         Midi_note( String name_str, Duration dur );
45         virtual Moment mom();
46         virtual String mudela_str( bool command_mode_bo );
47         
48 private:
49         static bool const simple_plet_b_s = false;
50         Duration dur_;
51         String name_str_;
52 };
53
54 class Midi_tempo : public Midi_event {
55 public:
56         Midi_tempo( int useconds_per_4_i );
57
58         int get_tempo_i( Moment moment );
59         virtual String mudela_str( bool command_mode_bo );
60         int useconds_per_4_i();
61
62 private:
63         int useconds_per_4_i_;
64         Real seconds_per_1_f_;
65 };
66
67 class Midi_text : public Midi_event {
68 public:
69         enum Type { 
70                 TEXT = 1, COPYRIGHT, TRACK_NAME, INSTRUMENT_NAME, LYRIC, 
71                 MARKER, CUE_POINT
72         };
73         Midi_text( Midi_text::Type type,  String str );
74         virtual String mudela_str( bool command_mode_bo );
75 private:
76         Type type_;
77         String text_str_;
78 };
79
80 class Midi_time : public Midi_event {
81 public:
82         Midi_time( int num_i, int den_i, int division_4_i, int count_32_i );
83
84         Duration i2_dur( int time_i, int division_1_i );
85         int clocks_1_i();
86         int den_i();
87         int num_i();
88         virtual String mudela_str( bool command_mode_bo );
89         Moment bar_mom();
90
91 private:
92         Real sync_f_;
93         Duration sync_dur_;
94         int clocks_1_i_;
95         int num_i_;
96         int den_i_;
97 };
98
99 #endif // MIDI_EVENT_HH
100