]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/display-woodwind-diagrams.scm
Doc: typo
[lilypond.git] / scm / display-woodwind-diagrams.scm
index 3468e863e9839259f6125deb111535b20d64d68f..1737890f5f70088e9228eb026d81c56be4009409 100644 (file)
@@ -1,6 +1,6 @@
 ;;;; This file is part of LilyPond, the GNU music typesetter.
 ;;;;
-;;;; Copyright (C) 2010 Mike Solomon <mikesol@stanfordalumni.org>
+;;;; Copyright (C) 2010--2012 Mike Solomon <mikesol@stanfordalumni.org>
 ;;;;
 ;;;; LilyPond is free software: you can redistribute it and/or modify
 ;;;; it under the terms of the GNU General Public License as published by
@@ -29,6 +29,8 @@
 
 ;; Utility functions
 
+(use-modules (ice-9 optargs))
+
 (define (return-1 x) 1.0)
 
 (define (make-spreadsheet parameter-list)
   ((make-named-spreadsheet '(clarinet bass-clarinet low-bass-clarinet))
     `((bottom-group-key-names
        . (()
-          ((f
+          ((ees
             . ((offset . (0.0 . ,(* 0 (+ 0.75 CL-RH-HAIR))))
-               (stencil . ,bass-clarinet-rh-f-key-stencil)
-               (text? . ("F" . #f))
+               (stencil . ,bass-clarinet-rh-ees-key-stencil)
+               (text? . ("E" . 0))
                (complexity . trill))))
-          ((f
+          ((ees
             . ((offset . (0.0 . ,(* 0 (+ 0.75 CL-RH-HAIR))))
-               (stencil . ,low-bass-clarinet-rh-f-key-stencil)
-               (text? . ("F" . #f))
+               (stencil . ,low-bass-clarinet-rh-ees-key-stencil)
+               (text? . ("E" . 0))
                (complexity . trill)))
            (d
             . ((offset . (,(+ 1.5 CL-RH-HAIR) . ,(* -1 (+ 0.75 CL-RH-HAIR))))
                  ,(make-right-hand-key-addresses '(one two three four))
                  (-0.5 . -0.7)))))
       (bottom-right-group-key-addresses
-       . (,(make-right-hand-key-addresses '(fis e ees gis))
+       . (,(make-right-hand-key-addresses '(fis e f gis))
           ,(make-right-hand-key-addresses '(fis e ees gis f))
           ,(make-right-hand-key-addresses '(fis e ees gis f d))))
       (right-hand-key-addresses
-       . (,(make-right-hand-key-addresses '(fis e ees gis))
+       . (,(make-right-hand-key-addresses '(fis e f gis))
           ,(make-right-hand-key-addresses '(fis e ees gis f))
           ,(make-right-hand-key-addresses
               '(low-d low-cis low-c fis e ees gis f d)))))))
                              (stencil . ,clarinet-rh-fis-key-stencil)
                              (text? . ("F" . 1))
                              (complexity . trill)))
-                         (e
+                         (gis
                           . ((offset . (,(+ 1.5 CL-RH-HAIR)
                                         . ,(* 3 (+ 0.75 CL-RH-HAIR))))
-                             (stencil . ,clarinet-rh-e-key-stencil)
-                             (text? . ("E" . #f))
+                             (stencil . ,clarinet-rh-gis-key-stencil)
+                             (text? . ("G" . 1))
                              (complexity . trill)))
-                         (ees
+                         (e
                           . ((offset . (0.0 . ,(* 2 (+ 0.75 CL-RH-HAIR))))
-                             (stencil . ,clarinet-rh-ees-key-stencil)
-                             (text? . ("E" . 0))
+                             (stencil . ,clarinet-rh-e-key-stencil)
+                             (text? . ("E" . #f))
                              (complexity . trill)))
-                         (gis
+                         (f
                           . ((offset . (,(+ 1.5 CL-RH-HAIR)
                                         . ,(* 1 (+ 0.75 CL-RH-HAIR))))
-                             (stencil . ,clarinet-rh-gis-key-stencil)
-                             (text? . ("G" . 1))
+                             (stencil . ,clarinet-rh-f-key-stencil)
+                             (text? . ("F" . #f))
                              (complexity . trill))))
                        (assoc-get 'bottom-group-key-names change-points)))))
        (graphical-commands
                radius)))
          (assoc-get 'stencils stencil-alist))))
 
-(define-public (print-keys instrument)
-  (let*
-    ((chosen-instrument
-      (begin
-        (format #t "\nPrinting keys for: ~a\n" instrument)
-        (assoc-get instrument woodwind-data-alist)))
-   (key-list (list-all-possible-keys (assoc-get 'keys chosen-instrument))))
-  (define (key-list-loop key-list)
-    (if (null? key-list)
-      0
-      (begin
-        (format #t "~a\n   ~a\n" (caar key-list) (cdar key-list))
-        (key-list-loop (cdr key-list)))))
-  (key-list-loop key-list)))
+(define*-public (print-keys instrument #:optional (port (current-output-port)))
+  (format port "\nPrinting keys for: ~a\n" instrument)
+  (let ((chosen-instrument (assoc-get instrument woodwind-data-alist)))
+    (do        ((key-list
+         (list-all-possible-keys (assoc-get 'keys chosen-instrument))
+         (cdr key-list)))
+       ((null? key-list))
+      (format port "~a\n   ~a\n" (caar key-list) (cdar key-list)))))
 
 (define-public (get-woodwind-key-list instrument)
   (list-all-possible-keys-verbose
       'keys
       (assoc-get instrument woodwind-data-alist))))
 
-(define-public (print-keys-verbose instrument)
-  (let*
-    ((chosen-instrument
-      (begin
-        (format #t "\nPrinting keys in verbose mode for: ~a\n" instrument)
-        (assoc-get instrument woodwind-data-alist)))
-   (key-list
-     (list-all-possible-keys-verbose (assoc-get 'keys chosen-instrument))))
-  (define (key-list-loop key-list)
-    (if (null? key-list)
-      0
-      (begin
-        (format #t "~a\n" (caar key-list))
-        (map (lambda (x)
-               (format #t "   possibilities for ~a:\n      ~a\n" (car x) (cdr x)))
-             (cdar key-list))
-        (key-list-loop (cdr key-list)))))
-  (key-list-loop key-list)))
+(define*-public (print-keys-verbose instrument
+                                   #:optional (port (current-output-port)))
+  (format port "\nPrinting keys in verbose mode for: ~a\n" instrument)
+  (do ((key-list (get-woodwind-key-list instrument)
+                (cdr key-list)))
+      ((null? key-list))
+    (format port "~a\n" (caar key-list))
+    (for-each
+     (lambda (x)
+       (format port "   possibilities for ~a:\n      ~a\n" (car x) (cdr x)))
+     (cdar key-list))))
 
 (define-markup-command
   (woodwind-diagram layout props instrument user-draw-commands)
   "Make a woodwind-instrument diagram.  For example, say
 
 @example
-\\markup \\woodwind-diagram #'oboe #'((lh . (d ees)) (cc . (five3qT1q)) (rh . (gis)))
+\\markup \\woodwind-diagram
+  #'oboe #'((lh . (d ees)) (cc . (five3qT1q)) (rh . (gis)))
 @end example
 
 @noindent
@@ -1944,7 +1934,7 @@ and shut.  To see all of the possibilities for all of the keys of a given
 instrument, invoke @code{(print-keys-verbose 'instrument)}.
 
 Lastly, substituting an empty list for the pressed-key alist will result in
-a diagram with all of the keys drawn but none filled. ie...
+a diagram with all of the keys drawn but none filled, for example:
 
 @example
 \\markup \\woodwind-diagram #'oboe #'()