lilypond-0.1.57
[lilypond.git] / m2m / midi-score.cc
blob541cb8f0f38c44351fc42462f10fa0360fdeaf89
1 //
2 // midi-score.cc -- implement Midi_score
3 //
4 // copyright 1997 Jan Nieuwenhuizen <jan@digicash.com>
6 #include "m2m.hh"
8 Midi_score::Midi_score( int format_i, int tracks_i, int tempo_i )
10 format_i_ = format_i;
11 tracks_i_ = tracks_i;
12 tempo_i_ = tempo_i;
15 Midi_score::~Midi_score()
19 void
20 Midi_score::add_track( Midi_track* midi_track_p )
22 midi_track_p_list_.bottom().add( midi_track_p );
25 int
26 Midi_score::output_mudela( String filename_str )
28 mtor << "Lily output to " << filename_str << " ..." << endl;
30 Lily_stream lily_stream( filename_str );
31 for ( PCursor<Midi_track*> midi_track_l_pcur( midi_track_p_list_.top() ); midi_track_l_pcur.ok(); midi_track_l_pcur++ ) {
32 midi_track_l_pcur->output_mudela( lily_stream );
33 lily_stream.newline();
36 lily_stream << "score {";
37 lily_stream.newline();
39 for ( PCursor<Midi_track*> midi_track_l_pcur( midi_track_p_list_.top() ); midi_track_l_pcur.ok(); midi_track_l_pcur++ ) {
40 lily_stream << "\tstaff { melodic music { ";
41 lily_stream << midi_track_l_pcur->name_str();
42 lily_stream << " } }";
43 lily_stream.newline();
46 lily_stream.indent();
47 lily_stream << "commands {";
48 lily_stream.indent();
49 midi_parser_l_g->midi_time_p_->output_mudela( lily_stream, true );
50 lily_stream.tnedni();
51 lily_stream << "}";
52 lily_stream.newline();
53 lily_stream << "midi {";
54 lily_stream.indent();
55 midi_parser_l_g->midi_tempo_p_->output_mudela( lily_stream, true );
56 lily_stream.tnedni();
57 lily_stream << "}";
58 lily_stream.tnedni();
60 lily_stream << "}";
61 lily_stream.newline();
63 return 0;
66 void
67 Midi_score::process()
69 for ( PCursor<Midi_track*> i( midi_track_p_list_.top() ); i.ok(); i++ )
70 i->process();