Skip to content

Commit

Permalink
Bend_engraver: avoid mid-measure barlines
Browse files Browse the repository at this point in the history
Defer setting the right bound of a BendAfter spanner until the end of
the timestep.  It is not known at the beginning of the timestep whether
a mid-measure barline will be created.

Update input/regression/bend-bound.ly to include barlines created with
\repeat and \bar.

Closes #6074.

(cherry picked from commit 32f3128)
  • Loading branch information
Dan Eble authored and hahnjo committed Jan 18, 2021
1 parent cbc53fe commit 0e45875
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 12 deletions.
37 changes: 30 additions & 7 deletions input/regression/bend-bound.ly
Original file line number Diff line number Diff line change
@@ -1,23 +1,46 @@
\version "2.17.30"

\header {
texidoc = "Bends should not be effected by the full width of a
@code{NonMusicalPaperColumn}. The bends should have identical X
spans in the two examples.
texidoc = "Bends should not be affected by the full width of a
@code{NonMusicalPaperColumn}. The bends should have identical X
spans in the two scores. No bends should cross bar lines.
"
}

music = \repeat unfold 16 { c''4\bendAfter #-4 }
sixteens = \repeat unfold 64 { c'16 }
music = \fixed c'' {
c4\bendAfter #-4
c4\bendAfter #-4
\repeat volta 2 {
c2\bendAfter #-4
|
c2\bendAfter #-4
}
c4\bendAfter #-4
c4\bendAfter #-4
|
c4\bendAfter #-4
c4\bendAfter #-4
\bar "||"
c2\bendAfter #-4
|
c2\bendAfter #-4
\bar "||"
c4\bendAfter #-4
c4\bendAfter #-4
|
\bar "|."
}

sixteenths = \repeat unfold 64 { c'16 }

\new Score {
<< \music \sixteens >>
<< \music \sixteenths >>
}

\new Score \with {
currentBarNumber = #200
barNumberVisibility = #(every-nth-bar-number-visible 1)
\override BarNumber.break-visibility = #end-of-line-invisible
} {
<< \music \sixteens >>
<< \music \sixteenths >>
}
17 changes: 12 additions & 5 deletions lily/bend-engraver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,6 @@ Bend_engraver::finalize ()
void
Bend_engraver::stop_fall ()
{
bool bar = scm_is_string (get_property (this, "whichBar"));

fall_->set_bound (RIGHT, unsmob<Grob> (bar
? get_property (this, "currentCommandColumn")
: get_property (this, "currentMusicalColumn")));
last_fall_ = fall_;
fall_ = 0;
note_head_ = 0;
Expand All @@ -73,6 +68,18 @@ Bend_engraver::stop_fall ()
void
Bend_engraver::stop_translation_timestep ()
{
if (last_fall_)
{
// don't cross a barline
SCM col_scm = scm_is_string (get_property (this, "whichBar"))
? get_property (this, "currentCommandColumn")
: get_property (this, "currentMusicalColumn");
if (auto *col = unsmob<Grob> (col_scm))
{
last_fall_->set_bound (RIGHT, col);
}
}

if (fall_ && !fall_->get_bound (LEFT))
{
fall_->set_bound (LEFT, note_head_);
Expand Down

0 comments on commit 0e45875

Please sign in to comment.