[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
reading properties
From: |
Han-Wen Nienhuys |
Subject: |
reading properties |
Date: |
Thu, 4 Apr 2002 16:59:49 +0200 |
address@hidden writes:
> I consider it very hard to read properties from within lily.
> The problem is that you need to pass a pointer to some sort of musical
> expression - and I don't know how to get such a pointer.
> I.e. when thinking about the ottava-implementation it would be nice to
> replace
>
> \property Staff.centralCPosition = #-13
>
> with
>
> \property Staff.centralCPosition = #(- (ly-get-context-property
> "Staff" "centralCPosition") 7)
>
> But the "get-translator-property"-function needs to get a pointer to the
> Staff rather than just the "Staff"-string - and hence the above does not
> work...
> Is this something like this currently possible at all? Othervise this
> would be something nice to allow before 1.6, imho.
The proper solution would be to have a special new type of music
production, something like
\applycontext SCHEME-FUNCTION
which would be a music expression/event, that when executed does
(apply SCHEME-FUNCTION current-translator)
then what you want could be done using
\context Staff
\applycontext #(lambda (trans)
(ly-set-trans-property trans centralCPosition
(+ (ly-get-trans-property trans centralCPosition) 7)))
We could even use this mechanism as a basic way to express various
other operations, such as barchecks, \property, staff changes,
etc. Implementing it shouldn't be that hard. Basically, you have to
implement a new music-iterator that does the gh_call (). Loads of fun
if you've never written such a beast before :-)
--
Han-Wen Nienhuys | address@hidden | http://www.cs.uu.nl/~hanwen/
- reading properties, Rune Zedeler, 2002/04/04
- reading properties,
Han-Wen Nienhuys <=
- Re: reading properties, Rune Zedeler, 2002/04/05
- Re: reading properties, Han-Wen Nienhuys, 2002/04/05
- Re: reading properties, Rune Zedeler, 2002/04/05
- Re: reading properties, Han-Wen Nienhuys, 2002/04/05
- Re: reading properties, Rune Zedeler, 2002/04/05
- Re: reading properties, Han-Wen Nienhuys, 2002/04/05