;;;; This file is part of LilyPond, the GNU music typesetter.
;;;;
-;;;; Copyright (C) 1998--2012 Jan Nieuwenhuizen <janneke@gnu.org>
+;;;; Copyright (C) 1998--2014 Jan Nieuwenhuizen <janneke@gnu.org>
;;;; Han-Wen Nienhuys <hanwen@xs4all.nl>
;;;;
;;;; LilyPond is free software: you can redistribute it and/or modify
(cons (ly:moment-main-numerator moment)
(ly:moment-main-denominator moment)))
+(define-public (seconds->moment s context)
+ "Return a moment equivalent to s seconds at the current tempo."
+ (ly:moment-mul (ly:context-property context 'tempoWholesPerMinute)
+ (ly:make-moment (/ s 60))))
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; durations
duration (base note length and dot count), as a number of whole notes."
(duration-length (duration-visual dur)))
+(define-public (unity-if-multimeasure context dur)
+ "Given a context and a duration, return @code{1} if the duration is
+longer than the @code{measureLength} in that context, and @code{#f} otherwise.
+This supports historic use of @code{Completion_heads_engraver} to split
+@code{c1*3} into three whole notes."
+ (if (ly:moment<? (ly:context-property context 'measureLength)
+ (ly:duration-length dur))
+ 1
+ #f))
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; arithmetic
(define-public (average x . lst)
(list elem)))
'() lst))
-(define-public (filtered-map proc lst)
- (filter
- (lambda (x) x)
- (map proc lst)))
+(define-public filtered-map filter-map)
(define-public (flatten-list x)
"Unnest list."