annotate base/classes.lisp @ 115:cf198383852d

Re-instated get-applicable-x for midi-related implementations and added key-sigs to midi darcs-hash:20070726144704-f76cc-a24c9e6c07b43c4084a73218f76a0b345fac5369.gz
author David Lewis <d.lewis@gold.ac.uk>
date Thu, 26 Jul 2007 15:47:04 +0100
parents 3ceaa5a08dc5
children 997bed70ef28
rev   line source
m@24 1 (cl:in-package #:amuse)
m@24 2
m@24 3 ;; collections of more than one event
m@24 4
d@33 5 (defclass constituent (anchored-period) ())
d@33 6 (defclass time-ordered-constituent (constituent list-slot-sequence)
d@33 7 ;; this won't work if lisp implementation doesn't support extensible
d@33 8 ;; sequences.
d@33 9 ())
d@33 10 (defclass composition (time-ordered-constituent) ())
m@89 11 (defclass monody (composition) ())
m@24 12
m@24 13 ;; types of information-specifiers
m@24 14
d@35 15 (defclass identifier () ()) ;; for composition specification
d@100 16 (defclass moment-designator () ()
d@100 17 (:documentation "Object indicating a point in time"))
d@100 18 (defclass period-designator () ()
d@100 19 (:documentation "Object indicating a region of time"))
d@100 20 (defclass anchored-period-designator (moment-designator period-designator) ()
d@100 21 (:documentation "Object indicating a region of time starting at
d@100 22 a specific point in time"))
d@100 23 (defclass pitch-designator () ()
d@100 24 (:documentation "Object indicating some sort of pitch"))
d@100 25 (defclass pitch-interval-designator () ()
d@100 26 (:documentation "Object indicating a distance in pitch space"))
m@24 27
m@24 28 ;; time-related classes
m@24 29
m@24 30 (defclass moment (moment-designator)
d@100 31 ((time :accessor %moment-time :initarg :time))
d@100 32 (:documentation "A moment represented on a number line"))
m@24 33
m@24 34 (defclass period (period-designator)
d@100 35 ((interval :accessor %period-interval :initarg :interval))
d@100 36 (:documentation "A number-line-based period"))
m@24 37
d@100 38 (defclass floating-period (period) ()
d@100 39 (:documentation "A simple numeric period"))
d@100 40 (defclass anchored-period (period moment anchored-period-designator) ()
d@100 41 (:documentation "Number-line-based anchored period"))
m@24 42
m@24 43 ;; pitch-related classes
m@24 44
m@24 45 (defclass frequency () ())
m@24 46
m@24 47 (defclass pitch (pitch-designator) ())
m@24 48 (defclass chromatic-pitch (pitch)
d@100 49 ((number :accessor %chromatic-pitch-number :initarg :number))
d@100 50 (:documentation "A pitch represented as a number, with higher
d@100 51 values representing high pitches."))
c@109 52 (defclass diatonic-pitch (pitch)
c@108 53 ((cp :initarg :cp :accessor %p-pc :reader diatonic-pitch-cp)
c@108 54 (mp :initarg :mp :accessor %p-pm :reader diatonic-pitch-mp))
c@109 55 (:documentation "A diatonic pitch, represented using MIPS: cp is an
c@109 56 integer representing chromatic pitch (An0 = 0, middle C = 39); mp is
c@109 57 an integer representing the morphetic pitch (An0 = 0, middle C =
c@109 58 23)."))
m@81 59
c@111 60 (defclass chromatic-pitch-interval (pitch-interval-designator)
c@111 61 ((span :accessor %chromatic-pitch-interval-span :initarg :span)))
c@111 62
c@111 63 (defclass diatonic-pitch-interval (pitch-interval-designator)
c@111 64 ((span :accessor %diatonic-pitch-interval-span :initarg :span :reader span)))
m@24 65
m@24 66 ;; events
m@24 67
m@24 68 (defclass event (anchored-period) ())
m@24 69 (defclass pitched-event (event pitch-designator) ())
m@24 70 (defclass chromatic-pitched-event (pitched-event chromatic-pitch) ())
m@24 71 (defclass percussive-event (event) ())
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
m@24 79 (defclass time-signature (anchored-period) ())
m@24 80
m@48 81 (defclass basic-time-signature (time-signature)
m@24 82 ;; N.B. Can only deal with numeric signatures
m@24 83 ((numerator :accessor %basic-time-signature-numerator
m@24 84 :initarg :numerator)
m@24 85 (denominator :accessor %basic-time-signature-denominator
m@24 86 :initarg :denominator)))
m@24 87
m@24 88 (defclass key-signature (anchored-period) ())
m@24 89
m@24 90 (defclass basic-key-signature (key-signature)
m@24 91 ;; Only has line-of-fifths distance from c, so custom signatures
m@24 92 ;; won't work
m@24 93 ((sharp-count :accessor %basic-key-signature-sharp-count
m@44 94 :initarg :sharp-count)))
m@24 95
m@40 96 (defclass midi-key-signature (basic-key-signature)
m@68 97 ;; mode: 0 = major key; 1 = minor key
m@40 98 ((mode :accessor %midi-key-signature-mode
m@44 99 :initarg :mode)))
m@40 100
m@24 101 (defclass tempo (anchored-period)
m@24 102 ;; accel and rit in symbolic encoding will need other structures, as
m@24 103 ;; will textual tempo markings.
m@24 104 ((bpm :accessor %tempo-bpm
m@24 105 :initarg :bpm)))
m@40 106