]> git.donarmstrong.com Git - lilypond.git/commitdiff
Ignore impossible notes in calculated fretboards
authorCarl Sorensen <c_sorensen@byu.edu>
Thu, 26 May 2011 22:46:39 +0000 (16:46 -0600)
committerCarl Sorensen <c_sorensen@byu.edu>
Fri, 27 May 2011 04:09:25 +0000 (22:09 -0600)
scm/translation-functions.scm

index cc54dc849ce4f37e525b11597316942cdc679d95..94862688fdb522ec369130ae485000983bafc582 100644 (file)
@@ -355,6 +355,9 @@ the current tuning?"
                    (cdr pitch-entry)
                    (list string this-fret finger))))
 
+    (define (kill-note! string-fret-fingers note-index)
+      (list-set! string-fret-fingers note-index (list #f #t)))
+
     (define string-fret-fingers
              (map (lambda (string finger)
                     (if (null? finger)
@@ -426,9 +429,8 @@ the current tuning?"
                                  string
                                  pitch)
                               (ly:warning (_ "Ignoring note in tablature."))
-                               (list-set! string-fret-fingers
-                                          (cdr pitch-entry)
-                                          (list #f #t))))))))))
+                               (kill-note! string-fret-fingers
+                                           (cdr pitch-entry))))))))))
         pitch-alist string-fret-fingers)
     ;; handle notes without strings assigned -- sorted by pitch, so
     ;; we need to use the alist to have the note number available
@@ -448,9 +450,12 @@ the current tuning?"
           (if (not (list-ref string-fret-finger 1))
              (if fit-string
                   (set-fret! pitch-entry fit-string finger)
-                 (ly:warning (_ "No string for pitch ~a (given frets ~a)")
-                             pitch
-                              specified-frets)))))
+                 (begin
+                    (ly:warning (_ "No string for pitch ~a (given frets ~a)")
+                               pitch
+                                specified-frets)
+                    (kill-note! string-fret-fingers
+                                (cdr pitch-entry)))))))
       (sort pitch-alist (lambda (pitch-entry-a pitch-entry-b)
                           (ly:pitch<? (car pitch-entry-b)
                                       (car pitch-entry-a)))))
@@ -524,7 +529,10 @@ chords.  Returns a placement-list."
                 string-frets
                 (create-fretboard
                  context grob (string-frets->placement-list
-                                string-frets string-count))))
+                                (filter (lambda (entry)
+                                          (car entry))
+                                        string-frets)
+                                string-count))))
          (if (null? grob)
              (placement-list->string-frets predefined-fretboard)
              (create-fretboard context grob predefined-fretboard)))))