annotate generics.lisp @ 11:9f05ce23e71e

More default methods darcs-hash:20061129122229-f76cc-078113c430c4ae9f6c01056c6e7e6ecd078e7409.gz
author David Lewis <d.lewis@gold.ac.uk>
date Wed, 29 Nov 2006 12:22:29 +0000
parents 356ee92313be
children f6c08ad94c8a
rev   line source
m@3 1 (cl:in-package #:amuse)
m@3 2
m@8 3 ;;; Pulling compositions from the database
m@8 4
m@8 5 (defgeneric get-composition (identifier))
m@8 6
m@0 7 ;;; Accessors (do we need the get- prefix?)
m@0 8
m@0 9 (defgeneric get-pitch (object &key kind)) ; ?
m@0 10 (defgeneric get-chromatic-pitch (object))
m@0 11 (defgeneric get-diatonic-pitch (object))
m@0 12 (defgeneric get-frequency (object))
m@0 13
m@0 14 (defgeneric get-duration (object))
m@0 15
m@0 16 (defgeneric get-onset (object)) ; get-time?
m@0 17
m@0 18
m@0 19 ;;; Time Protocol (or moments?)
m@0 20
m@0 21 ;; negative times/durations -> ERROR?
m@0 22
m@0 23 ;; time+: <time> <duration> -> <time>
m@0 24 ;; <duration> <time> -> <time> (same as previous?)
m@0 25 ;; <duration> <duration> -> <duration> (or a distinct duration+?)
m@0 26 ;; <time> <time> -> ERROR?
m@0 27 ;;
m@0 28 ;; time-: <time> <time> -> <duration>
m@0 29 ;; <time> <duration> -> <time>
m@0 30 ;; <duration> <duration> -> <duration> (or a distinct duration-?)
m@0 31 ;; <duration> <time> -> ERROR?
m@0 32
m@0 33 (defgeneric time+ (object1 object2))
m@0 34 (defgeneric time- (object1 object2))
m@0 35
m@0 36 (defgeneric time> (object1 object2))
d@11 37 (defgeneric time< (object1 object2)
d@11 38 (:method (o1 o2) (time> o2 o1)))
m@0 39 (defgeneric time= (object1 object2))
m@10 40 (defgeneric time>= (object1 object2)
m@10 41 (:method (o1 o2) (or (time> o1 o2) (time= o1 o2))))
m@10 42 (defgeneric time<= (object1 object2)
m@10 43 (:method (o1 o2) (or (time< o1 o2) (time= o1 o2))))
m@10 44 (defgeneric time/= (object1 object2)
m@10 45 (:method (o1 o2) (not (time= o1 o2))))
m@10 46
m@0 47
m@0 48 ;;; Duration protocol
m@0 49
m@0 50 (defgeneric duration> (object1 object2))
d@11 51 (defgeneric duration< (object1 object2)
d@11 52 (:method (o1 o2) (duration> o2 o1)))
m@0 53 (defgeneric duration= (object1 object2))
m@10 54 (defgeneric duration>= (object1 object2)
m@10 55 (:method (o1 o2) (or (duration> o1 o2) (duration= o1 o2))))
m@10 56 (defgeneric duration<= (object1 object2)
m@10 57 (:method (o1 o2) (or (duration< o1 o2) (duration= o1 o2))))
m@10 58 (defgeneric duration/= (object1 object2)
m@10 59 (:method (o1 o2) (not (duration= o1 o2))))
m@0 60
m@0 61
m@0 62 ;;; Pitch protocol
m@0 63
m@0 64 ;; pitch+: <pitch> <pitch> -> <pitch>
m@0 65 ;; <pitch> <interval> -> <pitch>
m@0 66 ;; <interval> <pitch> -> <pitch> (same as previous?)
m@0 67 ;; <interval> <interval> -> <interval> (or a distinct interval+?)
m@0 68 ;;
m@0 69 ;; pitch-: <pitch> <pitch> -> <interval>
m@0 70 ;; <pitch> <interval> -> <pitch>
m@0 71 ;; <interval> <interval> -> <interval> (or a distinct interval-?
m@0 72 ;; <interval> <pitch> -> ERROR?
m@0 73
m@0 74 (defgeneric pitch+ (object1 object2))
m@0 75 (defgeneric pitch- (object1 object2))
m@0 76
m@0 77 (defgeneric pitch> (object1 object2))
d@11 78 (defgeneric pitch< (object1 object2)
d@11 79 (:method (o1 o2) (pitch> o2 o1)))
m@0 80 (defgeneric pitch= (object1 object2))
m@10 81 (defgeneric pitch>= (object1 object2)
m@10 82 (:method (o1 o2) (or (pitch> o1 o2) (pitch= o1 o2))))
m@10 83 (defgeneric pitch<= (object1 object2)
m@10 84 (:method (o1 o2) (or (pitch< o1 o2) (pitch= o1 o2))))
m@10 85 (defgeneric pitch/= (object1 object2)
m@10 86 (:method (o1 o2) (not (pitch= o1 o2))))
m@0 87
m@0 88 ;;; Interval protocol (emphasise _pitch_ not _time_ interval?)
m@0 89
m@0 90 (defgeneric interval> (object1 object2))
d@11 91 (defgeneric interval< (object1 object2)
d@11 92 (:method (o1 o2) (interval> o2 o1)))
m@0 93 (defgeneric interval= (object1 object2))
m@10 94 (defgeneric interval>= (object1 object2)
m@10 95 (:method (o1 o2) (or (interval> o1 o2) (interval= o1 o2))))
m@10 96 (defgeneric interval<= (object1 object2)
m@10 97 (:method (o1 o2) (or (interval< o1 o2) (interval= o1 o2))))
m@10 98 (defgeneric interval/= (object1 object2)
m@10 99 (:method (o1 o2) (not (interval= o1 o2))))
m@0 100
m@9 101 ;;; Allen's (1984) interval relations
m@9 102 ;;; . equals already defined as INTERVAL= above
m@10 103 ;;; . inverses ommitted for now (just use CL:NOT)
m@10 104 ;;; . can all be defined in terms of MEETS (apparently)
m@9 105
m@9 106 (defgeneric meets (object1 object2))
m@9 107 (defgeneric before (object1 object2))
m@9 108 (defgeneric overlaps (object1 object2))
m@9 109 (defgeneric during (object1 object2))
m@9 110 (defgeneric starts (object1 object2))
m@9 111 (defgeneric ends (object1 object2))
m@9 112
m@10 113 ;;; and extensions thereof ...
m@9 114
m@10 115 (defgeneric subinterval (object1 object2)
m@10 116 (:method (o1 o2) (or (starts o1 o2) (during o1 o2) (ends o1 o2))))
m@10 117
m@10 118 (defgeneric disjoint (object1 object2)
m@10 119 (:method (o1 o2)
m@10 120 (or (before o1 o2) (meets o1 o2) (meets o2 o1) (before o2 o1))))
m@9 121
m@9 122
m@0 123 ;;; Time Signature
m@0 124 ;;; Tempo
m@0 125 ;;; Tonality (Key Signature / Mode)
m@0 126 ;;; Dynamics
m@0 127 ;;; Voice
m@0 128 ;;; Boundary Strength (phrasing)