2 score-scheme.cc -- implement Score bindings.
4 source file of the GNU LilyPond music typesetter
6 (c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
11 #include "output-def.hh"
12 #include "global-context.hh"
14 LY_DEFINE (ly_music_scorify, "ly:music-scorify",
16 (SCM music, SCM parser),
17 "Return @var{music} with @var{texts} encapsulated in @var{score}.")
19 Music *mus = unsmob_music (music);
20 SCM_ASSERT_TYPE (mus, music, SCM_ARG1, __FUNCTION__, "music");
22 Score *score = new Score;
23 score->set_music (music, parser);
25 SCM self = score->self_scm ();
26 scm_gc_unprotect_object (self);
30 LY_DEFINE (ly_score_embedded_format, "ly:score-embedded-format",
31 2, 1, 0, (SCM score, SCM layout, SCM key),
32 "Run @var{score} through @var{layout}, an output definition, "
33 "scaled to correct outputscale already, "
34 "return a list of layout-lines. "
35 "\nTake optional Object_key argument.")
37 Score *sc = unsmob_score (score);
38 Output_def *od = unsmob_output_def (layout);
43 SCM_ASSERT_TYPE (sc, score, SCM_ARG1, __FUNCTION__, "Score");
44 SCM_ASSERT_TYPE (od, layout, SCM_ARG2, __FUNCTION__, "Output_def");
46 Output_def *score_def = 0;
48 /* UGR, FIXME, these are default \layout blocks once again. They
50 for (int i = 0; !score_def && i < sc->defs_.size (); i++)
51 if (sc->defs_[i]->c_variable ("is-layout") == SCM_BOOL_T)
52 score_def = sc->defs_[i];
57 score_def = score_def->clone ();
58 SCM prot = score_def->self_scm ();
59 scm_gc_unprotect_object (prot);
61 /* TODO: SCORE_DEF should be scaled according to OD->parent_ or OD
63 score_def->parent_ = od;
65 SCM context = ly_run_translator (sc->get_music (), score_def->self_scm (),
67 SCM output = ly_format_output (context);
69 scm_remember_upto_here_1 (prot);