-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am Dienstag, 7. Oktober 2008 schrieb Han-Wen Nienhuys: > You can't do this; the format-metronome-markup is run during > interpreting, from Metronome_mark_engraver, which will pass the > context object by doing context()->self_scm() in C++.
Actually, as Graham noticed, there is only one spot where the context is used, namely to obtain the tempoHideNote property, which Graham doesn't need anyway. A quick hack would be to simply pass some random context to the function and hope that things work out. For example, one can pass the default paper block (nothing special about that block, but it was the first thing that came to my mind, since we already had something similar with extracting the papersize names): \version "2.11.62" \header{ piece = #(format-metronome-markup "Allegro" (ly:make-duration 2) 120 (ly:make-global-context (eval '$defaultpaper (current-module)))) } \relative c' { c } This works without an error message and produces the desired result. I don't know how one can create an empty context, which would be nicer than the ugly hack of misusing some unrelated context. How did I arrive at the above hack? Since the last argument of the format-metronome-markup is a context, I searched the code for lines with "make"/"create"/"generate" and "context" and found ly:make-global-context. Since that needs an Output_def, one only needs to get some Output_def (i.e. a paper block or something similar). Note, however, that the second argument needs to be a duration rather than an integer, so one has to call ly:make-duration (where the argument is the -log_2 of the duration, i.e. 2 means a quarter, 3 an eighth, etc.) Sample file is attached. Cheers, Reinhold - -- - ------------------------------------------------------------------ Reinhold Kainhofer, Vienna University of Technology, Austria email: [EMAIL PROTECTED], http://reinhold.kainhofer.com/ * Financial and Actuarial Mathematics, TU Wien, http://www.fam.tuwien.ac.at/ * K Desktop Environment, http://www.kde.org, KOrganizer maintainer * Chorvereinigung "Jung-Wien", http://www.jung-wien.at/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFI64EJTqjEwhXvPN0RAlAPAJ47vbvRpzBQuQ6GBgsUmypitVBOpgCeIjp+ Lw+nSDGuYQyCd4PPccPN20E= =pm5G -----END PGP SIGNATURE-----
\version "2.11.62" \header{ piece = #(format-metronome-markup "Allegro" (ly:make-duration 2) 120 (ly:make-global-context (eval '$defaultpaper (current-module)))) } \relative c' { c }
graham_metronome_mark_outside.pdf
Description: Adobe PDF document
_______________________________________________ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user