annotate implementations/meredith/constructors.lisp @ 286:d22c67dac97d

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