;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; note heads
-(define-public (note-head::calc-duration-log grob)
+
+(define-public (stem::calc-duration-log grob)
(ly:duration-log
(ly:event-property (event-cause grob) 'duration)))
+(define-public (note-head::calc-duration-log grob)
+ (min 2
+ (ly:duration-log
+ (ly:event-property (event-cause grob) 'duration))))
+
(define-public (dots::calc-dot-count grob)
(ly:duration-dot-count
(ly:event-property (event-cause grob) 'duration)))
(if (> digit 5)
(ly:input-message (ly:event-property event 'origin)
- "Music for the martians"))
+ "Warning: Fingering notation for finger number ~a" digit))
(number->string digit 10)
))
(number->string digit 10)
))
-(define-public (string-finger::calc-text grob)
+
+(define-public (stroke-finger::calc-text grob)
(let*
- ((digit (ly:event-property (event-cause grob) 'digit))
- (texts (ly:grob-property grob 'digit-names)))
- (vector-ref texts (1- (max (min 5 digit) 1)))
- ))
+ ((digit (ly:event-property (event-cause grob) 'digit))
+ (text (ly:event-property (event-cause grob) 'text)))
+
+ (if (string? text)
+ text
+ (vector-ref (ly:grob-property grob 'digit-names) (1- (max (min 5 digit) 1))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; dynamics
(make-tied-lyric-markup text)
text))))
-(define-public (lyric-text::calc-text grob)
- (ly:event-property (event-cause grob) 'text))
+(define-public ((grob::calc-property-by-copy prop) grob)
+ (ly:event-property (event-cause grob) prop))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; fret boards
+
+(define (string-frets->description string-frets string-count)
+ (let*
+ ((desc (list->vector
+ (map (lambda (x) (list 'mute (1+ x)))
+ (iota string-count)))))
+
+ (for-each (lambda (sf)
+ (let*
+ ((string (car sf))
+ (fret (cadr sf))
+ (finger (caddr sf)))
+
+
+ (vector-set! desc (1- string)
+ (if (= 0 fret)
+ (list 'open string)
+ (if finger
+ (list 'place-fret string fret finger)
+ (list 'place-fret string fret))
+
+
+ ))
+ ))
+ string-frets)
+
+ (vector->list desc)))
+
+(define-public (fret-board::calc-stencil grob)
+ (let* ((string-frets (ly:grob-property grob 'string-fret-finger-combinations))
+ (string-count (ly:grob-property grob 'string-count))
+ (layout (ly:grob-layout grob))
+ (defs (ly:output-def-lookup layout 'text-font-defaults))
+ (props (ly:grob-alist-chain grob defs)))
+
+ (make-fret-diagram layout props
+ (string-frets->description string-frets 6))))