From 70ce2535fede040193d9c2afbfcb5ec6253da8f3 Mon Sep 17 00:00:00 2001 From: Rune Zedeler Date: Sun, 20 Apr 2003 21:29:38 +0000 Subject: [PATCH] *** empty log message *** --- ChangeLog | 10 +++++ Documentation/user/refman.itely | 8 +++- aclocal.m4 | 3 -- input/test/chord-names-german.ly | 12 +++--- lily/chord-name-engraver.cc | 2 +- ly/engraver-init.ly | 1 + scm/chords-ignatzek.scm | 49 +++++++++++++++++++------ scm/translator-property-description.scm | 5 ++- 8 files changed, 68 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index 744671a493..bd35b8d849 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2003-04-20 Rune Zedeler + + * input/test/chord-names-german.ly: modified. + + * scm/chords-ignatzek.scm: + chord-name->german-markup: Added + note-name->german-markup: Changed (now producing lowercase notenames) + + * lily/chord-name-engraver.cc: Reads property chordNoteNamer + 2003-04-20 Han-Wen Nienhuys * ly/german-chords-init.ly: remove file diff --git a/Documentation/user/refman.itely b/Documentation/user/refman.itely index 7fe70a71ed..e97f573aa6 100644 --- a/Documentation/user/refman.itely +++ b/Documentation/user/refman.itely @@ -3289,8 +3289,14 @@ The root of a chord is usually printed as a letter with an optional alteration. The transformation from pitch to letter is done by this function. An application of setting this function, is providing chord names with german notation for the root. -@end table +@item chordNoteNamer +The default is to print single notes (as for instance the bass note) +using the chordRootNamer. However, by setting this function to a non-null +value you can specify a different function. I.e. you could use letters +in lower case for the base note. + +@end table @seealso diff --git a/aclocal.m4 b/aclocal.m4 index c1f4aee49b..eae65025b5 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,7 +1,4 @@ dnl aclocal.m4 -*-shell-script-*- -dnl WARNING WARNING WARNING -dnl do not edit! this is aclocal.m4, generated from /home/hanwen/usr/src/lilypond/stepmake/aclocal.m4 -dnl aclocal.m4 -*-shell-script-*- dnl StepMake subroutines for configure.in diff --git a/input/test/chord-names-german.ly b/input/test/chord-names-german.ly index 9d883cddfd..e0d155adec 100644 --- a/input/test/chord-names-german.ly +++ b/input/test/chord-names-german.ly @@ -1,5 +1,5 @@ -\version "1.7.16" +\version "1.7.17" \header { texidoc = "By setting @code{ChordNames.chordRootNamer}, the root @@ -7,12 +7,14 @@ } -scm = \chords { c4 b bes } +scm = \chords { c4/c cis/cis cisis/cisis ces/ces ceses/ceses b/b bis/bis bes/bes beses/beses } \score { - < \context ChordNames \chords < - \property ChordNames. chordRootNamer = #note-name->german-markup + % #t gives true german chord-names + % #f gives semi-german chord-names - + % - with Bb and below keeping the english names + \property ChordNames. chordRootNamer = #(chord-name->german-markup #f) + \property ChordNames. chordNoteNamer = #note-name->german-markup \scm > \context Voice \scm > -\paper { raggedright = ##t } } diff --git a/lily/chord-name-engraver.cc b/lily/chord-name-engraver.cc index 28f9cf803f..bc3c882f38 100644 --- a/lily/chord-name-engraver.cc +++ b/lily/chord-name-engraver.cc @@ -153,5 +153,5 @@ ENTER_DESCRIPTION(Chord_name_engraver, /* accepts */ "note-event", /* acks */ "", /* reads */ "chordChanges chordNameExceptions chordNameFunction " -"chordRootNamer chordNameExceptions majorSevenSymbol", +"chordNoteNamer chordRootNamer chordNameExceptions majorSevenSymbol", /* write */ ""); diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly index 0a2fc103ab..3e930cc84e 100644 --- a/ly/engraver-init.ly +++ b/ly/engraver-init.ly @@ -441,6 +441,7 @@ ScoreContext = \translator { majorSevenSymbol = #whiteTriangleMarkup chordNameSeparator = #(make-simple-markup "/") chordNameExceptions = #ignatzekExceptions + chordNoteNamer = #'() chordRootNamer = #note-name->markup %% tablature: diff --git a/scm/chords-ignatzek.scm b/scm/chords-ignatzek.scm index f0b4599c61..c247c90340 100644 --- a/scm/chords-ignatzek.scm +++ b/scm/chords-ignatzek.scm @@ -34,16 +34,37 @@ (accidental->markup (ly:pitch-alteration pitch)))))) -(define-public (note-name->german-markup pitch) - "Return pitch markup for PITCH, using german note names." - (make-line-markup - (list - (make-simple-markup - (vector-ref #("C" "D" "E" "F" "G" "A" "H") (ly:pitch-notename pitch))) - (make-normal-size-super-markup - (accidental->markup (ly:pitch-alteration pitch)))))) - - +(define-public ((chord-name->german-markup B-instead-of-Bb) pitch) + "Return pitch markup for PITCH, using german note names. + If B-instead-of-Bb is set to #t real german names are returned. + Otherwise semi-german names (with Bb and below keeping the british names) +" + (let* ((name (ly:pitch-notename pitch)) + (alt (ly:pitch-alteration pitch)) + (n-a (if (member (cons name alt) '((6 . -1) (6 . -2))) + (cons 7 (+ (if B-instead-of-Bb 1 0) alt)) + (cons name alt)))) + (make-line-markup + (list + (make-simple-markup + (vector-ref #("C" "D" "E" "F" "G" "A" "H" "B") (car n-a))) + (make-normal-size-super-markup + (accidental->markup (cdr n-a))))))) + + +(define-public (note-name->german-markup pitch) + (let* ((name (ly:pitch-notename pitch)) + (alt (ly:pitch-alteration pitch)) + (n-a (if (member (cons name alt) '((6 . -1) (6 . -2))) + (cons 7 (+ 1 alt)) + (cons name alt)))) + (make-line-markup + (list + (string-append + (list-ref '("c" "d" "e" "f" "g" "a" "h" "b") (car n-a)) + (if (or (equal? (car n-a) 2) (equal? (car n-a) 5)) + (list-ref '( "ses" "s" "" "is" "isis") (+ 2 (cdr n-a))) + (list-ref '("eses" "es" "" "is" "isis") (+ 2 (cdr n-a))))))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; @@ -177,6 +198,12 @@ ) ) (define name-root (ly:get-context-property context 'chordRootNamer)) + (define name-note + (let ((nn (ly:get-context-property context 'chordNoteNamer))) + (if (eq? nn '()) + ; replacing the next line with name-root gives guile-error...? -rz + (ly:get-context-property context 'chordRootNamer) + nn))) (define (is-natural-alteration? p) (= (natural-chord-alteration p) (ly:pitch-alteration p)) @@ -290,7 +317,7 @@ work than classifying the pitches." suffixes add-markups) sep)) (base-stuff (if bass-pitch - (list sep (name-root bass-pitch)) + (list sep (name-note bass-pitch)) '())) ) diff --git a/scm/translator-property-description.scm b/scm/translator-property-description.scm index 79f57f5b46..a216f88c53 100644 --- a/scm/translator-property-description.scm +++ b/scm/translator-property-description.scm @@ -156,9 +156,12 @@ into one staff.") (translator-property-description 'chordNameFunction procedure? "The function that converts lists of pitches to chord names.") +(translator-property-description + 'chordNoteNamer procedure? + "Function that converts from a pitch object to a text markup. Used for single pitches.") (translator-property-description 'chordRootNamer procedure? - "Function that converts from a pitch object to a text markup.") + "Function that converts from a pitch object to a text markup. Used for chords.") (translator-property-description 'chordNameExceptions list? "Alist of chord exceptions. Contains (CHORD . MARKUP) entries.") -- 2.39.2