]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/output-lib.scm
(datadir): remove LILYPONDPREFIX support.
[lilypond.git] / scm / output-lib.scm
index 64b9908e71ce18684d3f377d37fcf80cfb42e9ff..2496763397fd36deaf92990a186c2e07ecb456bf 100644 (file)
                       (else fret)))))))
 
 
+; default tunings for common string instruments
 (define-public guitar-tuning '(4 -1 -5 -10 -15 -20))
+(define-public guitar-open-g-tuning '(2 -1 -5 -10 -17 -22))
 (define-public bass-tuning '(-17 -22 -27 -32))
+(define-public mandolin-tuning '(16 9 2 -5))
 
 ;; tunings for 5-string banjo
 (define-public banjo-open-g-tuning '(2 -1 -5 -10 7))
 (define-public banjo-modal-tuning '(2 0 -5 -10 7))
 (define-public banjo-open-d-tuning '(2 -3 -6 -10 9))
 (define-public banjo-open-dm-tuning '(2 -3 -6 -10 9))
-;; convert 5-string banjo tunings to 4-string tunings by
-;; removing the 5th string
-;;
-;; example:
-;; \set TabStaff.stringTunings = #(four-string-banjo banjo-open-g-tuning)
+;; convert 5-string banjo tuning to 4-string by removing the 5th string
 (define-public (four-string-banjo tuning)
   (reverse (cdr (reverse tuning))))
 
@@ -244,6 +243,23 @@ centered, X==1 is at the right, X == -1 is at the left."
       (ly:grob-translate-axis! g 3.5 X)))
 
 
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Tuplets
+
+(define-public (tuplet-number::calc-denominator-text grob)
+  (let*
+      ((ev (ly:grob-property grob 'cause)))
+    
+    (number->string (ly:event-property ev 'denominator))))
+
+
+(define-public (tuplet-number::calc-fraction-text grob)
+  (let*
+      ((ev (ly:grob-property grob 'cause)))
+    (format "~a:~a" 
+      (ly:event-property ev 'denominator)
+      (ly:event-property ev 'numerator))))
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Color
 
@@ -324,3 +340,65 @@ centered, X==1 is at the right, X == -1 is at the left."
 
   value)
 
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; falls
+
+(define-public (fall::print spanner)
+  (let*
+      ((delta (ly:grob-property spanner 'delta-position))
+       (left-span (ly:spanner-bound spanner LEFT))
+       (right-span (ly:spanner-bound spanner RIGHT))
+       (thickness (* (ly:grob-property spanner 'thickness)
+                    (ly:output-def-lookup (ly:grob-layout spanner) 'line-thickness)))
+       (padding (ly:grob-property spanner 'padding 0.5))
+       (common (ly:grob-common-refpoint right-span
+                                       (ly:grob-common-refpoint spanner
+                                               left-span X)
+                                       X))
+       (left-x (+ padding  (interval-end  (ly:grob-robust-relative-extent left-span common X))))
+       (right-x (- (interval-start  (ly:grob-robust-relative-extent right-span common X)) padding))
+       (self-x (ly:grob-relative-coordinate spanner common X))
+       (dx (- right-x left-x))
+       (exp (list 'path thickness 
+                 `(quote
+                   (rmoveto
+                    ,(- left-x self-x) 0
+
+                    rcurveto                
+                    ,(/ dx 3)
+                    0
+                    ,dx ,(* 0.66 delta)
+                    ,dx ,delta
+                    ))))
+       )
+
+    (ly:make-stencil
+     exp
+     (cons 0 dx)
+     (cons (min 0 delta)
+          (max 0 delta)))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; grace spacing
+
+
+(define-public (grace-spacing::calc-shortest-duration grob)
+  (let*
+     ((cols (ly:grob-object grob 'columns))
+      (get-difference
+       (lambda (idx)
+        (ly:moment-sub (ly:grob-property (ly:grob-array-ref cols (1+ idx)) 'when)
+                       (ly:grob-property (ly:grob-array-ref cols idx) 'when))))
+      
+      (moment-min (lambda (x y)
+                   (cond
+                    ((and x y)
+                     (if (ly:moment<? x y)
+                           x
+                           y))
+                    (x x)
+                    (y y)))))
+                    
+    (fold moment-min #f (map get-difference
+                            (iota (1- (ly:grob-array-length cols)))))))
+