From 035a193e91753d3b7412c51cfef4eb0a6ab3c5c8 Mon Sep 17 00:00:00 2001 From: Valentin Villenave Date: Fri, 4 Sep 2009 11:58:17 +0200 Subject: [PATCH] New framework implementation, take2 This commit adds some commands that I've been planning to use for the last couple of years. Hopefully at some point the whole score will be generated on-the-fly without any redundancy or ugly hard-coded structures. --- definitions/functions.ly | 57 ++++++++++++++++++++++++++++++++++++++++++ definitions/music-functions.ly | 14 +++++------ master/master.ly | 23 +++++++++++++++++ 3 files changed, 87 insertions(+), 7 deletions(-) create mode 100644 definitions/functions.ly diff --git a/definitions/functions.ly b/definitions/functions.ly new file mode 100644 index 0000000..e340506 --- /dev/null +++ b/definitions/functions.ly @@ -0,0 +1,57 @@ +%------------------------------------------------------------------% +% Opéra Libre -- functions.ly % +% % +% (c) Valentin Villenave, 2008 % +% % +%------------------------------------------------------------------% + +% Core structure functions (with great help from Nicolas Sceaux and +% Reinhold Kainhofer). + +%%%%%%%%%%%%%%%%%%%%%%%%% Scores inclusion %%%%%%%%%%%%%%%%%%%%%%%%% + +%% Prefix/postfix defs --------------------------------------------% +#(define text-id "Texte") + +%% Variables handling ---------------------------------------------% +#(define (make-sym prefix-or-name name-or-postfix) + (if (symbol? prefix-or-name) + (string->symbol (string-append + (symbol->string prefix-or-name) + name-or-postfix)) + (string->symbol (string-append + prefix-or-name + (symbol->string name-or-postfix))))) + +#(define (make-this-music name) + (let ((music (ly:parser-lookup parser name))) + (if (ly:music? music) + music + (make-music 'Music 'void #t)))) + +#(define (make-this-text name) + (let ((mark (ly:parser-lookup parser name))) + (if (markup? mark) + mark + (begin + (ly:warning "no text found in markup") + point-stencil)))) + + +%% LilyPond commands ----------------------------------------------% +includeAll = +#(define-music-function (parser location variable-names) (list?) + (map (lambda (variable-name) + (let* ((music (make-this-music variable-name)) + (score (scorify-music music parser)) + (layout (ly:output-def-clone $defaultlayout)) + (header (make-module)) + (title (make-this-text (make-sym text-id variable-name)))) + (module-define! header 'piece title) + + (ly:score-set-header! score header) + (ly:score-add-output-def! score layout) + (add-score parser score))) + + variable-names) + (make-music 'Music 'void #t)) diff --git a/definitions/music-functions.ly b/definitions/music-functions.ly index 53f4caf..6a4f8cc 100755 --- a/definitions/music-functions.ly +++ b/definitions/music-functions.ly @@ -1,11 +1,11 @@ %------------------------------------------------------------------% -% Opéra Libre -- functions.ly % +% Opéra Libre -- music-functions.ly % % % % (c) Valentin Villenave, 2008 % % % %------------------------------------------------------------------% -% Various additional functions. +% Functions used for music notation. %%%%%%%%%%%%%%%%%%%%%%%%% Music Shortcuts %%%%%%%%%%%%%%%%%%%%%%%%%% @@ -92,12 +92,12 @@ PianoDeuxMains= \new Staff = "md" << \new Voice { \clef treble $droite } - \new Voice { \makeGhost $gauche } + %\new Voice { \makeGhost $gauche } >> \new Staff = "mg" << \new Voice { \clef bass $gauche } - \new Voice { \makeGhost $droite } + %\new Voice { \makeGhost $droite } >> >> #}) @@ -115,12 +115,12 @@ PercuDeuxMains= \new Staff = "percuDroite" << \new Voice { \clef treble $droite } - \new Voice { \makeGhost $gauche } + %\new Voice { \makeGhost $gauche } >> \new Staff = "percuGauche" << \new Voice { \clef bass $gauche } - \new Voice { \makeGhost $droite } + %\new Voice { \makeGhost $droite } >> >> #}) @@ -378,7 +378,7 @@ plak = %% Music layout ---------------------------------------------------% #(define modern-auto-beam-settings - (append default-auto-beam-settings + (append default-beam-settings `( ((end * * 3 4) . ,(ly:make-moment 1 4)) ((end * * 3 4) . ,(ly:make-moment 1 2)) diff --git a/master/master.ly b/master/master.ly index 4a9b157..e83fe06 100644 --- a/master/master.ly +++ b/master/master.ly @@ -7,9 +7,32 @@ %%% This is where all scenes are compiled sequentially. +#(define scenes + '( + Prologue + Ouverture + ActeUnSceneUn + ActeUnSceneUnBis + InterludeUn + ActeUnSceneDeux + InterludeDeux + ActeUnSceneTrois + ActeUnSceneTroisBis + ActeUnSceneTroisTer + InterludeTrois + ActeUnSceneQuatre + Entracte + ActeDeuxSceneUn + ActeDeuxSceneUnBis + ActeDeuxSceneDeux + ActeDeuxSceneTrois + )) + %%% Depends on: either vocal_score.ly or full_score.ly, %%% plus everything else. +%%% FIXME: deprec! + % \score { \Prologue -- 2.11.4.GIT