]> git.donarmstrong.com Git - lilypond.git/commitdiff
\applyMusic to music functions update, thanks to Michael Meixner.
authorGraham Percival <graham@percival-music.ca>
Wed, 7 Jun 2006 21:59:14 +0000 (21:59 +0000)
committerGraham Percival <graham@percival-music.ca>
Wed, 7 Jun 2006 21:59:14 +0000 (21:59 +0000)
ChangeLog
THANKS
input/test/add-staccato.ly
input/test/add-text-script.ly
input/test/music-box.ly
input/test/unfold-all-repeats.ly

index 5f5c2b58b837c9ec906c5089a88e32bfb3060d11..e51eb71e7ac65b14b5b0ff2e8df7d2678ae15a8f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-06-07  Graham Percival  <gpermus@gmail.com>
+
+       * input/test/ add-staccato.ly, add-text-script.ly,
+       unfold-all-repeats.ly, music-box.ly: \applyMusic to
+       music functions update, thanks to Michael Meixner.
+
 2006-06-07  Jan Nieuwenhuizen  <janneke@gnu.org>
 
        * SConstruct (LILYPONDPREFIX): Bootstrap fix.
diff --git a/THANKS b/THANKS
index dc1ba89fd6dd424a84a80c694ec7d473f0654c2f..c44741fb8ef8c7c4c91a9c2b00b6ef297449fd8b 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -54,6 +54,7 @@ J. Leung
 Harald Wellmann
 Karl Hammar
 Keith Packard
+Michael Meixner
 Orm Finnendahl
 Quentin Spencer
 Rick Hansen
index 3a8668c5b8e84da1c030105f0a69fbcf0ac8b6c3..45d61d4db1e13e9a68ecf55d7bbb6cbadc22a34c 100644 (file)
@@ -1,8 +1,7 @@
-
-\version "2.7.39"
+\version "2.9.7"
+\sourcefilename "add-staccato.ly"
 
 \header {
-
 texidoc= "@cindex Add Stacato
 Using @code{make-music}, you can add various stuff to notes. In this
 example staccato dots are added to the notes."
@@ -11,7 +10,7 @@ example staccato dots are added to the notes."
 #(define (make-script x)
    (make-music 'ArticulationEvent
                'articulation-type x))
-    
+
 #(define (add-script m x)
    (if
      (equal? (ly:music-property m 'name) 'EventChord)
@@ -23,11 +22,15 @@ example staccato dots are added to the notes."
 #(define (add-staccato m)
    (add-script m "staccato"))
 
+addStacc =
+#(define-music-function (parser location music) 
+                                       (ly:music?)
+               (music-map add-staccato music))    
+
 \score {
   \relative c'' {
-    a b \applyMusic #(lambda (x) (music-map add-staccato x)) { c c } 
+    a b \addStacc { c c } 
   }
   \layout{ ragged-right = ##t }
 }
 
-
index 12a0604cb3fabbbd9a1fd3bcb8ea52a843018605..6d66b21fe73d9f19d9e9e83725f1b0c400138810 100644 (file)
@@ -1,12 +1,10 @@
-\version "2.7.39"
+\version "2.9.7"
+\sourcefilename "add-text-script.ly"
 
 \header {
 texidoc= "@cindex make-music Fingering
 You can add various stuff to notes using @code{make-music}.
 In this example, an extra fingering is attached to a note. 
-
-In general, first do a @code{display} of the music you want to
-create, then write a function that will structure the music for you.
 "
 } 
 
@@ -14,7 +12,7 @@ create, then write a function that will structure the music for you.
    (make-music 'TextScriptEvent
                'direction DOWN
                'text (make-simple-markup x)))
-     
+
 #(define (add-text-script m x)
    (if (equal? (ly:music-property m 'name) 'EventChord)
        (set! (ly:music-property m 'elements)
@@ -27,9 +25,14 @@ create, then write a function that will structure the music for you.
             (add-text-script e x))))
    m)
 
+addScript =
+#(define-music-function (parser location script music )
+                                       ( string? ly:music? )
+               (add-text-script music script))
+
 \score {
-  \applyMusic #(lambda (x)  (add-text-script x "6") (display-music x) x )  { c'4-3 }
-       \layout{ ragged-right = ##t }
+  {
+    \addScript "6" { c'4-3 }
+  }
 }
 
-
index 4d11043f62cd9bb4d4b0309c9f25a8133e20f3c4..9d8fe6fabde65d37d6f46fc323a2dd7462ff09c7 100644 (file)
@@ -1,4 +1,6 @@
-\version "2.7.39"
+\version "2.9.7"
+\sourcefilename "music-box.ly"
+
 \include "deutsch.ly"
 % possible rename to scheme- something.  -gp
 % TODO: ask if it needs to have so many empty bars in the middle.  -gp
@@ -21,7 +23,7 @@ using Scheme functions to avoid typing work. " }
           (recurse (cdr elts))
         )))))
    music
-  )) 
+  ))
 
 #(define ((trans pitches) music)
   (let* ((es (ly:music-property music 'elements))
@@ -50,11 +52,6 @@ using Scheme functions to avoid typing work. " }
     music))
 
 
-
-
-
-\version "2.7.39"
-
 pat =  \transpose c c' \repeat unfold 2 {
   << { \context Staff = "up" {r8 e16 f g e f g } }
     { \context Staff = "down" <<
@@ -71,15 +68,21 @@ enda =  { r8 f,16 a, c f c a, \stemUp c \change Staff = down
 endb =  {\stemUp \tieUp r16 c,8.~c,4~c,2 r16 h,,8.~h,,4~h,,2 c,1 \bar "|."}
 endc =  {\stemDown \tieDown c,,2~c,, c,,~c,, c,,1_\fermata }
 
+
+prelude =
+#(define-music-function (parser location patterns) (ly:music?)
+                       (transform patterns))
+
+
 \score {
    \transpose c c' \context PianoStaff <<
        \new Staff = "up"   { \clef "G"  }
        \new Staff = "down" { \clef "F" }
-       { \applyMusic #transform {
+       { \prelude {
           \pat {c e g c' e' }
           \pat {c d a d' f' }
        }
-        
+       
 %{
                                %Etc.
 
@@ -121,7 +124,7 @@ endc =  {\stemDown \tieDown c,,2~c,, c,,~c,, c,,1_\fermata }
 %}
      }
    >>
-   
+
    \layout {
        \context {
           \PianoStaff
@@ -129,7 +132,7 @@ endc =  {\stemDown \tieDown c,,2~c,, c,,~c,, c,,1_\fermata }
        }
        line-width = 18.0 \cm
    }
-   
+
    \midi {
        \tempo 4 = 80
    }
index 522bb38ade4cecd458a5d4c6cc241b5bf21096cd..8c0f1ebbed46d9d6aa632380ba3ccd6b49f3e0b3 100644 (file)
@@ -1,11 +1,19 @@
-\version "2.7.39"
+\version "2.9.7"
+\sourcefilename "unfold-all-repeats.ly"
 
 \header { 
 texidoc = "Applying the standard function @code{unfold-repeats} unfolds 
 recursively all repeats for a correct MIDI output."
 }
 
-mel =  \context Staff {
+unfoldAll = 
+       #(define-music-function (parser location music )
+                        (ly:music?)
+       #{
+               \unfoldRepeats $music
+       #})
+
+mel = \context Staff {
   \repeat tremolo 8 {c'32 e' }
   \repeat percent 2 { c''8 d'' }
   \repeat volta 2 {c'4 d' e' f'} 
@@ -18,10 +26,7 @@ mel =  \context Staff {
 
 \score {  {
   \mel \break
-  \applyMusic #unfold-repeats \mel 
+  \unfoldAll \mel
  }
 }
 
-
-
-