]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/chord-ignatzek-names.scm
* scripts/lilypond-book.py (do_file): do not overwrite input file.
[lilypond.git] / scm / chord-ignatzek-names.scm
index 3e19987611e7e438bb45489bf1cfb4e0ff9448d0..26fa220e8f78068ecc6ccd73b0ebaba9692562bd 100644 (file)
@@ -1,9 +1,10 @@
 ;;;
-;;; chord-name.scm --  chord name utility functions
+;;; chord-ignatzek-names.scm --  chord name utility functions
 ;;;
 ;;; source file of the GNU LilyPond music typesetter
 ;;; 
-;;; (c)  2000--2003  Han-Wen Nienhuys <hanwen@cs.uu.nl>
+;;; (c)  2000--2004  Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
            ps)
        ))
   
-  (define name-root (ly:get-context-property context 'chordRootNamer))
+  (define name-root (ly:context-property context 'chordRootNamer))
   (define name-note 
-    (let ((nn (ly:get-context-property context 'chordNoteNamer)))
+    (let ((nn (ly:context-property context 'chordNoteNamer)))
       (if (eq? nn '())
          ; replacing the next line with name-root gives guile-error...? -rz
 
          ;; apparently sequence of defines is equivalent to let, not let* ? -hwn
-         (ly:get-context-property context 'chordRootNamer)       
+         (ly:context-property context 'chordRootNamer)   
          ;; name-root
          nn)))
 
@@ -136,7 +137,7 @@ work than classifying the pitches."
     
     (define (prefix-modifier->markup mod)
       (if (and (= 3 (pitch-step mod))
-              (= -1 (ly:pitch-alteration mod)))
+              (= FLAT (ly:pitch-alteration mod)))
          (make-simple-markup "m")
          (make-simple-markup "huh")
          ))
@@ -176,7 +177,7 @@ work than classifying the pitches."
           (args (list num-markup))
           (total (if (= (ly:pitch-alteration pitch) 0)
                      (if (= (pitch-step pitch) 7)
-                         (list (ly:get-context-property context 'majorSevenSymbol))
+                         (list (ly:context-property context 'majorSevenSymbol))
                          args)
                      (cons (accidental->markup (step-alteration pitch)) args)
                      ))
@@ -186,7 +187,7 @@ work than classifying the pitches."
 
     (let*
        (
-        (sep (ly:get-context-property context 'chordNameSeparator))
+        (sep (ly:context-property context 'chordNameSeparator))
         (root-markup (name-root root))
         (add-markups (map (lambda (x)
                             (glue-word-to-step "add" x))
@@ -202,7 +203,7 @@ work than classifying the pitches."
                               alterations
                               suffixes
                               add-markups) sep))
-        (base-stuff (if bass-pitch
+        (base-stuff (if (ly:pitch? bass-pitch)
                         (list sep (name-note bass-pitch))
                         '()))
         )
@@ -213,28 +214,44 @@ work than classifying the pitches."
                   (markup-join prefixes sep)
                   (make-super-markup to-be-raised-stuff))
             base-stuff))
-      (make-line-markup       base-stuff)
+      (make-line-markup base-stuff)
 
        ))
 
+  (define (ignatzek-format-exception
+          root
+          exception-markup
+          bass-pitch)
+
+      (make-line-markup
+       `(
+       ,(name-root root)
+       ,exception-markup
+       . 
+       ,(if (ly:pitch? bass-pitch)
+           (list (ly:context-property context 'chordNameSeparator)
+                 (name-note bass-pitch))
+          '()))))
+
   (let*
       (
        (root (car in-pitches))
        (pitches (map (lambda (x) (ly:pitch-diff x root)) (cdr in-pitches)))
-       (exceptions (ly:get-context-property context 'chordNameExceptions))
+       (exceptions (ly:context-property context 'chordNameExceptions))
        (exception (assoc-get-default pitches exceptions #f))
        (prefixes '())
        (suffixes '())
        (add-steps '())
        (main-name #f)
-       (bass-note #f)
+       (bass-note
+       (if (ly:pitch? inversion)
+           inversion
+           bass))
        (alterations '())
        )
-
-    (if
-     exception
-     (make-line-markup
-      (list (name-root root) exception))
+   
+    (if exception
+     (ignatzek-format-exception  root exception bass-note)
      
      (begin                            ; no exception.
        
@@ -256,9 +273,8 @@ work than classifying the pitches."
 
        ;; do minor-3rd modifier.
        (if (and (get-step 3 pitches)
-               (= (ly:pitch-alteration (get-step 3 pitches)) -1))
-          (set! prefixes (cons (get-step 3 pitches) prefixes))
-          )
+               (= (ly:pitch-alteration (get-step 3 pitches)) FLAT))
+          (set! prefixes (cons (get-step 3 pitches) prefixes)))
        
        ;; lazy bum. Should write loop.
        (cond
@@ -280,13 +296,6 @@ work than classifying the pitches."
         (set! alterations (delq main-name alterations))
         (set! add-steps (delq main-name add-steps))
 
-        (if (ly:pitch? inversion)
-            (set! bass-note inversion)
-            )
-        
-        (if (ly:pitch? bass)
-            (set! bass-note bass)
-            )
 
         ;; chords with natural (5 7 9 11 13) or leading subsequence.
         ;; etc. are named by the top pitch, without any further
@@ -302,8 +311,9 @@ work than classifying the pitches."
               (set! main-name (last alterations))
               (set! alterations '())
               ))
-        
+
         (ignatzek-format-chord-name root prefixes main-name alterations add-steps suffixes bass-note)
-        )
-       ))))
+        )))
+       ))
+