comparison implementations/meredith/constructors.lisp @ 215:4eceac78e7c6

add minimal backend for Dave Meredith's data Ignore-this: 91608f727967a4c5709bd41634ab9ae2 darcs-hash:20090524193956-16a00-038e6f7cb235dea4e7efcc70c4d1a7bc7fd402a6.gz committer: Jamie Forth <j.forth@gold.ac.uk>
author j.forth <j.forth@gold.ac.uk>
date Thu, 24 Feb 2011 11:23:18 +0000
parents
children 6f0881af3403
comparison
equal deleted inserted replaced
214:545f80a73f03 215:4eceac78e7c6
1 (cl:in-package #:amuse-meredith)
2
3 (defun make-meredith-composition-identifier (composition-id)
4 (make-instance 'meredith-composition-identifier
5 :composition-id composition-id))
6
7 (defun make-meredith-composition (&key events time interval
8 identifier description)
9 (make-instance 'meredith-composition
10 :%data events
11 :time time
12 :interval interval
13 :identifier identifier
14 :description description))
15
16 (defun make-meredith-event (&rest args)
17 (apply #'make-instance 'meredith-event args))
18
19 (defun db-event->meredith-event (db-event)
20 (destructuring-bind (event-id tatum-on tatum-dur tactus-on
21 tactus-dur crot-on crot-dur
22 tatum-on-ms tatum-dur-ms beat-on-ms
23 beat-dur-ms crot-on-ms crot-dur-ms
24 pitch-name midi-note-number cpitch
25 mpitch voice) db-event
26 (make-meredith-event :identifier event-id
27 :tatum-on tatum-on
28 :tatum-dur tatum-dur
29 :tactus-on tactus-on
30 :tactus-dur tactus-dur
31 :time crot-on ; define crotchet as standard time
32 :interval crot-dur
33 :tatum-on-ms tatum-on-ms
34 :tatum-dur-ms tatum-dur-ms
35 :beat-on-ms beat-on-ms
36 :beat-dur-ms beat-dur-ms
37 :crot-on-ms crot-on-ms
38 :crot-dur-ms crot-dur-ms
39 :pitch-name pitch-name
40 :number midi-note-number
41 :cp cpitch
42 :mp mpitch
43 :voice voice)))