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 |
| 498 (define-public (make-time-signature-set 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 |
497 (define-public (make-beam-rule-time-signature-set num den rest) | 510 (define-public (make-beam-rule-time-signature-set num den rest) |
498 "Set properties for time signature NUM/DEN." | 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." |
499 | 515 |
500 (define (make-default-beaming-rule context) | 516 (define (make-default-beaming-rule context) |
501 (override-property-setting | 517 (override-property-setting |
502 context | 518 context |
503 'beamSettings | 519 'beamSettings |
504 (list (cons num den) 'end) | 520 (list (cons num den) 'end) |
505 (list (cons '* (car rest))))) | 521 (list (cons '* (car rest))))) |
506 | 522 |
507 (let* ((set1 (make-property-set 'timeSignatureFraction (cons num den))) | 523 (let* ((set1 (make-property-set 'timeSignatureFraction (cons num den))) |
508 (beat (ly:make-moment 1 den)) | 524 (beat (ly:make-moment 1 den)) |
509 (len (ly:make-moment num den)) | 525 (len (ly:make-moment num den)) |
510 (set2 (make-property-set 'beatLength beat)) | 526 (set2 (make-property-set 'beatLength beat)) |
511 (set3 (make-property-set 'measureLength len)) | 527 (set3 (make-property-set 'measureLength len)) |
512 (beaming-rule | 528 (beaming-rule |
513 (if (null? rest) | 529 (if (null? rest) |
514 '() | 530 '() |
515 (list (make-apply-context make-default-beaming-rule)))) | 531 (list (make-apply-context make-default-beaming-rule)))) |
516 (output (cons* set1 set2 set3 beaming-rule))) | 532 (output (cons* set1 set2 set3 beaming-rule))) |
517 (descend-to-context | 533 (descend-to-context |
518 (context-spec-music | 534 (context-spec-music |
519 (make-simultaneous-music output) | 535 (make-sequential-music output) |
520 'Timing) | 536 'Timing) |
521 'Score))) | 537 'Score))) |
522 | |
523 (define-public (make-time-signature-set num den) | |
524 "Set properties for time signature NUM/DEN." | |
525 (make-beam-rule-time-signature-set num den '())) | |
526 | 538 |
527 (define-public (make-mark-set label) | 539 (define-public (make-mark-set label) |
528 "Make the music for the \\mark command." | 540 "Make the music for the \\mark command." |
529 (let* ((set (if (integer? label) | 541 (let* ((set (if (integer? label) |
530 (context-spec-music (make-property-set 'rehearsalMark label) | 542 (context-spec-music (make-property-set 'rehearsalMark label) |
531 'Score) | 543 'Score) |
532 #f)) | 544 #f)) |
533 (ev (make-music 'MarkEvent)) | 545 (ev (make-music 'MarkEvent)) |
534 (ch (make-event-chord (list ev)))) | 546 (ch (make-event-chord (list ev)))) |
535 (if set | 547 (if set |
536 (make-sequential-music (list set ch)) | 548 (make-sequential-music (list set ch)) |
537 (begin | 549 (begin |
538 (set! (ly:music-property ev 'label) label) | 550 (set! (ly:music-property ev 'label) label) |
539 ch)))) | 551 ch)))) |
540 | |
541 (define-public (set-time-signature num den . rest) | |
542 "Set properties for time signature @var{num/den}. | |
543 If @var{rest} is present, it is used to make a default | |
544 @code{beamSetting} rule." | |
545 | |
546 (define (make-default-beaming-rule context) | |
547 (override-property-setting | |
548 context | |
549 'beamSettings | |
550 (list (cons num den) 'end) | |
551 (list (cons '* (car rest))))) | |
552 | |
553 (ly:export (apply make-beam-rule-time-signature-set | |
554 (list num den rest)))) | |
555 ; (if (pair? rest) | |
556 ; (ly:export | |
557 ; (make-sequential-music | |
558 ; (list | |
559 ; (context-spec-music | |
560 ; (make-apply-context make-default-beaming-rule) | |
561 ;(lambda (c) (override-property-setting | |
562 ; c 'beamSettings | |
563 ; (list (cons num den) 'end) | |
564 ; (list (cons '* (car rest)))))) | |
565 ; 'Score) | |
566 ; (apply make-time-signature-set (list num den))))) | |
567 ; (ly:export (apply make-time-signature-set (list num den))))) | |
568 | 552 |
569 (define-safe-public (make-articulation name) | 553 (define-safe-public (make-articulation name) |
570 (make-music 'ArticulationEvent | 554 (make-music 'ArticulationEvent |
571 'articulation-type name)) | 555 'articulation-type name)) |
572 | 556 |
573 (define-public (make-lyric-event string duration) | 557 (define-public (make-lyric-event string duration) |
574 (make-music 'LyricEvent | 558 (make-music 'LyricEvent |
575 'duration duration | 559 'duration duration |
576 'text string)) | 560 'text string)) |
577 | 561 |
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1413 (define-public (event-chord-notes event-chord) | 1397 (define-public (event-chord-notes event-chord) |
1414 "Return a list of all notes from @{event-chord}." | 1398 "Return a list of all notes from @{event-chord}." |
1415 (filter | 1399 (filter |
1416 (lambda (m) (eq? 'NoteEvent (ly:music-property m 'name))) | 1400 (lambda (m) (eq? 'NoteEvent (ly:music-property m 'name))) |
1417 (ly:music-property event-chord 'elements))) | 1401 (ly:music-property event-chord 'elements))) |
1418 | 1402 |
1419 (define-public (event-chord-pitches event-chord) | 1403 (define-public (event-chord-pitches event-chord) |
1420 "Return a list of all pitches from @{event-chord}." | 1404 "Return a list of all pitches from @{event-chord}." |
1421 (map (lambda (x) (ly:music-property x 'pitch)) | 1405 (map (lambda (x) (ly:music-property x 'pitch)) |
1422 (event-chord-notes event-chord))) | 1406 (event-chord-notes event-chord))) |
LEFT | RIGHT |