lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reverting Beat Grouping Commands


From: Trevor Daniels
Subject: Re: Reverting Beat Grouping Commands
Date: Sun, 5 Apr 2009 12:05:26 +0100

Carl

As an alternative to having a complex time-signature-dependent revert command why don't we introduce a context property to control whether the beam-ending rules should be applied or not? This seems particularly easy to do, and is conceptually simple. We would need to add a couple of lines to default-auto-beam-check in auto-beam.scm like this:

change

(settings (get 'autoBeamSettings '()))

to

(settings (if (get 'useBeamEndingRules #t)
 (get 'autoBeamSettings '())
 '()))

What do you think? It seems to work fine. Shall I make this my first frog task?

Trevor


----- Original Message ----- From: "Carl D. Sorensen" <address@hidden> To: "Trevor Daniels" <address@hidden>; "lilypond-devel" <address@hidden>
Sent: Monday, March 23, 2009 1:14 AM
Subject: Reverting Beat Grouping Commands


Trevor,

Here is the code that I remembered had been provided for reverting auto-beam
settings.

Unfortunately, I remembered it coming from Nicolas instead of Neil. I guess I got my Scheme-guru-beginning-with-N names confused. Sorry, Neil!

HTH,

Carl


------ Forwarded Message
From: Neil Puttock <address@hidden>
Date: Sat, 25 Oct 2008 14:06:42 -0600
To: Trevor Daniels <address@hidden>
Cc: "Carl D. Sorensen" <address@hidden>, Lilypond-User List
<address@hidden>
Conversation: Beat grouping and reverting
Subject: Re: Beat grouping and reverting

Hi Trevor,

2008/10/25 Trevor Daniels <address@hidden>:
Carl

But how do you revert entries like this:

((end * * 6 8) . #f) ;; switch-off at-any-beat feature

The simplest way would be to add a function to switch this back on:

#(define (revert-property-setting context property setting)
 "Like the C++ code that executes \revert, but without type
checking. "
 (define (revert-member alist entry new)
"Return ALIST, with ENTRY removed. ALIST is not modified, instead
a fresh copy of the list-head is made."
   (cond
    ((null? alist) new)
((equal? (car alist) entry) (revert-member (cdr alist) entry new)) (else (revert-member (cdr alist) entry (cons (car alist) new)))))
 (ly:context-set-property!
  context property
(revert-member (ly:context-property context property) setting '())))

#(define (allow-at-any-beat num den)
 (ly:export
  (context-spec-music
   (make-apply-context (lambda (c)
                         (revert-property-setting
                          c 'autoBeamSettings
                          (cons `(end * * ,num ,den) #f))))
       'Voice)))

\relative c'' {
 #(set-time-signature 6 8 '())
 #(allow-at-any-beat 6 8)
 #(revert-auto-beam-setting '(end * * 6 8) 3 8)
 #(revert-auto-beam-setting '(end 1 32 6 8) 1 8)
 #(revert-auto-beam-setting '(end 1 32 6 8) 1 4)
 #(revert-auto-beam-setting '(end 1 32 6 8) 1 2)
 #(revert-auto-beam-setting '(end 1 32 6 8) 5 8)
 a8 a a a a a
 \set beatGrouping = #'(2 2 2)
 a8 a a a a a
}

A better solution might be to rewrite revert-auto-beam-setting so that
the args for beat begin/end are moved to the optional argument list
(which is currently only used for the context).

Regards,
Neil

------ End of Forwarded Message






reply via email to

[Prev in Thread] Current Thread [Next in Thread]