5 #include "proto.hh" // ugh, these all for midi-main.hh
8 #include "sourcefile.hh"
10 #include "midi-main.hh" // *tors
12 #include "my-midi-lexer.hh"
13 #include "my-midi-parser.hh"
15 #include "duration.hh"
16 #include "midi-event.hh"
17 #include "midi-track.hh"
18 #include "midi-score.hh"
35 Midi_event
* midi_event_p
; // Voice_element* ?
36 Midi_score
* midi_score_p
; // Input_score* ?
37 Midi_track
* midi_track_p
; // Input_music* ?
41 %token SYSEX_EVENT1 SYSEX_EVENT2
43 %token SEQUENCE TEXT COPYRIGHT TRACK_NAME INSTRUMENT_NAME LYRIC MARKER CUE_POINT
44 %token END_OF_TRACK TEMPO SMPTE_OFFSET TIME KEY SSME
46 %token
<i
> INT8 INT16 INT32 INT7_8UNSET INT7_8SET VARINT
47 %token
<i
> RUNNING_STATUS DATA_ENTRY ALL_NOTES_OFF
48 %token
<i
> NOTE_OFF NOTE_ON
49 %token
<i
> POLYPHONIC_AFTERTOUCH CONTROLMODE_CHANGE PROGRAM_CHANGE
50 %token
<i
> CHANNEL_AFTERTOUCH PITCHWHEEL_RANGE
54 %type
<midi_score_p
> header midi_score
55 %type
<midi_track_p
> track
56 %type
<midi_event_p
> event
57 %type
<midi_event_p
> the_event meta_event the_meta_event text_event midi_event sysex_event
58 %type
<midi_event_p
> running_status data_entry all_notes_off
59 %type
<midi_event_p
> note_off note_on
60 %type
<midi_event_p
> polyphonic_aftertouch controlmode_change program_change
61 %type
<midi_event_p
> channel_aftertouch pitchwheel_range
67 midi_parser_l_g
->add_score
( $2 );
77 midi_parser_l_g
->reset
();
82 HEADER INT32 INT16 INT16 INT16
{
83 $$
= new Midi_score
( $3, $4, $5 );
84 midi_parser_l_g
->set_division_4
( $5 );
90 $$
= new Midi_track
( track_i
++ );
93 $$
->add_event
( midi_parser_l_g
->mom
(), $2 );
100 if
( $2 && $2->mudela_str
().length_i
() )
101 dtor
<< $2->mudela_str
() << " " << flush
;
107 midi_parser_l_g
->forward
( $1 );
121 META_EVENT the_meta_event
{
125 META_EVENT INT8 INT8 INT8
{
141 | TEMPO INT8 INT8 INT8
{
142 $$
= new Midi_tempo
( ( $2 << 16 ) + ( $3 << 8 ) + $4 );
143 dtor
<< $$
->mudela_str
() << endl
; // ?? waai not at event:
144 midi_parser_l_g
->set_tempo
( ( $2 << 16 ) + ( $3 << 8 ) + $4 );
146 | SMPTE_OFFSET INT8 INT8 INT8 INT8 INT8
{
149 | TIME INT8 INT8 INT8 INT8
{
150 $$
= new Midi_time
( $2, $3, $4, $5 );
151 dtor
<< $$
->mudela_str
() << endl
; // ?? waai not at event:
152 midi_parser_l_g
->set_time
( $2, $3, $4, $5 );
155 $$
= new Midi_key
( $2, $3 );
156 midi_parser_l_g
->set_key
( $2, $3 );
166 dtor
<< "\n% Text: ";
169 dtor
<< "\n% Copyright: ";
172 dtor
<< "\n% Track name: ";
175 dtor
<< "\n% Instrument name: ";
178 dtor
<< "\n% Lyric: ";
181 dtor
<< "\n% Marker: ";
184 dtor
<< "\n% Cue point: ";
199 | polyphonic_aftertouch
{
201 | controlmode_change
{
205 | channel_aftertouch
{
212 RUNNING_STATUS INT8
{ //INT8 {
224 ALL_NOTES_OFF INT8 INT8
{
233 $$
= midi_parser_l_g
->note_end_midi_event_p
( $1 & ~
0x80, $2, $3 );
242 midi_parser_l_g
->note_begin
( $1 & ~
0x90, $2, $3 );
246 polyphonic_aftertouch:
247 POLYPHONIC_AFTERTOUCH INT8 INT8
{
253 CONTROLMODE_CHANGE INT8 INT8
{
259 PROGRAM_CHANGE INT8
{
265 CHANNEL_AFTERTOUCH INT8 INT8
{
271 PITCHWHEEL_RANGE INT8 INT8
{
280 | SYSEX_EVENT2 DATA
{ // INT8 ?