annotate base/conditions.lisp @ 106:8528c316fbcc
delete diatonic-pitch (as was)
Delete the diatonic-pitch class, in preparation for MIPS pitch being our single
representation. Add a DIATONIC-PITCH-OCTAVE generic, and make OCTAVE return
the octave based on a MIDI-PITCH-NUMBER (and make sure that it returns an
integer, too).
darcs-hash:20070726121235-dc3a5-4cbd1058145163eecbfc84384234904e2353fead.gz
author |
c.rhodes <c.rhodes@gold.ac.uk> |
date |
Thu, 26 Jul 2007 13:12:35 +0100 |
parents |
8d2b1662f658 |
children |
b16472d7823f |
rev |
line source |
m@24
|
1 (cl:in-package #:amuse)
|
m@24
|
2
|
m@24
|
3 ;; Some conditions we might want to be able to signal
|
m@24
|
4
|
m@24
|
5 (define-condition undefined-action (condition)
|
m@24
|
6 ;; This condition would apply to an attempt to perform a meaningless
|
m@24
|
7 ;; operation on an object. This may, initially, include things that
|
m@24
|
8 ;; are a pain to implement but should really be used when it's
|
m@24
|
9 ;; genuinely unclear what an operation means in the given
|
m@24
|
10 ;; context. In such cases, a condition handler might be the best
|
m@24
|
11 ;; approach anyway.
|
m@24
|
12 ((operation :initarg :operation
|
m@24
|
13 :reader undefined-action-operation)
|
m@24
|
14 (datatype :initarg :datatype
|
m@24
|
15 :reader undefined-action-datatype))
|
m@24
|
16 (:report (lambda (condition stream)
|
m@24
|
17 (format stream "The consequence of performing ~A on and object of type ~A is undefined"
|
m@24
|
18 (undefined-action-operation condition)
|
m@24
|
19 (undefined-action-datatype condition)))))
|
m@24
|
20
|
m@24
|
21 (define-condition insufficient-information (condition)
|
m@24
|
22 ;; It should be possible to construct genuinely minimal musical
|
m@24
|
23 ;; structures. When the information in these is insufficient to
|
m@24
|
24 ;; answer a query, this condition should be raised.
|
m@24
|
25 ((operation :initarg :operation
|
m@24
|
26 :reader insufficient-information-operation)
|
m@24
|
27 (datatype :initarg :datatype
|
m@24
|
28 :reader insufficient-information-datatype))
|
m@24
|
29 (:report (lambda (condition stream)
|
m@24
|
30 (format stream "The ~A object does not contain enough information to perform ~A"
|
m@24
|
31 (insufficient-information-datatype condition)
|
m@24
|
32 (insufficient-information-operation condition)))))
|
m@24
|
33
|
m@24
|
34
|