Erik Sandberg schreef:
I'm more or less done with repeats now. Patch attached.
Known issue: unfold-repeats will probably not work for percent repeats. (the
repeat will be unfolded, but percents will still remain). I'd suggest to fix
this by scrapping percent-repeat-iterator, and to create a SequentialMusic of
percent-repeat-events instead. So
\repeat percent 4 c4
=>
{c4 <pre> <pre> <pre> }
where <pre> is a percent-repeat-event. This requires that
percent-repeat-engraver and slash-repeat-engraver are changed (simplified) as
well.
I don't understand this. unfold-repeats is on the front end, we can just
make it replace PercentRepeatMusic with UnfoldedRepeatMusic wholly; that
should work, right?
BTW, is there any particular reason why percent-repeat-engraver and
slash-repeat-engraver are not merged?
yes, because the percent-repeat-engraver is already unwieldy. I don't
want it to be bigger still.
+ if (mp->is_mus_type ("event-chord"))
+ $$ = mp;
+ else
+ {
+ Music *br = MY_MAKE_MUSIC ("TupletSpannerEvent");
+ br->set_spot (@$);
+ br->set_property ("numerator", scm_int2num (n));
+ br->set_property ("denominator", scm_int2num (d));
+ br->set_property ("length", mp->get_length ().smobbed_copy
());
+ Music *ev = MY_MAKE_MUSIC ("EventChord");
+ ev->set_property ("elements", scm_cons (br->self_scm (),
SCM_EOL));
+ Music *sim = MY_MAKE_MUSIC ("SimultaneousMusic");
+ sim->set_property ("elements", scm_list_2 (ev->self_scm (),
mp->self_scm ()));
+ sim->set_spot (@$);
+ $$ = context_spec_music (ly_symbol2scm ("Bottom"),
+ SCM_UNDEFINED, sim, SCM_EOL,
false);
+ }
I don't understand. Why don't you send TupletSpanEvents (START, STOP)
from the iterator? If you do that, you might even be able to scrap a lot
of the hairy timekeeping logic in the engraver.
With this solution there's a mismatch between the syntax and the
internal representation, and "length" has to have the right value,
making life harder for people generating stuff from scheme
- if (m->is_mus_type ("repeated-music")
- && m->get_property ("iterator-ctor")
- == Percent_repeat_iterator::constructor_proc
+ if (m->is_mus_type ("percent-repeat-event")
This is actually superfluous. Can you scrap it?
Index: lily/slash-repeat-engraver.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/slash-repeat-engraver.cc,v
retrieving revision 1.29
diff -u -r1.29 slash-repeat-engraver.cc
--- lily/slash-repeat-engraver.cc 6 Jan 2006 09:13:25 -0000 1.29
+++ lily/slash-repeat-engraver.cc 10 May 2006 06:02:12 -0000
@@ -59,13 +59,10 @@
bool
Slash_repeat_engraver::try_music (Music *m)
{
- if (m->is_mus_type ("repeated-music")
- && !repeat_
- && m->get_property ("iterator-ctor")
- == Percent_repeat_iterator::constructor_proc)
+ if (m->is_mus_type ("percent-repeat-event"))
idem.
ADD_ACKNOWLEDGER (Tuplet_engraver, note_column);
ADD_TRANSLATOR (Tuplet_engraver,
- /* doc */ "Catch Time_scaled_music and generate appropriate bracket
",
+ /* doc */ "Catch TupletSpannerEvent and generate appropriate bracket
",
/* create */ "TupletBracket TupletNumber",
- /* accept */ "time-scaled-music",
+ /* accept */ "tuplet-spanner-event",
/* read */ "tupletNumberFormatFunction tupletSpannerDuration
tupletFullLength",
/* write */ "");
Index: lily/volta-engraver.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/volta-engraver.cc,v
retrieving revision 1.75
diff -u -r1.75 volta-engraver.cc
--- lily/volta-engraver.cc 26 Jan 2006 11:16:41 -0000 1.75
+++ lily/volta-engraver.cc 10 May 2006 06:02:12 -0000
@@ -22,7 +22,7 @@
/*
Create Volta spanners, by reading repeatCommands property, usually
- set by Unfolded_repeat_iterator.
+ set by Volta_repeat_iterator.
*/
class Volta_engraver : public Engraver
{
Index: scm/define-music-types.scm
===================================================================
RCS file: /sources/lilypond/lilypond/scm/define-music-types.scm,v
retrieving revision 1.78
diff -u -r1.78 define-music-types.scm
--- scm/define-music-types.scm 9 May 2006 02:15:57 -0000 1.78
+++ scm/define-music-types.scm 10 May 2006 06:02:12 -0000
@@ -398,6 +398,12 @@
(iterator-ctor . ,ly:property-unset-iterator::constructor)
))
+ (PercentRepeatEvent
+ . (
+ (description . "Used internally to signal percent repeats.")
+ (types . (general-music percent-repeat-event))
+ ))
+
(PesOrFlexaEvent
. (
(description . "Within a ligature, mark the previous and the
@@ -534,19 +540,6 @@
(types . (general-music span-event event trill-span-event))
))
- (TimeScaledMusic
- . (
- (description . "Multiply durations, as in tuplets.
-
-Syntax @code{\\times @var{fraction} @var{music}}, e.g.
[EMAIL PROTECTED] 2/3 @{ ... @}} for triplets.
- ")
- (length-callback . ,ly:music-wrapper::length-callback)
- (start-callback . ,ly:music-wrapper::start-callback)
- (iterator-ctor . ,ly:time-scaled-music-iterator::constructor)
- (types . (time-scaled-music music-wrapper-music general-music))
- ))
-
(TransposedMusic
. (
(description . "Music that has been transposed.")
@@ -557,6 +550,12 @@
(types . (music-wrapper-music general-music transposed-music))
))
+ (TupletSpannerEvent
+ . (
+ (description . "Used internally to signal tuplet brackets.")
+ (types . (tuplet-spanner-event event general-music))
+ ))
+
(UnrelativableMusic
. (
(description . "Music that can not be converted from relative to
absolute notation.
Index: scm/music-functions.scm
===================================================================
RCS file: /sources/lilypond/lilypond/scm/music-functions.scm,v
retrieving revision 1.168
diff -u -r1.168 music-functions.scm
--- scm/music-functions.scm 9 May 2006 02:15:57 -0000 1.168
+++ scm/music-functions.scm 10 May 2006 06:02:12 -0000
@@ -202,6 +202,49 @@
(music-map (lambda (x) (shift-one-duration-log x shift dot))
music))
+(define (truncate-list! ls n)
+ "destructively truncate a list to n elements"
+ (set-cdr! (list-tail ls (1- n)) '())
+ ls)
+
use srfi-1 split-at!
--
Han-Wen Nienhuys - [EMAIL PROTECTED] - http://www.xs4all.nl/~hanwen
LilyPond Software Design
-- Code for Music Notation
http://www.lilypond-design.com
_______________________________________________
lilypond-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-devel