]> git.donarmstrong.com Git - lilypond.git/blobdiff - ly/music-functions-init.ly
* Documentation/topdocs/NEWS.tely (Top): doc new feature.
[lilypond.git] / ly / music-functions-init.ly
index 4396a64c45873c565fe107197118baa8fca6450a..1fb36ffaadce209a9f37dae6c1b540ee76622d61 100644 (file)
@@ -15,7 +15,6 @@
 acciaccatura =
 #(def-grace-function startAcciaccaturaMusic stopAcciaccaturaMusic)
 
-
 addquote =
 #(define-music-function (parser location name music) (string? ly:music?)
    "Add a piece of music to be quoted "
@@ -116,7 +115,7 @@ barNumberCheck =
               (lambda (c)
                 (let*
                     ((cbn (ly:context-property c 'currentBarNumber)))
-                  (if (not (= cbn n))
+                  (if (and  (number? cbn) (not (= cbn n)))
                       (ly:input-message location "Barcheck failed got ~a expect ~a"
                                         cbn n))))))
 
@@ -126,13 +125,13 @@ breathe =
 #(define-music-function (parser location) ()
             (make-music 'EventChord 
               'origin location
-              'elements (list (make-music 'BreathingSignEvent))))
+              'elements (list (make-music 'BreathingEvent))))
 
 bendAfter =
 #(define-music-function (parser location delta) (integer?)
              
   (make-music 'BendAfterEvent
-   'delta-pitch delta))
+   'delta-step delta))
 
 clef =
 #(define-music-function (parser location type)
@@ -202,6 +201,39 @@ acceleration/deceleration. "
 grace =
 #(def-grace-function startGraceMusic stopGraceMusic)
 
+
+"instrument-definitions" = #'()
+
+addInstrumentDefinition =
+#(define-music-function
+   (parser location name lst) (string? list?)
+
+   (set! instrument-definitions (acons name lst instrument-definitions))
+
+   (make-music 'SequentialMusic 'void #t))
+
+
+instrumentSwitch =
+#(define-music-function
+   (parser location name) (string?)
+   (let*
+       ((handle  (assoc name instrument-definitions))
+       (instrument-def (if handle (cdr handle) '()))
+       )
+
+     (if (not handle)
+        (ly:input-message "No such instrument: ~a" name))
+     (context-spec-music
+      (make-music 'SimultaneousMusic
+                 'elements
+                 (map (lambda (kv)
+                        (make-property-set
+                         (car kv)
+                         (cdr kv)))
+                      instrument-def))
+      'Staff)))
+
+
 keepWithTag =
 #(define-music-function
   (parser location tag music) (symbol? ly:music?)
@@ -291,7 +323,6 @@ removeWithTag =
 %% doing
 %% define-music-function in a .scm causes crash.
 
-
 octave =
 #(define-music-function (parser location pitch-note) (ly:music?)
    "octave check"
@@ -331,11 +362,6 @@ pitchedTrill =
           (display sec-note-events)))
 
      main-note))
-
-
-
-
-
    
 parenthesize =
 #(define-music-function (parser loc arg) (ly:music?)
@@ -481,8 +507,8 @@ spacingTweaks =
    (make-music 'SequentialMusic 'void #t))
 
 
-transposedCueDuring = #
-(define-music-function
+transposedCueDuring =
+#(define-music-function
   (parser location what dir pitch-note main-music)
   (string? ly:dir? ly:music? ly:music?)
 
@@ -503,7 +529,15 @@ as a first or second voice."
 
 
 
+transposition =
+#(define-music-function (parser location pitch-note) (ly:music?)
+   "Set instrument transposition"
 
+   (context-spec-music
+    (make-property-set 'instrumentTransposition
+                      (ly:pitch-diff (ly:make-pitch 0 0 0) (pitch-of-note pitch-note)))
+        'Staff
+))
 
 tweak = #(define-music-function (parser location sym val arg)
           (symbol? scheme? ly:music?)
@@ -532,3 +566,17 @@ tag = #(define-music-function (parser location tag arg)
 unfoldRepeats =
 #(define-music-function (parser location music) (ly:music?)
                  (unfold-repeats music))
+
+untied =
+#(define-music-function (parser location note) (ly:music?)
+   "Specify that @var{note} should not have ties. " 
+   (set! (ly:music-property note 'untied) #t)
+   note)
+
+withMusicProperty =
+#(define-music-function (parser location sym val music) (symbol? scheme? ly:music?)
+   "Set @var{sym} to @var{val} in @var{music}."
+
+   (set! (ly:music-property music sym) val)
+   music)
+