[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Adding a new accidental style
From: |
Edward Lilley |
Subject: |
Adding a new accidental style |
Date: |
Sun, 14 Apr 2019 16:08:18 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) |
Dear all,
I am trying extend Lilypond in Scheme to add a new accidental
style. What I am currently stuck on is how to add a new item to the
"accidental-styles" alist in such a way that it is visible to the
\accidentalStyle command.
I have a file called "hist-accidentals.scm" that contains the following:
> (define-public (hist-accidental-rule context pitch barnum measurepos)
> "An accidental rule that only typesets sharps and flats, indicating
> relative alteration compared to the key signature."
> (let* ((keysig (ly:context-property context 'localAlterations))
> (entry (find-pitch-entry keysig pitch #t #t)))
> (if (not entry)
> (cons #f #f)
> (let* ((global-entry (find-pitch-entry keysig pitch #f #f))
> (key-acc (key-entry-alteration global-entry))
> (acc (ly:pitch-alteration pitch))
> (entrymp (key-entry-measure-position entry))
> (entrybn (key-entry-bar-number entry)))
> (cons #f (not (or (equal? acc key-acc)
> (and (equal? entrybn barnum) (equal?
> entrymp measurepos)))))))))
>
> (set! accidental-styles
> (cons hist #f
> (Staff ,(make-accidental-rule 'same-octave 0))
> (Staff ,(make-accidental-rule 'same-octave 1)
> hist-accidental-rule)))
> accidental-styles))
(currently the contents of "hist-accidental-rule" is just a copy of the
"teaching" accidental style)
At the top of the relevant lilypond file, I load the scheme file with
> #(load "hist-accidentals.scm")
But when I come to write
> \accidentalStyle hist
later on, lilypond complains with "warning: unknown accidental style:
hist". How do I modify variables defined using "define-public"? Or, what
should I be doing instead?
Thanks,
Edward
--
- Adding a new accidental style,
Edward Lilley <=