]> git.donarmstrong.com Git - lilypond.git/blob - hdr/midiitem.hh
release: 0.0.34
[lilypond.git] / hdr / midiitem.hh
1 //
2 //  midiitem.hh -- part of LilyPond
3 //
4 //  copyright 1997 Jan Nieuwenhuizen <jan@digicash.com>
5
6 #ifndef MIDI_ITEM_HH
7 #define MIDI_ITEM_HH
8 #include "string.hh"
9 #include "proto.hh"
10
11 struct Midi_item {
12     /* *************** */
13     static String int2varlength_str( int i );
14     virtual void output_midi( Midi_stream& midi_stream_r );
15     virtual String str() = 0;
16 };
17
18 struct Midi_note : public Midi_item {
19     /* *************** */
20     int const c0_pitch_i_c_ = 60;
21     Byte dynamic_byte_;
22
23     /**
24       Generate a note-event on a channel pitch.
25
26       @param #melreq_l# the pitch. If null, then output a silent C
27       #on_b# turn on?
28      */
29     Midi_note( Melodic_req* melreq_l, int channel_i, bool on_b );
30         
31     virtual String str();
32
33     int channel_i_;
34     int on_b_;
35     int pitch_i_;
36 };
37
38 struct Midi_duration : public Midi_item {
39     /* *************** */
40     Midi_duration( Real seconds_f );
41
42     virtual String str();
43
44     Real seconds_f_;
45 };
46
47 struct Midi_chunk : Midi_item {
48     /* *************** */
49     Midi_chunk();
50
51     void add( String str );
52     void set( String header_str, String data_str, String footer_str );
53     virtual String str();
54
55 private:
56     String data_str_;
57     String footer_str_;
58     String header_str_;
59 };
60
61 struct Midi_header : Midi_chunk {
62     /* *************** */
63     Midi_header( int format_i, int tracks_i, int tempo_i );
64 };
65
66 struct Midi_track : Midi_chunk {
67     /* *************** */
68     int number_i_;
69     Midi_track( int number_i );
70
71     void add( int delta_time_i, String event );
72 //      void add( Moment delta_time_moment, Midi_item& mitem_r );
73     void add( Moment delta_time_moment, Midi_item* mitem_l );
74 };
75
76 #endif // MIDI_ITEM_HH //
77