From 15d1d60a7ce123baa47f1b7fc37267872dfa99ad Mon Sep 17 00:00:00 2001 From: Valentin Villenave Date: Wed, 29 Oct 2008 16:32:57 +0100 Subject: [PATCH] New TextSpanners implementation --- definitions/functions.ly | 32 ++++++++++++++++++++++++++++++-- definitions/mesures.ly | 23 ++++++++++------------- instruments/percu.ly | 12 ++++++------ 3 files changed, 46 insertions(+), 21 deletions(-) diff --git a/definitions/functions.ly b/definitions/functions.ly index 5bc9256..face345 100755 --- a/definitions/functions.ly +++ b/definitions/functions.ly @@ -425,6 +425,8 @@ meno = (list (make-music 'TextSpanEvent 'span-direction t)))) music) + +%% The two following functions are deprecated. Better code follows below. startTxt = #(define-music-function (parser location texte music ) (string? ly:music?) #{ \override TextSpanner #'bound-details #'left #'text = @@ -432,9 +434,35 @@ startTxt = $(make-text-span music -1)#}) stopTxt = -#(define-music-function (parser location music ) (ly:music?) +#(define-music-function (parser location) () (make-text-span music 1)) - + +#(define (make-text-span txt) +"Make a TextSpanner that begins with the given STR." + (let* ((m (make-music 'TextSpanEvent + 'span-direction -1)) + (details (cdr (assoc 'bound-details + (cdr (assoc 'TextSpanner + all-grob-descriptions))))) + (left-details (cdr (assoc 'left + details)))) + (ly:music-set-property! m 'tweaks + (acons 'bound-details + (acons 'left + (acons 'text txt + left-details) + details) + (ly:music-property m 'tweaks))) + m)) + +startText= +#(define-music-function (location parser txt) (string?) +(make-text-span txt)) + +stopText= #(make-music 'TextSpanEvent 'span-direction 1) + +rit = #(make-text-span "rit.") + %% Tempo indications ----------------------------------------------% #(define-markup-command (mvt layout props arg) (markup?) (interpret-markup layout props diff --git a/definitions/mesures.ly b/definitions/mesures.ly index f985622..675c1c5 100755 --- a/definitions/mesures.ly +++ b/definitions/mesures.ly @@ -12,7 +12,8 @@ PrologueMesures = { \time 3/4 \mark \markup \init-did \PrologueAAA - \partial 4 s4 R2.*3 + \partial 4 s4 + R2.*3 \time 4/4 R1 \bar "||" \time 2/4 \tempo "Largo" 4 = 48 @@ -48,11 +49,9 @@ PrologueMesures = { \time 3/4 R2. \time 2/4 \mark \markup \did \PrologueE - r2 %FIXME: replace with MmRest? - \startTxt #"rit." - R2 - \time 3/4 R2. - \stopTxt \bar "||" + R2*2\rit + \time 3/4 R2.\stopText + \bar "||" \time 2/4 \mark \markup \did \PrologueF \tempo "Tempo giusto" @@ -87,8 +86,7 @@ PrologueMesures = { R4. \bar"||" \tempo "Andantino" 4. = 56 R4.*25 - %FIXME: doesn't work. - \startTxt #"Poco a poco allargando..." + \startText #"Poco a poco allargando..." R4.*9 r8 \mark \markup \did \PrologueL @@ -330,14 +328,13 @@ ActeUnSceneUnBisMesures = { R2.*5 \mark \markup \did \ActeUnSceneUnBisB R2. - \startTxt #"molto rit." - R2. - R2. + \startText #"molto rit." + R2.*2 \stopTxt \mark \markup \did \ActeUnSceneUnBisC \tempo "A Tempo" R2. - \startTxt #"molto rit." + \startText #"molto rit." R2. \time 4/4 \stopTxt @@ -983,7 +980,7 @@ ActeDeuxSceneUnBisMesures = { \mark \markup \did \ActeDeuxSceneUnBisF R1*5/4*16 \mark \markup \did \ActeDeuxSceneUnBisG - \startTxt #"molto rit." + \startText #"molto rit." r1*5/4 %FIXME R1*5/4 r1 diff --git a/instruments/percu.ly b/instruments/percu.ly index 5ccb3e7..b69cf66 100755 --- a/instruments/percu.ly +++ b/instruments/percu.ly @@ -42,7 +42,7 @@ Timbales = { ProloguePercus = << \new Staff { \Marimba \relative { - mi''4 r r8 mi r4 | r8 mi r4 r16 mi8. | + \ind #"bag. dures" mi''4 r r8 mi r4 | r8 mi r4 r16 mi8. | mi8 mi \t { mi mi mi } \tt {mi16 mi mi mi mi} | mi4 r2. | R2*2 R2. R2*2 R2. R2*2 R2. R2*2 R2. } @@ -50,7 +50,7 @@ ProloguePercus = << \new DrumStaff { \Percus \new DrumVoice \drummode { \partial 4 r4 R2.*3 R1 - \ind #"Gong" cb2 \laissezVibrer | R2 | + \ind #"Tam-tam" cb2 \laissezVibrer | R2 | } } \new Staff { \Timbales @@ -80,7 +80,7 @@ ActeUnSceneUnBisPercus = << \new DrumVoice \drummode { R2.*7 R1 R2. R1 R2.*10 R1*2 R2 R2*3 R2. R2 R2. R2 R2.*2 - r2 r4 \ind #"Tambour" sn | + r2 r4 \ind #"Tambour" \ind #"(bag. fagot)" sn | sn32 sn8.. r4 r8.. sn32 sn8.. sn32 | sn4 r2 R2 R1 R2.*2 R2*2 @@ -158,7 +158,7 @@ ActeUnSceneDeuxPercus = {\Marimba ActeUnSceneTroisPercus = << \new DrumStaff { \Percus \new DrumVoice \drummode { - \ind #"Tambour" sn2.:32~sn8 \t {sn16 sn sn} sn2:32~ sn2.: + \ind #"Tambour" \ind #"(bag. fagot)" sn2.:32~sn8 \t {sn16 sn sn} sn2:32~ sn2.: sn8 \t {sn16 sn sn} sn8 \t{sn16 sn sn} sn4:32 sn8 sn4 sn8 sn4 | sn8 \t {sn16 sn sn} sn8 sn4 sn8 sn2.:32 R2.*4 | sn4:32 sn4 r | @@ -427,7 +427,7 @@ ActeUnSceneQuatrePercus = << %%% Piu lento %%% R2.*21 R1. r2 hh4:32 r4 | R1. r4 hh2:32 hh4 | R1. - r4 r8 r16 \ind #"Tambour" sn sn4 r | + r4 r8 r16 \ind #"Tambour" \ind #"(bag. fagot)" sn sn4 r | R1. R1 R1. R1 sn4 r r2 r4 r8 sn16 sn | sn4 r r2 r4 r8 \t {sn16 sn sn} | sn4 r r2 r8 sn16 sn sn8 sn | @@ -707,7 +707,7 @@ ActeDeuxSceneDeuxPercus = << R2. R1 R2. R1 R2. R1 R2. R2*2 R2 R2. R1*3 - r4 \ind #"Tambour" sn8 sn sn sn4 r8 sn sn | + r4 \ind #"Tambour" \ind #"(bag. fagot)" sn8 sn sn sn4 r8 sn sn | sn4 sn8 sn sn sn4 r8 sn sn | sn4 sn8 sn16 sn sn sn | sn4 sn r16 sn32 sn | sn4 r r8 | sn4 r8 sn sn | sn4 sn8 sn sn | sn4 sn r16 sn32 sn | sn4 r r8 | -- 2.11.4.GIT