lilypond-1.0.19
[lilypond.git] / hdr / midiitem.hh
blobf4b14aa5ef14cda2c562bc3d447abd94b887312c
1 //
2 // midiitem.hh -- part of LilyPond
3 //
4 // copyright 1997 Jan Nieuwenhuizen <jan@digicash.com>
6 #ifndef MIDI_ITEM_HH
7 #define MIDI_ITEM_HH
8 #include "string.hh"
9 #include "proto.hh"
11 struct Midi_item {
12 /* *************** */
13 static String i2varint_str( int i );
14 virtual void output_midi( Midi_stream& midi_stream_r );
15 virtual String str() = 0;
18 struct Midi_note : public Midi_item {
19 /* *************** */
20 int const c0_pitch_i_c_ = 60;
21 Byte dynamic_byte_;
23 /**
24 Generate a note-event on a channel pitch.
26 @param #melreq_l# is the pitch.
28 Midi_note( Melodic_req* melreq_l, int channel_i, bool on_b );
30 virtual String str();
32 int channel_i_;
33 int on_b_;
34 int pitch_i_;
37 struct Midi_duration : public Midi_item {
38 /* *************** */
39 Midi_duration( Real seconds_f );
41 virtual String str();
43 Real seconds_f_;
46 struct Midi_chunk : Midi_item {
47 /* *************** */
48 Midi_chunk();
50 void add( String str );
51 void set( String header_str, String data_str, String footer_str );
52 virtual String str();
54 private:
55 String data_str_;
56 String footer_str_;
57 String header_str_;
60 struct Midi_header : Midi_chunk {
61 /* *************** */
62 Midi_header( int format_i, int tracks_i, int clocks_per_4_i );
65 struct Midi_tempo : Midi_item {
66 /* *************** */
67 Midi_tempo( int tempo_i );
69 virtual String str();
71 int tempo_i_;
74 struct Midi_track : Midi_chunk {
75 /* *************** */
76 int number_i_;
77 Midi_track( int number_i );
79 void add( int delta_time_i, String event );
80 // void add( Moment delta_time_moment, Midi_item& mitem_r );
81 void add( Moment delta_time_moment, Midi_item* mitem_l );
84 #endif // MIDI_ITEM_HH //