]> git.donarmstrong.com Git - lilypond.git/commitdiff
* input/regression/music-map.ly (texidoc): new file.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 28 Nov 2002 23:08:35 +0000 (23:08 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 28 Nov 2002 23:08:35 +0000 (23:08 +0000)
* scm/music-functions.scm (music-map): new function

ChangeLog
input/regression/music-map.ly [new file with mode: 0644]
lily/ligature-engraver.cc
scm/music-functions.scm

index 5de30b28a63b7478f9363bb90101927f7141a53b..9df46a4bbfee5e702ee0c828479a9ed0ca84e562 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2002-11-29  Han-Wen Nienhuys  <hanwen@cs.uu.nl>
+
+       * input/regression/music-map.ly (texidoc): new file.
+
+       * scm/music-functions.scm (music-map): new function
+
+2002-11-28  Han-Wen Nienhuys  <hanwen@cs.uu.nl>
+
+       * lily/ligature-engraver.cc (create_ligature_spanner): fix fixes.
+
 2002-11-28  Heikki Junes <hjunes@cc.hut.fi>
 
        * input/test/to-xml.ly:
diff --git a/input/regression/music-map.ly b/input/regression/music-map.ly
new file mode 100644 (file)
index 0000000..b92b853
--- /dev/null
@@ -0,0 +1,39 @@
+\header {
+
+texidoc =
+
+"With @code{music-map}, you can apply functions operating on a single
+piece of music to an entire music expression. In this example, the
+scripts and dynamics of the first measure of music are applied to the
+2nd measure. "
+
+}
+
+
+\version "1.7.8"
+
+#(define (notes-to-skip m)
+"Convert all stuff with duration (notes, lyrics, bass figures, etc.) to skips.
+Scripts and dynamics are maintained.
+"
+  (if (memq 'rhythmic-event (ly:get-mus-property m 'types))
+       (let* ((newmus    (make-music-by-name 'SkipEvent)))
+               (map
+                 (lambda (x) (ly:set-mus-property! newmus (car x) (cdr x)))
+                 (ly:get-mutable-properties m))
+               newmus
+       )
+       m)
+)
+
+
+foobar = \notes \transpose c c' { c4-\>-^ c4-^ c4-\!-^ c4-^  } 
+
+\score {
+  \notes \relative c''  \context Voice {
+       \foobar
+
+       < \apply #(lambda (x) (music-map x notes-to-skip))
+               \foobar
+          { d2 d2 } > 
+}}
index 6e282805d2ac944148abf076e44d3befeee43200..3344e363a6b44f87bc05ea82d1787c31a0be3efc 100644 (file)
@@ -64,7 +64,7 @@ Ligature_engraver::try_music (Music *m)
 Spanner *
 Ligature_engraver::create_ligature_spanner ()
 {
-  return new Spanner (SCM_EOL);
+  return 0;
 }
 
 void
@@ -185,7 +185,7 @@ Ligature_engraver::acknowledge_grob (Grob_info info)
 
 ENTER_DESCRIPTION (Ligature_engraver,
 /* descr */       "Abstract class; a concrete subclass handles Ligature_events by engraving Ligatures in a concrete style.",
-/* creats */      "Ligature_engraver",
+/* creats */      "",
 /* accepts */     "ligature-event abort-event",
 /* acks  */      "ligature-head-interface rest-interface",
 /* reads */       "",
index 8fba5384cf05f118533ee193fc4ab085314bf083..01e84057bf053c25fd1153b82f33a8d4799f9441 100644 (file)
                 (number->string (ly:get-mus-property mus 'denominator))
                 ))
 
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(define-public (music-map music function)
+  "Apply @var{function} to @var{music} and all of the music it contains. "
+  (let* ((es (ly:get-mus-property music 'elements))
+         (e (ly:get-mus-property music 'element))
+        )
+
+    (ly:set-mus-property! music 'elements 
+       (map (lambda (y) (music-map y function)) es))
+       (if (ly:music? e)
+           (ly:set-mus-property! music 'element (music-map e function)))
+       (function music)
+       ))
+
+
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 
@@ -51,6 +68,8 @@
     music))
 
 
+
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; repeats.