trying to overcome gapless problems with mpg123 (very small tick left) and facilitate output to wav
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
)
|
||||
|
||||
(provide ao-open-live
|
||||
ao-open-file
|
||||
ao-play
|
||||
ao-close
|
||||
ao-at-second
|
||||
@@ -81,36 +82,47 @@
|
||||
|
||||
(rc:define/contract (ao-open-live bits rate channels byte-format)
|
||||
(rc:-> ao-valid-bits? ao-valid-rate? ao-valid-channels? ao-valid-format? ao-handle?)
|
||||
(let ((handle (make-ao-handle device-number)))
|
||||
(ao-open-file bits rate channels byte-format #f))
|
||||
|
||||
(fin:register-finalizer handle
|
||||
(lambda (handle)
|
||||
(ao-close handle)))
|
||||
(define (valid-file-kind? f)
|
||||
(or (string? f) (path? f) (eq? f #f)))
|
||||
|
||||
(set-ao-handle-bits! handle bits)
|
||||
(set-ao-handle-bytes-per-sample! handle (bytes-for-bits bits))
|
||||
(set-ao-handle-byte-format! handle byte-format)
|
||||
(set-ao-handle-channels! handle channels)
|
||||
(set-ao-handle-rate! handle rate)
|
||||
(rc:define/contract (ao-open-file bits rate channels byte-format filename)
|
||||
(rc:-> ao-valid-bits? ao-valid-rate? ao-valid-channels? ao-valid-format? valid-file-kind? ao-handle?)
|
||||
(let* ((handle (make-ao-handle device-number))
|
||||
(file (if (eq? filename #f)
|
||||
#f
|
||||
(format "~a" filename)))
|
||||
)
|
||||
(fin:register-finalizer handle
|
||||
(lambda (handle)
|
||||
(ao-close handle)))
|
||||
|
||||
(info-sound "ao-open-live ~a ~a ~a ~a" bits rate channels byte-format)
|
||||
(set-ao-handle-bits! handle bits)
|
||||
(set-ao-handle-bytes-per-sample! handle (bytes-for-bits bits))
|
||||
(set-ao-handle-byte-format! handle byte-format)
|
||||
(set-ao-handle-channels! handle channels)
|
||||
(set-ao-handle-rate! handle rate)
|
||||
|
||||
(info-sound "ao-open-live ~a ~a ~a ~a ~a" bits rate channels byte-format file)
|
||||
|
||||
(let ((player (ffi:ao_create_async bits rate channels byte-format)))
|
||||
(set-ao-handle-async-player! handle player)
|
||||
(if (eq? player #f)
|
||||
(begin
|
||||
(err-sound "ao-open-live - cannote create player")
|
||||
(set-ao-handle-closed! handle #t)
|
||||
handle)
|
||||
(begin
|
||||
(info-sound "ao-open-live - created player")
|
||||
(set-ao-handle-closed! handle #f)
|
||||
handle
|
||||
(let ((player (ffi:ao_create_async bits rate channels byte-format file)))
|
||||
(set-ao-handle-async-player! handle player)
|
||||
(if (eq? player #f)
|
||||
(begin
|
||||
(err-sound "ao-open-live - cannote create player")
|
||||
(set-ao-handle-closed! handle #t)
|
||||
handle)
|
||||
(begin
|
||||
(info-sound "ao-open-live - created player")
|
||||
(set-ao-handle-closed! handle #f)
|
||||
handle
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(rc:define/contract (ao-close handle)
|
||||
(rc:-> ao-handle? void?)
|
||||
|
||||
Reference in New Issue
Block a user