annotate base/classes.lisp @ 189:70c8d723fb8a

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