X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=ly%2Fmusic-functions-init.ly;h=beb8bd10e497a20937066c8372f691a264928487;hb=f3828bfa1cb6fb30c60715701572fb72b4c95897;hp=cbba26a65256a366e3c2793cebb641e91d18266b;hpb=e8d5061834a5a658c5ffd078237e9cd660069a7d;p=lilypond.git diff --git a/ly/music-functions-init.ly b/ly/music-functions-init.ly index cbba26a652..beb8bd10e4 100644 --- a/ly/music-functions-init.ly +++ b/ly/music-functions-init.ly @@ -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") @@ -1123,6 +1134,24 @@ parenthesize = (set! (ly:music-property arg 'parenthesize) #t)) arg) +#(define (make-directed-part-combine-music + parser direction chord-range part1 part2 + one-context-settings + two-context-settings + shared-context-settings) + + (let ((pc-music (make-part-combine-music + parser (list part1 part2) direction chord-range))) + #{ \context Staff << + \context Voice = "one" \with #one-context-settings {} + \context Voice = "two" \with #two-context-settings {} + \context Voice = "shared" \with #shared-context-settings {} + #pc-music + #(make-part-combine-marks + default-part-combine-mark-state-machine + (ly:music-property pc-music 'split-list)) + >> #} )) + partcombine = #(define-music-function (parser location chord-range part1 part2) ((number-pair? '(0 . 8)) ly:music? ly:music?) @@ -1131,36 +1160,30 @@ a music expression containing simultaneous voices, where @var{part1} and @var{part2} are combined into one voice where appropriate. Optional @var{chord-range} sets the distance in steps between notes that may be combined into a chord or unison.") - #{ \context Staff << - \context Voice = "one" \with { \voiceOne } {} - \context Voice = "two" \with { \voiceTwo } {} - \context Voice = "shared" {} - #(make-part-combine-music parser (list part1 part2) #f chord-range) - >> #} ) + (make-directed-part-combine-music parser #f chord-range part1 part2 + #{ \with { \voiceOne \override DynamicLineSpanner.direction = #UP } #} + #{ \with { \voiceTwo \override DynamicLineSpanner.direction = #DOWN } #} + #{ #} )) partcombineUp = #(define-music-function (parser location chord-range part1 part2) ((number-pair? '(0 . 8)) ly:music? ly:music?) (_i "Take the music in @var{part1} and @var{part2} and typeset so that they share a staff with stems directed upward.") - #{ \context Staff << - \context Voice = "one" \with { \voiceOne } {} - \context Voice = "two" \with { \voiceThree } {} - \context Voice = "shared" \with { \voiceOne } {} - #(make-part-combine-music parser (list part1 part2) UP chord-range) - >> #} ) + (make-directed-part-combine-music parser UP chord-range part1 part2 + #{ \with { \voiceOne \override DynamicLineSpanner.direction = #UP } #} + #{ \with { \voiceThree \override DynamicLineSpanner.direction = #UP } #} + #{ \with { \voiceOne \override DynamicLineSpanner.direction = #UP } #} )) partcombineDown = #(define-music-function (parser location chord-range part1 part2) ((number-pair? '(0 . 8)) ly:music? ly:music?) (_i "Take the music in @var{part1} and @var{part2} and typeset so that they share a staff with stems directed downward.") - #{ \context Staff << - \context Voice = "one" \with { \voiceFour } {} - \context Voice = "two" \with { \voiceTwo } {} - \context Voice = "shared" \with { \voiceTwo } {} - #(make-part-combine-music parser (list part1 part2) DOWN chord-range) - >> #} ) + (make-directed-part-combine-music parser DOWN chord-range part1 part2 + #{ \with { \voiceFour \override DynamicLineSpanner.direction = #DOWN } #} + #{ \with { \voiceTwo \override DynamicLineSpanner.direction = #DOWN } #} + #{ \with { \voiceTwo \override DynamicLineSpanner.direction = #DOWN } #} )) partcombineForce = #(define-music-function (location parser type once) (boolean-or-symbol? boolean?)