fix openal for vocab changes

db4
Doug Coleman 2008-01-10 10:49:50 -10:00
parent ca30e5475f
commit 390875df8f
2 changed files with 13 additions and 25 deletions

View File

@ -2,14 +2,17 @@
! See http://factorcode.org/license.txt for BSD license.
!
IN: openal.macosx
USING: openal alien.c-types kernel alien alien.syntax shuffle
combinators.lib ;
USING: alien.c-types kernel alien alien.syntax shuffle
combinators.lib openal.backend namespaces ;
TUPLE: macosx-openal-backend ;
LIBRARY: alut
T{ macosx-openal-backend } openal-backend set-global
FUNCTION: void alutLoadWAVFile ( ALbyte* fileName, ALenum* format, void** data, ALsizei* size, ALsizei* frequency ) ;
M: macosx-openal-impl load-wav-file ( filename -- format data size frequency )
M: macosx-openal-backend load-wav-file ( path -- format data size frequency )
0 <int> f <void*> 0 <int> 0 <int>
[ alutLoadWAVFile ] 4keep
>r >r >r *int r> *void* r> *int r> *int ;

View File

@ -3,24 +3,20 @@
!
IN: openal
USING: kernel alien system combinators alien.syntax namespaces
alien.c-types sequences vocabs.loader shuffle combinators.lib ;
alien.c-types sequences vocabs.loader shuffle combinators.lib
openal.backend ;
: load-alut-library ( -- )
"alut" {
<< "alut" {
{ [ win32? ] [ "alut.dll" ] }
{ [ macosx? ] [ "/System/Library/Frameworks/OpenAL.framework/OpenAL" ] }
{ [ unix? ] [ "libalut.so" ] }
} cond "cdecl" add-library ; parsing
} cond "cdecl" add-library >>
: load-openal-library ( -- )
"openal" {
<< "openal" {
{ [ win32? ] [ "OpenAL32.dll" ] }
{ [ macosx? ] [ "/System/Library/Frameworks/OpenAL.framework/OpenAL" ] }
{ [ unix? ] [ "libopenal.so" ] }
} cond "cdecl" add-library ; parsing
load-alut-library
load-openal-library
} cond "cdecl" add-library >>
LIBRARY: openal
@ -261,18 +257,7 @@ SYMBOL: init
"create-buffer-from-file failed" throw
] when ;
SYMBOL: openal-impl
HOOK: load-wav-file openal-impl ( filename -- format data size frequency )
TUPLE: macosx-openal-impl ;
TUPLE: other-openal-impl ;
macosx? [
"openal.macosx" require
macosx-openal-impl
] [
"openal.other" require
other-openal-impl
] if construct-empty openal-impl set-global
macosx? "openal.macosx" "openal.other" ? require
: create-buffer-from-wav ( filename -- buffer )
gen-buffer dup rot load-wav-file