17 Midi_event
* midi_event_p
; // Voice_element* ?
18 Midi_score
* midi_score_p
; // Input_score* ?
19 Midi_track
* midi_track_p
; // Input_music* ?
23 %token SYSEX_EVENT1 SYSEX_EVENT2
26 %token END_OF_TRACK TEMPO SMPTE_OFFSET TIME KEY SSME
28 %token
<i
> INT8 INT16 INT32 INT7_8UNSET INT7_8SET VARINT
29 %token
<i
> RUNNING_STATUS DATA_ENTRY ALL_NOTES_OFF
30 %token
<i
> NOTE_OFF NOTE_ON
31 %token
<i
> POLYPHONIC_AFTERTOUCH CONTROLMODE_CHANGE PROGRAM_CHANGE
32 %token
<i
> CHANNEL_AFTERTOUCH PITCHWHEEL_RANGE
33 %token
<i
> YYTEXT YYCOPYRIGHT YYTRACK_NAME YYINSTRUMENT_NAME YYLYRIC YYMARKER YYCUE_POINT
37 %type
<midi_score_p
> header midi_score
38 %type
<midi_track_p
> track
39 %type
<midi_event_p
> event
40 %type
<midi_event_p
> the_event meta_event the_meta_event text_event midi_event sysex_event
41 %type
<midi_event_p
> running_status data_entry all_notes_off
42 %type
<midi_event_p
> note_off note_on
43 %type
<midi_event_p
> polyphonic_aftertouch controlmode_change program_change
44 %type
<midi_event_p
> channel_aftertouch pitchwheel_range
50 midi_parser_l_g
->add_score
( $2 );
59 if
( midi_parser_l_g
->copyright_str_.length_i
() )
60 $2->copyright_str_
= midi_parser_l_g
->copyright_str_
;
61 if
( midi_parser_l_g
->track_name_str_.length_i
() )
62 $2->name_str_
= midi_parser_l_g
->track_name_str_
;
63 if
( midi_parser_l_g
->instrument_str_.length_i
() )
64 $2->instrument_str_
= midi_parser_l_g
->instrument_str_
;
65 midi_parser_l_g
->reset
();
70 HEADER INT32 INT16 INT16 INT16
{
71 $$
= new Midi_score
( $3, $4, $5 );
72 midi_parser_l_g
->set_division_4
( $5 );
78 $$
= new Midi_track
( midi_parser_l_g
->track_i_
++,
79 // silly, cause not set yet!
80 midi_parser_l_g
->copyright_str_
,
81 midi_parser_l_g
->track_name_str_
,
82 midi_parser_l_g
->instrument_str_
);
85 $$
->add_event
( midi_parser_l_g
->mom
(), $2 );
93 String str
= $2->mudela_str
( false
);
95 dtor
<< str
<< " " << flush
;
102 midi_parser_l_g
->forward
( $1 );
116 META_EVENT the_meta_event
{
120 META_EVENT INT8 INT8 INT8
{
129 Midi_text
::Type type
= (Midi_text
::Type
)$1;
133 case Midi_text
::COPYRIGHT
:
134 midi_parser_l_g
->copyright_str_
= *$2;
136 case Midi_text
::TRACK_NAME
:
137 midi_parser_l_g
->track_name_str_
= *$2;
138 while
( midi_parser_l_g
->track_name_str_.index_i
( ' ' ) != -1 )
139 *(midi_parser_l_g
->track_name_str_.ch_l
() + midi_parser_l_g
->track_name_str_.index_i
( ' ' ) ) = '_';
141 case Midi_text
::INSTRUMENT_NAME
:
142 midi_parser_l_g
->instrument_str_
= *$2;
145 $$
= new Midi_text
( type
, *$2 );
154 | TEMPO INT8 INT8 INT8
{
155 $$
= new Midi_tempo
( ( $2 << 16 ) + ( $3 << 8 ) + $4 );
156 dtor
<< $$
->mudela_str
( false
) << endl
;
157 midi_parser_l_g
->set_tempo
( ( $2 << 16 ) + ( $3 << 8 ) + $4 );
159 | SMPTE_OFFSET INT8 INT8 INT8 INT8 INT8
{
162 | TIME INT8 INT8 INT8 INT8
{
163 $$
= new Midi_time
( $2, $3, $4, $5 );
164 dtor
<< $$
->mudela_str
( true
) << endl
;
165 midi_parser_l_g
->set_time
( $2, $3, $4, $5 );
168 $$
= new Midi_key
( $2, $3 );
169 midi_parser_l_g
->set_key
( $2, $3 );
172 $$
= new Midi_text
( (Midi_text
::Type
)0, *$2 );
179 dtor
<< "\n% Text: ";
182 dtor
<< "\n% Copyright: ";
185 dtor
<< "\n% Track name: ";
187 | YYINSTRUMENT_NAME
{
188 dtor
<< "\n% Instrument name: ";
191 dtor
<< "\n% Lyric: ";
194 dtor
<< "\n% Marker: ";
197 dtor
<< "\n% Cue point: ";
212 | polyphonic_aftertouch
{
214 | controlmode_change
{
218 | channel_aftertouch
{
225 RUNNING_STATUS INT8
{ //INT8 {
237 ALL_NOTES_OFF INT8 INT8
{
246 $$
= midi_parser_l_g
->note_end_midi_event_p
( $1 & ~
0x80, $2, $3 );
255 midi_parser_l_g
->note_begin
( $1 & ~
0x90, $2, $3 );
259 polyphonic_aftertouch:
260 POLYPHONIC_AFTERTOUCH INT8 INT8
{
266 CONTROLMODE_CHANGE INT8 INT8
{
272 PROGRAM_CHANGE INT8
{
278 CHANNEL_AFTERTOUCH INT8 INT8
{
284 PITCHWHEEL_RANGE INT8 INT8
{
293 | SYSEX_EVENT2 DATA
{ // INT8 ?