Mercurial > hg > amuse
comparison implementations/midi/midifile-import.lisp @ 281:4a03a1478c02
add identifier and timebase slots to midifile composition class
Ignore-this: 4e72a0860344399452bea196c3739bbf
darcs-hash:20090524150506-16a00-bce845ccf20a9289a4015fb58287f25ebfa178ad.gz
| author | j.forth <j.forth@gold.ac.uk> |
|---|---|
| date | Sun, 24 May 2009 16:05:06 +0100 |
| parents | 4a0e15e2829a |
| children | 61dfbaea3c0b |
comparison
equal
deleted
inserted
replaced
| 280:9ce6b954d403 | 281:4a03a1478c02 |
|---|---|
| 11 "Creates an identifier for MIDI files, based on a pathname" | 11 "Creates an identifier for MIDI files, based on a pathname" |
| 12 (make-instance 'midifile-identifier :path pathname)) | 12 (make-instance 'midifile-identifier :path pathname)) |
| 13 | 13 |
| 14 (defmethod get-composition ((identifier midifile-identifier)) | 14 (defmethod get-composition ((identifier midifile-identifier)) |
| 15 (%initialise-midifile-composition (midi:read-midi-file | 15 (%initialise-midifile-composition (midi:read-midi-file |
| 16 (midifile-identifier-pathname identifier)))) | 16 (midifile-identifier-pathname identifier)) |
| 17 identifier)) | |
| 17 | 18 |
| 18 (defun %initialise-midifile-composition (midifile) | 19 (defun %initialise-midifile-composition (midifile identifier) |
| 19 ;; Takes a midifile object (from the "MIDI" package) | 20 ;; Takes a midifile object (from the "MIDI" package) |
| 20 ;; and returns an amuse midi object | 21 ;; and returns an amuse midi object |
| 21 ;; FIXME: gets it wrong if patch changes in mid-note | 22 ;; FIXME: gets it wrong if patch changes in mid-note |
| 22 ;; FIXME: assumes controllers are global in scope and location | 23 ;; FIXME: assumes controllers are global in scope and location |
| 23 (let ((tracks (midi:midifile-tracks midifile)) | 24 (let ((tracks (midi:midifile-tracks midifile)) |
| 127 :time-signatures (if time-sigs | 128 :time-signatures (if time-sigs |
| 128 (sort time-sigs #'time<) | 129 (sort time-sigs #'time<) |
| 129 (list (make-standard-time-signature-period | 130 (list (make-standard-time-signature-period |
| 130 4 4 0 (/ last-time division)))) | 131 4 4 0 (/ last-time division)))) |
| 131 :tempi (sort tempi #'time<) | 132 :tempi (sort tempi #'time<) |
| 132 :key-signatures (sort key-sigs #'time<)))) | 133 :key-signatures (sort key-sigs #'time<) |
| 134 :identifier identifier | |
| 135 :midi-timebase division))) | |
| 133 (sequence:adjust-sequence composition | 136 (sequence:adjust-sequence composition |
| 134 (length notes) | 137 (length notes) |
| 135 :initial-contents (sort notes #'time<))))) | 138 :initial-contents (sort notes #'time<))))) |
| 136 | 139 |
| 137 (defun make-event-from-on-off-pair (note-on cut-off divisions track patch) | 140 (defun make-event-from-on-off-pair (note-on cut-off divisions track patch) |
