forked from Shirakumo/harmony
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfiles.lisp
More file actions
33 lines (25 loc) · 1.1 KB
/
files.lisp
File metadata and controls
33 lines (25 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#|
This file is a part of harmony
(c) 2017 Shirakumo http://tymoon.eu (shinmera@tymoon.eu)
Author: Nicolas Hafner <shinmera@tymoon.eu>
|#
(in-package #:org.shirakumo.fraf.harmony)
(defvar *filetype-source-map* (make-hash-table :test 'equalp))
(defun source-type (name)
(or (gethash name *filetype-source-map*)
(error "Unknown file type ~a." name)))
(defun (setf source-type) (type name)
(setf (gethash name *filetype-source-map*) type))
(defmacro define-source-type (name type)
`(setf (source-type ,(string name)) ',type))
(defmethod play (server (file pathname) mixer &rest initargs &key class &allow-other-keys)
(let ((initargs (copy-list initargs)))
(remf initargs :class)
(apply #'play server (or class (source-type (pathname-type file))) mixer
:file file initargs)))
(defmethod decode ((file pathname) &rest initargs &key class &allow-other-keys)
(let ((initargs (copy-list initargs)))
(remf initargs :class)
(apply #'decode (or class (source-type (pathname-type file))) :file file initargs)))
(defclass file-source (source)
((file :initarg :file :accessor file)))