X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=ly%2Fmusic-functions-init.ly;h=26f0e68fe4962104feede7a9bf0ebe12a4c6b16d;hb=a2b9a06290592396b4466ae74a26935f14c2984a;hp=f14f54300180a79caebf68c9d95c36ac085785bf;hpb=c521f5d108e214c1598410e033bf3944e674924c;p=lilypond.git diff --git a/ly/music-functions-init.ly b/ly/music-functions-init.ly index f14f543001..26f0e68fe4 100644 --- a/ly/music-functions-init.ly +++ b/ly/music-functions-init.ly @@ -267,7 +267,7 @@ instrumentSwitch = #(define-music-function (parser location name) (string?) (_i "Switch instrument to @var{name}, which must be predefined with -@var{\addInstrumentDefinition}.") +@code{\\addInstrumentDefinition}.") (let* ((handle (assoc name instrument-definitions)) (instrument-def (if handle (cdr handle) '())) @@ -359,6 +359,30 @@ musicMap = #(define-music-function (parser location proc mus) (procedure? ly:music?) (music-map proc mus)) +overrideBeamSettings = +#(define-music-function + (parser location + context time-signature rule-type grouping-rule) + (symbol? pair? symbol? pair?) + + (_i "Override beamSettings in @var{context} +for time signatures of @var{time-signature} and rules of type +@var{rule-type} to have a grouping rule alist +@var{grouping-rule}. +@var{rule-type} can be @code{end} or @code{subdivide}, +with a potential future value of @code{begin}. +@var{grouping-rule} is an alist of @var{(beam-type . grouping)} +entries. @var{grouping} is in units of @var{beam-type}. If +@var{beam-type} is @code{*}, grouping is in units of the denominator +of @var{time-signature}.") + + ;; TODO -- add warning if largest value of grouping is + ;; greater than time-signature. + +#{ +#(override-beam-setting + $time-signature $rule-type $grouping-rule $context) +#}) overrideProperty = #(define-music-function (parser location name property value) @@ -647,6 +671,19 @@ resetRelativeOctave = reference-note)) +revertBeamSettings = +#(define-music-function + (parser location + context time-signature rule-type) + (symbol? pair? symbol?) + + (_i "Revert beam settings in @var{context} for time signatures of +@var{time-signature} and groups of type +@var{group-type}. @var{group-type} can be @code{end} +or @code{subdivide}.") +#{ + #(revert-beam-setting $time-signature $rule-type $context) +#}) scaleDurations = #(define-music-function (parser location fraction music) (number-pair? ly:music?) @@ -654,6 +691,25 @@ scaleDurations = (ly:music-compress music (ly:make-moment (car fraction) (cdr fraction)))) +setBeatGrouping = +#(define-music-function (parser location grouping) (pair?) + (_i "Set the beat grouping in the current time signature to +@var{grouping}.") + (define (default-group-setting c) + (let* ((context-time-signature + (ly:context-property c 'timeSignatureFraction)) + (time-signature (if (null? context-time-signature) + '(4 . 4) + context-time-signature))) + (override-property-setting + c + 'beamSettings + (list time-signature 'end) + (list (cons '* grouping))))) + + (context-spec-music + (make-apply-context default-group-setting) + 'Score)) shiftDurations = @@ -675,6 +731,12 @@ the `parameters' assoc list.") (cons 'system-Y-extent (cdr (assoc 'system-Y-extent parameters)))) #}) +styledNoteHeads = +#(define-music-function + (parser location style heads music) + (symbol? list-or-symbol? ly:music?) + (_i "Set @var{heads} in @var{music} to @var{style}.") + (style-note-heads heads style music)) rightHandFinger = #(define-music-function (parser location finger) (number-or-string?) @@ -701,7 +763,8 @@ scoreTweak = (make-music 'SequentialMusic))) -tag = #(define-music-function (parser location tag arg) +tag = +#(define-music-function (parser location tag arg) (symbol? ly:music?) (_i "Add @var{tag} to the @code{tags} property of @var{arg}.") @@ -745,16 +808,20 @@ transposition = (ly:pitch-negate (pitch-of-note pitch-note))) 'Staff)) -tweak = #(define-music-function (parser location sym val arg) - (symbol? scheme? ly:music?) - - (_i "Add @code{sym . val} to the @code{tweaks} property of @var{arg}.") +tweak = +#(define-music-function (parser location sym val arg) + (symbol? scheme? ly:music?) + (_i "Add @code{sym . val} to the @code{tweaks} property of @var{arg}.") - (set! - (ly:music-property arg 'tweaks) - (acons sym val - (ly:music-property arg 'tweaks))) - arg) + (if (equal? (object-property sym 'backend-type?) #f) + (begin + (ly:warning (_ "cannot find property type-check for ~a") sym) + (ly:warning (_ "doing assignment anyway")))) + (set! + (ly:music-property arg 'tweaks) + (acons sym val + (ly:music-property arg 'tweaks))) + arg)