csr21@59: (in-package "AMUSE-GSHARP") csr21@59: csr21@59: (defmethod time-signatures ((composition gsharp-composition)) csr21@59: ()) csr21@59: d@162: (defmethod get-composition ((id gsharp-gsh-identifier)) d@162: "Makes a gsharp buffer from .gsh file and generates a composition d@162: from its first segment. N.B. 1) This is not compatible with d@162: multi-segment files 2) No application frame is created (=> data flow d@162: is pretty much one way)" d@162: (let ((buffer (with-open-file (s (%gsharp-identifier-pathname id)) d@162: (gsharp::read-buffer-from-stream s)))) d@162: (gsharp::recompute-measures buffer) d@162: (segment-composition (car (gsharp::segments buffer))))) d@162: d@162: (defmethod get-composition ((id gsharp-mxml-identifier)) d@162: "Makes a gsharp buffer from .mxml file and generates a composition d@162: from its first segment. N.B. 1) This is not compatible with d@162: multi-segment files 2) No application frame is created (=> data flow d@162: is pretty much one way)" d@162: (let ((buffer (gsharp-mxml::parse-mxml d@162: (gsharp-mxml::musicxml-document d@162: (%gsharp-identifier-pathname id))))) d@162: (gsharp::recompute-measures buffer) d@162: (segment-composition (car (gsharp::segments buffer))))) d@162: d@162: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; d@162: ;; d@162: ;; These versions may not be useful, but create and return a gsharp d@162: ;; application frame as well as a composition d@162: d@162: (defgeneric get-composition-with-application-frame (identifier)) d@162: (defmethod get-composition-with-application-frame ((id gsharp-identifier)) d@162: (let* ((frame (clim:make-application-frame 'gsharp:gsharp)) d@162: (clim:*application-frame* frame) d@162: (esa:*esa-instance* frame)) d@162: (clim:adopt-frame (clim:find-frame-manager :server-path '(:null)) frame) d@162: (import-from-identifier frame id) d@162: (gsharp::recompute-measures (car (esa-buffer::buffers frame))) d@162: (values (segment-composition (car (gsharp::segments (car (esa-buffer::buffers frame))))) d@162: frame))) d@162: d@162: (defgeneric import-from-identifier (frame id)) d@162: (defmethod import-from-identifier (frame (id gsharp-gsh-identifier)) d@162: (clim:execute-frame-command frame '(gsharp::com-new-buffer)) d@162: (gsharp::frame-find-file frame (%gsharp-identifier-pathname id))) d@162: (defmethod import-from-identifier (frame (id gsharp-mxml-identifier)) d@162: (clim:execute-frame-command frame `(gsharp::com-import-musicxml ,(%gsharp-identifier-pathname id))))