Am 15.02.2013 11:40, schrieb Urs Liska:
After a few test I have one further question.
I managed to tweak your functions to my needs (i.e. make it _less_
generic, because I need it for a specific purpose).
Attached you'll find my version of the function with example.
I created a function that only takes the \book as its argument, then
processes it twice, assigning different first pages each.
While this actually does what I want I would like to make the input
structure still more simple by passing the \score instead of the \book
to the function.
What I'm actually doing is:
mybook = \book {
\include "file-containing-score-block.ily"
}
\writeBookOddEven #mybook
which is somewhat redundant.
What I would like to write is:
\writeBookOddEven \include "file-containing-score-block.ily"
this will only work, if you have *only* one score block in this file and
nothing else ... I would think its somewhat dangerous ;)
(or - slightly more generic:
\writeBookOddEven
\score {
...
}
You can create an adhoc-book in scheme with a #{-#} construct:
writeScoreOddEven =
#(define-void-function (parser location score)
(ly:score?)
(let ((book #{ \book { \score { $score } } #}))
; process with first-number 1
...
Now you have a book object to process. Of course you can also build a
book in pure scheme (*ly:make-book*/paper header scores/), but you don't
need to.
HTH
Best Jan-Peter
Probably my problem is really tiny, but I can't find the solution
because the documentation of the ly:... functions isn't really helpful.
If I change the passed parameter from ly:book? to ly:score? then I
don't know how to access the implicit \book object inside the function.
I assume that I should use ly:book-add-score! to add the score object
passed into the function to the book. But I don't know how to access
this book object (i.e. what to write instead of book-smob in
*"ly:book-add-score!*/book-smob score")
/
Attached is my attempt (writeScoreOddEven.ly) with comments on where I
assume changes to be done.
Help is highly appreciated.
Best
Urs
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user