j@215
|
1 (cl:in-package #:amuse-meredith)
|
j@215
|
2
|
j@215
|
3 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
j@215
|
4 ;;; Specialised constructors
|
j@215
|
5 (defmethod make-composition-identifier ((package (eql *package*))
|
j@215
|
6 composition-id)
|
j@215
|
7 (make-meredith-composition-identifier composition-id))
|
j@215
|
8
|
j@215
|
9 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
j@215
|
10 ;;; Compositions
|
j@215
|
11
|
j@215
|
12 (defvar *event-attributes*
|
j@215
|
13 #.(clsql:locally-enable-sql-reader-syntax)
|
j@215
|
14 (list [event-id] [tatum-on] [tatum-dur] [tactus-on] [tactus-dur]
|
j@215
|
15 [crot-on] [crot-dur] [tatum-on-ms] [tatum-dur-ms] [beat-on-ms]
|
j@215
|
16 [beat-dur-ms] [crot-on-ms] [crot-dur-ms] [pitch-name]
|
j@215
|
17 [midi-note-number] [chrom-pitch] [morph-pitch] [voice])
|
j@215
|
18 #.(clsql:locally-disable-sql-reader-syntax))
|
j@215
|
19
|
j@215
|
20 (defmethod get-composition ((identifier meredith-composition-identifier))
|
j@215
|
21 #.(clsql:locally-enable-sql-reader-syntax)
|
j@215
|
22 (let* ((composition-id (composition-id identifier))
|
j@215
|
23 (where-clause [= [composition-id] composition-id])
|
j@215
|
24 (description
|
j@225
|
25 (car (clsql:select [description]
|
j@225
|
26 :from [|meredith-compositions|]
|
j@225
|
27 :where where-clause
|
j@225
|
28 :flatp t
|
j@225
|
29 :field-names nil
|
j@225
|
30 :database *amuse-database*)))
|
j@225
|
31 (composition (make-meredith-composition
|
j@225
|
32 :identifier identifier
|
j@225
|
33 :description description))
|
j@215
|
34 (db-events (apply #'clsql:select
|
j@215
|
35 (append *event-attributes*
|
j@215
|
36 (list :from [|meredith-events|]
|
j@215
|
37 :order-by '(([event-id] :asc))
|
j@225
|
38 :where where-clause
|
j@225
|
39 :database *amuse-database*))))
|
j@225
|
40 (events (loop for e in db-events
|
j@225
|
41 collect (db-event->meredith-event e composition))))
|
j@225
|
42 (sequence:adjust-sequence composition (length events)
|
j@225
|
43 :initial-contents events))
|
j@215
|
44 #.(clsql:locally-disable-sql-reader-syntax))
|
j@215
|
45
|
j@215
|
46 (defmethod copy-event (event)
|
j@215
|
47 (with-slots (identifier tatum-on tatum-dur tactus-on tactus-dur
|
j@215
|
48 (time amuse::time)
|
j@215
|
49 (interval amuse::interval) tatum-on-ms
|
j@215
|
50 tatum-dur-ms beat-on-ms beat-dur-ms
|
j@215
|
51 crot-on-ms crot-dur-ms pitch-name
|
j@215
|
52 (midi-note-number amuse::number)
|
j@215
|
53 (cp amuse::cp) (mp amuse::mp) voice) event
|
j@215
|
54 (make-meredith-event :identifier identifier
|
j@215
|
55 :tatum-on tatum-on
|
j@215
|
56 :tatum-dur tatum-dur
|
j@215
|
57 :tactus-on tactus-on
|
j@215
|
58 :tactus-dur tactus-dur
|
j@215
|
59 :time time
|
j@215
|
60 :interval interval
|
j@215
|
61 :tatum-on-ms tatum-on-ms
|
j@215
|
62 :tatum-dur-ms tatum-dur-ms
|
j@215
|
63 :beat-on-ms beat-on-ms
|
j@215
|
64 :beat-dur-ms beat-dur-ms
|
j@215
|
65 :crot-on-ms crot-on-ms
|
j@215
|
66 :crot-dur-ms crot-dur-ms
|
j@215
|
67 :pitch-name pitch-name
|
j@215
|
68 :number midi-note-number
|
j@215
|
69 :cp cp
|
j@215
|
70 :mp mp
|
j@215
|
71 :voice voice)))
|
j@215
|
72
|
j@215
|
73 (defmethod get-applicable-key-signatures ((event meredith-event)
|
j@215
|
74 (composition
|
j@215
|
75 meredith-composition))
|
j@215
|
76 nil)
|
j@215
|
77
|
j@215
|
78 (defmethod get-applicable-key-signatures ((event meredith-composition)
|
j@215
|
79 o)
|
j@215
|
80 nil)
|
j@215
|
81
|
j@215
|
82 (defmethod get-applicable-time-signatures ((event meredith-event)
|
j@215
|
83 (composition
|
j@215
|
84 meredith-composition))
|
j@215
|
85 (make-standard-time-signature-period 4 4 0 (duration composition)))
|
j@215
|
86
|
j@215
|
87 (defmethod time-signatures ((composition meredith-composition))
|
j@215
|
88 (list (make-standard-time-signature-period 4 4 0 (duration composition))))
|
j@215
|
89
|
j@215
|
90 (defmethod crotchet ((event meredith-composition))
|
j@215
|
91 (amuse:make-standard-period 1))
|
j@215
|
92
|
j@215
|
93 (defmethod crotchet ((event meredith-event))
|
j@215
|
94 (amuse:make-standard-period 1))
|
j@215
|
95
|
j@215
|
96 (defmethod tempi ((composition meredith-composition))
|
j@215
|
97 (list (make-standard-tempo-period 120 0 88)))
|