X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scm%2Fauto-beam.scm;h=1f4ad95ca4c92d6ae9c360a9135e5438141ed00d;hb=aeb2de649b6409561db9d4530ef6c1eef56f0445;hp=73a01b03600618911dfbea84f657ab77d0b859fa;hpb=3379da1fe0fe84cd2c8939abf97bc9f48102f8f8;p=lilypond.git diff --git a/scm/auto-beam.scm b/scm/auto-beam.scm index 73a01b0360..1f4ad95ca4 100644 --- a/scm/auto-beam.scm +++ b/scm/auto-beam.scm @@ -3,7 +3,7 @@ ;;; ;;; source file of the GNU LilyPond music typesetter ;;; -;;; (c) 2000 Jan Nieuwenhuizen +;;; (c) 2000--2003 Jan Nieuwenhuizen ;;; ;;; specify generic beam begin and end times @@ -28,79 +28,114 @@ ;;; end beams with 16th notes each 1 4 note ;;; end beams with 32th notes each 1 8 note -(define auto-beam-settings +(define-public default-auto-beam-settings `( - ((end * * 3 2) . ,(make-moment 1 2)) - ((end 1 16 3 2) . ,(make-moment 1 4)) - ((end 1 32 3 2) . ,(make-moment 1 8)) + ((end * * 3 2) . ,(ly:make-moment 1 2)) + ((end 1 16 3 2) . ,(ly:make-moment 1 4)) + ((end 1 32 3 2) . ,(ly:make-moment 1 8)) - ((begin 1 8 3 4) . ,(make-moment 1 4)) + ((begin 1 8 3 4) . ,(ly:make-moment 1 4)) - ((end * * 3 4) . ,(make-moment 3 4)) - ((begin 1 16 3 4) . ,(make-moment 1 16)) - ((end 1 16 3 4) . ,(make-moment 1 4)) - ;;((begin 1 32 3 4) . ,(make-moment 1 8)) - ((end 1 32 3 4) . ,(make-moment 1 8)) + ((end * * 3 4) . ,(ly:make-moment 3 4)) + ((begin 1 16 3 4) . ,(ly:make-moment 1 16)) + ((end 1 16 3 4) . ,(ly:make-moment 1 4)) + ;;((begin 1 32 3 4) . ,(ly:make-moment 1 8)) + ((end 1 32 3 4) . ,(ly:make-moment 1 8)) - ((begin 1 16 3 8) . ,(make-moment 1 8)) - ((end * * 3 8) . ,(make-moment 3 8)) + ((begin 1 16 3 8) . ,(ly:make-moment 1 8)) + ((end * * 3 8) . ,(ly:make-moment 3 8)) ;; in common time: ;; end beams each 1 2 note ;; end beams with 32th notes each 1 8 note ;; end beams with 1 8 triplets each 1 4 note - ((end * * 4 4) . ,(make-moment 1 2)) - ((end 1 12 4 4) . ,(make-moment 1 4)) - ((end 1 16 4 4) . ,(make-moment 1 4)) - ((end 1 32 4 4) . ,(make-moment 1 8)) + ((end * * 4 4) . ,(ly:make-moment 1 2)) + ((end 1 12 4 4) . ,(ly:make-moment 1 4)) + ((end 1 16 4 4) . ,(ly:make-moment 1 4)) + ((end 1 32 4 4) . ,(ly:make-moment 1 8)) - ((end * * 2 4) . ,(make-moment 1 4)) - ((end 1 12 2 4) . ,(make-moment 1 4)) - ((end 1 16 2 4) . ,(make-moment 1 4)) - ((end 1 32 2 4) . ,(make-moment 1 8)) + ((end * * 2 4) . ,(ly:make-moment 1 4)) + ((end 1 12 2 4) . ,(ly:make-moment 1 4)) + ((end 1 16 2 4) . ,(ly:make-moment 1 4)) + ((end 1 32 2 4) . ,(ly:make-moment 1 8)) ;; It seems that, because of a bug in the previous auto-beamer, ;; we had the effect of this setting x - ;; ((end * * 2 8) . ,(make-moment 2 8)) + ;; ((end * * 2 8) . ,(ly:make-moment 2 8)) - ((end * * 4 8) . ,(make-moment 1 4)) - ((end 1 16 4 8) . ,(make-moment 1 4)) - ((end 1 32 4 8) . ,(make-moment 1 8)) + ((end * * 4 8) . ,(ly:make-moment 1 4)) + ((end 1 16 4 8) . ,(ly:make-moment 1 4)) + ((end 1 32 4 8) . ,(ly:make-moment 1 8)) - ((end * * 4 16) . ,(make-moment 1 8)) + ((end * * 4 16) . ,(ly:make-moment 1 8)) - ((end * * 6 8) . ,(make-moment 3 8)) - ((end 1 16 6 8) . ,(make-moment 3 8)) - ((end 1 32 6 8) . ,(make-moment 1 8)) + ((end * * 6 8) . ,(ly:make-moment 3 8)) + ((end 1 16 6 8) . ,(ly:make-moment 3 8)) + ((end 1 32 6 8) . ,(ly:make-moment 1 8)) - ((end * * 9 8) . ,(make-moment 3 8)) - ((end 1 16 9 8) . ,(make-moment 3 8)) - ((end 1 32 9 8) . ,(make-moment 1 8)) + ((end * * 9 8) . ,(ly:make-moment 3 8)) + ((end 1 16 9 8) . ,(ly:make-moment 3 8)) + ((end 1 32 9 8) . ,(ly:make-moment 1 8)) - ((end * * 12 8) . ,(make-moment 3 8)) - ((end 1 16 12 8) . ,(make-moment 3 8)) - ((end 1 32 12 8) . ,(make-moment 1 8)) - (meta . ,(grob-description "autoBeamSettings")) + ((end * * 12 8) . ,(ly:make-moment 3 8)) + ((end 1 16 12 8) . ,(ly:make-moment 3 8)) + ((end 1 32 12 8) . ,(ly:make-moment 1 8)) )) -;;; Users may override in most cases, simply by issuing -;;; -;;; % from here on consider ending beam every 1 4 note -;;; \property Voice.autoBeamSettings \push #'(end * * * *) = #(make-moment 1 4) -;;; -;;; % no autobeaming -;;; \property Voice.beamAuto = ##f -;;; -;;; or, more globally, by doing: -;;; -;;; \paper{ -;;; \translator{ -;;; \VoiceContext -;;; % consider ending beam at every 1 2 note -;;; autoBeamSettings \push #'(end * * * *) = #(make-moment 1 2) -;;; } -;;; } -;;; -;;; see also input test auto-beam-override.ly + +(define (override-property-setting context context-prop setting value) + "Like the C++ code that executes \override, but without type +checking. " + + (ly:set-context-property! context context-prop + (cons (cons setting value) + (ly:get-context-property context context-prop) + ) + ) + ) + +(define (revert-property-setting context setting) + "Like the C++ code that executes \revert, but without type +checking. " + + (define (revert-assoc alist key) + "Return ALIST, with KEY removed. ALIST is not modified, instead +a fresh copy of the list-head is made." + (cond + ((null? alist) '()) + ((equal? (caar alist) key) (cdr alist)) + (else (cons (car alist) (revert-assoc alist key))) + )) + + + + (ly:set-context-property! + context context-prop + (revert-assoc (ly:get-context-property context context-prop) + setting)) + ) + +(define-public (override-auto-beam-setting setting num den) + (ly:export + (context-spec-music + (make-apply-context (lambda (c) + (override-property-setting + c 'autoBeamSettings + setting (ly:make-moment num den)) + )) + 'Voice) + )) + +(define-public (revert-auto-beam-setting setting) + (ly:export + (context-spec-music + (make-apply-context (lambda (c) + (revert-property-setting + c 'autoBeamSettings + setting))) + + 'Voice))) + +