annotate base/classes.lisp @ 167:4cb3ec07831f

Finish moving get-applicable from amuse-geerdes darcs-hash:20080101132215-40ec0-ce1cb48a47fc7a5a7e2e51ebf0d74d572771c7fb.gz
author d.lewis <d.lewis@gold.ac.uk>
date Tue, 01 Jan 2008 13:22:15 +0000
parents 8156c30c0c53
children 4a0e15e2829a
rev   line source
m@24 1 (cl:in-package #:amuse)
m@24 2
m@124 3 ;; top-level amuse object
m@24 4
m@125 5 (defclass amuse-object () ())
m@24 6
m@24 7 ;; types of information-specifiers
m@24 8
d@147 9 (defclass identifier (amuse-object) ()
d@147 10 (:documentation "Base class to allow specification of
d@147 11 composition to get. Must be subclassed."))
d@147 12
d@136 13 (defclass moment (amuse-object) ()
d@100 14 (:documentation "Object indicating a point in time"))
d@136 15 (defclass period (amuse-object) ()
d@100 16 (:documentation "Object indicating a region of time"))
d@136 17 (defclass anchored-period (moment period) ()
d@100 18 (:documentation "Object indicating a region of time starting at
d@100 19 a specific point in time"))
d@136 20 (defclass pitch (amuse-object) ()
d@100 21 (:documentation "Object indicating some sort of pitch"))
d@136 22 (defclass pitch-interval (amuse-object) ()
d@100 23 (:documentation "Object indicating a distance in pitch space"))
m@24 24
m@24 25 ;; time-related classes
m@24 26
d@136 27 (defclass standard-moment (moment)
d@100 28 ((time :accessor %moment-time :initarg :time))
d@136 29 (:documentation "A moment that has time represented on a
d@136 30 continuous, progressive number line"))
m@24 31
d@136 32 (defclass standard-period (period)
d@100 33 ((interval :accessor %period-interval :initarg :interval))
d@136 34 (:documentation "A period that places time intervals
d@136 35 on a progressive number-line"))
m@24 36
d@136 37 (defclass standard-anchored-period (standard-period standard-moment anchored-period) ()
d@100 38 (:documentation "Number-line-based anchored period"))
m@24 39
m@24 40 ;; pitch-related classes
m@24 41
d@136 42 (defclass frequency-pitch (pitch) ())
m@24 43
m@24 44 (defclass chromatic-pitch (pitch)
d@100 45 ((number :accessor %chromatic-pitch-number :initarg :number))
d@123 46 (:documentation "A pitch represented as a number, with
d@123 47 chromatic pitches having distinct values."))
c@109 48 (defclass diatonic-pitch (pitch)
c@108 49 ((cp :initarg :cp :accessor %p-pc :reader diatonic-pitch-cp)
c@108 50 (mp :initarg :mp :accessor %p-pm :reader diatonic-pitch-mp))
c@109 51 (:documentation "A diatonic pitch, represented using MIPS: cp is an
c@109 52 integer representing chromatic pitch (An0 = 0, middle C = 39); mp is
c@109 53 an integer representing the morphetic pitch (An0 = 0, middle C =
c@109 54 23)."))
m@81 55
d@136 56 (defclass chromatic-pitch-interval (pitch-interval)
d@138 57 ((span :accessor %chromatic-pitch-interval-span :initarg :span))
d@138 58 (:documentation "An interval represented as a number, recording
d@138 59 the number of ascending chromatic pitches between two pitches."))
c@111 60
d@136 61 (defclass diatonic-pitch-interval (pitch-interval)
d@138 62 ((span :accessor %diatonic-pitch-interval-span :initarg :span :reader span))
d@138 63 (:documentation "How is this inplemented?"))
m@24 64
m@24 65 ;; events
m@24 66
d@122 67 (defclass event (anchored-period) ()
d@122 68 (:documentation "Notelike object"))
d@136 69 (defclass pitched-event (event pitch) ()
d@136 70 (:documentation "Event with pitch information"))
d@136 71 (defclass standard-pitched-event (pitched-event
d@136 72 standard-anchored-period) ()
d@122 73 (:documentation "Event with pitch information"))
d@122 74 (defclass chromatic-pitched-event (pitched-event chromatic-pitch) ()
d@122 75 (:documentation "Event with chromatic pitch information"))
d@136 76 (defclass standard-chromatic-pitched-event (chromatic-pitched-event
d@136 77 standard-anchored-period) ()
d@136 78 (:documentation "Event with chromatic pitch information and
d@136 79 standard-period"))
d@122 80 (defclass percussive-event (event) ()
d@134 81 (:documentation "Unpitched percussion Event. There's an issue
d@134 82 with this name - is there a reason why this is unpitched
d@134 83 necessarily, or why I'm not counting piano, etc in this? Perhaps
d@136 84 what I mean is that it should be renamed unpitched-event?
d@136 85 Actually, is this necessary? Isn't this just an event?"))
d@136 86 (defclass standard-percussive-event (event standard-anchored-period) ()
d@136 87 (:documentation "Unpitched percussion Event. There's an issue
d@136 88 with this name - is there a reason why this is unpitched
d@136 89 necessarily, or why I'm not counting piano, etc in this? Perhaps
d@136 90 what I mean is that it should be renamed unpitched-event?
d@138 91 Actually, is this necessary? Isn't this just an event?
d@138 92 Timbral/instrumental information will be generalised later but is
d@138 93 less agreed-on than pitch."))
m@24 94
m@24 95 ;;; Range-based `constituents'
m@24 96 ;; Whilst these are all constituents in the CHARM sense, their
m@24 97 ;; properties apply to a timed range rather than to a set of
m@24 98 ;; events. As such, they can be regarded as anchored-periods with
m@24 99 ;; properties.
m@24 100
d@136 101 (defclass time-signature (amuse-object) ()
d@136 102 (:documentation "Abstract class for time signature"))
m@24 103
d@136 104 (defclass time-signature-period (time-signature anchored-period) ()
d@136 105 (:documentation "Abstract class for time signatures in time"))
d@136 106
d@136 107 (defclass standard-time-signature (time-signature)
m@24 108 ((numerator :accessor %basic-time-signature-numerator
m@24 109 :initarg :numerator)
m@24 110 (denominator :accessor %basic-time-signature-denominator
d@123 111 :initarg :denominator))
d@123 112 (:documentation "Class with slots for numerator and
d@123 113 denominator. Can only deal with numeric signatures."))
m@24 114
d@136 115 (defclass standard-time-signature-period (standard-time-signature
d@136 116 time-signature-period
d@136 117 standard-anchored-period)
d@136 118 ()
d@136 119 (:documentation "STANDARD-TIME-SIGNATURE on a time number line"))
d@136 120
d@136 121 (defclass key-signature (amuse-object) ()
d@123 122 (:documentation "Base class for key signature"))
m@24 123
d@136 124 (defclass key-signature-period (key-signature anchored-period) ()
d@136 125 (:documentation "Abstract class for time signatures in time"))
d@136 126
d@136 127 (defclass standard-key-signature (key-signature)
m@24 128 ((sharp-count :accessor %basic-key-signature-sharp-count
d@123 129 :initarg :sharp-count))
d@123 130 (:documentation "Simple class - Only has line-of-fifths
d@123 131 distance from c, so custom signatures won't work"))
m@24 132
d@136 133 (defclass standard-key-signature-period (standard-key-signature
d@136 134 key-signature-period
d@136 135 standard-anchored-period)
d@136 136 ()
d@136 137 (:documentation "STANDARD-KEY-SIGNATURE on a time number line"))
d@136 138
d@136 139 (defclass midi-key-signature (standard-key-signature)
m@40 140 ((mode :accessor %midi-key-signature-mode
d@123 141 :initarg :mode))
d@123 142 (:documentation "MIDI-based flavour of basic key signature,
d@123 143 adding a slot for mode: 0 = major key; 1 = minor key"))
m@40 144
d@136 145 (defclass midi-key-signature-period (standard-key-signature-period
d@136 146 midi-key-signature)
d@136 147 ()
d@136 148 (:documentation "MIDI-KEY-SIGNATURE on a time number line"))
d@136 149
d@136 150 (defclass tempo (amuse-object) ()
d@136 151 (:documentation "Abstract class for tempo"))
d@136 152 (defclass tempo-period (tempo anchored-period) ()
d@136 153 (:documentation "Abstract class for tempo associated with a
d@136 154 time period"))
d@136 155 (defclass standard-tempo (tempo)
m@24 156 ((bpm :accessor %tempo-bpm
d@123 157 :initarg :bpm))
d@123 158 (:documentation "Rather literal reading of absolute tempo.
d@123 159 accel and rit in symbolic encoding will need other structures,
d@123 160 as will textual tempo markings."))
d@136 161 (defclass standard-tempo-period (standard-tempo
d@136 162 tempo-period
d@136 163 standard-anchored-period)
d@136 164 ()
d@136 165 (:documentation "Tempo associated with a standard-anchored-period"))
m@40 166
m@124 167 ;; collections of more than one event
m@124 168
d@147 169 (defclass constituent (anchored-period) ()
d@147 170 (:documentation "Base class for constituents"))
d@147 171 (defclass standard-constituent (constituent standard-anchored-period) ()
d@147 172 (:documentation "Base class for constituents using standard
d@147 173 time representation"))
m@124 174 (defclass time-ordered-constituent (constituent list-slot-sequence)
m@124 175 ;; this won't work if lisp implementation doesn't support extensible
m@124 176 ;; sequences.
m@124 177 ())
d@136 178 (defclass standard-time-ordered-constituent (time-ordered-constituent
d@136 179 standard-constituent
d@136 180 list-slot-sequence)
d@136 181 ;; this won't work if lisp implementation doesn't support extensible
d@136 182 ;; sequences.
d@136 183 ())
d@147 184 (defclass composition (time-ordered-constituent) ()
d@147 185 (:documentation "Base class for compositions"))
d@136 186 (defclass standard-composition (composition
d@147 187 standard-time-ordered-constituent) ()
d@147 188 (:documentation "Base class for compositions using standard
d@147 189 time representation"))
d@147 190 (defclass monody (composition) ()
d@147 191 (:documentation "Class for indicating suitability for analysis
d@147 192 requiring a monody"))
m@143 193 (defclass standard-monody (monody standard-composition) ())