[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Feature request
From: |
Han-Wen Nienhuys |
Subject: |
Re: Feature request |
Date: |
Sun, 7 Oct 2001 12:29:11 +0200 |
address@hidden writes:
> Han-Wen Nienhuys wrote:
>
> > It shouldn't be hard to write a Scheme function to replace all repeats
> > with unfold repeats.
> [...]
> > Left to the reader as an exercise.
>
> With thanks to Han-Wen:
>
With the following patch (for 1.5, but should also work for 1.4), it
will also work for addlyric and partcombine. Maybe it would also be
a good idea to use #'elements for repeated music as well (1st element
is the body, the rest the alternatives.)
Generated by address@hidden,
>From = lilypond-1.5.15, To = lilypond-1.5.15.hwn1
usage
cd lilypond-source-dir; patch -E -p1 < lilypond-1.5.15.hwn1.diff
Patches do not contain automatically generated files
or (urg) empty directories,
i.e., you should rerun autoconf, configure
diff -purN ../lilypond-1.5.15/CHANGES ./CHANGES
--- ../lilypond-1.5.15/CHANGES Fri Oct 5 18:02:16 2001
+++ ./CHANGES Sun Oct 7 12:16:21 2001
@@ -1,3 +1,9 @@
+1.5.15.hwn1
+===========
+
+* Change Part_combine_music and Lyric_combine_music to use 'elements
+music property.
+
1.5.14.jcn6
===========
diff -purN ../lilypond-1.5.15/VERSION ./VERSION
--- ../lilypond-1.5.15/VERSION Fri Oct 5 19:51:30 2001
+++ ./VERSION Sat Oct 6 00:35:22 2001
@@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond
MAJOR_VERSION=1
MINOR_VERSION=5
PATCH_LEVEL=15
-MY_PATCH_LEVEL=
+MY_PATCH_LEVEL=hwn1
# use the above to send patches: MY_PATCH_LEVEL is always empty for a
# released version.
diff -purN ../lilypond-1.5.15/lily/lyric-combine-music.cc
./lily/lyric-combine-music.cc
--- ../lilypond-1.5.15/lily/lyric-combine-music.cc Sun Mar 11 19:10:33 2001
+++ ./lily/lyric-combine-music.cc Sun Oct 7 12:16:39 2001
@@ -46,16 +46,28 @@ Lyric_combine_music::compress (Moment m)
music_l ()->compress (m);
}
+
+
Music*
Lyric_combine_music::music_l () const
{
- return unsmob_music (get_mus_property ("music"));
+ SCM l = get_mus_property ("elements");
+ if (!gh_pair_p (l))
+ return 0;
+ return unsmob_music (gh_car (l));
}
+
Music*
Lyric_combine_music::lyrics_l () const
{
- return unsmob_music (get_mus_property ("lyrics"));
+ SCM l = get_mus_property ("elements");
+ if (!gh_pair_p (l))
+ return 0;
+ l = gh_cdr (l);
+ if (!gh_pair_p (l))
+ return 0;
+ return unsmob_music (gh_car (l));
}
Lyric_combine_music::Lyric_combine_music ()
diff -purN ../lilypond-1.5.15/lily/parser.yy ./lily/parser.yy
--- ../lilypond-1.5.15/lily/parser.yy Mon Sep 24 01:43:17 2001
+++ ./lily/parser.yy Sun Oct 7 12:22:05 2001
@@ -852,8 +852,6 @@ Composite_music:
$$->set_mus_property ("element", $2->self_scm ());
scm_gc_unprotect_object ($2->self_scm ());
#endif
-
-
}
| CONTEXT string '=' string Music {
Context_specced_music *csm = new Context_specced_music
(SCM_EOL);
@@ -971,8 +969,7 @@ relative_music:
re_rhythmed_music:
ADDLYRICS Music Music {
Lyric_combine_music * l = new Lyric_combine_music (SCM_EOL);
- l->set_mus_property ("music", $2->self_scm ());
- l->set_mus_property ("lyrics", $3->self_scm ());
+ l->set_mus_property ("elements", gh_list ($2->self_scm (),
$3->self_scm (), SCM_UNDEFINED));
scm_gc_unprotect_object ($3->self_scm ());
scm_gc_unprotect_object ($2->self_scm ());
$$ = l;
@@ -984,12 +981,10 @@ part_combined_music:
Part_combine_music * p = new Part_combine_music (SCM_EOL);
p->set_mus_property ("what", $2);
- p->set_mus_property ("one", $3->self_scm ());
- p->set_mus_property ("two", $4->self_scm ());
+ p->set_mus_property ("elements", gh_list ($3->self_scm
(),$4->self_scm (), SCM_UNDEFINED));
scm_gc_unprotect_object ($3->self_scm ());
scm_gc_unprotect_object ($4->self_scm ());
-
$$ = p;
}
diff -purN ../lilypond-1.5.15/lily/part-combine-music.cc
./lily/part-combine-music.cc
--- ../lilypond-1.5.15/lily/part-combine-music.cc Sun Mar 11 19:10:34 2001
+++ ./lily/part-combine-music.cc Sun Oct 7 12:16:44 2001
@@ -50,13 +50,23 @@ Part_combine_music::compress (Moment m)
Music*
Part_combine_music::first_l () const
{
- return unsmob_music (get_mus_property ("one"));
+ SCM l = get_mus_property ("elements");
+ if (!gh_pair_p (l))
+ return 0;
+ return unsmob_music (gh_car (l));
}
+
Music*
Part_combine_music::second_l () const
{
- return unsmob_music (get_mus_property ("two"));
+ SCM l = get_mus_property ("elements");
+ if (!gh_pair_p (l))
+ return 0;
+ l = gh_cdr (l);
+ if (!gh_pair_p (l))
+ return 0;
+ return unsmob_music (gh_car (l));
}
--
Han-Wen Nienhuys | address@hidden | http://www.cs.uu.nl/~hanwen/