X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fperformance.cc;h=6bdec3790c7867abc63afdee27e40a36f142fac8;hb=8536db51578c1d3ba3da834e5a308c2790dd4f87;hp=c2b822e7655dbca8f8666a2dde79dc76af2a952a;hpb=163225c0cbb1055dfd3614615350ab9f3aaba74c;p=lilypond.git diff --git a/lily/performance.cc b/lily/performance.cc index c2b822e765..6bdec3790c 100644 --- a/lily/performance.cc +++ b/lily/performance.cc @@ -3,7 +3,7 @@ source file of the GNU LilyPond music typesetter - (c) 1997--2004 Jan Nieuwenhuizen + (c) 1997--2005 Jan Nieuwenhuizen */ #include "performance.hh" @@ -26,17 +26,16 @@ Performance::Performance () { midi_ = 0; - audio_elem_p_list_ = 0; + audio_element_list_ = 0; } - Performance::~Performance () { - delete audio_elem_p_list_; + delete audio_element_list_; } void -Performance::output (Midi_stream& midi_stream) +Performance::output (Midi_stream &midi_stream) { int tracks_i = audio_staffs_.size () + 1; @@ -45,43 +44,43 @@ Performance::output (Midi_stream& midi_stream) midi_stream << Midi_header (1, tracks_i, clocks_per_4_i); output_header_track (midi_stream); - progress_indication ("\n"); - progress_indication (_ ("Track...") + " "); + message (_ ("Track...") + " "); int channel = 0; for (int i = 0; i < audio_staffs_.size (); i++) { Audio_staff *s = audio_staffs_[i]; - if (verbose_global_b) - progress_indication ("[" + to_string (i)) ; + if (be_verbose_global) + progress_indication ("[" + to_string (i)); /* MIDI players tend to ignore instrument settings on channel 10, the percussion channel by default. - */ + */ if (channel % 16 == 9) - channel++; - + channel++; /* Huh? Why does each staff also have a separate channel? We should map channels to voices, not staves. --hwn. - */ + */ if (s->channel_ < 0) { s->channel_ = channel % 16; if (channel > 15) - warning ("MIDI channel wrapped around. Remapping modulo 16."); + { + warning (_ ("MIDI channel wrapped around")); + warning (_ ("remapping modulo 16")); + } } - + s->output (midi_stream, channel++); - if (verbose_global_b) + if (be_verbose_global) progress_indication ("]"); } } - void -Performance::output_header_track (Midi_stream& midi_stream) +Performance::output_header_track (Midi_stream &midi_stream) { Midi_track midi_track; @@ -96,7 +95,7 @@ Performance::output_header_track (Midi_stream& midi_stream) /* This seems silly, but in fact the audio elements should be generated elsewhere: not midi-specific. - */ + */ Audio_text creator_a (Audio_text::TEXT, str); Midi_text creator (&creator_a); midi_track.add (Moment (0), &creator); @@ -104,22 +103,21 @@ Performance::output_header_track (Midi_stream& midi_stream) /* Better not translate this */ str = "Generated automatically by: "; str += id_string; - + Audio_text generate_a (Audio_text::TEXT, str); Midi_text generate (&generate_a); midi_track.add (Moment (0), &generate); - + str = _ ("at "); time_t t (time (0)); str += ctime (&t); str = str.left_string (str.length () - 1); str = String_convert::pad_to (str, 60); - + Audio_text at_a (Audio_text::TEXT, str); Midi_text at (&at_a); midi_track.add (Moment (0), &at); - // TODO: // str = _f ("from musical definition: %s", origin_string_); @@ -144,28 +142,29 @@ Performance::output_header_track (Midi_stream& midi_stream) void Performance::add_element (Audio_element *p) { - if (Audio_staff*s=dynamic_cast (p)) + if (Audio_staff *s = dynamic_cast (p)) { audio_staffs_.push (s); } - audio_elem_p_list_ = new Killing_cons (p, audio_elem_p_list_); + audio_element_list_ = new Killing_cons (p, audio_element_list_); } -SCM -Performance::process (String out) + +void +Performance::write_output (String out) { if (out == "-") out = "lelie.midi"; - + /* Maybe a bit crude, but we had this before */ File_name file_name (out); file_name.ext_ = "midi"; out = file_name.to_string (); - + Midi_stream midi_stream (out); - progress_indication (_f ("MIDI output to `%s'...", out)); + message (_f ("MIDI output to `%s'...", out)); output (midi_stream); progress_indication ("\n"); - return SCM_UNDEFINED; } +