[prev in list] [next in list] [prev in thread] [next in thread]
List: lilypond-user
Subject: Scheme function for tempo marking -- "hash" for names?
From: "Dmytro O. Redchuk" <brownian.box () gmail ! com>
Date: 2008-09-29 11:54:37
Message-ID: 8409fdee0809290454i58be43ax7c51d6ca63bc1c01 () mail ! gmail ! com
[Download RAW message or body]
Hi, all,
i'm sorry, this is, probably, purely-scheme-related-question.
Sorry, i'm not a programmer.
I wanted to align tempo mark ("Adagio", "Moderato" etc)
left-side-centered on key signature
if it is not C-dur or A-moll, otherwise aligned left-side above left
side of time signature.
I wrote small function for tempo marking:
tempoMark =
#(define-music-function (parser location mark anchor offset)
(string? list? number?)
#{
\once \override Score.RehearsalMark #'self-alignment-X = #-1
\once \override Score.KeySignature
#'break-align-anchor-alignment = #CENTER
\once \override Score.TimeSignature
#'break-align-anchor-alignment = #LEFT
\once \override Score.RehearsalMark
#'break-align-symbols = #$anchor
\once \override Score.RehearsalMark #'Y-offset = #$offset
\mark \markup { \bold \smaller $mark }
#})
I use it like this:
\tempoMark "Moderato" #'(key-signature) #0
Next, let's say, i would like to have tempo marking translated into Ukrainian
("Швидко" instead of "Allegro" etc.). But i'm not sure that i will not
change those
translations, so i would like to have a function like this:
moderato =
#(define-music-function (parser location anchor offset)
(list? number?)
#{
\tempoMark "Помірно" $anchor #$offset
#})
and to use it like this:
\moderato #'(key-signature) #0
So, if i decide to "translate back", or to change translations, i can
modify function definition.
But in this case i need to write a lot of identical functions.
So, two questions:
1. Is it possible to define a "hash" (key->value) and use it in a
single function?
I am not a programmer [*], so please give me a clue.
2. May be, i am quite *wrong*, and should use some different approach?
Thank you.
________
* I know how to program this in Python, perl, awk, bash;
however i'm not a programmer at all, that's why i'm asking
for "keyword" or "template", or smth like this.
--
Dmytro O. Redchuk
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic