(defvar with-music t)(defvar music-uri nil)(defvar music-speed 100)(defvar bgm-play nil)(register-device 'audio-mem
"audio-mem"
(get-default-prio)
#'(lambda (sig)))(register-node 'music-content
#'(lambda ()(and music-uri (eq music-uri req-content-uri) (not next-flag)))
#'(lambda ()(when bgm-play
(audio-stop 'audio-mem)(setf bgm-play nil))(setf music-uri (if (music-p) req-content-uri nil))(when music-uri
(setf next-flag nil))(eval-events (list 'request-play 'request-stop 'stream-finish)))
#'(lambda ()
t))(register-node 'music-open
#'(lambda ()(and stream-valid (eq (get-stream-type) 'STREAM_ES_MODE) (get-stream-audio-codec)))
#'(lambda ()(unless stream-valid
(setf music-format nil)(setf stream-valid (stream-open 'stream-in
:mode play-mode
:seek seek-time
:speed music-speed
:content-uri music-uri
:dlna-protocol dlna-protocol
:not-dlnadoc not-dlnadoc
:index-uri index-uri
:size content-size
:duration content-duration))(set-stream-info 'stream-in))(eval-events (list 'stream-change)))
#'(lambda ()(when stream-valid
(stream-close 'stream-in)(setf stream-valid nil))))(register-node 'music-setup
#'(lambda ()(and (eq trik-speed music-speed) (not (eq music-speed 0))))
#'(lambda ()(stream-stop 'stream-in)(setf music-format (get-stream-audio-codec))(setf music-speed trik-speed)(eval-events (list 'play-speed-change)))
#'(lambda ()(setf music-speed 0)))(register-node 'music-play
#'(lambda ()
t)
#'(lambda ()(stream-play 'stream-in music-speed))
#'(lambda ()(stream-stop 'stream-in)))(register-node 'music-monitor
#'(lambda ()
t)
#'(lambda ()(set-play-timer music-speed))
#'(lambda ()(cancel-timer 'play-time-timer)))(defun file-music-start (filename format loop)(music-env)(setf bgm-play (audio-play 'audio-mem
:filename filename
:format format
:mode (if loop "loop" nil))))(defun music-connect ()(if (device-id 'video)(device-open 'audio-mem (device-id 'video))(device-open 'audio-mem 0))(stream-music-device 'stream-in 'audio-mem)(append-t
'music-content
'music-open
'music-setup
'music-play
'music-monitor)(eval-node 'music-content))(defun music-disconnect ()(cancel-node 'music-content)(init-node 'music-content)(device-close 'audio-mem)(setf music-uri nil)(setf music-speed 100)(setf bgm-play nil))
