Mercurial > hg > amuse
comparison base/methods.lisp @ 245:70969555ca07
Twiddle comment separators.
Ignore-this: ff8dea522834ce66c6b0aee3bc54dd27
darcs-hash:20100604153923-16a00-029be21bba10fa97e77a694aec54086cc27003e8.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 | eb4d239f5437 |
children | b3260d1d2419 |
comparison
equal
deleted
inserted
replaced
244:76a695fe294f | 245:70969555ca07 |
---|---|
577 ;; directly. There may be sensible defaults, but it's the job | 577 ;; directly. There may be sensible defaults, but it's the job |
578 ;; of an implementation's author to solve that. | 578 ;; of an implementation's author to solve that. |
579 (error 'insufficient-information :operation 'beat-period :datatype (class-of composition))))) | 579 (error 'insufficient-information :operation 'beat-period :datatype (class-of composition))))) |
580 | 580 |
581 | 581 |
582 ;;;======================================================================== | 582 ;;;===================================================================== |
583 ;;; Copying events in time | 583 ;;; Copying events in time |
584 ;;;======================================================================== | 584 ;;;===================================================================== |
585 | 585 |
586 (defmethod move-to-first-bar ((composition composition)) | 586 (defmethod move-to-first-bar ((composition composition)) |
587 (let ((offset (floor (timepoint (elt composition 0))))) | 587 (let ((offset (floor (timepoint (elt composition 0))))) |
588 (loop | 588 (loop |
589 for event in (%list-slot-sequence-data composition) | 589 for event in (%list-slot-sequence-data composition) |
592 (- (timepoint event) offset)) | 592 (- (timepoint event) offset)) |
593 collect event into shifted-events | 593 collect event into shifted-events |
594 finally (return shifted-events)))) | 594 finally (return shifted-events)))) |
595 | 595 |
596 | 596 |
597 ;;;======================================================================== | 597 ;;;===================================================================== |
598 ;;; Searching for events | 598 ;;; Searching for events |
599 ;;;======================================================================== | 599 ;;;===================================================================== |
600 | 600 |
601 (defmethod find-next-event ((source-event event) &key predicate test | 601 (defmethod find-next-event ((source-event event) &key predicate test |
602 break-test search-list) | 602 break-test search-list) |
603 "Ideally a sorted search list that begins with the first event after | 603 "Ideally a sorted search list that begins with the first event after |
604 the source-event should be provided, otherwise, the search will begin | 604 the source-event should be provided, otherwise, the search will begin |
623 (when break-test | 623 (when break-test |
624 (when (funcall break-test source-event e) | 624 (when (funcall break-test source-event e) |
625 (return nil))))))) | 625 (return nil))))))) |
626 | 626 |
627 | 627 |
628 ;;;======================================================================== | 628 ;;;===================================================================== |
629 ;;; Sorting Compositions | 629 ;;; Sorting Compositions |
630 ;;;======================================================================== | 630 ;;;===================================================================== |
631 | 631 |
632 (defmethod event< ((event1 event) (event2 event) attribute-list) | 632 (defmethod event< ((event1 event) (event2 event) attribute-list) |
633 (dolist (attribute attribute-list nil) ;nil if equal | 633 (dolist (attribute attribute-list nil) ;nil if equal |
634 (if (< (funcall attribute event1) (funcall attribute event2)) | 634 (if (< (funcall attribute event1) (funcall attribute event2)) |
635 (return t) | 635 (return t) |