2 midi-def.cc -- implement Midi_def
4 source file of the GNU LilyPond music typesetter
6 (c) 1997 Jan Nieuwenhuizen <jan@digicash.com>
11 #include "midi-def.hh"
12 #include "input-translator.hh"
13 #include "performer-group-performer.hh"
14 #include "assoc-iter.hh"
18 // classes, alphasorted
22 // routines, alphasorted
27 int Midi_def::den_i_s = 4;
28 int Midi_def::num_i_s = 4;
35 set_tempo( Moment( 1, 4 ), 60 );
38 Midi_def::Midi_def( Midi_def const& s )
40 whole_seconds_f_ = s.whole_seconds_f_;
41 itrans_p_ = s.itrans_p_ ? new Input_translator( *s.itrans_p_ ) : 0;
42 outfile_str_ = s.outfile_str_;
51 Midi_def::duration_to_seconds_f( Moment mom )
56 return Moment( whole_seconds_f_ ) * mom;
60 Midi_def::get_global_translator_p() const
62 return itrans_p_->get_group_performer_p()->global_l();
66 Midi_def::get_tempo_i( Moment moment )
68 return Moment( whole_seconds_f_ ) * Moment( 60 ) * moment;
72 Midi_def::print() const
76 mtor << "4/min: " << Real( 60 ) / ( whole_seconds_f_ * 4 );
77 mtor << "out: " << outfile_str_;
83 Midi_def::set( Input_translator* itrans_p )
90 Midi_def::set_tempo( Moment moment, int count_per_minute_i )
92 whole_seconds_f_ = Moment( count_per_minute_i ) / Moment( 60 ) / moment;