On Thu, Oct 31, 2013 at 7:56 PM, David Kastrup <d...@gnu.org> wrote: > Well, if you now remove the Axis_group_engraver from Dynamics and add it > to \DynamicsStaff, your results will be more consistent as no new axis > groups get started. However, conflicting dynamics specifications will > get pasted over each other.
Okay, this should do the trick. I’m fairly certain this isn’t an issue that matters to many users besides me, but attached is a patch in case you’d deem it interesting enough for upstream inclusion. (I’m too rusty to bother with Rietveld for something arguably pedestrian.) (TBH, my own opinion on the matter is that the Dynamics context pretty much sucks anyway, and should probably not have been included as an "official" context in the first place -- even though it can be a handy workaround, as is the attached patch.) Thanks for the help! (And: nice seeing you again.) Cheers, Valentin.
From 8abb84c2bf30e32702ecd274df7bfa114f0d851f Mon Sep 17 00:00:00 2001 From: Valentin Villenave <valen...@villenave.net> Date: Thu, 31 Oct 2013 21:15:06 +0100 Subject: [PATCH] Make Dynamics into a Staff-like context. This commit creates a DynamicsVoice context, and moves the former Dynamics context to a higher (Staff-like) level. This should allow to assign variables that contain polyphonic sections without unintended side effects (such as additional Voice and Staff contexts being created whenever a VoiceSeparator \\ is entered). --- input/regression/dynamics-polyphony.ly | 42 ++++++++++++++++++++++++++++++++++ ly/engraver-init.ly | 27 +++++++++++++++------- 2 files changed, 61 insertions(+), 8 deletions(-) create mode 100644 input/regression/dynamics-polyphony.ly diff --git a/input/regression/dynamics-polyphony.ly b/input/regression/dynamics-polyphony.ly new file mode 100644 index 0000000..898913e --- /dev/null +++ b/input/regression/dynamics-polyphony.ly @@ -0,0 +1,42 @@ +\version "2.17.30" + +\header { + texidoc = "The Dynamics context can handle multiple voices, +even though it may lead to collisions." +} + +music = \relative c' { + f2\mp c' | + << % Creating two temporary DynamicsVoice contexts. + { bes8\> c d bes a2\p } + \\ + { g\sfz f } % collides with the spanner. + >> +} + +% The actual staves will be printed without dynamics. +#(define (dynamic? x) + (let ((name (ly:music-property x 'name))) + (or + (eq? name 'DynamicEvent) + (eq? name 'AbsoluteDynamicEvent) + (eq? name 'CrescendoEvent) + (eq? name 'DecrescendoEvent) + (eq? name 'SpanDynamicEvent)))) + +removeDynamics = +#(define-music-function (parser location music) (ly:music?) + (music-filter + (lambda (x) + (not (dynamic? x))) + music)) + +\score { + \new PianoStaff << + \new Staff \removeDynamics \music + \new Dynamics \music + \new Staff \removeDynamics { + \clef bass \transpose c c, \music + } + >> +} diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly index 9c8547d..27381b3 100644 --- a/ly/engraver-init.ly +++ b/ly/engraver-init.ly @@ -16,7 +16,7 @@ %%%% You should have received a copy of the GNU General Public License %%%% along with LilyPond. If not, see <http://www.gnu.org/licenses/>. -\version "2.17.29" +\version "2.17.30" \context { \name "Global" @@ -391,7 +391,7 @@ a collection of staves, with a bracket in front and spanning bar lines." \context { \type "Engraver_group" - \name Dynamics + \name DynamicsVoice \alias Voice \consists "Output_property_engraver" \consists "Bar_engraver" @@ -402,14 +402,9 @@ a collection of staves, with a bracket in front and spanning bar lines." \consists "Text_engraver" \consists "Text_spanner_engraver" \consists "Font_size_engraver" - \consists "Axis_group_engraver" pedalSustainStrings = #'("Ped." "*Ped." "*") pedalUnaCordaStrings = #'("una corda" "" "tre corde") - \override VerticalAxisGroup.staff-affinity = #CENTER - \override VerticalAxisGroup.nonstaff-relatedstaff-spacing = - #'((basic-distance . 5) - (padding . 0.5)) \override TextScript.font-shape = #'italic \override DynamicLineSpanner.Y-offset = #0 \override DynamicLineSpanner.outside-staff-priority = ##f @@ -423,11 +418,27 @@ a collection of staves, with a bracket in front and spanning bar lines." ,(ly:make-simple-closure (list ly:self-alignment-interface::x-aligned-on-self)))) + \description "Corresponds to the dynamics of a single voice. +Using the upper-level Dynamics context as a wrapper is preferred, +since it can handle polyphonic variables as well." +} + +\context { + \type "Engraver_group" + \name "Dynamics" + \alias "Staff" + \accepts "DynamicsVoice" + \defaultchild "DynamicsVoice" + \consists "Axis_group_engraver" + \override VerticalAxisGroup.staff-affinity = #CENTER + \override VerticalAxisGroup.nonstaff-relatedstaff-spacing = + #'((basic-distance . 5) + (padding . 0.5)) + \description "Holds a single line of dynamics, which will be centered between the staves surrounding this context." } - \context{ \type "Engraver_group" -- 1.8.3.1
_______________________________________________ bug-lilypond mailing list bug-lilypond@gnu.org https://lists.gnu.org/mailman/listinfo/bug-lilypond