annotate base/classes.lisp @ 190:725ce7ce77ba

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