return ly_rational2scm (q);
}
-LY_DEFINE (pitch_notename, "ly:pitch-notename",
+LY_DEFINE (ly_pitch_notename, "ly:pitch-notename",
1, 0, 0, (SCM pp),
"Extract the note name from pitch @var{pp}.")
{
return scm_from_int (q);
}
+LY_DEFINE (ly_pitch_tones, "ly:pitch-tones",
+ 1, 0, 0, (SCM pp),
+ "Calculate the number of tones of@tie{}@var{pp} from"
+ " middle@tie{}C as a rational number.")
+{
+ LY_ASSERT_SMOB (Pitch, pp, 1);
+ return ly_rational2scm (unsmob_pitch (pp)->tone_pitch ());
+}
+
+
LY_DEFINE (ly_pitch_quartertones, "ly:pitch-quartertones",
1, 0, 0, (SCM pp),
"Calculate the number of quarter tones of@tie{}@var{pp} from"
(left-pitch (ly:event-property (event-cause left-bound) 'pitch))
(right-pitch (ly:event-property (event-cause right-bound) 'pitch)))
- (if (< (ly:pitch-semitones right-pitch) (ly:pitch-semitones left-pitch))
+ (if (< (ly:pitch-tones right-pitch) (ly:pitch-tones left-pitch))
-0.75
0.75)))
(define (calc-fret pitch string tuning)
"Calculate the fret to play @var{pitch} on @var{string} with
@var{tuning}."
- (- (ly:pitch-semitones pitch) (ly:pitch-semitones (list-ref tuning (1- string)))))
+ (* 2 (- (ly:pitch-tones pitch) (ly:pitch-tones (list-ref tuning (1- string))))))
(define (note-pitch note)
"Get the pitch (in semitones) from @var{note}."
(and (or (and (not restrain-open-strings)
(eq? fret 0))
(>= fret minimum-fret))
+ (integer? fret)
(close-enough fret))))
(define (open-string string pitch)
tuning)))
(if (< this-fret 0)
(ly:warning (_ "Negative fret for pitch ~a on string ~a")
- (car pitch-entry) string))
+ (car pitch-entry) string)
+ (if (not (integer? this-fret))
+ (ly:warning (_ "Missing fret for pitch ~a on string ~a")
+ (car pitch-entry) string)))
(delete-free-string string)
(set! specified-frets (cons this-fret specified-frets))
(list-set! string-fret-fingers
(ly:context-property context
'handleNegativeFrets
'recalculate)))
- (cond ((or (>= this-fret 0)
+ (cond ((or (and (>= this-fret 0) (integer? this-fret))
(eq? handle-negative 'include))
(set-fret! pitch-entry string finger))
((eq? handle-negative 'recalculate)