[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] autochange.scm: Use averaged chord pitches to determinestaff
From: |
Mark Polesky |
Subject: |
Re: [PATCH] autochange.scm: Use averaged chord pitches to determinestaff. |
Date: |
Mon, 27 Jul 2009 23:36:34 -0700 (PDT) |
Okay, I'm almost finished with the autochange stuff (staff, not clef).
I like the current implementation, but the tweakable parameter called
"margin" on line 24 of autochange_revised.scm is for the moment stuck
there. So, for right now, if the user wants to change that parameter,
it must be done from within the scheme file, which is obviously not
preferable. I intend to define a new context-property called
"autochangeMargin" so that the user can do this sort of thing:
\new PianoStaff \autochange \relative {
\set autochangeMargin = #2
c8 d e f g f e d
c b a g f g a b
c d e f g f e d
}
However, I can't figure out how to do that. I understand that I need
to:
1) add an entry to define-context-properties.scm
2) maybe initialize a value somewhere in engraver-init.ly (?)
But I'm stuck because I don't know how to access the context from
within the "make-autochange-music" function in autochange_revised.scm.
The arguments accepted by that function right now are "parser" and
"music", and I toyed around with the idea of changing the definition
of autochange in music-functions-init.ly from this:
autochange =
#(define-music-function (parser location music) (ly:music?)
(_i "Make voices that switch between staves automatically")
(make-autochange-music parser music))
to this:
autochange =
#(define-music-function (parser location music) (ly:music?)
(_i "Make voices that switch between staves automatically")
(make-autochange-music parser location music))
ie. passing the location argument to the function, with the vague idea
that somehow the location argument would get me closer to the context.
Can someone please tell me how to get the context in this situation,
so that I can do this:
(define margin (ly:context-property context 'autochangeMargin))
I imagine that it's entirely doable in Scheme, but perhaps I need C++.
Man, I sure hope not, because I'm so close.
Anyone know how to do this?
Thanks.
- Mark
autochange_revised.scm
Description: Text Data
autochange.ly
Description: Text Data
- Re: [PATCH] autochange.scm: Use averaged chord pitches to determine staff., (continued)
Re: [PATCH] autochange.scm: Use averaged chord pitches to determinestaff.,
Mark Polesky <=