1 ;------------------------------------------------------------------;
2 ; opus_libre -- libdynamics.scm ;
4 ; (c) 2008-2011 Valentin Villenave <valentin@villenave.net> ;
6 ; opus_libre is a free framework for GNU LilyPond: you may ;
7 ; redistribute it and/or modify it under the terms of the GNU ;
8 ; General Public License as published by the Free Software ;
9 ; Foundation, either version 3 of the License, or (at your option) ;
10 ; any later version. ;
11 ; This program is distributed WITHOUT ANY WARRANTY; without ;
12 ; even the implied warranty of MERCHANTABILITY or FITNESS FOR A ;
13 ; PARTICULAR PURPOSE. You should have received a copy of the GNU ;
14 ; General Public License along with this program (typically in the ;
15 ; share/doc/ directory). If not, see http://www.gnu.org/licenses/ ;
17 ;------------------------------------------------------------------;
24 (let ((name (ly:music-property x 'name)))
26 (eq? name 'DynamicEvent)
27 (eq? name 'AbsoluteDynamicEvent)
28 (eq? name 'CrescendoEvent)
29 (eq? name 'DecrescendoEvent)
30 (eq? name 'SpanDynamicEvent))))
33 ;; Tag all dynamics in MUSIC.
34 (define-music-function (music) (ly:music?)
38 (set! (ly:music-property x 'tags)
40 (ly:music-property x 'tags))))
43 (define removeDynamics
44 ;; Remove untagged dynamics.
45 (define-music-function (music) (ly:music?)
46 (if (ly:get-option 'no-auto-piano-dynamics)
50 (let ((tags (ly:music-property x 'tags))
51 (dir (ly:music-property x 'direction)))
54 (not (memq 'staff-dynamics tags))
58 (define filterDynamics
59 ;; Like \removeWithTag, but will not affect other contexts
60 ;; (i.e. no \change, no \bar or \time etc.)
61 (define-music-function (music) (ly:music?)
62 (if (ly:get-option 'no-auto-piano-dynamics)
63 (make-music 'Music 'void #t)
66 (let ((name (ly:music-property x 'name))
67 (tags (ly:music-property x 'tags))
68 (dir (ly:music-property x 'direction)))
70 (eq? name 'ContextChange)
71 (eq? name 'VoiceSeparator)
72 ;(eq? name 'ContextSpeccedMusic)
73 (memq 'staff-dynamics tags)