From ae0a8ce9764d714e026ed7c6f24502ac10df3797 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Sun, 10 Jan 1999 22:45:18 +0100 Subject: [PATCH] patch::: 1.1.19.jcn5: isb pl 19.jcn5 - interstaff beams v0: see beam-interstaff.ly and wtk1-fugue2.ly --- Generated by janneke@gnu.org using package-diff 0.62, >From = lilypond-1.1.19.jcn4, To = lilypond-1.1.19.jcn5 usage cd lilypond-source-dir; patch -E -p1 < lilypond-1.1.19.jcn5.diff Patches do not contain automatically generated files or (urg) empty directories, i.e., you should rerun autoconf, configure and possibly make outdirs. --state 1.1.19.jcn4 1.1.19.jcn5 ++state --- NEWS | 10 +++++++++- VERSION | 2 +- input/test/beam-interstaff.ly | 31 +++++++++++++++++++++++++++++++ input/test/beam-isknee.ly | 22 ++++++++++++++++++++++ lily/beam-engraver.cc | 14 ++++++++++++++ lily/beam.cc | 17 ++++++++++++++--- lily/include/beam.hh | 3 +++ lily/include/stem-info.hh | 1 + lily/include/stem.hh | 5 ++++- lily/stem-engraver.cc | 2 ++ lily/stem-info.cc | 20 ++++++++++++++++++++ mutopia/J.S.Bach/wtk1-fugue2.ly | 21 +++++++++++++++------ 12 files changed, 136 insertions(+), 12 deletions(-) create mode 100644 input/test/beam-interstaff.ly create mode 100644 input/test/beam-isknee.ly diff --git a/NEWS b/NEWS index c394b259e7..7baf3c440b 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,12 @@ ---- ../lilypond-1.1.19.jcn3/NEWS Sat Jan 9 16:03:22 1999 +--- ../lilypond-1.1.19.jcn4/NEWS Sat Jan 9 21:11:06 1999 +++ b/NEWS Sun Jan 10 22:05:13 1999 +@@ -1,3 +1,6 @@ +pl 19.jcn5 + - interstaff beams v0: see beam-interstaff.ly and wtk1-fugue2.ly + + pl 19.jcn4 + - new stem/beam parameters + - bf: forced stem shorten--- ../lilypond-1.1.19.jcn3/NEWS Sat Jan 9 16:03:22 1999 ++ b/NEWS Sat Jan 9 21:11:06 1999 @@ -1,3 +1,7 @@ pl 19.jcn4 diff --git a/VERSION b/VERSION index 198de8d0d5..705b1d3fb3 100644 --- a/VERSION +++ b/VERSION @@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=1 PATCH_LEVEL=19 -MY_PATCH_LEVEL=jcn4 +MY_PATCH_LEVEL=jcn5 # 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 new file mode 100644 index 0000000000..65e0a5d2c2 --- /dev/null +++ b/input/test/beam-interstaff.ly @@ -0,0 +1,31 @@ +\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{ + \translator{ + \GrandStaffContext + minVerticalAlign = 2.5*\staffheight; + maxVerticalAlign = 2.5*\staffheight; + } + linewidth=-1.; + } +} diff --git a/input/test/beam-isknee.ly b/input/test/beam-isknee.ly new file mode 100644 index 0000000000..45a5e4bf41 --- /dev/null +++ b/input/test/beam-isknee.ly @@ -0,0 +1,22 @@ +\score{ + \type GrandStaff < + \type Staff=one \notes\relative c'{ + s1 + } + \type Staff=two \notes\relative c'{ + \clef bass; +% no knee + \stemup [c8 \translator Staff=one \stemdown g'16 f] + s8 + s2 + } + > + \paper{ + \translator{ + \GrandStaffContext + minVerticalAlign = 2.8*\staffheight; + maxVerticalAlign = 2.8*\staffheight; + } + linewidth=-1.; + } +} diff --git a/lily/beam-engraver.cc b/lily/beam-engraver.cc index 7353da47f8..a2f315962b 100644 --- a/lily/beam-engraver.cc +++ b/lily/beam-engraver.cc @@ -63,6 +63,20 @@ 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; + + prop = get_property ("maxVerticalAlign", 0); + if (prop.isnum_b ()) + { + beam_p_->vertical_align_f_ += (Real)prop; + beam_p_->vertical_align_f_ /= (Real)2; + } + announce_element (Score_element_info (beam_p_, reqs_drul_[START])); } } diff --git a/lily/beam.cc b/lily/beam.cc index 6e2e3b4641..af118cb5dd 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -77,6 +77,10 @@ Beam::do_brew_molecule_p () const mol_p->translate_axis (x0 - spanned_drul_[LEFT]->absolute_coordinate (X_AXIS), X_AXIS); + // correct if last note (and therefore reference point of beam) + // is on different staff + mol_p->translate_axis (- sinfo_.top ().interstaff_f_ * internote_f, Y_AXIS); + return mol_p; } @@ -229,13 +233,20 @@ Beam::check_stemlengths_f (bool set_b) for (int i=0; i < sinfo_.size (); i++) { Real y = sinfo_[i].x_ * slope_f_ + left_y_; + // correct for knee if (dir_ != sinfo_[i].dir_) - y -= dir_ * (beam_f / 2 - + (sinfo_[i].mult_i_ - 1) * interbeam_f) / internote_f; + { + y -= dir_ * (beam_f / 2 + + (sinfo_[i].mult_i_ - 1) * interbeam_f) / internote_f; + if (!i && sinfo_[i].stem_l_->staff_sym_l_ != + sinfo_.top ().stem_l_->staff_sym_l_) + y += dir_ * (multiple_i_ - (sinfo_[i].stem_l_->flag_i_ - 2) >? 0) + * interbeam_f / internote_f; + } if (set_b) - sinfo_[i].stem_l_->set_stemend (y); + sinfo_[i].stem_l_->set_stemend (y - sinfo_[i].interstaff_f_); y *= dir_; if (y > sinfo_[i].maxy_f_) diff --git a/lily/include/beam.hh b/lily/include/beam.hh index fa26038d08..a94b0eba90 100644 --- a/lily/include/beam.hh +++ b/lily/include/beam.hh @@ -40,6 +40,9 @@ public: /// maximum number of beams (for opening-up of beam-spacing) int multiple_i_; + /// vertical align distance between staffs + Real vertical_align_f_; + Array sinfo_; Beam(); diff --git a/lily/include/stem-info.hh b/lily/include/stem-info.hh index 695a2c88fc..14d39426e3 100644 --- a/lily/include/stem-info.hh +++ b/lily/include/stem-info.hh @@ -20,6 +20,7 @@ struct Stem_info { Real miny_f_; Real maxy_f_; int mult_i_; + Real interstaff_f_; Stem* stem_l_; Stem_info (); diff --git a/lily/include/stem.hh b/lily/include/stem.hh index 267be4f67a..81f4617bf9 100644 --- a/lily/include/stem.hh +++ b/lily/include/stem.hh @@ -76,7 +76,10 @@ public: /// direction of the beam Direction beam_dir_; - + + /// what staff am i on? + Staff_symbol* staff_sym_l_; + Stem (); /// ensure that this Stem also encompasses the Notehead #n# diff --git a/lily/stem-engraver.cc b/lily/stem-engraver.cc index ae32b12ba1..07998e448f 100644 --- a/lily/stem-engraver.cc +++ b/lily/stem-engraver.cc @@ -13,6 +13,7 @@ #include "duration-convert.hh" #include "misc.hh" #include "abbrev.hh" +#include "staff-info.hh" Stem_engraver::Stem_engraver() { @@ -45,6 +46,7 @@ Stem_engraver::acknowledge_element(Score_element_info i) int durlog_i = r->duration_.durlog_i_; stem_p_->flag_i_ = durlog_i; + stem_p_->staff_sym_l_ = get_staff_info ().staff_sym_l_; if (abbrev_req_l_) { diff --git a/lily/stem-info.cc b/lily/stem-info.cc index 370efcfadc..a25535b8dc 100644 --- a/lily/stem-info.cc +++ b/lily/stem-info.cc @@ -15,6 +15,7 @@ #include "paper-def.hh" #include "lookup.hh" #include "stem-info.hh" +#include "beam.hh" Stem_info::Stem_info () { @@ -27,6 +28,7 @@ Stem_info::Stem_info (Stem*s) dir_ = stem_l_->dir_; beam_dir_ = stem_l_->beam_dir_; mult_i_ = stem_l_->mult_i_; + interstaff_f_ = 0; Paper_def* paper_l = stem_l_->paper (); Real internote_f = paper_l->internote_f (); @@ -77,6 +79,8 @@ Stem_info::Stem_info (Stem*s) /* knee */ { idealy_f_ -= beam_f; + // idealy_f_ -= (mult_i_ - 1) * interbeam_f; + // idealy_f_ += (mult_i_ - stem_l_->flag_i_ >? 0) * interbeam_f; maxy_f_ = idealy_f_; miny_f_ = -INT_MAX; @@ -97,5 +101,21 @@ Stem_info::Stem_info (Stem*s) idealy_f_ = maxy_f_ ? idealy_f_; + + // interstaff beam + Beam* beam_l_ = stem_l_->beam_l_; + 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; + 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/wtk1-fugue2.ly b/mutopia/J.S.Bach/wtk1-fugue2.ly index 7d2239f968..946ffbe4d7 100644 --- a/mutopia/J.S.Bach/wtk1-fugue2.ly +++ b/mutopia/J.S.Bach/wtk1-fugue2.ly @@ -45,20 +45,22 @@ dux = \notes \relative c''{ %%10 as4 r8 a [bes bes16 a] [bes8 f] | g4 r8 g [as as g f] | + r8 \translator Staff = bass \stemup - r8 [as, bes c ] r8 [as16 g] [as8 f8] | + [as, bes c ] r8 [as16 g] [as8 f8] | [bes8 c bes as] [bes g f es] | [f des' c bes] [c as g f] | %%15 g8 - \translator Staff = treble \stemdown - [g'16 fis] [g8 c,] [es g16 fis!] [g8 a] | + [g'16 fis] [g8 c,] + [es \translator Staff = treble \stemdown g16 fis!] [g8 a] | [d, g16 fis] [g8 a!] [c,16 d] es4 [d16 c] | % forced accident! bes8 r8 r16 [d e fis] [g a bes8] ~ [bes16 e, f g] | [a bes c8] ~ [c16 fis,16 g a] [bes8 es,!16 d] [es8 g, ] | [as f'16 es] [f8 a,8] [bes g'16 f] [g8 b, ] | %%20 - [c16 f es d] [c bes! as g] [f8 as' g f] | + [c16 f \translator Staff = bass \stemup es d] [c bes! as g] + [f8 \translator Staff = treble \stemdown as' g f] | [es d es f] [b, c d b] | c4 r8 e8 [f f16 e] [f8 c] | d4 r8 d8 [es8 es16 d] [es8 bes] | @@ -144,7 +146,8 @@ bassdux = \notes \relative c' { [f d'16 c ] [d8 fis,] g4 r16 [g, a b] | [c16 d es8~] [es16 a, bes c] [d es f8~] [f16 b, c d] | %%20 - es8 r r e [f f, es! d] | % -> \classic_accidentals +% es8 r r e [f f, es! d] | % -> \classic_accidentals + es8 r r e \stemdown [f f, es! d] \stemboth | r [as' g f] [g f16 es] [f8 g] | [c16 d es d] [c bes as g] [f bes' as g] [f es d c] | [bes c d c] [bes as g f] [es as' g f] [es d c bes] | @@ -188,7 +191,13 @@ bassdux = \notes \relative c' { %hmm % \translator { \BarNumberingScoreContext } % \translator { \BarNumberingStaffContext } - \translator{ \OrchestralScoreContext } +% \translator{ \OrchestralScoreContext } + \translator{ \OrchestralScoreContext } + \translator{ + \GrandStaffContext + minVerticalAlign = 3.0*\staffheight; + maxVerticalAlign = 3.0*\staffheight; + } } \header{ opus = "BWV 847"; -- 2.39.2