This commit is contained in:
2026-02-22 23:15:08 +01:00
parent 2cc96f30ae
commit 24b39bee60
8 changed files with 101 additions and 32 deletions

View File

@@ -13,6 +13,7 @@
ao_driver_id
ao_open_live
ao_play
ao_play_ptr
ao_close
ao_shutdown
ao_append_option
@@ -26,15 +27,18 @@
)
(define-ffi-definer define-libao
(ffi-lib "libao" '("3" "4" "5" #f)
#:get-lib-dirs (lambda ()
(cons (build-path ".") (get-lib-search-dirs)))
#:fail (lambda ()
(ffi-lib (get-lib-path "libao-4.dll")))
))
(define ao_lib (ffi-lib "libao" '("3" "4" "5" #f)
#:get-lib-dirs (λ ()
(let ((sp (cons (build-path ".") (get-lib-search-dirs))))
(displayln sp)
sp))
#:fail (λ ()
(ffi-lib (get-lib-path "libao-4.dll")))
))
(define-ffi-definer define-libao ao_lib)
(define _libao-pointer (_cpointer 'ao_device))
(define-cstruct _ao_sample_format (
[bits _int] ; bits per sample
@@ -66,6 +70,10 @@
; int ao_play(ao_device *device, char *output_samples, uint_32 num_bytes);
(define-libao ao_play (_fun _libao-pointer _pointer _uint32 -> _int))
(define ao_play_ptr (get-ffi-obj "ao_play" ao_lib _fpointer
(λ () (error 'ao_lib "libao does not provide 'ao_play'"))
))
; int ao_close(ao_device *device);
(define-libao ao_close (_fun _libao-pointer -> _int))