]> gitweb.factorcode.org Git - factor.git/commitdiff
openal.alut: fixing alut so it should throw better error messages
authorBjörn Lindqvist <bjourne@gmail.com>
Wed, 14 Sep 2016 13:53:29 +0000 (15:53 +0200)
committerBjörn Lindqvist <bjourne@gmail.com>
Wed, 14 Sep 2016 13:53:29 +0000 (15:53 +0200)
extra/openal/alut/alut.factor

index 2a21a2e5bc6dc28619d99715d81c73913fd67ad8..f4ae603f6857917eed7469e6d20196e6e5d6af4b 100755 (executable)
@@ -71,21 +71,24 @@ FUNCTION: void alutUnloadWAV ( ALenum format, void* data, ALsizei size, ALsizei
 
 SYMBOL: init
 
+: throw-alut-error ( -- )
+    alutGetError alutGetErrorString throw ;
+
 : init-openal ( -- )
     init get-global expired? [
-        f f alutInit 0 = [ "Could not initialize OpenAL" throw ] when
+        f f alutInit 0 = [ throw-alut-error ] when
         1337 <alien> init set-global
     ] when ;
 
 : exit-openal ( -- )
     init get-global expired? [
-        alutExit 0 = [ "Could not close OpenAL" throw ] when
+        alutExit 0 = [ throw-alut-error ] when
         f init set-global
     ] unless ;
 
 : create-buffer-from-file ( filename -- buffer )
     alutCreateBufferFromFile dup AL_NONE = [
-        "create-buffer-from-file failed" throw
+        throw-alut-error
     ] when ;
 
 os macosx? "openal.alut.macosx" "openal.alut.other" ? require