lilypond-devel
[Top][All Lists]
Advanced

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

[PATCH] Re: Creating books with Scheme


From: Reinhold Kainhofer
Subject: [PATCH] Re: Creating books with Scheme
Date: Tue, 18 Aug 2009 19:41:38 +0200
User-agent: KMail/1.11.4 (Linux/2.6.28-13-generic; KDE/4.2.4; i686; ; )

Am Montag, 17. August 2009 12:05:23 schrieb Nicolas Sceaux:
> Le 17 août 09 à 09:23, Nicolas Sceaux a écrit :
> > Le 17 août 09 à 02:41, Reinhold Kainhofer a écrit :
> >> Hmm, to me it seems that you are effectively calling the parser to
> >> interpret
> >> \include "file.ly". That is a nice way around my problem, where
> >> only the parser
> >> seems to have a pointer to the current book (so you are invoking
> >> the parser to
> >> insert the scores into the bookpart), but it can't be used in my
> >> case.
> >>
> >> My problem is that I don't have the score in a file in lilypond
> >> syntax at all.
> >> I have only the notes of the individual instruments, but the whole
> >> score
> >> (containing part-combined staves, etc.) is really generated on-the-
> >> fly in
> >> scheme.
> >
> > If you look at the definition of `bookpart-score-handler' in my
> > file, you see that the book-part argument is not used. Instead,
> > all scores are added to the toplevel-scores parser variable (even
> > though they are not really toplevel, it does not matter).
> > The `toplevel-bookpart-handler' then uses this variable to actually
> > add the scores to the bookpart. This function is called by the parser
> > when a \bookpart block is closed, so at this point the bookpart object
> > is known.
> >
> > You can change the book-score-handler and toplevel-book-handler to
> > act the same way.
>
> Here is a short example showing how that may be done.

Thanks a lot, that's really cool. I hope you dont mind if I add this to the 
LSR?
BTW, toplevel scores are printed twice... do you know any workaround for this?

Eg. the example:

\book {
  \oneNoteScore
}
\oneNoteScore
\oneNoteScore

generates one file with for the book with one score, and one global score 
containing the two top-level \oneNoteScore twice (i.e. four scores, in the 
order ABAB)... When the toplevel-book-handler is called for the global scores 
(i.e. the implicit book), the 'toplevel-scores contains two scores, at the end 
of the function the list is empty. 


I found out that this seems to be a small but in ly/init.ly file, as the scores 
are added to the book there, but the list of toplevel-scores is not cleared...

Patch is at: 
http://codereview.appspot.com/110041

Okay to apply?
Cheers,
Reinhold

-- 
------------------------------------------------------------------
Reinhold Kainhofer, address@hidden, http://reinhold.kainhofer.com/
 * Financial & Actuarial Math., Vienna Univ. of Technology, Austria
 * http://www.fam.tuwien.ac.at/, DVR: 0005886
 * LilyPond, Music typesetting, http://www.lilypond.org




reply via email to

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