Mercurial > hg > amuse
diff base/methods.lisp @ 233:eb4d239f5437
add some time-related generic functions to base
Ignore-this: 8ad91dcfa5c8a0301c29dda7d2f27802
darcs-hash:20100212101520-16a00-6821cd98b78bf27be148e3e7e4b46c8f0b80928b.gz
committer: Jamie Forth <j.forth@gold.ac.uk>
author | j.forth <j.forth@gold.ac.uk> |
---|---|
date | Thu, 24 Feb 2011 11:23:18 +0000 |
parents | 32b40c50075e |
children | 70969555ca07 |
line wrap: on
line diff
--- a/base/methods.lisp Thu Feb 24 11:23:18 2011 +0000 +++ b/base/methods.lisp Thu Feb 24 11:23:18 2011 +0000 @@ -544,6 +544,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))