]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 3687 (part 1): Provide a compress MM function for MM rests only
authorTrevor Daniels <t.daniels@treda.co.uk>
Tue, 28 Apr 2015 22:50:31 +0000 (23:50 +0100)
committerTrevor Daniels <t.daniels@treda.co.uk>
Wed, 6 May 2015 16:46:41 +0000 (17:46 +0100)
  Multi-measure rests were previously compressed (i.e. all bars
  following the first were removed) by using the \compressFullBarRests
  predef.  This simply turned on 'skipBars, which causes bar lines at
  the ends of bars which contain either no rhythmic event or contain
  a rhythmic event with a duration extending beyond the bar to be removed.
  Such bars are generated by notes with durations longer than a bar,
  like a1*3, or by shorter notes which extend beyond the bar.

  This patch provides a function which also uses 'skipBars, but with
  a filter so that 'skipBars is activated only when an actual MM rest
  is encountered and deactivated by the first following rhythmic event.

ly/music-functions-init.ly

index 20a9e49700ef91c36774fd50c9887644d8708904..e039c1cf7c00d82f4c68c106ac9498ee98b1a8f0 100644 (file)
@@ -287,6 +287,17 @@ as @code{\\compoundMeter #'((3 2 8))} or shorter
     \set Timing.measureLength = #mlen
   #} ))
 
+compressMMRests =
+#(define-music-function (parser location music) (ly:music?)
+  (_i "Remove the empty bars created by multi-measure rests,
+leaving just the first bar containing the MM rest itself.")
+   (music-map
+    (lambda (m)
+      (if (eq? 'MultiMeasureRestMusic (ly:music-property m 'name))
+          #{ \once \set Score.skipBars = ##t #m #}
+          #{ #m #} ))
+    music))
+
 crossStaff =
 #(define-music-function (parser location notes) (ly:music?)
   (_i "Create cross-staff stems")