Re: [frogs] Picking up contents of \paper \layout and \midi blocks in Scheme

[ Thread Index | Date Index | More lilynet.net/frogs Archives ]


Hi Reinhold,

I'm trying to get hold of this stuff in a new routine called from print-book-with in lily-library.scm
so I can generate a {base}[-[output-suffix]] name for the .mid(i) files in the score or bookpart block.

(define (print-book-with parser book process-procedure)
  (let*
      ((paper (ly:parser-lookup parser '$defaultpaper))
;;  want to get the innermost \paper here instead
       (layout (ly:parser-lookup parser '$defaultlayout))
;;  want to get the innermost \layout here instead
       (midi (ly:parser-lookup parser '$defaultmidi))
;;  want to get the innermost \midi here instead
       (base (ly:parser-output-name parser))
;;               ^^^^^^^^^^^^^^
;;  P.S. will this solve your TODO in orchestrallily, line 604 to get a filename for the .toc file?    
       (outfile-name (get-outfile-name parser base paper midi)) )

    (process-procedure book paper layout outfile-name)
    ))


Cheers,

Ian Hulin

Reinhold Kainhofer wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am Samstag, 27. Juni 2009 15:27:08 schrieb Ian Hulin:
  
I want to pick up attributes set in these blocks in Scheme.  I can
successfully pick up the outermost blocks by doing things like

let* ((mymidi  ly:parser-lookup (parser '$defaultmidi))
     (keyval '() )
    (set! keyval (ly:output-def-lookup mymidi 'an-attribute)))


How do I pick up the contents of a locally declared \midi within a
\bookpart, i.e not declared at the outermost level?
    
That depends on where you need to obtain the output-def. Can you give use the 
context of the scheme function? In particular, if you have the score object, 
you can use ly:score-output-defs to get all output defs (layout and midi) and 
simply filter out the midi block. If that is not set, you can use $defaultmidi.

But, as I said, everything depends on the context of the scheme code...

I had a similar problem a while ago (see my mail "Re: Accessing header 
properties from ordinary markup" On May 22, 2008 to lilypond-user), but have 
not yet been able to properly solve it... 
My current code can be found at:
      http://lsr.dsi.unimi.it/LSR/Snippet?id=467
but it only uses $defaultlayout so far, either, since I haven't found a way to 
obtain the score there.

So, if someone with deeper knowledge about the internals can provide a 
solution, it would also help me a lot.

Cheers,
Reinhold

PS: the LSR seems to break with this snippet: only the header fields are shown 
in the image, but not the actual markup produced by the snippet!
- -- 
- ------------------------------------------------------------------
Reinhold Kainhofer, reinhold@xxxxxxxxxxxxx, 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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iD8DBQFKRliATqjEwhXvPN0RApchAKCXzYGAYouy/WMnXpc0CIStHD/yOgCeNDxI
XINuAOxkhCYcauAwnBa8WrU=
=2rPY
-----END PGP SIGNATURE-----

---

----
Join the Frogs!


______________________________________________        
This email has been scanned by Netintelligence        
http://www.netintelligence.com/email


  



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/