]> git.donarmstrong.com Git - lilypond.git/blob - mi2mu/include/midi-event.hh
partial: 0.0.40.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;
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
60 private:
61         int useconds_per_4_i_;
62         Real seconds_per_1_f_;
63 };
64
65 class Midi_text : public Midi_event {
66 public:
67         enum Type { 
68                 TEXT = 1, COPYRIGHT, TRACK_NAME, INSTRUMENT_NAME, LYRIC, 
69                 MARKER, CUE_POINT
70         };
71         Midi_text( Midi_text::Type type,  String str );
72         virtual String mudela_str( bool command_mode_bo );
73 private:
74         Type type_;
75         String text_str_;
76 };
77
78 class Midi_time : public Midi_event {
79 public:
80         Midi_time( int num_i, int den_i, int division_4_i, int count_32_i );
81
82         Duration i2_dur( int time_i, int division_1_i );
83         int clocks_1_i();
84         virtual String mudela_str( bool command_mode_bo );
85         Moment bar_mom();
86
87 private:
88         Real sync_f_;
89         Duration sync_dur_;
90         int clocks_1_i_;
91         int num_i_;
92         int den_i_;
93 };
94
95 #endif // MIDI_EVENT_HH
96