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. ! See http://factorcode.org/license.txt for BSD license.
! !
IN: openal.macosx IN: openal.macosx
USING: openal alien.c-types kernel alien alien.syntax shuffle USING: alien.c-types kernel alien alien.syntax shuffle
combinators.lib ; combinators.lib openal.backend namespaces ;
TUPLE: macosx-openal-backend ;
LIBRARY: alut LIBRARY: alut
T{ macosx-openal-backend } openal-backend set-global
FUNCTION: void alutLoadWAVFile ( ALbyte* fileName, ALenum* format, void** data, ALsizei* size, ALsizei* frequency ) ; 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> 0 <int> f <void*> 0 <int> 0 <int>
[ alutLoadWAVFile ] 4keep [ alutLoadWAVFile ] 4keep
>r >r >r *int r> *void* r> *int r> *int ; >r >r >r *int r> *void* r> *int r> *int ;

View File

@ -3,24 +3,20 @@
! !
IN: openal IN: openal
USING: kernel alien system combinators alien.syntax namespaces 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" ] } { [ win32? ] [ "alut.dll" ] }
{ [ macosx? ] [ "/System/Library/Frameworks/OpenAL.framework/OpenAL" ] } { [ macosx? ] [ "/System/Library/Frameworks/OpenAL.framework/OpenAL" ] }
{ [ unix? ] [ "libalut.so" ] } { [ unix? ] [ "libalut.so" ] }
} cond "cdecl" add-library ; parsing } cond "cdecl" add-library >>
: load-openal-library ( -- ) << "openal" {
"openal" {
{ [ win32? ] [ "OpenAL32.dll" ] } { [ win32? ] [ "OpenAL32.dll" ] }
{ [ macosx? ] [ "/System/Library/Frameworks/OpenAL.framework/OpenAL" ] } { [ macosx? ] [ "/System/Library/Frameworks/OpenAL.framework/OpenAL" ] }
{ [ unix? ] [ "libopenal.so" ] } { [ unix? ] [ "libopenal.so" ] }
} cond "cdecl" add-library ; parsing } cond "cdecl" add-library >>
load-alut-library
load-openal-library
LIBRARY: openal LIBRARY: openal
@ -261,18 +257,7 @@ SYMBOL: init
"create-buffer-from-file failed" throw "create-buffer-from-file failed" throw
] when ; ] when ;
SYMBOL: openal-impl macosx? "openal.macosx" "openal.other" ? require
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
: create-buffer-from-wav ( filename -- buffer ) : create-buffer-from-wav ( filename -- buffer )
gen-buffer dup rot load-wav-file gen-buffer dup rot load-wav-file