audio decoding
This commit is contained in:
+36
-2
@@ -24,7 +24,7 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(define-struct audio-reader
|
||||
(exts open reader seeker stopper))
|
||||
(exts valid? open reader seeker stopper))
|
||||
|
||||
;; audiotype, audio-reader
|
||||
(define audio-readers (make-hash))
|
||||
@@ -32,6 +32,7 @@
|
||||
(hash-set! audio-readers
|
||||
'flac
|
||||
(make-audio-reader '("flac")
|
||||
flac-valid?
|
||||
flac-open
|
||||
flac-read
|
||||
flac-seek
|
||||
@@ -84,7 +85,40 @@
|
||||
(-> (or/c string? path?) boolean?)
|
||||
(let ((f (build-path file)))
|
||||
(let ((e (format "~a" (path-get-extension f))))
|
||||
(audio-valid-ext? e))))
|
||||
(if (audio-valid-ext? e)
|
||||
(let ((reader (find-reader file)))
|
||||
(if (eq? reader #f)
|
||||
#f
|
||||
(audio-reader-valid? file)))
|
||||
#f))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; cb-stream-info will be called with
|
||||
; - audio-type: symbol?
|
||||
; - handle: audio-handle?
|
||||
; - meta: hash?
|
||||
; Meta information must at least contain:
|
||||
; ('duration . seconds) - duration of the audio in seconds (or fractions): double
|
||||
; ('bits-per-sample . integer) - number of audio bits per sample
|
||||
; ('channels . integer) - number of audio channels
|
||||
; ('sample-rate . integer) - number of samples per second per channel
|
||||
; ('total-samples . integer) - total number of samples of the audio
|
||||
;
|
||||
; cb-audio will be called with
|
||||
; - audio-type: symbol?
|
||||
; - handle: audio-handle?
|
||||
; - buf-info: hash?
|
||||
; - buffer: cpointer? - contains data to be fed to ao - must be owned / released by the driver
|
||||
; the ao-async backend will copy the data
|
||||
; - buf-size: integer? - contains the size of the data
|
||||
; buf-info must at least contain:
|
||||
; ('duration . seconds) - duration of the audio in seconds (or fractions): double
|
||||
; ('bits-per-sample . integer) - number of audio bits per sample
|
||||
; ('channels . integer) - number of audio channels
|
||||
; ('sample-rate . integer) - number of samples per second per channel
|
||||
; ('total-samples . integer) - total number of samples of the audio
|
||||
; (sample . integer) - the current sample the audio buffer applies to.
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(define/contract (audio-open audio-file cb-stream-info cb-audio)
|
||||
(-> (or/c string? path?) procedure? procedure? audio-handle?)
|
||||
|
||||
Reference in New Issue
Block a user