I'm struggling with how to access a function that is define-public'ed in an scm
file. In particular, the file define-music-display-methods.scm defines the
note-name->lily-string function to return a human-readable representation of
the given pitch. Now, I want to call that from a custom function that I'm
definin in my own .ly file. How can I call that note-name->lily-string function?
That function does not seem to be available by default (judging from the code,
it is in the display-lily module...).
I tried inserting
#(use-module (scm display-lily))
in my .ly file, but that didn't work at all. Using
#(ly:load "define-music-display-methods.scm")
makes note-name->lily-string available, but then $defaultlayout can no longer
be found?!?
Example is attached (it uses my patch http://codereview.appspot.com/112044)
Thanks a lot,
Reinhold
--
------------------------------------------------------------------
Reinhold Kainhofer, [email protected], http://reinhold.kainhofer.com/
* Financial & Actuarial Math., Vienna Univ. of Technology, Austria
* http://www.fam.tuwien.ac.at/, DVR: 0005886
* LilyPond, Music typesetting, http://www.lilypond.org
\version "2.13.4"
% I tried the following for note-name->lily-string (which I changed to define-public):
% This does not work at all:
% #(use-module (scm display-lily))
% This works, but then $defaultlayout is not available any more:
% #(ly:load "define-music-display-methods.scm")
#(define add-one-note-score
(let ((pitch 0))
(lambda (parser)
(let* ((scmpitch (ly:make-pitch 0 pitch 0))
(music (make-music 'EventChord
'elements (list (make-music 'NoteEvent
'duration (ly:make-duration 2 0 1 1)
'pitch scmpitch))))
(score (scorify-music music parser))
(layout (ly:output-def-clone $defaultlayout))
(title (markup #:large #:line ((ly:format "Score with a ~a"
"dummy pitch name"
; (note-name->lily-string scmpitch parser)
)))))
(ly:score-add-output-def! score layout)
(add-text parser title)
(add-score parser score))
(set! pitch (modulo (1+ pitch) 7)))))
oneNoteScore =
#(define-music-function (parser location) ()
(add-one-note-score parser)
(make-music 'Music 'void #t))
%%%
\oneNoteScore
_______________________________________________
lilypond-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-devel