Valentin Villenave skrev:
Rune: what's wrong with loading markup.scm?
It is not loading the file that is the problem. It is the reason for me having to load the file that is the problem. I was unable to do the function without using functions that are not meant to be accessible to the user. I do not like that.
I made a file - REALLY messy - that implements a function to make a mixed meter.
I will put it into lsr soon. Would really like to get some time to clean it a bit up first, though.
Optimizations/comments much appreciated! -Rune
\version "2.10.33" \include "mixed-meter.ly" { \mixedMeter #'(3 2 2 3 2 2 2 2 3 2 2 8) \repeat unfold 25 c'8 \repeat unfold 50 c'16 }
<<inline: test-mixed-meter.preview.png>>
\version "2.10.33" #(ly:load "markup.scm") #(define (compound-time . args) (let* ((revargs (reverse args)) (num (car revargs)) (dens (reverse (cdr revargs)))) (make-override-markup '(baseline-skip . 0) (make-number-markup (make-line-markup (cons (make-column-markup (list (car dens) num)) (map (lambda (den) (make-line-markup (list (make-vcenter-markup "+") (make-column-markup (list den num))))) (cdr dens)))))))) #(define (sum-list lst) (if (pair? lst) (+ (car lst) (sum-list (cdr lst))) 0)) #(ly:load "auto-beam.scm") #(define (make-auto-beam-setting setting num den . rest) (context-spec-music (make-apply-context (lambda (c) (override-property-setting c 'autoBeamSettings setting (ly:make-moment num den)))) (if (and (pair? rest) (symbol? (car rest))) (car rest) 'Voice))) mixedMeter = #(define-music-function (parser location args) (pair?) #{ #(let* ((revargs (reverse $args)) (num (car revargs)) (dens (reverse (cdr revargs)))) (letrec ((make-auto-beam-settings (lambda (lst accum) (if (pair? lst) (begin (cons (make-auto-beam-setting `(end * * ,(sum-list dens) ,num) accum num) (make-auto-beam-settings (cdr lst) (+ accum (car lst))))) '())))) (ly:export (make-music 'SequentialMusic 'elements (make-auto-beam-settings (cdr dens) (car dens)))))) \override Staff.TimeSignature #'stencil = #ly:text-interface::print \override Staff.TimeSignature #'text = #(apply compound-time (map number->string $args)) \set Staff.beatGrouping = #(reverse (cdr (reverse $args))) \set Timing.measureLength = #(ly:make-moment (sum-list (cdr (reverse $args))) (car (reverse $args))) \set Timing.beatLength = #(ly:make-moment 1 (car (reverse $args))) #} )
_______________________________________________ bug-lilypond mailing list bug-lilypond@gnu.org http://lists.gnu.org/mailman/listinfo/bug-lilypond