Mercurial > hg > amuse
comparison base/methods.lisp @ 276:3180b03d436a
add move-to-first-bar method
darcs-hash:20090124002529-16a00-b7802e0488f4e2f0c442d6735845503b50440a25.gz
author | j.forth <j.forth@gold.ac.uk> |
---|---|
date | Sat, 24 Jan 2009 00:25:29 +0000 |
parents | aa2b33f83ac6 |
children | e52b6eb30408 |
comparison
equal
deleted
inserted
replaced
190:725ce7ce77ba | 276:3180b03d436a |
---|---|
561 ;; If no time-sig, there's no way of answering this | 561 ;; If no time-sig, there's no way of answering this |
562 ;; directly. There may be sensible defaults, but it's the job | 562 ;; directly. There may be sensible defaults, but it's the job |
563 ;; of an implementation's author to solve that. | 563 ;; of an implementation's author to solve that. |
564 (error 'insufficient-information :operation 'beat-period :datatype (class-of composition))))) | 564 (error 'insufficient-information :operation 'beat-period :datatype (class-of composition))))) |
565 | 565 |
566 | |
567 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
568 ;; Copying events in time | |
569 | |
570 (defmethod move-to-first-bar ((composition composition)) | |
571 (let ((offset (floor (timepoint (car composition))))) | |
572 (loop | |
573 for event in (%list-slot-sequence-data) | |
574 do (setf event (copy-event event)) | |
575 do (setf (timepoint event) | |
576 (- (timepoint event) offset)) | |
577 collect event into shifted-events | |
578 finally (return shifted-events)))) |