annotate 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
rev   line source
j@215 1 (cl:in-package #:amuse-meredith)
j@215 2
j@215 3 (defun make-meredith-composition-identifier (composition-id)
j@215 4 (make-instance 'meredith-composition-identifier
j@215 5 :composition-id composition-id))
j@215 6
j@215 7 (defun make-meredith-composition (&key events time interval
j@215 8 identifier description)
j@215 9 (make-instance 'meredith-composition
j@215 10 :%data events
j@215 11 :time time
j@215 12 :interval interval
j@215 13 :identifier identifier
j@215 14 :description description))
j@215 15
j@215 16 (defun make-meredith-event (&rest args)
j@215 17 (apply #'make-instance 'meredith-event args))
j@215 18
j@215 19 (defun db-event->meredith-event (db-event)
j@215 20 (destructuring-bind (event-id tatum-on tatum-dur tactus-on
j@215 21 tactus-dur crot-on crot-dur
j@215 22 tatum-on-ms tatum-dur-ms beat-on-ms
j@215 23 beat-dur-ms crot-on-ms crot-dur-ms
j@215 24 pitch-name midi-note-number cpitch
j@215 25 mpitch voice) db-event
j@215 26 (make-meredith-event :identifier event-id
j@215 27 :tatum-on tatum-on
j@215 28 :tatum-dur tatum-dur
j@215 29 :tactus-on tactus-on
j@215 30 :tactus-dur tactus-dur
j@215 31 :time crot-on ; define crotchet as standard time
j@215 32 :interval crot-dur
j@215 33 :tatum-on-ms tatum-on-ms
j@215 34 :tatum-dur-ms tatum-dur-ms
j@215 35 :beat-on-ms beat-on-ms
j@215 36 :beat-dur-ms beat-dur-ms
j@215 37 :crot-on-ms crot-on-ms
j@215 38 :crot-dur-ms crot-dur-ms
j@215 39 :pitch-name pitch-name
j@215 40 :number midi-note-number
j@215 41 :cp cpitch
j@215 42 :mp mpitch
j@215 43 :voice voice)))