Open svetlyak40wt opened 4 years ago
Does it help if you wrap everything in (sb-int:with-float-traps-masked (:divide-by-zero :overflow :underflow :inexact :invalid) ...)
Tried to use a version built by Homebrew, but without success, because cl-out123 inserts it's static
directory in the path:
CL-USER> (ql:quickload :cffi)
(:CFFI)
CL-USER> (push "/usr/local/Cellar/mpg123/1.25.13/lib/" cffi:*foreign-library-directories*)
("/usr/local/Cellar/mpg123/1.25.13/lib/"
(CFFI::EXPLODE-PATH-ENVIRONMENT-VARIABLE "LD_LIBRARY_PATH")
(CFFI::EXPLODE-PATH-ENVIRONMENT-VARIABLE "DYLD_LIBRARY_PATH") (UIOP/OS:GETCWD)
(CFFI::DARWIN-FALLBACK-LIBRARY-PATH))
CL-USER> (ql:quickload :cl-out123)
To load "cl-out123":
Load 1 ASDF system:
cl-out123
; Loading "cl-out123"
(:CL-OUT123)
CL-USER> (cl-out123:make-output NIL)
#<CL-OUT123:OUTPUT "SBCL COMMON-LISP-USER">
CL-USER> (cl-out123:connect *)
; Debugger entered on #<DIVISION-BY-ZERO {1003920EF3}>
[1] CL-USER>
; Evaluation aborted on #<DIVISION-BY-ZERO {1003920EF3}>
CL-USER> cffi:*foreign-library-directories*
(#P"/Users/art/projects/lisp/lisp-project-of-the-day/.qlot/dists/ultralisp/software/Shirakumo-cl-out123-20190627104836/static/"
"/usr/local/Cellar/mpg123/1.25.13/lib/"
(CFFI::EXPLODE-PATH-ENVIRONMENT-VARIABLE "LD_LIBRARY_PATH")
(CFFI::EXPLODE-PATH-ENVIRONMENT-VARIABLE "DYLD_LIBRARY_PATH") (UIOP/OS:GETCWD)
(CFFI::DARWIN-FALLBACK-LIBRARY-PATH))
CL-USER>
Does it help if you wrap everything in (sb-int:with-float-traps-masked (:divide-by-zero :overflow :underflow :inexact :invalid) ...)
Yes, it helps.
But late, when I call play
:
CL-USER> (let ((buffersize (* (cl-flac:channels *file*)
(/ (cl-flac:samplerate *file*) 100))))
(cffi:with-foreign-object (buffer :float buffersize)
(loop for read = (cl-flac:read-directly *file* buffer (* buffersize 4))
for played = (cl-out123:play #v1 buffer read)
while (< 0 read)
do (when (/= played read)
(format T "~&Warning: playback not catching up with input by ~a bytes."
(- read played))))))
it fails with this condition:
#<OUTPUT "SBCL COMMON-LISP-USER" coreaudio/NIL> failed to play back: no active audio device
Hmm, odd. I'll have to take a look some other time.
BTW, I've patched cl-out123 to inject Homebrew path instead:
CL-USER> cffi:*foreign-library-directories*
(#P"/usr/local/Cellar/mpg123/1.25.13/lib/"
(CFFI::EXPLODE-PATH-ENVIRONMENT-VARIABLE "LD_LIBRARY_PATH")
(CFFI::EXPLODE-PATH-ENVIRONMENT-VARIABLE "DYLD_LIBRARY_PATH") (UIOP/OS:GETCWD)
(CFFI::DARWIN-FALLBACK-LIBRARY-PATH))
But this did not help.
I've tried today to reproduce an example from: https://github.com/Shirakumo/cl-flac/blob/master/test.lisp, but
cl-out123:connect
does not work as expected.This minimal code throws an error:
Second attempt to call
(cl-out123:connect *)
just hangs.