-
This commit is contained in:
37
libao/libao-async-ffi.rkt
Normal file
37
libao/libao-async-ffi.rkt
Normal file
@@ -0,0 +1,37 @@
|
||||
#lang racket/base
|
||||
|
||||
|
||||
(require ffi/unsafe
|
||||
ffi/unsafe/define
|
||||
setup/dirs
|
||||
"../utils/utils.rkt"
|
||||
)
|
||||
|
||||
(provide ao_create_async
|
||||
ao_stop_async
|
||||
ao_play_async
|
||||
ao_is_at_second_async
|
||||
)
|
||||
|
||||
;(ffi-lib "/usr/local/lib/libao-play-async.so")
|
||||
|
||||
(define-ffi-definer define-libao-async
|
||||
(ffi-lib "libao-play-async" '("0" #f)
|
||||
#:get-lib-dirs (lambda ()
|
||||
(cons (build-path ".") (get-lib-search-dirs)))
|
||||
#:fail (λ () (error "Cannot load libao-play-async"))
|
||||
))
|
||||
|
||||
(define _libao-async-handle-pointer (_cpointer 'ao-async-handle))
|
||||
|
||||
;extern void *ao_create_async(void *ao_device);
|
||||
(define-libao-async ao_create_async(_fun _pointer -> _libao-async-handle-pointer))
|
||||
|
||||
;extern void ao_stop_async(void *handle);
|
||||
(define-libao-async ao_stop_async(_fun _libao-async-handle-pointer -> _void))
|
||||
|
||||
;extern void ao_play_async(void *handle, double at_second, int buf_size, void *mem);
|
||||
(define-libao-async ao_play_async(_fun _libao-async-handle-pointer _double _uint32 _pointer -> _void))
|
||||
|
||||
;extern double ao_is_at_second_async(void *handle);
|
||||
(define-libao-async ao_is_at_second_async(_fun _libao-async-handle-pointer -> _double))
|
||||
Reference in New Issue
Block a user