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 "translator.hh"
13 #include "performance.hh"
14 #include "assoc-iter.hh"
15 #include "score-performer.hh"
18 // classes, alphasorted
22 // routines, alphasorted
28 set_tempo (Moment (1, 4), 60);
36 Midi_def::duration_to_seconds_f (Moment mom)
41 return Moment (whole_in_seconds_mom_) * mom;
46 Midi_def::get_tempo_i (Moment one_beat_mom)
48 Moment wholes_per_min = Moment(60) /Moment(whole_in_seconds_mom_);
49 int beats_per_min = wholes_per_min / one_beat_mom;
50 return int (beats_per_min);
54 Midi_def::set_tempo (Moment one_beat_mom, int beats_per_minute_i)
56 Moment beats_per_second = Moment (beats_per_minute_i) / Moment (60);
57 whole_in_seconds_mom_ = 1/(beats_per_second * one_beat_mom);
61 Midi_def::print() const
65 DOUT << "4/min: " << Real (60) / (whole_in_seconds_mom_ * 4);
66 DOUT << "out: " << outfile_str_;
72 IMPLEMENT_IS_TYPE_B1(Midi_def, Music_output_def);