lilypond-0.1.37
[lilypond.git] / src / midi-score.cc
blob02905b8718870274de247480e05c55cc96d276f3
1 //
2 // midi-score.cc -- implement Midi_score
3 //
4 // copyright 1997 Jan Nieuwenhuizen <jan@digicash.com>
6 #include "proto.hh"
7 #include "plist.hh"
8 #include "string.hh"
9 #include "moment.hh"
10 #include "duration.hh"
11 #include "source-file.hh"
12 #include "source.hh"
13 #include "midi-main.hh" // *tors
14 #include "midi-event.hh"
15 #include "lily-stream.hh"
16 #include "track-column.hh"
17 #include "midi-track.hh"
18 #include "midi-score.hh"
20 Midi_score::Midi_score( int format_i, int tracks_i, int tempo_i )
22 format_i_ = format_i;
23 tracks_i_ = tracks_i;
24 tempo_i_ = tempo_i;
27 Midi_score::~Midi_score()
31 void
32 Midi_score::add_track( Midi_track* midi_track_p )
34 midi_track_p_list_.bottom().add( midi_track_p );
37 int
38 Midi_score::output_mudela( String filename_str )
40 mtor << "Lily output to " << filename_str << " ..." << endl;
42 Lily_stream lily_stream( filename_str );
43 for ( PCursor<Midi_track*> midi_track_l_pcur( midi_track_p_list_.top() ); midi_track_l_pcur.ok(); midi_track_l_pcur++ ) {
44 midi_track_l_pcur->output_mudela( lily_stream );
45 lily_stream << "\n";
48 lily_stream << "score {\n";
50 for ( PCursor<Midi_track*> midi_track_l_pcur( midi_track_p_list_.top() ); midi_track_l_pcur.ok(); midi_track_l_pcur++ ) {
51 lily_stream << "\tstaff { melodic music { ";
52 lily_stream << midi_track_l_pcur->name_str();
53 lily_stream << " } }\n";
56 lily_stream << "\tcommands { meter { 4*4 } }\n";
57 lily_stream << "\tmidi { tempo 4:60 }\n";
59 lily_stream << "}\n";
61 return 0;