X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fperformance.cc;h=88ba2c8b8ee6a4958f74111e80f4092f8ecdbd12;hb=32b02b2642bd132a548afc163c28667aff074829;hp=c2b822e7655dbca8f8666a2dde79dc76af2a952a;hpb=163225c0cbb1055dfd3614615350ab9f3aaba74c;p=lilypond.git diff --git a/lily/performance.cc b/lily/performance.cc index c2b822e765..88ba2c8b8e 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" @@ -29,14 +29,13 @@ Performance::Performance () audio_elem_p_list_ = 0; } - Performance::~Performance () { delete audio_elem_p_list_; } void -Performance::output (Midi_stream& midi_stream) +Performance::output (Midi_stream &midi_stream) { int tracks_i = audio_staffs_.size () + 1; @@ -51,37 +50,35 @@ Performance::output (Midi_stream& midi_stream) 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."); } - + 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 +93,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 +101,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,7 +140,7 @@ 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); } @@ -156,12 +152,12 @@ Performance::process (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));