[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Nested Musicfunctions -> location
From: |
Jan-Peter Voigt |
Subject: |
Nested Musicfunctions -> location |
Date: |
Mon, 25 Jun 2012 11:10:42 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 |
Hello list,
here's my approach to inherit the input-location in nested music-functions:
--snip--
\version "2.15.40"
% a test function, which simply outputs the location
test = #(define-music-function (parser location mus)(ly:music?)
(ly:input-message location "~A" location) mus)
% a scheme-function to execute a music-function with a specific location
argument
#(define-public (ly:music-function-exec fun parser location . args)
(apply (ly:music-function-extract fun) parser location args))
% a nested music-function
fun = #(define-music-function (parser location mus)(ly:music?)
#{
$(ly:music-function-exec test parser location mus)
#})
% example
\new Staff {
% this will output this location, *not* the location _inside_ of the fun
function
\fun \relative c'' {
c des ees
}
}
--snip--
This is helpful, if nested music-function-calls output warnings or other
ly:input-message's.
I use contructs like this (for example) to nest the \shape command and
calculate the needed offset parameters from "easier" values.
Cheers, Jan-Peter
- Nested Musicfunctions -> location,
Jan-Peter Voigt <=