[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: erreur dans fonction scheme
From: |
Gilles |
Subject: |
Re: erreur dans fonction scheme |
Date: |
Mon, 27 May 2013 16:07:35 +0200 |
User-agent: |
Opera Mail/12.15 (Linux) |
Cette version devrait être déjà plus allégée :
#(cond
((and upperline lowerline)
(color-staff-lines white black black white) ; 4 arguments
(else
(color-staff-lines white black white))) % 3 arguments
Ah, j'ai trouvé le color-staff-lines auquel tu faisais référence :
http://lsr.dsi.unimi.it/LSR/Item?id=700
En principe quand on veut changer de fonction pour un stencil elle doit
être de la forme
#(lambda(grob) ...
Dans le snippet,
... #'stencil = #(color-staff-lines ....) est équivalent à
... #'stencil = #(lambda(grob)((color-staff-lines ...) grob)))
Apparemment, Lilypond ne comprend plus quand il y a une instruction (cond
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#(define upperline #f)
#(define lowerline #f)
\relative c' {
\override Staff.StaffSymbol #'stencil = #(cond
((and upperline lowerline)
(lambda(grob)((color-staff-lines white black red white) grob))) ;
en rouge
(else
(lambda(grob)((color-staff-lines white green white) grob)))) % en
vert
c1 %% en vert
}
#(define upperline #t)
#(define lowerline #t)
\relative c' {
\override Staff.StaffSymbol #'stencil = #(cond
((and upperline lowerline)
(lambda(grob)((color-staff-lines white black red white) grob))) ;
en rouge
(else
(lambda(grob)((color-staff-lines white green white) grob)))) % en
vert
c1 %% en rouge
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Il faut réécrire 2 fois la fonction, car sinon upperline et lowerline ne
sont pas réévaluées.
En particulier avec un \with ça ne marche pas :
%%%%%%%%%%%%%%%%%%%%%%%%%%% avec \with
#(define upperline #f)
#(define lowerline #f)
staffSet = \with { \override StaffSymbol #'stencil = #(cond
((and upperline lowerline)
(lambda(grob)((color-staff-lines white black red white) grob))) ;
en rouge
(else
(lambda(grob)((color-staff-lines white green white) grob)))) % en
vert
}
\new Staff \with { \staffSet } \relative c' {
c1 % en vert : OK
}
#(define upperline #t)
#(define lowerline #t)
\new Staff \with { \staffSet } \relative c' {
c1 % en vert : pas OK :-(
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Ça doit marcher (non testé) si on met les réglages dans un \include, après
les variables
% morceau 1
#(define upperline #f)
#(define lowerline #f)
\include "mesreglages.ly"
% morceau 2
#(define upperline #t)
#(define lowerline #t)
\include "mesreglages.ly"
--
Gilles
Re: erreur dans fonction scheme, Daniel Cartron, 2013/05/27