From e4a2fa122a8e8135a181793b99f8e2a38c94aa3b Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Mon, 11 Jan 1999 18:02:53 +0100 Subject: [PATCH] patch::: 1.1.20.jcn1: patsje pl 20.jcn1 - interstaff slurs v0: preludes-1.ly - warnings for silly interbeam settings --- NEWS | 4 + TODO | 10 ++- VERSION | 2 +- input/test/beam-interstaff.ly | 4 +- input/test/slur-interstaff.ly | 33 +++++++++ lily/beam-engraver.cc | 8 +- lily/beam.cc | 2 + lily/bow.cc | 4 + lily/encompass-info.cc | 42 +++++++++-- lily/include/beam.hh | 2 +- lily/include/bow.hh | 2 + lily/include/direction.hh | 2 + lily/include/slur.hh | 7 +- lily/include/stem.hh | 3 + lily/slur-engraver.cc | 9 +++ lily/slur.cc | 3 +- lily/stem-info.cc | 24 ++++-- .../J.S.Bach/Petites-Preludes/preludes-1.ly | 74 +++++++++++++++---- 18 files changed, 186 insertions(+), 49 deletions(-) create mode 100644 input/test/slur-interstaff.ly diff --git a/NEWS b/NEWS index 5df616f269..50c2ba76d9 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +pl 20.jcn1 + - interstaff slurs v0: preludes-1.ly + - warnings for silly interbeam settings + pl 20 diff --git a/TODO b/TODO index f01020231f..31ee656807 100644 --- a/TODO +++ b/TODO @@ -47,10 +47,16 @@ BUGS: * fix: cello suites + * fix: petites preludes (rediculous dims) + * fix extender + * fix fingering 'a-5': font direction broken *again* + * fix braces + * multibar rests: SkipBars=0 + * ly2dvi barfs on linewidth = -1. * fix midi output. @@ -585,10 +591,6 @@ SMALLISH PROJECTS * handle EOF graciously in error messages. - * really centered whole rest - - * centered multi-bar-rest - * declare notenametab? * midi esp.: use I32 iso int where 32 bits are needed (or assumed...) diff --git a/VERSION b/VERSION index d648aa5100..f5155c60a8 100644 --- a/VERSION +++ b/VERSION @@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=1 PATCH_LEVEL=20 -MY_PATCH_LEVEL= +MY_PATCH_LEVEL=jcn1 # use the above to send patches: MY_PATCH_LEVEL is always empty for a # released version. diff --git a/input/test/beam-interstaff.ly b/input/test/beam-interstaff.ly index 65e0a5d2c2..d09e796c21 100644 --- a/input/test/beam-interstaff.ly +++ b/input/test/beam-interstaff.ly @@ -23,8 +23,8 @@ \paper{ \translator{ \GrandStaffContext - minVerticalAlign = 2.5*\staffheight; - maxVerticalAlign = 2.5*\staffheight; + minVerticalAlign = 3.0*\staffheight; + maxVerticalAlign = 3.0*\staffheight; } linewidth=-1.; } diff --git a/input/test/slur-interstaff.ly b/input/test/slur-interstaff.ly new file mode 100644 index 0000000000..2d6ccbf281 --- /dev/null +++ b/input/test/slur-interstaff.ly @@ -0,0 +1,33 @@ +\score{ + \type GrandStaff < + \type Staff=one \notes\relative c'{ + \stemup c8( c \translator Staff=two \stemup c )c + r2 + \translator Staff=one + \stemdown c8( c \translator Staff=two \stemup c )c + r2 + \stemdown c8( c \translator Staff=one \stemdown c )c + r2 + \translator Staff=two + \stemup c8( c \translator Staff=one \stemdown c )c + r2 + } + \type Staff=two \notes\relative c'{ + \clef bass; + s1 + s1 + s1 + s1 + } + > + \paper{ + % no slur damping + slur_slope_damping = 10.0; + \translator{ + \GrandStaffContext + minVerticalAlign = 3.0*\staffheight; + maxVerticalAlign = 3.0*\staffheight; + } + linewidth=-1.; + } +} diff --git a/lily/beam-engraver.cc b/lily/beam-engraver.cc index 3165cf6660..0b2e9af091 100644 --- a/lily/beam-engraver.cc +++ b/lily/beam-engraver.cc @@ -63,19 +63,15 @@ Beam_engraver::do_process_requests () if (prop.isnum_b ()) beam_p_->quantisation_ = (Beam::Quantisation)(int)prop; - // silly try at interstaff beam // must set minVerticalAlign == maxVerticalAlign to get sane results // see input/test/beam-interstaff.ly prop = get_property ("minVerticalAlign", 0); if (prop.isnum_b ()) - beam_p_->vertical_align_f_ = prop; + beam_p_->vertical_align_drul_[MIN] = prop; prop = get_property ("maxVerticalAlign", 0); if (prop.isnum_b ()) - { - beam_p_->vertical_align_f_ += (Real)prop; - beam_p_->vertical_align_f_ /= (Real)2; - } + beam_p_->vertical_align_drul_[MAX] = prop; announce_element (Score_element_info (beam_p_, reqs_drul_[START])); } diff --git a/lily/beam.cc b/lily/beam.cc index af118cb5dd..90476e1e9f 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -41,6 +41,8 @@ Beam::Beam () damping_i_ = 1; quantisation_ = NORMAL; multiple_i_ = 0; + vertical_align_drul_[MIN] = 0; + vertical_align_drul_[MAX] = -1; } void diff --git a/lily/bow.cc b/lily/bow.cc index 935eae60b3..66c1bfd562 100644 --- a/lily/bow.cc +++ b/lily/bow.cc @@ -22,6 +22,9 @@ Bow::Bow () dy_f_drul_[LEFT] = dy_f_drul_[RIGHT] = 0.0; dx_f_drul_[LEFT] = dx_f_drul_[RIGHT] = 0.0; dash_i_ = 0; + interstaff_f_ = 0; + vertical_align_drul_[MIN] = 0; + vertical_align_drul_[MAX] = -1; } Molecule* @@ -54,6 +57,7 @@ Bow::do_brew_molecule_p () const Molecule* mol_p = new Molecule; mol_p->add_atom (a); + mol_p->translate_axis (-interstaff_f_, Y_AXIS); return mol_p; } diff --git a/lily/encompass-info.cc b/lily/encompass-info.cc index 1a352c49a7..f8854f0292 100644 --- a/lily/encompass-info.cc +++ b/lily/encompass-info.cc @@ -12,6 +12,9 @@ #include "note-column.hh" #include "paper-def.hh" #include "encompass-info.hh" +#include "slur.hh" +#include "staff-sym.hh" +#include "debug.hh" Encompass_info::Encompass_info () { @@ -26,15 +29,15 @@ Encompass_info::Encompass_info (Note_column const* note, Direction dir) Real notewidth = paper->note_width () * 0.8; Real internote = interline / 2; - Stem* stem = note->stem_l_; + Stem* stem_l_ = note->stem_l_; /* set o_.x () to middle of notehead or on the exact position of stem, according to slur direction */ - o_.x () = stem->hpos_f (); + o_.x () = stem_l_->hpos_f (); /* - stem->dir == dir + stem_l_->dir == dir ________ | | / \ x| x| |x |x @@ -42,16 +45,39 @@ Encompass_info::Encompass_info (Note_column const* note, Direction dir) */ - if (stem->dir_ != dir) - o_.x () -= 0.5 * notewidth * stem->dir_; + if (stem_l_->dir_ != dir) + o_.x () -= 0.5 * notewidth * stem_l_->dir_; - o_.y () = stem->extent (Y_AXIS)[dir]; + o_.y () = stem_l_->extent (Y_AXIS)[dir]; /* leave a gap: slur mustn't touch head/stem */ o_.y () += 2.5 * internote * dir; - if (stem->dir_ != dir) + if (stem_l_->dir_ != dir) o_.y () += 1.0 * internote * dir; -} + Slur* slur_l_ = stem_l_->slur_l_; + if (slur_l_->encompass_arr_.size () + && stem_l_->staff_sym_l_ != slur_l_->encompass_arr_[0]->stem_l_->staff_sym_l_) + { + if (stem_l_->staff_sym_l_->dim_cache_[Y_AXIS].valid_b ()) + { + slur_l_->interstaff_f_ = stem_l_->staff_sym_l_->absolute_coordinate (Y_AXIS) + - slur_l_->encompass_arr_[0]->stem_l_->staff_sym_l_->absolute_coordinate (Y_AXIS); + } + else + { + warning (_ ("invalid dimension cache: guessing staff position")); + if (slur_l_->vertical_align_drul_[MIN] != + slur_l_->vertical_align_drul_[MAX]) + warning (_ ("minVerticalAlign != maxVerticalAlign: interstaff slurs may be broken")); + slur_l_->interstaff_f_ = slur_l_->vertical_align_drul_[MIN]; + // urg, guess staff order: + // if our stem ends higher, our staff is probably lower... + if (stem_l_->chord_start_f () > slur_l_->encompass_arr_[0]->stem_l_->chord_start_f ()) + slur_l_->interstaff_f_ *= -1; + } + o_.y () += slur_l_->interstaff_f_; + } +} diff --git a/lily/include/beam.hh b/lily/include/beam.hh index a94b0eba90..1e4bf9d0b9 100644 --- a/lily/include/beam.hh +++ b/lily/include/beam.hh @@ -41,7 +41,7 @@ public: int multiple_i_; /// vertical align distance between staffs - Real vertical_align_f_; + Drul_array vertical_align_drul_; Array sinfo_; diff --git a/lily/include/bow.hh b/lily/include/bow.hh index e8e8d54dc9..7a59b7fdf4 100644 --- a/lily/include/bow.hh +++ b/lily/include/bow.hh @@ -26,6 +26,8 @@ public: int dash_i_; + Real interstaff_f_; + Drul_array vertical_align_drul_; protected: virtual Molecule* do_brew_molecule_p () const; diff --git a/lily/include/direction.hh b/lily/include/direction.hh index 45f574b83a..ea6adf88c0 100644 --- a/lily/include/direction.hh +++ b/lily/include/direction.hh @@ -18,6 +18,8 @@ enum Direction DOWN=-1, LEFT=-1, RIGHT=1, + MIN=-1, + MAX=1, CENTER=0, SMALLER=-1, BIGGER=1, diff --git a/lily/include/slur.hh b/lily/include/slur.hh index 491150c877..30123a335b 100644 --- a/lily/include/slur.hh +++ b/lily/include/slur.hh @@ -18,13 +18,12 @@ class Slur : public Bow { public: - Link_array encompass_arr_; - void add_column (Note_column*); - Slur (); - VIRTUAL_COPY_CONS(Score_element); + + void add_column (Note_column*); + Link_array encompass_arr_; protected: virtual Array get_encompass_offset_arr () const; diff --git a/lily/include/stem.hh b/lily/include/stem.hh index 81f4617bf9..34e829d634 100644 --- a/lily/include/stem.hh +++ b/lily/include/stem.hh @@ -63,6 +63,9 @@ public: */ Beam* beam_l_; + /// our slur (urg) + Slur* slur_l_; + Drul_array beams_i_drul_; /// maximum number of beams diff --git a/lily/slur-engraver.cc b/lily/slur-engraver.cc index e0e4253f86..9a6b20b38c 100644 --- a/lily/slur-engraver.cc +++ b/lily/slur-engraver.cc @@ -78,6 +78,15 @@ Slur_engraver::do_process_requests() Scalar prop = get_property ("slurdash", 0); if (prop.isnum_b ()) s_p->dash_i_ = prop; + + prop = get_property ("minVerticalAlign", 0); + if (prop.isnum_b ()) + s_p->vertical_align_drul_[MIN] = prop; + + prop = get_property ("maxVerticalAlign", 0); + if (prop.isnum_b ()) + s_p->vertical_align_drul_[MAX] = prop; + requests_arr_.push (slur_req_l); start_slur_l_arr_.push (s_p); announce_element (Score_element_info (s_p, slur_req_l)); diff --git a/lily/slur.cc b/lily/slur.cc index b88c4b5614..f8a0fc3672 100644 --- a/lily/slur.cc +++ b/lily/slur.cc @@ -30,7 +30,6 @@ #include "main.hh" - Slur::Slur () { } @@ -41,6 +40,7 @@ Slur::add_column (Note_column*n) if (!n->head_l_arr_.size ()) warning (_ ("Putting slur over rest.")); encompass_arr_.push (n); + n->stem_l_->slur_l_ = this; add_dependency (n); } @@ -280,6 +280,7 @@ Slur::get_encompass_offset_arr () const Encompass_info info (encompass_arr_[i], dir_); notes.push (info.o_ - left); } + d.y () += interstaff_f_; notes.push (d); return notes; diff --git a/lily/stem-info.cc b/lily/stem-info.cc index a25535b8dc..dec7ead2f1 100644 --- a/lily/stem-info.cc +++ b/lily/stem-info.cc @@ -16,6 +16,7 @@ #include "lookup.hh" #include "stem-info.hh" #include "beam.hh" +#include "staff-sym.hh" Stem_info::Stem_info () { @@ -107,12 +108,23 @@ Stem_info::Stem_info (Stem*s) if (beam_l_->sinfo_.size () && stem_l_->staff_sym_l_ != beam_l_->sinfo_[0].stem_l_->staff_sym_l_) { - // hmm, perhaps silly now to have vertical_align in Beam - interstaff_f_ = beam_l_->vertical_align_f_ / internote_f; - // urg, guess staff order: - // if our stem ends higher, our staff is probably lower... - if (idealy_f_ * beam_dir_ > beam_l_->sinfo_[0].idealy_f_ * beam_dir_) - interstaff_f_ *= -1; + if (stem_l_->staff_sym_l_->dim_cache_[Y_AXIS].valid_b ()) + { + interstaff_f_ = stem_l_->staff_sym_l_->absolute_coordinate (Y_AXIS) + - beam_l_->sinfo_[0].stem_l_->staff_sym_l_->absolute_coordinate (Y_AXIS) / internote_f; + } + else + { + warning (_ ("invalid dimension cache: guessing staff position")); + if (beam_l_->vertical_align_drul_[MIN] != + beam_l_->vertical_align_drul_[MAX]) + warning (_ ("minVerticalAlign != maxVerticalAlign: interstaff slurs may be broken")); + interstaff_f_ = beam_l_->vertical_align_drul_[MIN] / internote_f; + // urg, guess staff order: + // if our stem ends higher, our staff is probably lower... + if (idealy_f_ * beam_dir_ > beam_l_->sinfo_[0].idealy_f_ * beam_dir_) + interstaff_f_ *= -1; + } idealy_f_ += interstaff_f_ * beam_dir_; miny_f_ += interstaff_f_ * beam_dir_; maxy_f_ += interstaff_f_ * beam_dir_; diff --git a/mutopia/J.S.Bach/Petites-Preludes/preludes-1.ly b/mutopia/J.S.Bach/Petites-Preludes/preludes-1.ly index 1c00016cae..bc7bd540d0 100644 --- a/mutopia/J.S.Bach/Petites-Preludes/preludes-1.ly +++ b/mutopia/J.S.Bach/Petites-Preludes/preludes-1.ly @@ -14,7 +14,13 @@ copyright = "public domain"; \version "1.0.14"; -one = \notes\relative c { +% urg, this all changed and was never fixed +% howto get rid of these ridiculous dimensions???? +% to view the output, subsitute 0.0 with 0.0 in the .tex file... + +% one = \type Voice=one \notes\relative c { +% one = \notes\relative c { +one = \type Staff=treble \notes\relative c { \property Voice . textstyle = "italic" r16\p_"legato"\< [g''-1( c-3 )e-5] r [g,-1( c )e] r [g,( c )d] r [b-1( d-2 \!)g-5] | @@ -34,15 +40,32 @@ one = \notes\relative c { r [a, c g'-5] r [a, c f!-4] | % ugh arpeggio < - { \voiceone f4 r s } - { \voicetwo r s } + { \voiceone f4 r } + { \voicetwo r } > \onevoice + % s % ugh beam across staffs slur starts at lower staff - r16 [g,-1( b d] | - \voiceone - )b s4 [g'16-1( b-2 d] )b s s s [f'-2 g-3 b-5 f-2] | - \onevoice +% r16 [g,-1( b d] | +% \voiceone +% )b s4 [g'16-1( b-2 d] )b s s s [f'-2 g-3 b-5 f-2] | +% \onevoice + \translator Staff=bass\stemup + r16 [g,,-5( b-4 d ] + [f-1 \translator Staff=treble\stemdown g16-1 b d] | \stemup )b + \translator Staff=bass\stemdown + [g-5( b-4 d-2] f-1 + \translator Staff=treble\stemup + [g16-1 b-2 d] )b + \translator Staff=bass\stemup + \clef "violin"; + [g-4 b-2 d-1] + \stemup + % urg, below translator change affects previous beam too!? + % howto separate translator command from previous beam end? + \skip 4*0; + [\translator Staff=treble f-2 g-3 b-5 f-2] | + \stemboth [e-1\f c'-5( g-3 f-2] [e-1 c'-5 g-3 e-2] [)d c'-5( f,-3 e-2] [d-1 b'-5 f-3 d-2] | [)c b'-5( e,-3 d-2] [c-1 a'-5 e-3 c-2] @@ -59,14 +82,16 @@ one = \notes\relative c { [es-2 fis-3 a-4 c-5] < { \voiceone r [c8 b16] } - { \voicetwo [d,8 f-2] } + %%% urg urg ?{ \voicetwo [d,8 f-2] } > \onevoice | \bar "|."; } -two = \notes\relative c{ +% two = \notes\relative c{ +% two = \type Voice=three \notes\relative c{ +two = \type Staff=bass \notes\relative c{ \property Voice . textstyle = "roman" c4-5 e-3 g-\mordent^"(\\textsharp)" g,4 | d'-\mordent-5 f-3 a-\mordent^"(\\textsharp)" a,4 | @@ -76,13 +101,18 @@ two = \notes\relative c{ f4-1 e d-3-\prall c | g'-\mordent^"(\\textsharp)" g, g'-\mordent g, | g'-\mordent g, g'-\mordent g, | - % ugh f should be at upper staff - g'-\mordent r r16 [g,-5( b-4 d] )f-1 s s s | - s [g-5( b-4 d-2] )f-1 s s s s \clef "violin"; [g-4 b-2 d-1] - s s s s \clef bass; | +% % ugh f should be at upper staff +% g'-\mordent r r16 [g,-5( b-4 d] )f-1 s s s | +% g'-\mordent r r16 [g,-5( b-4 d \translator Staff=treble )f-1 ] s s s | +% \translator Staff=bass +% s [g-5( b-4 d-2] )f-1 s s s s \clef "violin"; [g-4 b-2 d-1] +% s s s s \clef bass; | + g' r s s | s s s s \clef bass; | < - { \voiceone g,,1 ~ g ~ g ~ g ~ g ~ g ~ g } - { \voicetwo g,1 ~ g ~ g ~ g ~ g ~ g ~ g } +% { \voiceone g,,1 ~ g ~ g ~ g ~ g ~ g ~ g } +% { \voicetwo g,1 ~ g ~ g ~ g ~ g ~ g ~ g } + { \voicethree g1 ~ g ~ g ~ g ~ g ~ g ~ g } + { \voicefour g,1 ~ g ~ g ~ g ~ g ~ g ~ g } > \bar "|."; @@ -112,7 +142,19 @@ grand_staff = \type GrandStaff < \score{ % Moderato \grand_staff - \include "preludes-paper.ly"; +% \include "preludes-paper.ly"; + \paper{ + % no slur damping + slur_slope_damping = 10.0; + % linewidth= 193.\mm; + linewidth= 180.\mm; + gourlay_maxmeasures = 4.0; + \translator{ + \GrandStaffContext + minVerticalAlign = 3.0*\staffheight; + maxVerticalAlign = 3.0*\staffheight; + } + } \midi{ \tempo 4 = 80; } \header { opus = "BWV 924"; -- 2.39.5