Mercurial > hg > amuse
diff implementations/geerdes/methods.lisp @ 211:e2839225f6fb
integrate db-admin into geerdes
Ignore-this: 442285f4febbcd5d390a49d8c8b69e00
darcs-hash:20090522211215-16a00-0e6571178e720d2cf648e09486ec2bb160950355.gz
committer: Jamie Forth <j.forth@gold.ac.uk>
author | j.forth <j.forth@gold.ac.uk> |
---|---|
date | Thu, 24 Feb 2011 11:23:17 +0000 |
parents | 4cb3ec07831f |
children | 619194befdd4 |
line wrap: on
line diff
--- a/implementations/geerdes/methods.lisp Thu Feb 24 11:23:17 2011 +0000 +++ b/implementations/geerdes/methods.lisp Thu Feb 24 11:23:17 2011 +0000 @@ -36,6 +36,12 @@ (defmethod (setf file-id) (value (object geerdes-identifier-file-id)) (setf (slot-value object 'file-id) value)) +;; Specialised constructors + +(defmethod make-composition-identifier ((package (eql *package*)) + composition-id) + (g-id-file-id composition-id)) + ;; Composition (defmethod get-composition ((identifier geerdes-identifier)) @@ -51,7 +57,8 @@ :from [midi_file] :where [= [cat_id] cat-id] :flatp t - :result-types :auto))) + :result-types :auto + :database *amuse-database*))) (timebase (second file-info)) (file-id (first file-info)) (composition (make-instance 'geerdes-composition @@ -63,6 +70,7 @@ (%midi-constituents composition) (get-db-constituents file-id)) #.(clsql:restore-sql-reader-syntax-state) composition)) + (defmethod get-geerdes-composition ((identifier geerdes-identifier-file-id)) #.(clsql:locally-enable-sql-reader-syntax) (let* ((file-id (file-id identifier)) @@ -70,7 +78,8 @@ :from [midi_file] :where [= [id] file-id] :flatp t - :result-types :auto))) + :result-types :auto + :database *amuse-database*))) (timebase (second file-info)) (cat-id (first file-info)) (composition (make-instance 'geerdes-composition @@ -89,7 +98,9 @@ SELECT track, channel, start, duration, patch, pitch, velocity, id, event_id, mel_duration FROM midi_event LEFT JOIN derived_midi_monody ON (id=event_id) WHERE file_id=" (princ-to-string file-id) - " ORDER BY start"))) + " ORDER BY start") + :database *amuse-database*)) + (defun get-db-constituents (file-id) (clsql:query (concatenate 'string " SELECT track, channel, start, duration, @@ -100,7 +111,8 @@ LEFT JOIN midi_timesig ts ON (id=ts.constituent_id) LEFT JOIN midi_param param ON (id=param.constituent_id) WHERE c.file_id=" (princ-to-string file-id) - " ORDER BY start"))) + " ORDER BY start") + :database *amuse-database*)) (defmethod monody ((composition geerdes-composition)) (unless (amuse-geerdes::%monody composition) @@ -149,4 +161,3 @@ (defmethod crotchet ((object geerdes-object)) (make-standard-period 1)) -