[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Fix #1507: Inconsistent \festival output in regression testing. (issue46
From: |
n . puttock |
Subject: |
Fix #1507: Inconsistent \festival output in regression testing. (issue4693046) |
Date: |
Tue, 12 Jul 2011 21:48:03 +0000 |
Reviewers: ,
Description:
Fix #1507: Inconsistent \festival output in regression testing.
* input/regression/song-skip-noword.ly
reset *skip-word* to default at end of file to prevent override
leaking
into other regression tests
* ly/festival.ly (festivalsyl):
use paramaterize to set *syllabify* and limit its scope locally to the
music function's body
* scm/song.scm:
make global configuration variables srfi-39 paramaters
Please review this at http://codereview.appspot.com/4693046/
Affected files:
M input/regression/song-skip-noword.ly
M ly/festival.ly
M scm/song.scm
Index: input/regression/song-skip-noword.ly
diff --git a/input/regression/song-skip-noword.ly
b/input/regression/song-skip-noword.ly
index
b683410d5f3a09b8e12910093df95473ed6fbc08..267e20588f427eac0127a1425d1d08d60dbc85da
100644
--- a/input/regression/song-skip-noword.ly
+++ b/input/regression/song-skip-noword.ly
@@ -1,17 +1,20 @@
\version "2.14.0"
\header {
- texidoc="Festival song synthesis output supports
+ texidoc = "Festival song synthesis output supports
lyrics which are not complete words.
"
}
\include "festival.ly"
-#(set! *skip-word* #f)
+#(*skip-word* #f)
\festival #"song-skip-noword.xml" { \tempo 4 = 100 }
-\relative c' { c c g' }
+\relative c' { c4 c g' }
\addlyrics {
twin -- \skip 4
kle
}
+
#(ly:progress "song-skip-noword")
#(ly:progress "~a" (ly:gulp-file "song-skip-noword.xml"))
+
+#(*skip-word* "-skip-")
Index: ly/festival.ly
diff --git a/ly/festival.ly b/ly/festival.ly
index
cbe88d67c847b1acb51cefe7006e3bb349f51fa4..fa4910628fa60470ba8c7fb1bd2d24d74759d533
100644
--- a/ly/festival.ly
+++ b/ly/festival.ly
@@ -1,3 +1,5 @@
+%%%% -*- Mode: Scheme -*-
+
%%%% Festival singing mode output
%%%% This file is part of LilyPond, the GNU music typesetter.
%%%%
@@ -20,16 +22,19 @@
\version "2.14.0"
#(use-modules (scm song))
+#(use-modules (srfi srfi-39))
% \festival #"filename" { \tempo N = X } { music }
festival =
-#(define-music-function (parser location filename tempo music) (string?
ly:music? ly:music?)
- (output-file music tempo filename)
- music)
+#(define-music-function (parser location filename tempo music)
+ (string? ly:music? ly:music?)
+ (output-file music tempo filename)
+ music)
% \festivalsyl #"filename" { \tempo N = X } { music }
festivalsyl =
-#(define-music-function (parser location filename tempo music) (string?
ly:music? ly:music?)
- (set! *syllabify* #t)
- (output-file music tempo filename)
- music)
+#(define-music-function (parser location filename tempo music)
+ (string? ly:music? ly:music?)
+ (parameterize ((*syllabify* #t))
+ (output-file music tempo filename))
+ music)
Index: scm/song.scm
diff --git a/scm/song.scm b/scm/song.scm
index
9dbca9fd6286d7c1c8204075840737c8e4d287fc..9655e321e49afe05c00a48361d2d8f8fc3bbc608
100644
--- a/scm/song.scm
+++ b/scm/song.scm
@@ -19,14 +19,13 @@
;;;; along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
-(define-module (scm song))
-
-(use-modules (srfi srfi-1))
-(use-modules (ice-9 optargs))
-(use-modules (ice-9 receive))
-
-(use-modules (lily))
-(use-modules (scm song-util))
+(define-module (scm song)
+ #:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-39)
+ #:use-module (ice-9 optargs)
+ #:use-module (ice-9 receive)
+ #:use-module (lily)
+ #:use-module (scm song-util))
;;; Configuration
@@ -34,23 +33,23 @@
;; The word to be sung in places where notes are played without lyrics.
;; If it is #f, the places without lyrics are omitted on the output.
-(define-public *skip-word* "-skip-")
+(define-public *skip-word* (make-parameter "-skip-"))
;; If true, use syllables in the Festival XML file.
;; If false, use whole words instead; this is necessary in languages like
;; English, were the phonetic form cannot be deduced from syllables well
enough.
-(define-public *syllabify* #f)
+(define-public *syllabify* (make-parameter #f))
;; Base Festival octave to which LilyPond notes are mapped.
-(define-public *base-octave* 5)
+(define-public *base-octave* (make-parameter 5))
;; The resulting base octave is sum of *base-octave* and
;; *base-octave-shift*. This is done to work around a Festival bug
;; causing Festival to segfault or produce invalid pitch on higher pitches.
;(define *base-octave-shift* -2)
-(define *base-octave-shift* 0)
+(define *base-octave-shift* (make-parameter 0))
;; The coeficient by which the notes just before \breath are shortened.
-(define-public *breathe-shortage* 0.8)
+(define-public *breathe-shortage* (make-parameter 0.8))
;;; LilyPond interface
@@ -162,7 +161,7 @@
(set! *default-tempo* (property-value
(find-child tempo-spec (lambda (elt)
(music-property? elt
'tempoWholesPerMinute)))))
- (round (* tempo (expt 2 (+ 2 *base-octave-shift*)))))))
+ (round (* tempo (expt 2 (+ 2 (*base-octave-shift*))))))))
(defstruct music-context
music
@@ -220,7 +219,7 @@
(push! (make-lyrics
#:text (ly:music-property lyric-event 'text)
#:duration (* (duration->number (ly:music-property
lyric-event 'duration)) 4)
- #:unfinished (and (not *syllabify*)
(find-child-named music 'HyphenEvent))
+ #:unfinished (and (not (*syllabify*))
(find-child-named music 'HyphenEvent))
#:ignore-melismata ignore-melismata
#:context current-voice)
lyrics-list))
@@ -393,9 +392,9 @@
((music-name? music 'BreathingEvent)
(if last-note-spec
(let* ((note-duration (note-duration last-note-spec))
- (rest-spec (make-rest #:duration (* note-duration (- 1
*breathe-shortage*))
+ (rest-spec (make-rest #:duration (* note-duration (- 1
(*breathe-shortage*)))
#:origin (ly:music-property
music 'origin))))
- (set-note-duration! last-note-spec (* note-duration
*breathe-shortage*))
+ (set-note-duration! last-note-spec (* note-duration
(*breathe-shortage*)))
(add! (make-score-notes #:note/rest-list (list rest-spec))
result-list))
(warning music "\\\\breathe without previous note known")))
;; anything else
@@ -603,7 +602,7 @@
last-verse
(append (verse-notelist/rests last-verse) (list
notelist/rest))))))
((pair? notelist/rest)
- (add! (make-verse #:text *skip-word* #:notelist/rests
(list notelist/rest))
+ (add! (make-verse #:text (*skip-word*) #:notelist/rests
(list notelist/rest))
verse-list))
(else
(error "Unreachable branch reached")))
@@ -662,7 +661,7 @@
((< duration (- epsilon))
(warning (if (null? note-list) (safe-last consumed) (safe-car
note-list))
"Skip misalignment: ~a ~a ~a ~a" context skip duration
consumed)))
- (values (if *skip-word*
+ (values (if (*skip-word*)
consumed
'())
note-list)))
@@ -784,7 +783,7 @@
(octave (inexact->exact (floor (/ semitones 12))))
(tone (modulo semitones 12)))
(format #f "~a~a" (car (assoc-get tone festival-note-mapping))
- (+ octave *base-octave* *base-octave-shift*))))
+ (+ octave (*base-octave*) (*base-octave-shift*)))))
(define (write-header port tempo)
(let ((beats (or (tempo->beats tempo) 100)))
- Fix #1507: Inconsistent \festival output in regression testing. (issue4693046),
n . puttock <=