[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Denemo-devel] d-MeasureFull?
From: |
Richard Shann |
Subject: |
[Denemo-devel] d-MeasureFull? |
Date: |
Thu, 10 Jun 2010 08:35:43 +0100 |
Nils,
I think we should change the name of the procedure d-MeasureFull
(defined in denemo.scm). I suggest
(define (MeasureFullStatus) ....
The reasons are, firstly the '?' at the end is a convention for
something that returns a boolean (I think). At the very least it should
return #f if the answer to the (terse) question MeasureFull? is no. (Ok,
so it is ambiguous what that means, if it is over-full is it still
full?). Secondly, d- is a prefix by C to avoid clashes with variables
defined in scheme. There are a few cases where it seemed a good idea to
use that naming convention in denemo.scm for uniformity - completing the
set of d-Directive-xxx things.
As far as I can see, there are no scripts that use it outside denemo.scm
so this should be a harmless change. In fact, the only uses seem to be
to test if the status is not #f. Perhaps three procedures would be good
(define (MeasureIsUnderfull?) (equal? (MeasureFullStatus) #f))
(define (MeasureIsOverfull?) (equal? (MeasureFullStatus) 2))
(define (MeasureIsFull?) (equal? (MeasureFullStatus) 1)) - or perhaps
MeasureIsExact? if the ambiguity seems too strong
(If I have got the scheme syntax right).
For reference the current code is below
Richard
;;;;;;;Get Measure Filling Status
(define (d-MeasureFull?)
(let script ((MaxTicks 0) (return #f))
(d-PushPosition)
(d-GoToMeasureEnd)
(set! MaxTicks (* 1536 (d-GetTimeSignature #t) )) ; How many ticks are
in a 100% filled measure?
(set! return (cond
((not(d-GetEndTick)) #f) ; empty
((< (d-GetEndTick) MaxTicks) #f) ; underful
((= MaxTicks (d-GetEndTick)) 1) ; 100% filled
((< MaxTicks (d-GetEndTick)) 2) ; >100% filled
(else (display "strange!")) ; ?
))
(d-PopPosition)
return
))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Denemo-devel] d-MeasureFull?,
Richard Shann <=