annotate base/classes.lisp @ 126:efaa02d21690

move amuse-midi out of amuse.asd to amuse-midi.asd darcs-hash:20070730140900-c0ce4-9e8c4877f581746446186bf61de5501afcb11a32.gz
author Marcus Pearce <m.pearce@gold.ac.uk>
date Mon, 30 Jul 2007 15:09:00 +0100
parents c179481a7bd0
children 5e362d998f29
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
m@125 9 (defclass identifier (amuse-object) ()) ;; for composition specification
m@125 10 (defclass moment-designator (amuse-object) ()
d@100 11 (:documentation "Object indicating a point in time"))
m@124 12 (defclass period-designator (amuse-object) ()
d@100 13 (:documentation "Object indicating a region of time"))
d@100 14 (defclass anchored-period-designator (moment-designator period-designator) ()
d@100 15 (:documentation "Object indicating a region of time starting at
d@100 16 a specific point in time"))
m@124 17 (defclass pitch-designator (amuse-object) ()
d@100 18 (:documentation "Object indicating some sort of pitch"))
m@124 19 (defclass pitch-interval-designator (amuse-object) ()
d@100 20 (:documentation "Object indicating a distance in pitch space"))
m@24 21
m@24 22 ;; time-related classes
m@24 23
m@24 24 (defclass moment (moment-designator)
d@100 25 ((time :accessor %moment-time :initarg :time))
d@100 26 (:documentation "A moment represented on a number line"))
m@24 27
m@24 28 (defclass period (period-designator)
d@100 29 ((interval :accessor %period-interval :initarg :interval))
d@100 30 (:documentation "A number-line-based period"))
m@24 31
d@100 32 (defclass floating-period (period) ()
d@100 33 (:documentation "A simple numeric period"))
d@100 34 (defclass anchored-period (period moment anchored-period-designator) ()
d@100 35 (:documentation "Number-line-based anchored period"))
m@24 36
m@24 37 ;; pitch-related classes
m@24 38
m@24 39 (defclass frequency () ())
m@24 40
m@24 41 (defclass pitch (pitch-designator) ())
m@24 42 (defclass chromatic-pitch (pitch)
d@100 43 ((number :accessor %chromatic-pitch-number :initarg :number))
d@123 44 (:documentation "A pitch represented as a number, with
d@123 45 chromatic pitches having distinct values."))
c@109 46 (defclass diatonic-pitch (pitch)
c@108 47 ((cp :initarg :cp :accessor %p-pc :reader diatonic-pitch-cp)
c@108 48 (mp :initarg :mp :accessor %p-pm :reader diatonic-pitch-mp))
c@109 49 (:documentation "A diatonic pitch, represented using MIPS: cp is an
c@109 50 integer representing chromatic pitch (An0 = 0, middle C = 39); mp is
c@109 51 an integer representing the morphetic pitch (An0 = 0, middle C =
c@109 52 23)."))
m@81 53
c@111 54 (defclass chromatic-pitch-interval (pitch-interval-designator)
c@111 55 ((span :accessor %chromatic-pitch-interval-span :initarg :span)))
c@111 56
c@111 57 (defclass diatonic-pitch-interval (pitch-interval-designator)
c@111 58 ((span :accessor %diatonic-pitch-interval-span :initarg :span :reader span)))
m@24 59
m@24 60 ;; events
m@24 61
d@122 62 (defclass event (anchored-period) ()
d@122 63 (:documentation "Notelike object"))
d@122 64 (defclass pitched-event (event pitch-designator) ()
d@122 65 (:documentation "Event with pitch information"))
d@122 66 (defclass chromatic-pitched-event (pitched-event chromatic-pitch) ()
d@122 67 (:documentation "Event with chromatic pitch information"))
d@122 68 (defclass percussive-event (event) ()
d@122 69 (:documentation "Unpitched percussion Event. Is there a reason why
d@122 70 this is unpitched necessarily, or why I'm not counting piano, etc in
d@122 71 this? Perhaps what I mean is that it should be renamed?"))
m@24 72
m@24 73 ;;; Range-based `constituents'
m@24 74 ;; Whilst these are all constituents in the CHARM sense, their
m@24 75 ;; properties apply to a timed range rather than to a set of
m@24 76 ;; events. As such, they can be regarded as anchored-periods with
m@24 77 ;; properties.
m@24 78
d@123 79 (defclass time-signature (anchored-period) ()
d@123 80 (:documentation "Base class for time signature"))
m@24 81
m@48 82 (defclass basic-time-signature (time-signature)
m@24 83 ((numerator :accessor %basic-time-signature-numerator
m@24 84 :initarg :numerator)
m@24 85 (denominator :accessor %basic-time-signature-denominator
d@123 86 :initarg :denominator))
d@123 87 (:documentation "Class with slots for numerator and
d@123 88 denominator. Can only deal with numeric signatures."))
m@24 89
d@123 90 (defclass key-signature (anchored-period) ()
d@123 91 (:documentation "Base class for key signature"))
m@24 92
m@24 93 (defclass basic-key-signature (key-signature)
m@24 94 ((sharp-count :accessor %basic-key-signature-sharp-count
d@123 95 :initarg :sharp-count))
d@123 96 (:documentation "Simple class - Only has line-of-fifths
d@123 97 distance from c, so custom signatures won't work"))
m@24 98
m@40 99 (defclass midi-key-signature (basic-key-signature)
m@40 100 ((mode :accessor %midi-key-signature-mode
d@123 101 :initarg :mode))
d@123 102 (:documentation "MIDI-based flavour of basic key signature,
d@123 103 adding a slot for mode: 0 = major key; 1 = minor key"))
m@40 104
m@24 105 (defclass tempo (anchored-period)
m@24 106 ((bpm :accessor %tempo-bpm
d@123 107 :initarg :bpm))
d@123 108 (:documentation "Rather literal reading of absolute tempo.
d@123 109 accel and rit in symbolic encoding will need other structures,
d@123 110 as will textual tempo markings."))
m@40 111
m@124 112 ;; collections of more than one event
m@124 113
m@124 114 (defclass constituent (anchored-period) ())
m@124 115 (defclass time-ordered-constituent (constituent list-slot-sequence)
m@124 116 ;; this won't work if lisp implementation doesn't support extensible
m@124 117 ;; sequences.
m@124 118 ())
m@124 119 (defclass composition (time-ordered-constituent) ())
m@124 120 (defclass monody (composition) ())
m@125 121