Hello Timothy, hello Lukas, thank you for your replies.
> You can wrap the \context { ... } in a scheme function, which is called
> in the \layout block, e.g.
>
> musicXMLFeatureA = #(define-scheme-function (args) (predicates)
> #{ \context { \Score \consists ... } #} )
>
> \layout { \musicXMLFeatureA \musicXMLFeatureB }
That I did try before, the problem here is that Lilypond cannot handle passing
a single context def, but not a list of such, which is a problem if you want
to create feature sets.
What I ended up doing after sleeping over it was to take inspiration by `layout-
set-absolute-staff-size` and rather have void functions that directly modify
the
layout. So now I have:
layoutApplyToContext =
#(define-void-function (context-name mod) (symbol? ly:context-mod?)
(let* ((layout (current-module))
(context-def (module-ref layout context-name #f)))
(if (not context-def)
(set! context-def #{ \context { } #}))
(module-define!
layout context-name
(ly:context-def-modify context-def mod))))
which allows to call
from anywhere that is evaluated within the \layout block:
\layoutApplyToContext Staff \with { instrumentName = "xyz" }
Since these don’t need to a return value to be handled by the parser a function
can just call any number of such things, allowing me to have feature sets that
enable \featureA, \featureB, ...
With this I think the first non-alpha version of my musicxml export is done. It
is not perfect, but it works for quite complex scores already. So now will
look for a good hosting platform to put it on, so you all can try it and
hopefully leave some feedback (like, this input does not compile, this
produces wrong output, etc.)
But first need to take a break.
Cheers,
Tina
signature.asc
Description: This is a digitally signed message part.
