]> gitweb.factorcode.org Git - factor.git/commitdiff
move alut stuff to openal.alut so alut only gets deployed if we use it
authorJoe Groff <arcata@gmail.com>
Wed, 17 Feb 2010 06:31:21 +0000 (22:31 -0800)
committerJoe Groff <arcata@gmail.com>
Wed, 17 Feb 2010 06:31:21 +0000 (22:31 -0800)
21 files changed:
extra/morse/morse.factor [changed mode: 0644->0755]
extra/openal/alut/alut.factor [new file with mode: 0755]
extra/openal/alut/backend/authors.txt [new file with mode: 0755]
extra/openal/alut/backend/backend.factor [new file with mode: 0755]
extra/openal/alut/macosx/authors.txt [new file with mode: 0755]
extra/openal/alut/macosx/macosx.factor [new file with mode: 0755]
extra/openal/alut/macosx/tags.txt [new file with mode: 0644]
extra/openal/alut/other/authors.txt [new file with mode: 0755]
extra/openal/alut/other/other.factor [new file with mode: 0755]
extra/openal/backend/authors.txt [deleted file]
extra/openal/backend/backend.factor [deleted file]
extra/openal/example/example.factor [changed mode: 0644->0755]
extra/openal/macosx/authors.txt [deleted file]
extra/openal/macosx/macosx.factor [deleted file]
extra/openal/macosx/tags.txt [deleted file]
extra/openal/openal.factor [changed mode: 0644->0755]
extra/openal/other/authors.txt [deleted file]
extra/openal/other/other.factor [deleted file]
extra/space-invaders/space-invaders.factor [changed mode: 0644->0755]
extra/synth/example/example.factor [changed mode: 0644->0755]
extra/synth/synth.factor [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index cbe3c0f..c6f1601
@@ -1,6 +1,6 @@
 ! Copyright (C) 2007, 2008, 2009 Alex Chapman, 2009 Diego Martinelli
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors ascii assocs biassocs combinators hashtables kernel lists literals math namespaces make multiline openal parser sequences splitting strings synth synth.buffers ;
+USING: accessors ascii assocs biassocs combinators hashtables kernel lists literals math namespaces make multiline openal openal.alut parser sequences splitting strings synth synth.buffers ;
 IN: morse
 
 ERROR: no-morse-ch ch ;
diff --git a/extra/openal/alut/alut.factor b/extra/openal/alut/alut.factor
new file mode 100755 (executable)
index 0000000..d1b8d26
--- /dev/null
@@ -0,0 +1,103 @@
+! Copyright (C) 2007 Chris Double.\r
+! See http://factorcode.org/license.txt for BSD license.\r
+USING: kernel accessors arrays alien system combinators\r
+alien.syntax namespaces alien.c-types sequences vocabs.loader\r
+shuffle openal openal.alut.backend alien.libraries generalizations\r
+specialized-arrays alien.destructors ;\r
+FROM: alien.c-types => float short ;\r
+SPECIALIZED-ARRAY: uint\r
+IN: openal.alut\r
+\r
+<< "alut" {\r
+        { [ os windows? ]  [ "alut.dll" ] }\r
+        { [ os macosx? ] [\r
+            "/System/Library/Frameworks/OpenAL.framework/OpenAL"\r
+        ] }\r
+        { [ os unix?  ]  [ "libalut.so" ] }\r
+    } cond "cdecl" add-library >>\r
+\r
+<< os macosx? [ "alut" deploy-library ] unless >>\r
+\r
+LIBRARY: alut\r
+\r
+CONSTANT: ALUT_API_MAJOR_VERSION 1\r
+CONSTANT: ALUT_API_MINOR_VERSION 1\r
+CONSTANT: ALUT_ERROR_NO_ERROR 0\r
+CONSTANT: ALUT_ERROR_OUT_OF_MEMORY HEX: 200\r
+CONSTANT: ALUT_ERROR_INVALID_ENUM HEX: 201\r
+CONSTANT: ALUT_ERROR_INVALID_VALUE HEX: 202\r
+CONSTANT: ALUT_ERROR_INVALID_OPERATION HEX: 203\r
+CONSTANT: ALUT_ERROR_NO_CURRENT_CONTEXT HEX: 204\r
+CONSTANT: ALUT_ERROR_AL_ERROR_ON_ENTRY HEX: 205\r
+CONSTANT: ALUT_ERROR_ALC_ERROR_ON_ENTRY HEX: 206\r
+CONSTANT: ALUT_ERROR_OPEN_DEVICE HEX: 207\r
+CONSTANT: ALUT_ERROR_CLOSE_DEVICE HEX: 208\r
+CONSTANT: ALUT_ERROR_CREATE_CONTEXT HEX: 209\r
+CONSTANT: ALUT_ERROR_MAKE_CONTEXT_CURRENT HEX: 20A\r
+CONSTANT: ALUT_ERROR_DESTRY_CONTEXT HEX: 20B\r
+CONSTANT: ALUT_ERROR_GEN_BUFFERS HEX: 20C\r
+CONSTANT: ALUT_ERROR_BUFFER_DATA HEX: 20D\r
+CONSTANT: ALUT_ERROR_IO_ERROR HEX: 20E\r
+CONSTANT: ALUT_ERROR_UNSUPPORTED_FILE_TYPE HEX: 20F\r
+CONSTANT: ALUT_ERROR_UNSUPPORTED_FILE_SUBTYPE HEX: 210\r
+CONSTANT: ALUT_ERROR_CORRUPT_OR_TRUNCATED_DATA HEX: 211\r
+CONSTANT: ALUT_WAVEFORM_SINE HEX: 100\r
+CONSTANT: ALUT_WAVEFORM_SQUARE HEX: 101\r
+CONSTANT: ALUT_WAVEFORM_SAWTOOTH HEX: 102\r
+CONSTANT: ALUT_WAVEFORM_WHITENOISE HEX: 103\r
+CONSTANT: ALUT_WAVEFORM_IMPULSE HEX: 104\r
+CONSTANT: ALUT_LOADER_BUFFER HEX: 300\r
+CONSTANT: ALUT_LOADER_MEMORY HEX: 301\r
+\r
+FUNCTION: ALboolean alutInit ( int* argcp, char** argv ) ;\r
+FUNCTION: ALboolean alutInitWithoutContext ( int* argcp, char** argv ) ;\r
+FUNCTION: ALboolean alutExit ( ) ;\r
+FUNCTION: ALenum alutGetError ( ) ;\r
+FUNCTION: char* alutGetErrorString ( ALenum error ) ;\r
+FUNCTION: ALuint alutCreateBufferFromFile ( char* fileName ) ;\r
+FUNCTION: ALuint alutCreateBufferFromFileImage ( void* data, ALsizei length ) ;\r
+FUNCTION: ALuint alutCreateBufferHelloWorld ( ) ;\r
+FUNCTION: ALuint alutCreateBufferWaveform ( ALenum waveshape, ALfloat frequency, ALfloat phase, ALfloat duration ) ;\r
+FUNCTION: void* alutLoadMemoryFromFile ( char* fileName, ALenum* format, ALsizei* size, ALfloat* frequency ) ;\r
+FUNCTION: void* alutLoadMemoryFromFileImage ( void* data, ALsizei length, ALenum* format, ALsizei* size, ALfloat* frequency ) ;\r
+FUNCTION: void* alutLoadMemoryHelloWorld ( ALenum* format, ALsizei* size, ALfloat* frequency ) ;\r
+FUNCTION: void* alutLoadMemoryWaveform ( ALenum waveshape, ALfloat frequency, ALfloat phase, ALfloat duration, ALenum* format, ALsizei* size, ALfloat* freq ) ;\r
+FUNCTION: char* alutGetMIMETypes ( ALenum loader ) ;\r
+FUNCTION: ALint alutGetMajorVersion ( ) ;\r
+FUNCTION: ALint alutGetMinorVersion ( ) ;\r
+FUNCTION: ALboolean alutSleep ( ALfloat duration ) ;\r
+\r
+FUNCTION: void alutUnloadWAV ( ALenum format, void* data, ALsizei size, ALsizei frequency ) ;\r
+\r
+SYMBOL: init\r
+\r
+: init-openal ( -- )\r
+    init get-global expired? [\r
+        f f alutInit 0 = [ "Could not initialize OpenAL" throw ] when\r
+        1337 <alien> init set-global\r
+    ] when ;\r
+\r
+: exit-openal ( -- )\r
+    init get-global expired? [\r
+        alutExit 0 = [ "Could not close OpenAL" throw ] when\r
+        f init set-global\r
+    ] unless ;\r
+\r
+: create-buffer-from-file ( filename -- buffer )\r
+    alutCreateBufferFromFile dup AL_NONE = [\r
+        "create-buffer-from-file failed" throw\r
+    ] when ;\r
+\r
+os macosx? "openal.alut.macosx" "openal.alut.other" ? require\r
+\r
+: create-buffer-from-wav ( filename -- buffer )\r
+    gen-buffer dup rot load-wav-file\r
+    [ alBufferData ] 4 nkeep alutUnloadWAV ;\r
+\r
+: check-error ( -- )\r
+    alGetError dup ALUT_ERROR_NO_ERROR = [\r
+        drop\r
+    ] [\r
+        alGetString throw\r
+    ] if ;\r
+\r
diff --git a/extra/openal/alut/backend/authors.txt b/extra/openal/alut/backend/authors.txt
new file mode 100755 (executable)
index 0000000..44b06f9
--- /dev/null
@@ -0,0 +1 @@
+Chris Double
diff --git a/extra/openal/alut/backend/backend.factor b/extra/openal/alut/backend/backend.factor
new file mode 100755 (executable)
index 0000000..fc50d3d
--- /dev/null
@@ -0,0 +1,4 @@
+USING: namespaces system ;
+IN: openal.alut.backend
+
+HOOK: load-wav-file os ( filename -- format data size frequency )
diff --git a/extra/openal/alut/macosx/authors.txt b/extra/openal/alut/macosx/authors.txt
new file mode 100755 (executable)
index 0000000..44b06f9
--- /dev/null
@@ -0,0 +1 @@
+Chris Double
diff --git a/extra/openal/alut/macosx/macosx.factor b/extra/openal/alut/macosx/macosx.factor
new file mode 100755 (executable)
index 0000000..3c0a467
--- /dev/null
@@ -0,0 +1,14 @@
+! Copyright (C) 2007 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien.c-types kernel alien alien.syntax shuffle
+openal openal.alut.backend namespaces system generalizations ;
+IN: openal.alut.macosx
+
+LIBRARY: alut
+
+FUNCTION: void alutLoadWAVFile ( ALbyte* fileName, ALenum* format, void** data, ALsizei* size, ALsizei* frequency ) ;
+
+M: macosx load-wav-file ( path -- format data size frequency )
+    0 <int> f <void*> 0 <int> 0 <int>
+    [ alutLoadWAVFile ] 4 nkeep
+    [ [ [ *int ] dip *void* ] dip *int ] dip *int ;
diff --git a/extra/openal/alut/macosx/tags.txt b/extra/openal/alut/macosx/tags.txt
new file mode 100644 (file)
index 0000000..6bf6830
--- /dev/null
@@ -0,0 +1 @@
+unportable
diff --git a/extra/openal/alut/other/authors.txt b/extra/openal/alut/other/authors.txt
new file mode 100755 (executable)
index 0000000..44b06f9
--- /dev/null
@@ -0,0 +1 @@
+Chris Double
diff --git a/extra/openal/alut/other/other.factor b/extra/openal/alut/other/other.factor
new file mode 100755 (executable)
index 0000000..b195792
--- /dev/null
@@ -0,0 +1,14 @@
+! Copyright (C) 2007 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien.c-types alien.syntax combinators generalizations
+kernel openal openal.alut.backend ;
+IN: openal.alut.other
+
+LIBRARY: alut
+
+FUNCTION: void alutLoadWAVFile ( ALbyte* fileName, ALenum* format, void** data, ALsizei* size, ALsizei* frequency, ALboolean* looping ) ;
+
+M: object load-wav-file ( filename -- format data size frequency )
+    0 <int> f <void*> 0 <int> 0 <int>
+    [ 0 <char> alutLoadWAVFile ] 4 nkeep
+    { [ *int ] [ *void* ] [ *int ] [ *int ] } spread ;
diff --git a/extra/openal/backend/authors.txt b/extra/openal/backend/authors.txt
deleted file mode 100755 (executable)
index 44b06f9..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Chris Double
diff --git a/extra/openal/backend/backend.factor b/extra/openal/backend/backend.factor
deleted file mode 100644 (file)
index 41069dc..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-USING: namespaces system ;
-IN: openal.backend
-
-HOOK: load-wav-file os ( filename -- format data size frequency )
old mode 100644 (file)
new mode 100755 (executable)
index 4d979a8..7789ee6
@@ -1,6 +1,6 @@
 ! Copyright (C) 2007 Chris Double.\r
 ! See http://factorcode.org/license.txt for BSD license.\r
-USING: calendar kernel openal sequences threads ;\r
+USING: calendar kernel openal openal.alut sequences threads ;\r
 IN: openal.example\r
 \r
 : play-hello ( -- )\r
diff --git a/extra/openal/macosx/authors.txt b/extra/openal/macosx/authors.txt
deleted file mode 100755 (executable)
index 44b06f9..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Chris Double
diff --git a/extra/openal/macosx/macosx.factor b/extra/openal/macosx/macosx.factor
deleted file mode 100644 (file)
index f0a6b92..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-! Copyright (C) 2007 Chris Double.
-! See http://factorcode.org/license.txt for BSD license.
-USING: alien.c-types kernel alien alien.syntax shuffle
-openal openal.backend namespaces system generalizations ;
-IN: openal.macosx
-
-LIBRARY: alut
-
-FUNCTION: void alutLoadWAVFile ( ALbyte* fileName, ALenum* format, void** data, ALsizei* size, ALsizei* frequency ) ;
-
-M: macosx load-wav-file ( path -- format data size frequency )
-    0 <int> f <void*> 0 <int> 0 <int>
-    [ alutLoadWAVFile ] 4 nkeep
-    [ [ [ *int ] dip *void* ] dip *int ] dip *int ;
diff --git a/extra/openal/macosx/tags.txt b/extra/openal/macosx/tags.txt
deleted file mode 100644 (file)
index 6bf6830..0000000
+++ /dev/null
@@ -1 +0,0 @@
-unportable
old mode 100644 (file)
new mode 100755 (executable)
index d3c2b0a..bbe61f9
@@ -2,20 +2,12 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel accessors arrays alien system combinators
 alien.syntax namespaces alien.c-types sequences vocabs.loader
-shuffle openal.backend alien.libraries generalizations
+shuffle alien.libraries generalizations
 specialized-arrays alien.destructors ;
 FROM: alien.c-types => float short ;
 SPECIALIZED-ARRAY: uint
 IN: openal
 
-<< "alut" {
-        { [ os windows? ]  [ "alut.dll" ] }
-        { [ os macosx? ] [
-            "/System/Library/Frameworks/OpenAL.framework/OpenAL"
-        ] }
-        { [ os unix?  ]  [ "libalut.so" ] }
-    } cond "cdecl" add-library >>
-
 << "openal" {
         { [ os windows? ]  [ "OpenAL32.dll" ] }
         { [ os macosx? ] [
@@ -24,7 +16,7 @@ IN: openal
         { [ os unix?  ]  [ "libopenal.so" ] }
     } cond "cdecl" add-library >>
 
-<< os macosx? [ "openal" deploy-library "alut" deploy-library ] unless >>
+<< os macosx? [ "openal" deploy-library ] unless >>
 
 LIBRARY: openal
 
@@ -254,71 +246,6 @@ FUNCTION: void alcCaptureSamples ( ALCdevice* device, void* buf, ALCsizei samps
 DESTRUCTOR: alcCloseDevice*
 DESTRUCTOR: alcDestroyContext
 
-LIBRARY: alut
-
-CONSTANT: ALUT_API_MAJOR_VERSION 1
-CONSTANT: ALUT_API_MINOR_VERSION 1
-CONSTANT: ALUT_ERROR_NO_ERROR 0
-CONSTANT: ALUT_ERROR_OUT_OF_MEMORY HEX: 200
-CONSTANT: ALUT_ERROR_INVALID_ENUM HEX: 201
-CONSTANT: ALUT_ERROR_INVALID_VALUE HEX: 202
-CONSTANT: ALUT_ERROR_INVALID_OPERATION HEX: 203
-CONSTANT: ALUT_ERROR_NO_CURRENT_CONTEXT HEX: 204
-CONSTANT: ALUT_ERROR_AL_ERROR_ON_ENTRY HEX: 205
-CONSTANT: ALUT_ERROR_ALC_ERROR_ON_ENTRY HEX: 206
-CONSTANT: ALUT_ERROR_OPEN_DEVICE HEX: 207
-CONSTANT: ALUT_ERROR_CLOSE_DEVICE HEX: 208
-CONSTANT: ALUT_ERROR_CREATE_CONTEXT HEX: 209
-CONSTANT: ALUT_ERROR_MAKE_CONTEXT_CURRENT HEX: 20A
-CONSTANT: ALUT_ERROR_DESTRY_CONTEXT HEX: 20B
-CONSTANT: ALUT_ERROR_GEN_BUFFERS HEX: 20C
-CONSTANT: ALUT_ERROR_BUFFER_DATA HEX: 20D
-CONSTANT: ALUT_ERROR_IO_ERROR HEX: 20E
-CONSTANT: ALUT_ERROR_UNSUPPORTED_FILE_TYPE HEX: 20F
-CONSTANT: ALUT_ERROR_UNSUPPORTED_FILE_SUBTYPE HEX: 210
-CONSTANT: ALUT_ERROR_CORRUPT_OR_TRUNCATED_DATA HEX: 211
-CONSTANT: ALUT_WAVEFORM_SINE HEX: 100
-CONSTANT: ALUT_WAVEFORM_SQUARE HEX: 101
-CONSTANT: ALUT_WAVEFORM_SAWTOOTH HEX: 102
-CONSTANT: ALUT_WAVEFORM_WHITENOISE HEX: 103
-CONSTANT: ALUT_WAVEFORM_IMPULSE HEX: 104
-CONSTANT: ALUT_LOADER_BUFFER HEX: 300
-CONSTANT: ALUT_LOADER_MEMORY HEX: 301
-
-FUNCTION: ALboolean alutInit ( int* argcp, char** argv ) ;
-FUNCTION: ALboolean alutInitWithoutContext ( int* argcp, char** argv ) ;
-FUNCTION: ALboolean alutExit ( ) ;
-FUNCTION: ALenum alutGetError ( ) ;
-FUNCTION: char* alutGetErrorString ( ALenum error ) ;
-FUNCTION: ALuint alutCreateBufferFromFile ( char* fileName ) ;
-FUNCTION: ALuint alutCreateBufferFromFileImage ( void* data, ALsizei length ) ;
-FUNCTION: ALuint alutCreateBufferHelloWorld ( ) ;
-FUNCTION: ALuint alutCreateBufferWaveform ( ALenum waveshape, ALfloat frequency, ALfloat phase, ALfloat duration ) ;
-FUNCTION: void* alutLoadMemoryFromFile ( char* fileName, ALenum* format, ALsizei* size, ALfloat* frequency ) ;
-FUNCTION: void* alutLoadMemoryFromFileImage ( void* data, ALsizei length, ALenum* format, ALsizei* size, ALfloat* frequency ) ;
-FUNCTION: void* alutLoadMemoryHelloWorld ( ALenum* format, ALsizei* size, ALfloat* frequency ) ;
-FUNCTION: void* alutLoadMemoryWaveform ( ALenum waveshape, ALfloat frequency, ALfloat phase, ALfloat duration, ALenum* format, ALsizei* size, ALfloat* freq ) ;
-FUNCTION: char* alutGetMIMETypes ( ALenum loader ) ;
-FUNCTION: ALint alutGetMajorVersion ( ) ;
-FUNCTION: ALint alutGetMinorVersion ( ) ;
-FUNCTION: ALboolean alutSleep ( ALfloat duration ) ;
-
-FUNCTION: void alutUnloadWAV ( ALenum format, void* data, ALsizei size, ALsizei frequency ) ;
-
-SYMBOL: init
-
-: init-openal ( -- )
-    init get-global expired? [
-        f f alutInit 0 = [ "Could not initialize OpenAL" throw ] when
-        1337 <alien> init set-global
-    ] when ;
-
-: exit-openal ( -- )
-    init get-global expired? [
-        alutExit 0 = [ "Could not close OpenAL" throw ] when
-        f init set-global
-    ] unless ;
-
 : gen-sources ( size -- seq )
     dup <uint-array> [ alGenSources ] keep ;
 
@@ -327,17 +254,6 @@ SYMBOL: init
 
 : gen-buffer ( -- buffer ) 1 gen-buffers first ;
 
-: create-buffer-from-file ( filename -- buffer )
-    alutCreateBufferFromFile dup AL_NONE = [
-        "create-buffer-from-file failed" throw
-    ] when ;
-
-os macosx? "openal.macosx" "openal.other" ? require
-
-: create-buffer-from-wav ( filename -- buffer )
-    gen-buffer dup rot load-wav-file
-    [ alBufferData ] 4 nkeep alutUnloadWAV ;
-
 : queue-buffers ( source buffers -- )
     [ length ] [ >uint-array ] bi alSourceQueueBuffers ;
 
@@ -360,12 +276,5 @@ os macosx? "openal.macosx" "openal.other" ? require
 
 : source-stop ( source -- ) alSourceStop ;
 
-: check-error ( -- )
-    alGetError dup ALUT_ERROR_NO_ERROR = [
-        drop
-    ] [
-        alGetString throw
-    ] if ;
-
 : source-playing? ( source -- bool )
     AL_SOURCE_STATE get-source-param AL_PLAYING = ;
diff --git a/extra/openal/other/authors.txt b/extra/openal/other/authors.txt
deleted file mode 100755 (executable)
index 44b06f9..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Chris Double
diff --git a/extra/openal/other/other.factor b/extra/openal/other/other.factor
deleted file mode 100644 (file)
index ada8d6b..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-! Copyright (C) 2007 Chris Double.
-! See http://factorcode.org/license.txt for BSD license.
-USING: alien.c-types alien.syntax combinators generalizations
-kernel openal openal.backend ;
-IN: openal.other
-
-LIBRARY: alut
-
-FUNCTION: void alutLoadWAVFile ( ALbyte* fileName, ALenum* format, void** data, ALsizei* size, ALsizei* frequency, ALboolean* looping ) ;
-
-M: object load-wav-file ( filename -- format data size frequency )
-    0 <int> f <void*> 0 <int> 0 <int>
-    [ 0 <char> alutLoadWAVFile ] 4 nkeep
-    { [ *int ] [ *void* ] [ *int ] [ *int ] } spread ;
old mode 100644 (file)
new mode 100755 (executable)
index 17e277f..01bf621
@@ -18,6 +18,7 @@ USING:
     math
     math.order
     openal
+    openal.alut
     opengl.gl
     sequences
     ui
old mode 100644 (file)
new mode 100755 (executable)
index 747cfb9..e09d903
@@ -1,6 +1,6 @@
 ! Copyright (C) 2008 Alex Chapman
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors arrays kernel namespaces make openal sequences
+USING: accessors arrays kernel namespaces make openal openal.alut sequences
 synth synth.buffers ;
 IN: synth.example
 
old mode 100644 (file)
new mode 100755 (executable)
index def610d..90645e3
@@ -1,6 +1,6 @@
 ! Copyright (C) 2008 Alex Chapman
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors kernel locals math math.constants math.functions memoize openal synth.buffers sequences sequences.modified sequences.repeating ;
+USING: accessors kernel locals math math.constants math.functions memoize openal openal.alut synth.buffers sequences sequences.modified sequences.repeating ;
 IN: synth
 
 MEMO: single-sine-wave ( samples/wave -- seq )