ffmpeg support

This commit is contained in:
2026-04-28 15:04:12 +02:00
parent d78a0ae9ff
commit d55f52818d
33 changed files with 157 additions and 22 deletions
+12 -3
View File
@@ -10,6 +10,7 @@
)
(provide ao-open-live
ao-device-bits
ao-open-file
ao-play
ao-close
@@ -35,6 +36,8 @@
(define-struct ao-handle (handle-num
[bits #:auto #:mutable]
[bytes-per-sample #:auto #:mutable]
[dev-bits #:auto #:mutable]
[dev-bytes-per-sample #:auto #:mutable]
[byte-format #:auto #:mutable]
[channels #:auto #:mutable]
[rate #:auto #:mutable]
@@ -113,15 +116,17 @@
(err-sound "ao-open-live - cannote create player")
(set-ao-handle-closed! handle #t)
handle)
(begin
(info-sound "ao-open-live - created player")
(let ((out-bits (ffi:ao_real_output_bits_async player)))
(info-sound "ao-open-live - created player at ~a bits" out-bits)
(set-ao-handle-dev-bits! handle out-bits)
(set-ao-handle-dev-bytes-per-sample! handle (/ out-bits 8))
(set-ao-handle-closed! handle #f)
handle
)
)
)
)
)
)
(rc:define/contract (ao-close handle)
@@ -143,6 +148,10 @@
(define (any? x)
#t)
(rc:define/contract (ao-device-bits handle)
(rc:-> ao-handle? integer?)
(ao-handle-dev-bits handle))
(rc:define/contract (ao-play handle music-id at-time-in-s music-duration-s buffer buf-len buf-type)
(rc:-> ao-handle? integer? number? number? any? integer? ao-supported-music-format? void?)
(let* ((bytes-per-sample (ao-handle-bytes-per-sample handle))