lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: implementation plan for music streams


From: Erik Sandberg
Subject: Re: implementation plan for music streams
Date: Wed, 10 May 2006 14:02:02 +0200
User-agent: Internet Messaging Program (IMP) 3.2.7

Citerar Han-Wen Nienhuys <address@hidden>:

> 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?

I implemented percent repeats in a way similar to tuplet brackets, i.e. by
sending a parallel event. One reason for this decision is that the EventChord
iterator is where events are supposed to be reported.

> > 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.

Then I'll add a SlashRepeatEvent or similar. (and perhaps a
DoublePercentRepeatEvent as well?)

> > +                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.

The nice thing about my solution is that time-scaled-music-iterator can be
scrapped altogether. This could also be achieved with start/stop events by
expanding \times <mus> to
{ TupletSpanStartEvent <mus> TupletSpanStopEvent }
but I guess there would be problems with nested tuplets (how to pair START and
STOP events?)

> > +(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!

thanks

Erik





reply via email to

[Prev in Thread] Current Thread [Next in Thread]