csr21@59
|
1 (in-package "AMUSE-GSHARP")
|
csr21@59
|
2
|
csr21@59
|
3 (defmethod time-signatures ((composition gsharp-composition))
|
csr21@59
|
4 ())
|
csr21@59
|
5
|
d@162
|
6 (defmethod get-composition ((id gsharp-gsh-identifier))
|
d@162
|
7 "Makes a gsharp buffer from .gsh file and generates a composition
|
d@162
|
8 from its first segment. N.B. 1) This is not compatible with
|
d@162
|
9 multi-segment files 2) No application frame is created (=> data flow
|
d@162
|
10 is pretty much one way)"
|
d@162
|
11 (let ((buffer (with-open-file (s (%gsharp-identifier-pathname id))
|
d@162
|
12 (gsharp::read-buffer-from-stream s))))
|
d@162
|
13 (gsharp::recompute-measures buffer)
|
d@162
|
14 (segment-composition (car (gsharp::segments buffer)))))
|
d@162
|
15
|
d@162
|
16 (defmethod get-composition ((id gsharp-mxml-identifier))
|
d@162
|
17 "Makes a gsharp buffer from .mxml file and generates a composition
|
d@162
|
18 from its first segment. N.B. 1) This is not compatible with
|
d@162
|
19 multi-segment files 2) No application frame is created (=> data flow
|
d@162
|
20 is pretty much one way)"
|
d@162
|
21 (let ((buffer (gsharp-mxml::parse-mxml
|
d@162
|
22 (gsharp-mxml::musicxml-document
|
d@162
|
23 (%gsharp-identifier-pathname id)))))
|
d@162
|
24 (gsharp::recompute-measures buffer)
|
d@162
|
25 (segment-composition (car (gsharp::segments buffer)))))
|
d@162
|
26
|
d@162
|
27 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
d@162
|
28 ;;
|
d@162
|
29 ;; These versions may not be useful, but create and return a gsharp
|
d@162
|
30 ;; application frame as well as a composition
|
d@162
|
31
|
d@162
|
32 (defgeneric get-composition-with-application-frame (identifier))
|
d@162
|
33 (defmethod get-composition-with-application-frame ((id gsharp-identifier))
|
d@162
|
34 (let* ((frame (clim:make-application-frame 'gsharp:gsharp))
|
d@162
|
35 (clim:*application-frame* frame)
|
d@162
|
36 (esa:*esa-instance* frame))
|
d@162
|
37 (clim:adopt-frame (clim:find-frame-manager :server-path '(:null)) frame)
|
d@162
|
38 (import-from-identifier frame id)
|
d@162
|
39 (gsharp::recompute-measures (car (esa-buffer::buffers frame)))
|
d@162
|
40 (values (segment-composition (car (gsharp::segments (car (esa-buffer::buffers frame)))))
|
d@162
|
41 frame)))
|
d@162
|
42
|
d@162
|
43 (defgeneric import-from-identifier (frame id))
|
d@162
|
44 (defmethod import-from-identifier (frame (id gsharp-gsh-identifier))
|
d@162
|
45 (clim:execute-frame-command frame '(gsharp::com-new-buffer))
|
d@162
|
46 (gsharp::frame-find-file frame (%gsharp-identifier-pathname id)))
|
d@162
|
47 (defmethod import-from-identifier (frame (id gsharp-mxml-identifier))
|
d@162
|
48 (clim:execute-frame-command frame `(gsharp::com-import-musicxml ,(%gsharp-identifier-pathname id))))
|