LEFT | RIGHT |
1 ;;;; music-functions.scm -- | 1 ;;;; music-functions.scm -- |
2 ;;;; | 2 ;;;; |
3 ;;;; source file of the GNU LilyPond music typesetter | 3 ;;;; source file of the GNU LilyPond music typesetter |
4 ;;;; | 4 ;;;; |
5 ;;;; (c) 1998--2009 Jan Nieuwenhuizen <janneke@gnu.org> | 5 ;;;; (c) 1998--2009 Jan Nieuwenhuizen <janneke@gnu.org> |
6 ;;;; Han-Wen Nienhuys <hanwen@xs4all.nl> | 6 ;;;; Han-Wen Nienhuys <hanwen@xs4all.nl> |
7 | 7 |
8 ;; (use-modules (ice-9 optargs)) | 8 ;; (use-modules (ice-9 optargs)) |
9 | 9 |
10 ;;; ly:music-property with setter | 10 ;;; ly:music-property with setter |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 (-2 . "15mb")))))) | 487 (-2 . "15mb")))))) |
488 (ly:context-set-property! context 'middleCOffset offset) | 488 (ly:context-set-property! context 'middleCOffset offset) |
489 (ly:context-set-property! context 'ottavation string) | 489 (ly:context-set-property! context 'ottavation string) |
490 (ly:set-middle-C! context))) | 490 (ly:set-middle-C! context))) |
491 (set! (ly:music-property m 'procedure) ottava-modify) | 491 (set! (ly:music-property m 'procedure) ottava-modify) |
492 (context-spec-music m 'Staff))) | 492 (context-spec-music m 'Staff))) |
493 | 493 |
494 (define-public (set-octavation ottavation) | 494 (define-public (set-octavation ottavation) |
495 (ly:export (make-ottava-set ottavation))) | 495 (ly:export (make-ottava-set ottavation))) |
496 | 496 |
| 497 ;;; Need to keep this definition for \time calls from parser |
497 (define-public (make-time-signature-set num den) | 498 (define-public (make-time-signature-set num den) |
498 "Set properties for time signature NUM/DEN." | 499 "Set properties for time signature NUM/DEN." |
| 500 (make-beam-rule-time-signature-set num den '())) |
| 501 |
| 502 ;;; Used for calls that include beat-grouping setting |
| 503 (define-public (set-time-signature num den . rest) |
| 504 "Set properties for time signature @var{num/den}. |
| 505 If @var{rest} is present, it is used to make a default |
| 506 @code{beamSetting} rule." |
| 507 (ly:export (apply make-beam-rule-time-signature-set |
| 508 (list num den rest)))) |
| 509 |
| 510 (define-public (make-beam-rule-time-signature-set num den rest) |
| 511 "Implement settings for new time signature. Can be |
| 512 called from either make-time-signature-set (used by \time |
| 513 in parser) or set-time-signature (called from scheme code |
| 514 included in .ly file." |
| 515 |
| 516 (define (make-default-beaming-rule context) |
| 517 (override-property-setting |
| 518 context |
| 519 'beamSettings |
| 520 (list (cons num den) 'end) |
| 521 (list (cons '* (car rest))))) |
499 | 522 |
500 (let* ((set1 (make-property-set 'timeSignatureFraction (cons num den))) | 523 (let* ((set1 (make-property-set 'timeSignatureFraction (cons num den))) |
501 (beat (ly:make-moment 1 den)) | 524 (beat (ly:make-moment 1 den)) |
502 (len (ly:make-moment num den)) | 525 (len (ly:make-moment num den)) |
503 (set2 (make-property-set 'beatLength beat)) | 526 (set2 (make-property-set 'beatLength beat)) |
504 (set3 (make-property-set 'measureLength len)) | 527 (set3 (make-property-set 'measureLength len)) |
505 » (basic» (list set1 set2 set3))) | 528 (beaming-rule |
| 529 (if (null? rest) |
| 530 '() |
| 531 (list (make-apply-context make-default-beaming-rule)))) |
| 532 (output (cons* set1 set2 set3 beaming-rule))) |
506 (descend-to-context | 533 (descend-to-context |
507 (context-spec-music (make-sequential-music basic) 'Timing) 'Score))) | 534 (context-spec-music |
| 535 (make-sequential-music output) |
| 536 'Timing) |
| 537 'Score))) |
508 | 538 |
509 (define-public (make-mark-set label) | 539 (define-public (make-mark-set label) |
510 "Make the music for the \\mark command." | 540 "Make the music for the \\mark command." |
511 (let* ((set (if (integer? label) | 541 (let* ((set (if (integer? label) |
512 (context-spec-music (make-property-set 'rehearsalMark label) | 542 (context-spec-music (make-property-set 'rehearsalMark label) |
513 'Score) | 543 'Score) |
514 #f)) | 544 #f)) |
515 (ev (make-music 'MarkEvent)) | 545 (ev (make-music 'MarkEvent)) |
516 (ch (make-event-chord (list ev)))) | 546 (ch (make-event-chord (list ev)))) |
517 (if set | 547 (if set |
518 (make-sequential-music (list set ch)) | 548 (make-sequential-music (list set ch)) |
519 (begin | 549 (begin |
520 (set! (ly:music-property ev 'label) label) | 550 (set! (ly:music-property ev 'label) label) |
521 ch)))) | 551 ch)))) |
522 | |
523 (define-public (set-time-signature num den . rest) | |
524 "Set properties for time signature @var{num/den}. | |
525 If @var{rest} is present, it is used to make a default @code{beamSetting} | |
526 rule." | |
527 (if (pair? rest) | |
528 (ly:export | |
529 (make-sequential-music | |
530 (list | |
531 (context-spec-music | |
532 (make-apply-context | |
533 (lambda (c) (override-property-setting | |
534 c 'beamSettings | |
535 (list (cons num den) 'end) | |
536 (list (cons '* (car rest)))))) | |
537 'Score) | |
538 (apply make-time-signature-set (list num den))))) | |
539 (ly:export (apply make-time-signature-set (list num den))))) | |
540 | 552 |
541 (define-safe-public (make-articulation name) | 553 (define-safe-public (make-articulation name) |
542 (make-music 'ArticulationEvent | 554 (make-music 'ArticulationEvent |
543 'articulation-type name)) | 555 'articulation-type name)) |
544 | 556 |
545 (define-public (make-lyric-event string duration) | 557 (define-public (make-lyric-event string duration) |
546 (make-music 'LyricEvent | 558 (make-music 'LyricEvent |
547 'duration duration | 559 'duration duration |
548 'text string)) | 560 'text string)) |
549 | 561 |
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1385 (define-public (event-chord-notes event-chord) | 1397 (define-public (event-chord-notes event-chord) |
1386 "Return a list of all notes from @{event-chord}." | 1398 "Return a list of all notes from @{event-chord}." |
1387 (filter | 1399 (filter |
1388 (lambda (m) (eq? 'NoteEvent (ly:music-property m 'name))) | 1400 (lambda (m) (eq? 'NoteEvent (ly:music-property m 'name))) |
1389 (ly:music-property event-chord 'elements))) | 1401 (ly:music-property event-chord 'elements))) |
1390 | 1402 |
1391 (define-public (event-chord-pitches event-chord) | 1403 (define-public (event-chord-pitches event-chord) |
1392 "Return a list of all pitches from @{event-chord}." | 1404 "Return a list of all pitches from @{event-chord}." |
1393 (map (lambda (x) (ly:music-property x 'pitch)) | 1405 (map (lambda (x) (ly:music-property x 'pitch)) |
1394 (event-chord-notes event-chord))) | 1406 (event-chord-notes event-chord))) |
LEFT | RIGHT |