-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split asset management mess into assets, resources and loaders
- Loading branch information
Showing
60 changed files
with
519 additions
and
565 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,28 @@ | ||
(in-package :cl-bodge.assets) | ||
|
||
|
||
(deftype pcm-data () | ||
'(or (simple-array (unsigned-byte 8) (*)) | ||
(simple-array (signed-byte 16) (*)) | ||
(simple-array (signed-byte 32) (*)) | ||
(simple-array single-float (*)) | ||
(simple-array double-float (*)))) | ||
(defclass audio () | ||
((channel-format :initarg :channel-format :initform nil | ||
:type channel-format :reader audio-channel-format-of) | ||
(sample-depth :initarg :sample-depth :initform nil | ||
:type sample-depth :reader audio-sample-depth-of) | ||
(sampling-rate :initarg :sampling-rate :initform nil | ||
:type positive-integer :reader audio-sampling-rate-of))) | ||
|
||
|
||
(deftype sample-depth () | ||
'(member 8 16)) | ||
(defclass pcm-16-audio (audio) () | ||
(:default-initargs :sample-depth 16)) | ||
|
||
|
||
(defenum channel-format | ||
:mono :stereo) | ||
(defclass cached-pcm-16-audio (pcm-16-audio) | ||
((samples :initarg :samples :reader pcm-audio-data-of))) | ||
|
||
|
||
(defgeneric pcm-audio-data-of (resource)) | ||
(defgeneric audio-channel-format-of (resource)) | ||
(defgeneric audio-sample-depth-of (resource)) | ||
(defgeneric audio-sampling-rate-of (resource)) | ||
(defun load-ogg-vorbis-audio (path) | ||
(with-open-sound-file (file path) | ||
(make-instance 'cached-pcm-16-audio | ||
:samples (read-short-samples-into-array file) | ||
:sampling-rate (sound-sample-rate file) | ||
:channel-format (ecase (sound-channels file) | ||
(1 :mono) | ||
(2 :stereo))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
(in-package :cl-bodge.resources) | ||
(in-package :cl-bodge.assets) | ||
|
||
;;; | ||
;;; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
(in-package :cl-bodge.assets) | ||
|
||
|
||
(defmethod read-chunk ((type (eql :encoded)) parameters stream) | ||
(destructuring-bind (&key name asset-class &allow-other-keys) parameters | ||
(decode-asset asset-class stream))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
(in-package :cl-bodge.resources) | ||
(in-package :cl-bodge.assets) | ||
|
||
|
||
(define-chunk-structure glyph-metrics | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.