Am Fr., 8. Nov. 2019 um 15:35 Uhr schrieb David Kastrup <d...@gnu.org>: > > Matt Wallis <m...@heligon.net> writes: > > > But it doesn't work if I try to set the midiPanPosition inside a midi > > context block like this: > > > > \version "2.19.83" > > > > \include "english.ly" > > sopStaff = \new Staff = "sop" { > > \relative c' { e4 f g a } > > } > > altoStaff = \new Staff = "alto" { > > \relative c' { c4 d e f } > > } > > \score { > > << > > \sopStaff > > \altoStaff > > >> > > \midi { > > \context Staff = "sop" { > > \set Staff.midiPanPosition = #1.0 > > \set Staff.midiBalance = #1.0 > > } > > \context Staff = "alto" { > > \set Staff.midiPanPosition = #-1.0 > > \set Staff.midiBalance = #-1.0 > > } > > } > > } > > This is terrible. Really, really terrible. \context Staff = "xxx" > should never be allowed in an output block since setting name-specific > context defs is not supported and does not make sense, either. I'll see > whether I can stop the parser from accepting this abomination. > > > > Furthermore, the result of doing this is that both staffs are played > > through the left, and nothing on the right. > > > > Am I doing something wrong? > > As a rule, changing syntax until something passes the parser instead of > working from documented syntax and examples is a bad idea. Most of the > time, you'll trigger error messages pinpointing the problem. > > But sometimes there are oversights. > > > I want to do the setting in the midi context block because I require > > different pan positions for a staff depending on which score it > > appears in. > > Then create different variables/expressions for that purpose. But the > \midi block cannot sensibly differentiate between differently named > contexts. > > -- > David Kastrup >
Below seems to work for \layout. \version "2.19.83" idFontSize = \applyContext #(lambda (ctx) (ly:context-set-property! ctx 'fontSize (cond ((string=? (ly:context-id ctx) "foo") -6) ((string=? (ly:context-id ctx) "bar") 6) (else (ly:context-property ctx 'fontSize))))) \score { << \new Staff = "foo" \relative c' { e4 f g a } \new Staff = "bar" \relative c' { c4 d e f } >> \layout { \context { \Staff \idFontSize } } } Didn't test for midi, though, why shouldn't the method work there as well. Cheers, Harm