lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Programmatically inject an \editionID in a staff


From: Urs Liska
Subject: Re: Programmatically inject an \editionID in a staff
Date: Thu, 24 May 2018 11:35:20 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0

This is a -- similar -- MWE:

\version "2.19.80"

\include "oll-core/package.ily"
\loadPackage edition-engraver

\consistToContexts #edition-engraver Score.Staff.Voice

makeStaff =
#(define-music-function (name content)(string? ly:music?)
     (make-music
      'ContextSpeccedMusic 'create-new #t
      'property-operations
      (list
       (list 'assign 'edition-id (append '(ICEID compile with) (list name))))
      'context-id name 'context-type 'Staff
      'element content))

\makeStaff "hello-staff" { c' d' }

\layout {
  \context {
    \Staff
    \editionID ##f compile.with
  }
}

\addEdition part
\editionMod part 1 0/4 compile.with.hello-staff.Staff.A \once \override 
NoteHead.color = #red
\editionMod part 1 0/4 compile.with.Score.A \once \override NoteHead.color = 
#red

However, in this case it seems *both* mods won't have any effect ...

Urs

Am 24.05.2018 um 11:17 schrieb Urs Liska:
I'm trying to "install" the edition engraver in a programmatically generated score construction.

I have this code somewhere in the function to create a score:

              (ly:score-add-output-def! score
                #{
                  \layout {
                    \context {
                      \Score
                      #(editionID #f movement-path)
                    }
                  }
                #})

where movement-path is a symbol list identifying the current movement's score, e.g. #'(masses three kyrie)

I know this is working because the page-layout openLilyLib package properly uses that successfully. So I know each score has its own edition-id.

Now in order to make it possible to use \editionMod and friends I need to add the \editionID to each staff. I tested

\displayMusic
\new Staff \with { \editionID test } { c' }

and got

(make-music
  'ContextSpeccedMusic
  'create-new
  #t
  'property-operations
  (list (list 'assign
              'edition-id
              (list (quote ICEID) (quote test))))
  'context-type
  'Staff
  'element
  (make-music
    'SequentialMusic
    'elements
    (list (make-music
            'NoteEvent
            'pitch
            (ly:make-pitch 0 0)
            'duration
            (ly:make-duration 2)))))

as a result.

So I thought I could inject the edition-id simply with

(list 'assign 'edition-id (append (list 'ICEID) path))

with 'path' being e.g. #'(masses three kyrie violin-one)
This is the current version of that (sub-)function:

             ;; Create a named Staff context with the appropriate
             ;; context modifications.
             ;; content is a variable number of music expressions
             (make-staff
              (lambda (name . content)
                (make-music
                 'ContextSpeccedMusic 'create-new #t
                 'property-operations
                 (list
                  (list 'assign 'edition-id (append (list 'ICEID) path))
                  (list 'assign 'instrumentName (car instrument-names))
                  (list 'assign 'shortInstrumentName (cdr instrument-names))
                  (list 'assign 'midiInstrument
                    (getOption `(kayser instruments ,base-part midi-instrument)))                   (list 'assign 'instrumentTransposition transposition-from)
                  frenched-score
                  lyric-mods)
                 'context-id name 'context-type 'Staff
                 'element (make-simultaneous-music content))))

This works without warnings or errors but doesn't seem to work.

\addEdition part
\editionMod part 1 0/4 masses.three.kyrie.violin-one.Voice.A \once \override NoteHead.color = #red \editionMod part 2 0/4 masses.three.kyrie.Score.A \once \override NoteHead.color = #red

Here only the second mod is applied (the one to Score.A), the mod to violin-one.Voice.A is ignored.

This is somewhat in line with the edition.log file which only reports a

 (masses three kyrie Score A) ""

context.

Does this information give any indication what I might be doing wrong? If I look at the definition of \editionID it doesn't give me any further hints.

TIA
Urs


_______________________________________________
lilypond-user mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/lilypond-user




reply via email to

[Prev in Thread] Current Thread [Next in Thread]