Mercurial > hg > amuse
diff base/methods.lisp @ 307:a85c59bcd88b
add some time-related generic functions to base
Ignore-this: 8ad91dcfa5c8a0301c29dda7d2f27802
darcs-hash:20100212101520-16a00-6821cd98b78bf27be148e3e7e4b46c8f0b80928b.gz
author | j.forth <j.forth@gold.ac.uk> |
---|---|
date | Fri, 12 Feb 2010 10:15:20 +0000 |
parents | fbeaedd242c6 |
children | 6c57b16a7829 |
line wrap: on
line diff
--- a/base/methods.lisp Sun Apr 04 22:05:37 2010 +0100 +++ b/base/methods.lisp Fri Feb 12 10:15:20 2010 +0000 @@ -542,6 +542,17 @@ (make-standard-anchored-period (timepoint start) (duration bar-duration)))))) +(defmethod ioi-from-bar ((event event)) + (- (timepoint (onset event)) + (timepoint (current-bar event (composition event))))) + +(defmethod ioi-from-bar ((constituent constituent)) + (- (timepoint (onset constituent)) + (timepoint (current-bar constituent constituent)))) + +(defmethod onset-in-bar ((o moment)) + (1+ (ioi-from-bar o))) + (defmethod beat-period ((moment standard-moment) (time-signature standard-time-signature) (composition composition))