OLD | NEW |
1 ;;;; This file is part of LilyPond, the GNU music typesetter. | 1 ;;;; This file is part of LilyPond, the GNU music typesetter. |
2 ;;;; | 2 ;;;; |
3 ;;;; Copyright (C) 1998--2011 Jan Nieuwenhuizen <janneke@gnu.org> | 3 ;;;; Copyright (C) 1998--2011 Jan Nieuwenhuizen <janneke@gnu.org> |
4 ;;;; Han-Wen Nienhuys <hanwen@xs4all.nl> | 4 ;;;; Han-Wen Nienhuys <hanwen@xs4all.nl> |
5 ;;;; | 5 ;;;; |
6 ;;;; LilyPond is free software: you can redistribute it and/or modify | 6 ;;;; LilyPond is free software: you can redistribute it and/or modify |
7 ;;;; it under the terms of the GNU General Public License as published by | 7 ;;;; it under the terms of the GNU General Public License as published by |
8 ;;;; the Free Software Foundation, either version 3 of the License, or | 8 ;;;; the Free Software Foundation, either version 3 of the License, or |
9 ;;;; (at your option) any later version. | 9 ;;;; (at your option) any later version. |
10 ;;;; | 10 ;;;; |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 (parameterize ((*indent* 0) | 226 (parameterize ((*indent* 0) |
227 (*previous-duration* (ly:make-duration 2)) | 227 (*previous-duration* (ly:make-duration 2)) |
228 (*force-duration* force-duration)) | 228 (*force-duration* force-duration)) |
229 (display (music->lily-string expr parser)) | 229 (display (music->lily-string expr parser)) |
230 (newline))) | 230 (newline))) |
231 | 231 |
232 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 232 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
233 | 233 |
234 (define-public (shift-one-duration-log music shift dot) | 234 (define-public (shift-one-duration-log music shift dot) |
235 "Add @var{shift} to @code{duration-log} of @code{'duration} in | 235 "Add @var{shift} to @code{duration-log} of @code{'duration} in |
236 @var{music} and optionally @var{dot} to any note encountered. This | 236 @var{music} and optionally @var{dot} to any note encountered. |
237 scales the music up by a factor `2^@var{shift} * (2 - (1/2)^@var{dot})'." | 237 The number of dots in the shifted music may not be less than zero." |
238 (let ((d (ly:music-property music 'duration))) | 238 (let ((d (ly:music-property music 'duration))) |
239 (if (ly:duration? d) | 239 (if (ly:duration? d) |
240 (let* ((cp (ly:duration-factor d)) | 240 (let* ((cp (ly:duration-factor d)) |
241 » (nd (ly:make-duration (+ shift (ly:duration-log d)) | 241 » (nd (ly:make-duration |
242 » » » » (+ dot (ly:duration-dot-count d)) | 242 (+ shift (ly:duration-log d)) |
243 » » » » (car cp) | 243 (max 0 (+ dot (ly:duration-dot-count d))) |
244 » » » » (cdr cp)))) | 244 » » (car cp) |
| 245 » » (cdr cp)))) |
245 (set! (ly:music-property music 'duration) nd))) | 246 (set! (ly:music-property music 'duration) nd))) |
246 music)) | 247 music)) |
247 | 248 |
248 (define-public (shift-duration-log music shift dot) | 249 (define-public (shift-duration-log music shift dot) |
249 (music-map (lambda (x) (shift-one-duration-log x shift dot)) | 250 (music-map (lambda (x) (shift-one-duration-log x shift dot)) |
250 music)) | 251 music)) |
251 | 252 |
252 (define-public (make-repeat name times main alts) | 253 (define-public (make-repeat name times main alts) |
253 "Create a repeat music expression, with all properties initialized | 254 "Create a repeat music expression, with all properties initialized |
254 properly." | 255 properly." |
(...skipping 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1478 (key-entry-alteration | 1479 (key-entry-alteration |
1479 (find-pitch-entry | 1480 (find-pitch-entry |
1480 keysig | 1481 keysig |
1481 (ly:make-pitch localoct | 1482 (ly:make-pitch localoct |
1482 (key-entry-notename entry) | 1483 (key-entry-notename entry) |
1483 0) | 1484 0) |
1484 #t #t)))) | 1485 #t #t)))) |
1485 entry | 1486 entry |
1486 (cons (car entry) (cons 'clef (cddr entry)))))) | 1487 (cons (car entry) (cons 'clef (cddr entry)))))) |
1487 (ly:context-property context 'localKeySignature))))) | 1488 (ly:context-property context 'localKeySignature))))) |
1488 » » | 1489 |
1489 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 1490 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1490 | 1491 |
1491 (define-public (skip-of-length mus) | 1492 (define-public (skip-of-length mus) |
1492 "Create a skip of exactly the same length as @var{mus}." | 1493 "Create a skip of exactly the same length as @var{mus}." |
1493 (let* ((skip | 1494 (let* ((skip |
1494 (make-music | 1495 (make-music |
1495 'SkipEvent | 1496 'SkipEvent |
1496 'duration (ly:make-duration 0 0)))) | 1497 'duration (ly:make-duration 0 0)))) |
1497 | 1498 |
1498 (make-event-chord (list (ly:music-compress skip (ly:music-length mus)))))) | 1499 (make-event-chord (list (ly:music-compress skip (ly:music-length mus)))))) |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1545 (define-public (event-chord-notes event-chord) | 1546 (define-public (event-chord-notes event-chord) |
1546 "Return a list of all notes from @var{event-chord}." | 1547 "Return a list of all notes from @var{event-chord}." |
1547 (filter | 1548 (filter |
1548 (lambda (m) (eq? 'NoteEvent (ly:music-property m 'name))) | 1549 (lambda (m) (eq? 'NoteEvent (ly:music-property m 'name))) |
1549 (ly:music-property event-chord 'elements))) | 1550 (ly:music-property event-chord 'elements))) |
1550 | 1551 |
1551 (define-public (event-chord-pitches event-chord) | 1552 (define-public (event-chord-pitches event-chord) |
1552 "Return a list of all pitches from @var{event-chord}." | 1553 "Return a list of all pitches from @var{event-chord}." |
1553 (map (lambda (x) (ly:music-property x 'pitch)) | 1554 (map (lambda (x) (ly:music-property x 'pitch)) |
1554 (event-chord-notes event-chord))) | 1555 (event-chord-notes event-chord))) |
OLD | NEW |