Audio error handling added - first basics, need to be enhanced
This commit is contained in:
+12
-4
@@ -6,6 +6,7 @@
|
||||
"ffmpeg-decoder.rkt"
|
||||
"audio-sniffer.rkt"
|
||||
"private/utils.rkt"
|
||||
"audio-errors.rkt"
|
||||
racket/contract
|
||||
racket/string
|
||||
racket/path
|
||||
@@ -193,13 +194,20 @@
|
||||
(let ((file (if (path? audio-file)
|
||||
(path->string audio-file)
|
||||
audio-file)))
|
||||
(unless (audio-file-valid? audio-file)
|
||||
(error (format "Not a valid audio file '~a'" audio-file)))
|
||||
|
||||
(unless (file-exists? audio-file)
|
||||
(error (format "File '~a' does not exist" audio-file)))
|
||||
(raise-audio-error 'file-not-found
|
||||
"File not found: '~a'" audio-file))
|
||||
|
||||
(unless (audio-file-valid? audio-file)
|
||||
(raise-audio-error 'invalid-audio-file
|
||||
"Not a valid audio file: '~a'" audio-file))
|
||||
|
||||
(let ((reader* (find-reader audio-file)))
|
||||
(when (eq? reader* #f)
|
||||
(error (format "Cannot find reader for '~a'" audio-file)))
|
||||
(raise-audio-error 'no-audio-reader
|
||||
"Cannot find reader for '~a'" audio-file))
|
||||
|
||||
(let* ((reader-type (car reader*))
|
||||
(reader (cadr reader*))
|
||||
(ao-type (audio-reader-ao-type reader))
|
||||
|
||||
Reference in New Issue
Block a user