+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:
--- /dev/null
+\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 } >
+}}
Spanner *
Ligature_engraver::create_ligature_spanner ()
{
- return new Spanner (SCM_EOL);
+ return 0;
}
void
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 */ "",
(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)
+ ))
+
+
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
music))
+
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; repeats.