lilypond-devel
[Top][All Lists]
Advanced

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

templates and a little bit more


From: Jan-Peter Voigt
Subject: templates and a little bit more
Date: Thu, 05 Apr 2012 19:37:36 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:11.0) Gecko/20120327 Thunderbird/11.0.1

Dear community,

I bundled some extensions in a little package to try out. Some of these ideas 
might be interesting to include in lily.
Here is a start of some docs, but just a little bit. I am working on it ...
http://www.xn--schne-noten-tfb.de/?tabs=3,1

and here are the files to include.
http://www.xn--schne-noten-tfb.de/lalily.tgz

If extract you this tar-gzip archive, you will get 3 files and one folder: 
lalily.ly, lalily.ily, lalily/ and alta-trinita.mus.ly. The alta-trinita-file 
is an example, the other three parts are the framework.
You only need to include lalily.ly - that file will include lalily.ily, if it 
hasn't done yet (include once). The ily-file will include some more files it 
finds on designated places, add the scheme-stuff to the guile-load-path and 
load some modules.
It *should* work, if you include from another folder like \include 
"my/downloaded/extensions/lalily.ly", but here it lives in a folder, wich is on 
the include path via the -I option ... in a shell scipt ...
I will start over later. What I wished to say is: That is not tested very well.
If you try this, you might wonder, what else are all these files doing ... they 
are a grown collection of things I use and are doing a lot of things.
I will gladly take parts and include them in a lily patch and I will gladly 
answer questions on them.
First of all, your harddisk will *not* be scanned and those informations are 
*not* sent to any secret service ;-)
But it looks for files lalily-templates.ly and lalily-config.ly in the current 
folder. And looks for files templates.*.ly, paper.*.ly and layout.*.ly in the 
layout folder.
And it sometimes creates a .log-file with some infos about the music stored.

A short addition to the website ... another example:

--snip--
\version "2.15.35"
\include "lalily.ly"

% register a template
\registerTemplate #'(my template) #(define-music-function (parser location 
piece options)(list? list?)
  #{
    <<
    \new Staff \with {
      % use option for instrument name
      instrumentName = $(assoc-get 'name options "N/A" #f )
    } \getMusic #'(music) % get music from '(... music)
    % call a template relative to this one ->  '(my template sub) with music in 
path '(... second)
    \callTemplate #'(sub) #'(second) $options
  >>
#})
% register a template
\registerTemplate #'(my template sub) #(define-music-function (parser location 
piece options)(list? list?)
#{
  % get music from current folder
  \new Staff \getMusic #'()
#})

% set template for a 'folder' - sets the current folder
\setDefaultTemplate #'(test) #'(my template) #'((name . "hello"))
% set title for current folder
\setTitle "Hello World"
% store music in '(test music)
\putMusic #'(music) \relative c' {
  c4 e g b
}
% store music in '(test second)
\putMusic #'(second) \relative c' {
  g4 c e g
}

% create PDF, MIDI and a log-file
\lalilyTest
--snip--

I'd like to add my template mechanism to lily and probably some more of my 
ideas.
What do you think about this?

The next days I might not answer directly - well I will still have look at my 
emails. But next tuesday I will be back again.

Tomorrow we might have a silent minute or what else is to say.
And then happy easter to you!
Cheers, Jan-Peter





reply via email to

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