lilypond-0.1.16
[lilypond.git] / src / midi-output.cc
blobaf298f74dd6236db37a0a057a9e3cfd82e3a5e4f
1 /*
2 midi-output.cc -- implement Midi_output
4 source file of the LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>, Jan Nieuwehuizen <jan@digicash.com>
7 */
9 #include "plist.hh"
10 #include "debug.hh"
11 #include "score.hh"
12 #include "staff.hh"
13 #include "midi-stream.hh"
14 #include "midi-def.hh"
15 #include "midi-output.hh"
16 #include "midi-walker.hh"
17 #include "midi-item.hh"
18 #include "staff-column.hh"
19 #include "musicalrequest.hh"
22 Midi_output:: Midi_output(Score* score_l, Midi_def* midi_l )
24 midi_l_ = midi_l;
26 Midi_stream midi_stream(midi_l->outfile_str_,
27 score_l->staffs_.size(),
28 384 );
29 // oeps, not tempo, but clocks per 4 (384 convention)
30 // must set tempo in tempo request
31 // midi_l->get_tempo_i(Moment(1, 4)));
33 midi_stream_l_ = &midi_stream;
34 int track_i=0;
36 for (iter_top(score_l->staffs_,i); i.ok(); i++) {
37 do_staff(i, track_i++);
42 void
43 Midi_output::do_staff(Staff*st_l,int track_i)
45 Midi_track midi_track( track_i );
46 Midi_tempo midi_tempo( midi_l_->get_tempo_i( Moment( 1, 4 ) ) );
47 midi_track.add( Moment( 0.0 ), &midi_tempo );
48 for (Midi_walker w (st_l, &midi_track); w.ok(); w++)
49 w.process_requests();
51 *midi_stream_l_ << midi_track;