Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(649)

Unified Diff: ly/spanners-init.ly

Issue 304160043: [GSoC] Implement cross-voice dynamic spanners
Patch Set: Fixed (though not sure if with best approach) issue with filtered acknowledgers. May try coding alt… Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ly/spanners-init.ly
diff --git a/ly/spanners-init.ly b/ly/spanners-init.ly
index 8d8a69444f8815af37d8080a75fdcf6a9a34688c..9bfa1b650f05f0f3a47f8347169f7a8ce6bfe4be 100644
--- a/ly/spanners-init.ly
+++ b/ly/spanners-init.ly
@@ -1,15 +1,40 @@
\version "2.19.29"
"\\=" =
-#(define-event-function (id event) (key? ly:event?)
- (_i "This sets the @code{spanner-id} property of the following
-@var{event} to the given @var{id} (non-negative integer or symbol).
-This can be used to tell LilyPond how to connect overlapping
-or parallel slurs or phrasing slurs within a single @code{Voice}.
+#(define-event-function (id-and-share event) (key-list-or-symbol? ly:event?)
+ (_i "This sets the @code{spanner-id} and @code{spanner-share-context}
+properties of the following @var{event}. @var{id-and-share} is expected to be a
+key-list (list of non-negative integers or symbols). If it has one element,
+@code{spanner-id} is set to that key and @code{spanner-share-context} to
+@code{'Voice}. If two elements are given, @code{spanner-share-context} is set
+to the first element and @code{spanner-id} to the second. This can be used to
+tell LilyPond how to connect overlapping or parallel slurs or phrasing slurs
+within a single @code{Voice}.
@lilypond[quote,verbatim]
\\fixed c' { c\\=1( d\\=2( e\\=1) f\\=2) }
@end lilypond\n")
- (set! (ly:music-property event 'spanner-id) id)
+ (if (key-list? id-and-share)
+ (let ((len (length id-and-share)))
+ (if (> len 2)
+ (ly:warning "Expected only two elements in argument to \\="))
+ (if (> len 1)
+ (begin
+ (set! (ly:music-property event 'spanner-share-context)
+ (list-ref id-and-share 0))
+ (set! (ly:music-property event 'spanner-id)
+ (list-ref id-and-share 1))
+ )
+ (begin
+ (set! (ly:music-property event 'spanner-share-context) 'Voice)
+ (set! (ly:music-property event 'spanner-id) (list-ref id-and-share 0))
+ )
+ )
+ )
+ (begin
+ (set! (ly:music-property event 'spanner-id) id-and-share)
+ (set! (ly:music-property event 'spanner-share-context) 'Voice)
+ )
+ )
event)
startGroup = #(make-span-event 'NoteGroupingEvent START)

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b