2 // midi-score.cc -- implement Midi_score
4 // copyright 1997 Jan Nieuwenhuizen <jan@digicash.com>
8 Midi_score::Midi_score( int format_i
, int tracks_i
, int tempo_i
)
15 Midi_score::~Midi_score()
20 Midi_score::add_track( Midi_track
* midi_track_p
)
22 midi_track_p_list_
.bottom().add( midi_track_p
);
26 Midi_score::output_mudela( String filename_str
)
28 tor( NORMAL_ver
) << "Lily output to " << filename_str
<< " ..." << endl
;
30 // ugh, ugly midi type 1 fix
31 if ( ( midi_track_p_list_
.size() == 1 ) && !midi_track_p_list_
.top()->number_i_
)
32 midi_track_p_list_
.top()->number_i_
= 1;
35 Lily_stream
lily_stream( filename_str
);
36 for ( PCursor
<Midi_track
*> i( midi_track_p_list_
.top() ); i
.ok(); i
++ ) {
37 tor( NORMAL_ver
) << "track " << track_i
++ << ": " << flush
;
38 i
->output_mudela( lily_stream
);
40 tor( NORMAL_ver
) << endl
;
43 lily_stream
<< "\\score{\n";
44 lily_stream
<< " < \\multi 3;\n";
45 for ( PCursor
<Midi_track
*> i( midi_track_p_list_
.top() ); i
.ok(); i
++ ) {
46 if ( ( midi_track_p_list_
.size() != 1 )
47 && ( i
== midi_track_p_list_
.top() ) )
49 lily_stream
<< "\\melodic{ ";
50 lily_stream
<< "\\$" << i
->id_str();
51 lily_stream
<< " }\n";
55 lily_stream
<< "\\paper{";
56 lily_stream
<< "unitspace = 20.0\\mm;";
59 lily_stream
<< "\\midi{";
60 // not use silly 0 track
61 midi_track_p_list_
.bottom()->midi_tempo_p_
->output_mudela( lily_stream
, true );
73 for ( PCursor
<Midi_track
*> i( midi_track_p_list_
.top() ); i
.ok(); i
++ ) {
74 tor( NORMAL_ver
) << "track " << track_i
++ << ": " << flush
;
76 tor( NORMAL_ver
) << endl
;