diff --git a/info.rkt b/info.rkt new file mode 100644 index 0000000..ebf7d49 --- /dev/null +++ b/info.rkt @@ -0,0 +1,26 @@ +#lang info + +(define pkg-authors '(hnmdijkema)) +(define version "0.1.0") +(define license 'GPL-2.0-or-later) ; The liboa library has this license +(define collection "racket-sound") +(define pkg-desc "racket-sound - Integration of popular music/sound related libraries in racket") + +(define scribblings + '( + ("scribblings/racket-sound.scrbl" () (library) "racket-sound") + ("scribblings/liboa.scrbl" () (library) "racket-sound/liboa/libao.rkt") + ("scribblings/flac-decoder.scrbl" () (library) "racket-sound/libflac/flac-decoder.rkt") + ("scribblings/taglib.scrbl" () (library) "racket-sound/libtag/taglib.rkt") + ) + ) + +(define deps + '("racket/gui" "racket/base" "racket")) + +(define build-deps + '("racket-doc" + "draw-doc" + "rackunit-lib" + "scribble-lib" + )) diff --git a/libao/libao-ffi.rkt b/libao/libao-ffi.rkt index d4e3bc4..08031ff 100644 --- a/libao/libao-ffi.rkt +++ b/libao/libao-ffi.rkt @@ -3,6 +3,7 @@ (require ffi/unsafe ffi/unsafe/define setup/dirs + "../utils/utils.rkt" ) (provide ;_libao_pointer diff --git a/libflac/flac.exe b/libflac/flac.exe deleted file mode 100644 index f79f639..0000000 Binary files a/libflac/flac.exe and /dev/null differ diff --git a/libflac/libflac-ffi.rkt b/libflac/libflac-ffi.rkt index ffb3688..ee4bbba 100644 --- a/libflac/libflac-ffi.rkt +++ b/libflac/libflac-ffi.rkt @@ -1,4 +1,3 @@ -;#lang racket/base (module libflac-ffi racket/base (require ffi/unsafe diff --git a/libflac/metaflac.exe b/libflac/metaflac.exe deleted file mode 100644 index 54dba80..0000000 Binary files a/libflac/metaflac.exe and /dev/null differ diff --git a/main.rkt b/main.rkt index 75fdd22..a53e5e3 100644 --- a/main.rkt +++ b/main.rkt @@ -1,2 +1,12 @@ #lang racket/base +(require "libao/libao.rkt" + "libflac/flac-decoder.rkt" + "libtag/taglib.rkt" + ) + +(provide (all-from-out "libao/libao.rkt") + (all-from-out "libflac/flac-decoder.rkt") + (all-from-out "libtag/taglib.rkt") + ) + diff --git a/utils/utils.rkt b/utils/utils.rkt index fa2202c..93cc9fc 100644 --- a/utils/utils.rkt +++ b/utils/utils.rkt @@ -1,7 +1,9 @@ (module utils racket/base (provide while + until get-lib-path + do-for ) (define-syntax while @@ -18,12 +20,43 @@ ) )) + (define-syntax until + (syntax-rules () + ((_ cond body ...) + (letrec ((until-f (lambda (last-result) + (if cond + last-result + (let ((last-reult (begin + body + ...))) + (until-f last-result)))))) + (until-f #f))))) + + (define-syntax do-for + (syntax-rules () + ((_ (init cond next) body ...) + (begin + init + (letrec ((do-for-f (lamba () + (if cond + (begin + (begin + body + ...) + next + (do-for-f)))))) + (do-for-f)))))) (define (get-lib-path lib) (let ((platform (system-type))) (cond [(eq? platform 'windows) - (build-path (current-directory) ".." "lib" "dll" lib)] + (let ((try1 (build-path (current-directory) ".." "lib" "dll" lib)) + (try2 (build-path (current-directory) "lib" "dll" lib))) + (if (file-exists? try1) + try1 + try2) + )] [else (error (format "Install the shared library: ~a" lib))] )))