From 78bb33faf9c196faf99ce20bb62ac577e9b30209 Mon Sep 17 00:00:00 2001 From: fred Date: Sun, 24 Mar 2002 20:05:53 +0000 Subject: [PATCH] lilypond-0.1.46 --- .dstreamrc | 2 +- init/performer.ly | 2 +- lib/duration-convert.cc | 35 ------------------- lib/include/duration-convert.hh | 12 ------- lib/include/duration.hh | 3 -- lily/include/midi-walker.hh | 2 +- lily/include/staff-performer.hh | 12 ++++--- lily/include/staff-side.hh | 21 ++++++------ lily/include/text-def.hh | 9 +++-- lily/include/text-item.hh | 23 ++++++++----- lily/midi-stream.cc | 43 +++++++++++++---------- lily/midi-walker.cc | 16 ++++----- lily/spring-spacer.cc | 4 ++- lily/staff-performer.cc | 61 +++++++++++++++++++++++---------- lily/staff-side.cc | 7 ++-- lily/template8.cc | 3 +- lily/text-item.cc | 43 +++++++++++++++++------ mutopia/standchen.ly | 13 ++++--- 18 files changed, 158 insertions(+), 153 deletions(-) diff --git a/.dstreamrc b/.dstreamrc index 03a97fa3a4..d92dd4797c 100644 --- a/.dstreamrc +++ b/.dstreamrc @@ -45,7 +45,7 @@ Lookup 0 Line_spacer 0 Melodic_req 0 Midi_def 0 -Midistrings 1 +Midistrings 0 Mixed_qp 0 Music 0 Music_iterator 0 diff --git a/init/performer.ly b/init/performer.ly index 87ce9ca7d8..90b3688412 100644 --- a/init/performer.ly +++ b/init/performer.ly @@ -47,7 +47,7 @@ Staff_group = \translator Score = \translator { \type "Score_performer"; -% instrument = piano; + instrument = piano; \accepts Staff; \accepts Grandstaff; \accepts Lyrics; diff --git a/lib/duration-convert.cc b/lib/duration-convert.cc index 46bfc1f652..49db74195d 100644 --- a/lib/duration-convert.cc +++ b/lib/duration-convert.cc @@ -38,14 +38,6 @@ Duration_convert::dur2_str (Duration dur) return str; } -#if 0 -int -Duration_convert::dur2_i (Duration dur, int division_1_i) -{ - return dur2_mom (dur) * Moment (division_1_i); -} -#endif - int Duration_convert::dur2ticks_i (Duration dur) { @@ -100,20 +92,6 @@ Duration_convert::dur2_mom (Duration dur) return mom * plet_factor_mom (dur); } -#if 0 -Moment -Duration_convert::i2_mom (int time_i, int division_1_i) -{ - if (!time_i) - return Moment (0); - - if (division_1_i > 0) - return Moment (time_i, division_1_i); - else - return Moment (-division_1_i, time_i); -} -#endif - Duration Duration_convert::mom2_dur (Moment mom) { @@ -201,28 +179,16 @@ Duration_convert::sync_f (Duration dur, Moment mom) Duration Duration_convert::ticks2_dur (int ticks_i) { - // Duration dur (4, 0); - // dur.set_plet (ticks_i, Duration::division_1_i_s / 4); - Moment mom (ticks_i, Duration::division_1_i_s); if (midi_as_plet_b_s) return mom2_dur (mom); Duration dur = mom2standardised_dur (mom); - // if (dur.mom () == mom) if (dur.length () == mom) return dur; -// huh? -#if 0 - dur.durlog_i_ = -100; - dur.dots_i_ = 0; - dur.set_ticks (ticks_i); - return dur; -#else return mom2_dur (mom); -#endif } Duration @@ -238,7 +204,6 @@ Duration_iterator::Duration_iterator () cursor_dur_.durlog_i_ = 7; if (Duration_convert::no_smaller_than_i_s) cursor_dur_.durlog_i_ = Duration_convert::no_smaller_than_i_s; - // cursor_dur_.set_plet (1, 1); } Duration diff --git a/lib/include/duration-convert.hh b/lib/include/duration-convert.hh index e3926f030c..7473638323 100644 --- a/lib/include/duration-convert.hh +++ b/lib/include/duration-convert.hh @@ -41,12 +41,6 @@ struct Duration_convert { static int no_smaller_than_i_s; static Array dur_array_s; -// /// Most used division in MIDI, all fine with me. -// static int const division_1_c_i = 384; - -// /// Return (integer, division) representation. -// static int dur2_i (Duration dur, int division_1_i = division_1_c_i ); - /// Return number of ticks in (ticks, division_1) representation static int dur2ticks_i (Duration dur ); @@ -63,12 +57,6 @@ struct Duration_convert { /// Return Mudela string representation. static String dur2_str (Duration dur ); -// /// Return Moment from (integer, division) representation. -// static Moment i2_mom (int i, int division_1_i = division_1_c_i ); - -// /// Return Moment (fraction of whole) representation, best guess. -// static Duration mom2_dur (Moment mom ); - /// Return duration from Moment (fraction of whole) representation. static Duration mom2_dur (Moment mom ); diff --git a/lib/include/duration.hh b/lib/include/duration.hh index 642701e8d5..69eaf8dcaf 100644 --- a/lib/include/duration.hh +++ b/lib/include/duration.hh @@ -25,9 +25,6 @@ extern bool no_triplets_bo_g; (dur) */ struct Duration { - /** - Ctor of Duration. - */ Duration (); /// is the "plet factor" of this note != 1 ? bool plet_b (); diff --git a/lily/include/midi-walker.hh b/lily/include/midi-walker.hh index 313e21af3d..492553ec8b 100644 --- a/lily/include/midi-walker.hh +++ b/lily/include/midi-walker.hh @@ -35,7 +35,7 @@ public: void process(); private: - void do_start_note (Midi_note* note_l); + void do_start_note (Midi_note* note_p); void do_stop_notes (Moment now_mom); void output_event (Moment now_mom, Midi_item* l); diff --git a/lily/include/staff-performer.hh b/lily/include/staff-performer.hh index 0d80586342..063b3c1b05 100644 --- a/lily/include/staff-performer.hh +++ b/lily/include/staff-performer.hh @@ -20,15 +20,17 @@ public: TRANSLATOR_CLONE(Staff_performer); DECLARE_MY_RUNTIME_TYPEINFO; - Staff_performer(); - ~Staff_performer(); + Staff_performer (); + ~Staff_performer (); - String instrument_str(); + String new_instrument_str (); + String instrument_str_; protected: virtual void play (Audio_element* p); - virtual void do_removal_processing(); - virtual void do_creation_processing(); + virtual void do_removal_processing (); + virtual void do_creation_processing (); + virtual void do_process_requests (); private: Audio_staff* audio_staff_p_; diff --git a/lily/include/staff-side.hh b/lily/include/staff-side.hh index ffc1e37d9f..1720722284 100644 --- a/lily/include/staff-side.hh +++ b/lily/include/staff-side.hh @@ -17,12 +17,8 @@ /** A symbol which sits along a staff. */ -class Staff_side : virtual Score_elem { - Link_array support_l_arr_; - - Interval support_height() const; - Real get_position_f() const; - +class Staff_side : virtual Score_elem +{ public: /** @@ -38,14 +34,19 @@ public: void set_staffsym (Staff_symbol * ); - - Staff_side(); + Staff_side (); void add_support (Score_elem*); DECLARE_MY_RUNTIME_TYPEINFO; protected: - virtual Interval symbol_height() const; + virtual Interval symbol_height () const; + virtual Real get_position_f () const; virtual void do_substitute_dependency (Score_elem *, Score_elem*); - virtual void do_post_processing(); + virtual void do_post_processing (); + Interval support_height () const; + +private: + Link_array support_l_arr_; +// Interval support_height () const; }; #endif // STAFF_SIDE_HH diff --git a/lily/include/text-def.hh b/lily/include/text-def.hh index 185ea715c7..6624959140 100644 --- a/lily/include/text-def.hh +++ b/lily/include/text-def.hh @@ -12,13 +12,12 @@ #include "lily-proto.hh" #include "input.hh" -class Text_def : public General_script_def { -protected: -// huh? move to public -// virtual Atom get_atom (Paper_def* p, Direction dir_) const; +class Text_def : public General_script_def +{ +public: DECLARE_MY_RUNTIME_TYPEINFO; VIRTUAL_COPY_CONS(Text_def,General_script_def); -public: + /** centered , or aligned? diff --git a/lily/include/text-item.hh b/lily/include/text-item.hh index ba7ae59db6..4102ba5e88 100644 --- a/lily/include/text-item.hh +++ b/lily/include/text-item.hh @@ -14,9 +14,9 @@ /** print a fixed width text above or below the staff. */ -class Text_item : public Item ,public Staff_side{ - void init (Text_def* tdef_l); - +class Text_item : public Item ,public Staff_side +{ +public: public: /// do I have width? @@ -24,17 +24,22 @@ public: /* ***************/ - Text_item (General_script_def*,Direction dir=0); - virtual ~Text_item(); + Text_item (General_script_def* ,Direction dir=0); + virtual ~Text_item (); DECLARE_MY_RUNTIME_TYPEINFO; protected: - General_script_def * tdef_p_; + // ugh: so, are we a text-def, or can this vary? + General_script_def* tdef_p_; + + virtual Interval symbol_height () const; - virtual Interval symbol_height() const; + virtual Molecule* brew_molecule_p () const; + virtual void do_pre_processing (); + virtual Real get_position_f () const; - virtual Molecule* brew_molecule_p() const; - virtual void do_pre_processing(); +private: +// void init (Text_def* tdef_l); }; diff --git a/lily/midi-stream.cc b/lily/midi-stream.cc index 34833fb24b..efc244c5de 100644 --- a/lily/midi-stream.cc +++ b/lily/midi-stream.cc @@ -19,46 +19,51 @@ Midi_stream::Midi_stream (String filename_str) { filename_str_ = filename_str; os_p_ = 0; - open(); + open (); } -Midi_stream::~Midi_stream() +Midi_stream::~Midi_stream () { *os_p_ << flush; // ugh. Share with tex_stream. if (!*os_p_) { - warning(_("error syncing file (disk full?)")); + warning (_ ("error syncing file (disk full?)")); exit_status_i_ = 1; } delete os_p_; } Midi_stream& -Midi_stream::operator <<(String str) +Midi_stream::operator << (String str) { - if (check_debug && !monitor->silent_b("Midistrings")) - str = String_convert::bin2hex_str (str); - *os_p_ << str; - - if (check_debug && !monitor->silent_b ("Midistrings")) - *os_p_ << "\n"; - return *this; } Midi_stream& -Midi_stream::operator <<(Midi_item const& mitem_c_r) +Midi_stream::operator << (Midi_item const& mitem_c_r) { - // *this << mitem_c_r.str(); - mitem_c_r.output (this); - if (check_debug && !monitor->silent_b("Midistrings")) - *os_p_ << "\n"; +// *this <silent_b ("Midistrings")) + { + str = String_convert::bin2hex_str (str) + "\n"; + // ugh, should have separate debugging output with Midi*::print routines + int i = str.index_i ("0a"); + while (i >= 0) + { + str[i] = '\n'; + str[i + 1] = '\t'; + i = str.index_i ("0a"); + } + } + + *os_p_ << str; return *this; } Midi_stream& -Midi_stream::operator <<(int i) +Midi_stream::operator << (int i) { // output binary string ourselves *this << Midi_item::i2varint_str (i); @@ -66,9 +71,9 @@ Midi_stream::operator <<(int i) } void -Midi_stream::open() +Midi_stream::open () { os_p_ = new ofstream (filename_str_.ch_C ()); if (!*os_p_) - error (_("can't open `") + filename_str_ + "\'"); + error (_ ("can't open `") + filename_str_ + "\'"); } diff --git a/lily/midi-walker.cc b/lily/midi-walker.cc index 36c8000024..38fbad9953 100644 --- a/lily/midi-walker.cc +++ b/lily/midi-walker.cc @@ -43,12 +43,12 @@ Midi_walker::~Midi_walker() Find out if start_note event is needed, and do it if needed. */ void -Midi_walker::do_start_note (Midi_note* note_l) +Midi_walker::do_start_note (Midi_note* note_p) { - Moment stop_mom = note_l->duration() + ptr ()->audio_column_l_->at_mom (); + Moment stop_mom = note_p->duration() + ptr ()->audio_column_l_->at_mom (); for (int i=0; i < stop_note_queue.size(); i++) { - if (stop_note_queue[ i ].val->pitch_i() == note_l->pitch_i ()) + if (stop_note_queue[ i ].val->pitch_i() == note_p->pitch_i ()) { if (stop_note_queue[ i ].key < stop_mom) stop_note_queue[ i ].ignore_b_ = true; @@ -58,11 +58,11 @@ Midi_walker::do_start_note (Midi_note* note_l) } Midi_note_event e; - e.val = new Midi_note_off (note_l); + e.val = new Midi_note_off (note_p); e.key = stop_mom; stop_note_queue.insert (e); - output_event (ptr()->audio_column_l_->at_mom (), note_l); + output_event (ptr()->audio_column_l_->at_mom (), note_p); } /** @@ -78,9 +78,9 @@ Midi_walker::do_stop_notes (Moment max_mom) continue; Moment stop_mom = e.key; - Midi_note_off* note_l = e.val; + Midi_note_off* note_p = e.val; - output_event (stop_mom, note_l); + output_event (stop_mom, note_p); } } @@ -109,7 +109,5 @@ Midi_walker::process() output_event (ptr()->audio_column_l_->at_mom (), p); else do_start_note ((Midi_note*)p); - - delete p; } diff --git a/lily/spring-spacer.cc b/lily/spring-spacer.cc index 94fd515d39..2b030e6c71 100644 --- a/lily/spring-spacer.cc +++ b/lily/spring-spacer.cc @@ -249,7 +249,6 @@ void Spring_spacer::make_constraints (Mixed_qp& lp) const { int dim=cols.size(); - Real nw_f = paper_l ()->note_width (); for (int j=0; j < dim; j++) { Colinfo c=cols[j]; @@ -635,6 +634,9 @@ Spring_spacer::calc_idealspacing() dist = dist >? minimum; } + // ugh: never let columns touch... try to set over here... + // ugh: use j iso i triggers ice in gcc-2.7.2.3 + cols[i].width_[LEFT] -= nw_f / 4; ideal_arr_[i] = dist; } } diff --git a/lily/staff-performer.cc b/lily/staff-performer.cc index 6c813df4ae..7270d20282 100644 --- a/lily/staff-performer.cc +++ b/lily/staff-performer.cc @@ -13,43 +13,60 @@ #include "audio-item.hh" #include "audio-staff.hh" -IMPLEMENT_IS_TYPE_B1(Staff_performer,Performer_group_performer); -ADD_THIS_TRANSLATOR(Staff_performer); +IMPLEMENT_IS_TYPE_B1 (Staff_performer,Performer_group_performer); +ADD_THIS_TRANSLATOR (Staff_performer); -Staff_performer::Staff_performer() +Staff_performer::Staff_performer () { audio_staff_p_ = 0; } -Staff_performer::~Staff_performer() +Staff_performer::~Staff_performer () { delete audio_staff_p_; } void -Staff_performer::do_creation_processing() +Staff_performer::do_creation_processing () { audio_staff_p_ = new Audio_staff; - if (instrument_str().length_i()) - { - // staff name - play (new Audio_text (Audio_text::TRACK_NAME, id_str_)); - // instrument description - play (new Audio_text (Audio_text::INSTRUMENT_NAME, instrument_str ())); - } + play (new Audio_text (Audio_text::TRACK_NAME, id_str_)); + +#if 1 + String str = new_instrument_str (); + if (str.length_i ()) + // instrument description + play (new Audio_text (Audio_text::INSTRUMENT_NAME, str)); +#endif // tempo play (new Audio_tempo (get_tempo_i ())); - if (instrument_str ().length_i ()) +#if 1 + if (str.length_i ()) // instrument - play (new Audio_instrument (instrument_str ())); + play (new Audio_instrument (str)); +#endif + Performer_group_performer::do_creation_processing (); } void -Staff_performer::do_removal_processing() +Staff_performer::do_process_requests () +{ + String str = new_instrument_str (); + if (str.length_i ()) + { + play (new Audio_text (Audio_text::INSTRUMENT_NAME, str)); + play (new Audio_instrument (str)); + } + Performer_group_performer::do_process_requests (); +} + + +void +Staff_performer::do_removal_processing () { Performer_group_performer::do_removal_processing (); Performer::play (audio_staff_p_); @@ -57,10 +74,16 @@ Staff_performer::do_removal_processing() } String -Staff_performer::instrument_str() +Staff_performer::new_instrument_str () { // mustn't ask Score for instrument: it will return piano! - return get_property ("instrument"); + String str = get_property ("instrument"); + if (str == instrument_str_) + return ""; + + instrument_str_ = str; + + return instrument_str_; /* ugh, but can't if (properties_dict_.elt_b ("instrument")) @@ -72,9 +95,9 @@ Staff_performer::instrument_str() void Staff_performer::play (Audio_element* p) { - if (p->is_type_b (Audio_item::static_name())) + if (p->is_type_b (Audio_item::static_name ())) { - audio_staff_p_->add ((Audio_item*)p); + audio_staff_p_->add ( (Audio_item*)p); } Performer::play (p); } diff --git a/lily/staff-side.cc b/lily/staff-side.cc index 06690a0334..0a741a104a 100644 --- a/lily/staff-side.cc +++ b/lily/staff-side.cc @@ -54,11 +54,11 @@ Staff_side::add_support (Score_elem*i) } Real -Staff_side::get_position_f() const +Staff_side::get_position_f () const { if (!dir_) { - warning (_("Staff_side::get_position_i(): " + warning (_("Staff_side::get_position_f(): " "somebody forgot to set my vertical direction, returning -20")); return -20; } @@ -68,8 +68,7 @@ Staff_side::get_position_f() const Real inter_f = paper()-> internote_f (); Interval v= support_height(); -// y = v[dir_] + 2*dir_*inter_f; // ugh - y = v[dir_]; // ugh + y = v[dir_] + 2 * dir_ * inter_f; // ugh return y; } diff --git a/lily/template8.cc b/lily/template8.cc index 301e86f3f7..4ce5596d28 100644 --- a/lily/template8.cc +++ b/lily/template8.cc @@ -11,10 +11,11 @@ #include "audio-column.hh" #include "audio-item.hh" #include "audio-staff.hh" +#include "midi-item.hh" #include "pcursor.tcc" #include "plist.tcc" template POINTERLIST_INSTANTIATE(Audio_element); template POINTERLIST_INSTANTIATE(Audio_column); - +template POINTERLIST_INSTANTIATE(Midi_event); diff --git a/lily/text-item.cc b/lily/text-item.cc index 16a45977f1..952e917052 100644 --- a/lily/text-item.cc +++ b/lily/text-item.cc @@ -13,49 +13,70 @@ #include "stem.hh" #include "molecule.hh" #include "lookup.hh" +#include "debug.hh" -Text_item::Text_item (General_script_def*tdef_l, Direction d) +Text_item::Text_item (General_script_def* tdef_l, Direction d) { dir_ = d; fat_b_ = false; - tdef_p_ = tdef_l->clone(); + tdef_p_ = tdef_l->clone (); } -Text_item::~Text_item() +Text_item::~Text_item () { delete tdef_p_; } void -Text_item::do_pre_processing() +Text_item::do_pre_processing () { if (!dir_) dir_ = DOWN; } +Real +Text_item::get_position_f () const +{ + // uhuh, tdef/gdef? + if ( (tdef_p_->name () != Text_def::static_name ()) + || ( ( (Text_def*)tdef_p_)->style_str_ != "finger")) + return Staff_side::get_position_f (); + + if (!dir_) + { + warning (_ ("Text_item::get_position_f(): " + "somebody forgot to set my vertical direction, returning -20")); + return -20; + } + + Interval v = support_height (); + // add no extra: fingers should be just above note, no? + return v[dir_]; +} + Interval -Text_item::symbol_height() const +Text_item::symbol_height () const { - return tdef_p_->get_atom (paper(), dir_).dim_.y (); + return tdef_p_->get_atom (paper (), dir_).dim_.y (); } Molecule* -Text_item::brew_molecule_p() const +Text_item::brew_molecule_p () const { - Atom a (tdef_p_->get_atom (paper(), dir_)); + Atom a (tdef_p_->get_atom (paper (), dir_)); /* if (fat_b_) - a.sym.dim.x = tdef_p_->width (paper()); + a.sym.dim.x = tdef_p_->width (paper ()); */ Molecule* mol_p = new Molecule (a); if (dir_<0) // should do something better anyway. - mol_p->translate_axis (-mol_p->extent().y ().left , Y_AXIS); + mol_p->translate_axis (-mol_p->extent ().y ().left , Y_AXIS); mol_p->translate_axis (y_, Y_AXIS); return mol_p; } -IMPLEMENT_IS_TYPE_B1(Text_item,Item); +IMPLEMENT_IS_TYPE_B1 (Text_item,Item); diff --git a/mutopia/standchen.ly b/mutopia/standchen.ly index e50751350a..32f0609dcc 100644 --- a/mutopia/standchen.ly +++ b/mutopia/standchen.ly @@ -1,11 +1,10 @@ \header{ -filename = "standchen.ly"; -title = "St\"andchen (Serenade) \"Leise flehen meine Lieder\""; -opus = "D. 957 No. 4"; -composer = "Franz Schubert (1797-1828)" - "Text by Ludwig Rellstab (1799-1860)"; -enteredby = "JCN"; -copyright = "public domain"; +filename = "standchen.ly"; +title = "St\"andchen (Serenade)\\\``Leise flehen meine Lieder''"; +opus = "D. 957 No. 4"; +composer = "Franz Schubert (1797-1828)\\\ \hfill Text by Ludwig Rellstab (1799-1860)"; +enteredby = "JCN"; +copyright = "public domain"; } %{ -- 2.39.5