Re: FW: [frogs] Re: Patching the output file naming code (Was: thanks to whomever put this in the LSR...)

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


Thanks, Mats, for some useful input.

Mats Bengtsson wrote:
For PDF output, please remember that you get a single PDF for each \book{} block, so
in that case there's no reason to do the setting per \score or \bookpart.
However, for MIDI the situation is different, since you get a separate MIDI file for each \score block, so for this reason it makes to allow for separate settings in \paper and \midi. However, it would also make sense that the setting done for the PDF file name also is used
as the default prefix for the MIDI files, right?

Not quite, the base name and the output-prefix setting are two different things.
I'd like to be able to do this:
In source file mozk165.ly
\paper{
%% or this could be specified in the --output command-line %%argument
	output-base="Exsultate"
	%%
}
\bookpart
{
	\header {
	   subtitle = "I. Allegro"
	}
    \score {
	\layout {
	}
	\midi {
		output-suffix = "Allegro"
	}
	... the actual music
    }
}
\bookpart
{
    \header {
	   subtitle = "II. Andante"
    }
    \score {
	\layout {
	}
	\midi {
		output-suffix = "Andante"
	}
	... the actual music
    }
}
\bookpart
{
    \header {
	   subtitle = "III. Vivace"
    }
    \score {
	\layout {
	}
	\midi {
		output-suffix = "Vivace"
	}
	... the actual music
    }
}

Would give Exsultate.pdf, and
	Exsultate-Allegro.mid(i)
	Exsultate-Andante.mid(i)
	Exsultate-Vivace.mid(i)

Without the \paper{output-base="Exsultate"} or --outfile=Exsultate command-line option it
Would give mozk165.pdf, and
	mozk165-Allegro.mid(i)
	mozk165-Andante.mid(i)
	mozk165-Vivace.mid(i)


However, until someone gives me a steer as to how to pick up and set the properties in the relevant block I'm stuck. Here's why.

I know the Scheme code supporting \fromproperty does

define-builtin-markup-command (fromproperty layout props symbol)
  (symbol?)
  other
  ()
 ...
  (let ((m (chain-assoc-get symbol props)))
;...........................................;
    (if (markup? m)
        (interpret-markup layout props m)
        empty-stencil)))
..
..
..


but I've got this available
(define (print-book-with parser book process-procedure)
  (let*
      ((paper (ly:parser-lookup parser '$defaultpaper))
       (layout (ly:parser-lookup parser '$defaultlayout))
       (base (ly:parser-output-name parser))

I can pass in the paper, layout blocks (or even the midi if I add the call to get the '$defaultmidi value ) to my procedure to generate the output name, but how do I get hold of a properties block
so I could do something like this in my get-output-name code.
	(let* ((pfile chain-assoc-get paper:output-base  props base ))
	      ((mfile chain-assoc-get midi:output-suffix props pfile)))
	
Hmmm... looks like I need to maintain two alists, one for the "main" output filename and one for the midi files.

Do we have any other entities in lily that are liable to produce an output file for each \score block in the source file?


Apologies for the lousy Scheme but I'm still learning.

If anyone can help out I'll buy you a virtual pint :=).

Cheers,
Ian Hulin

   /Mats

Carl D. Sorensen wrote:
And here's Graham's reply about where the filenames should go.

I second his opinion that it ought to be in \paper for the printed output.

By symmetry, it would seem that that drives us to needing to include it in
\midi for the midi output.

Declaring the file name twice seems to be unseemly, but I can't think of a
better way to do it.

Carl


------ Forwarded Message
From: Graham Percival <graham@xxxxxxxxxxxxxxxxx>
Reply-To: <frogs@xxxxxxxxxxx>
Date: Sun, 21 Jun 2009 00:25:45 -0600
To: <frogs@xxxxxxxxxxx>
Cc: Reinhold Kainhofer <reinhold@xxxxxxxxxxxxx>
Conversation: [frogs] Re: Patching the output file naming code (Was: thanks
to whomever  put this in the LSR...)
Subject: Re: [frogs] Re: Patching the output file naming code (Was: thanks
to whomever  put this in the LSR...)

On Sun, Jun 21, 2009 at 12:25:42AM +0100, Ian Hulin wrote:
Is \paper the right place to put properties relating to output
filenames, or should it be property of \score itself?

IMO it should be in \paper, but I suppose that it could be useful
in \midi as well.  It doesn't feel right to have this in \score.

Cheers,
- Graham

---

----
Join the Frogs!


------ End of Forwarded Message



_______________________________________________
lilypond-devel mailing list
lilypond-devel@xxxxxxx
http://lists.gnu.org/mailman/listinfo/lilypond-devel



---

----
Join the Frogs!


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