From e9d228bb1f5285b992420ccd155568726fa75267 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= <gambas@users.sourceforge.net>
Date: Mon, 22 Jul 2013 07:15:23 +0000
Subject: [PATCH] [GB.OPENAL] * NEW: More work done. 'Al' class is finished,
 'Alc' is on the way...

git-svn-id: svn://localhost/gambas/trunk@5758 867c0c6c-44f3-4631-809d-bfa615b0a4ec
---
 gb.openal/src/Makefile.am |   5 +-
 gb.openal/src/c_al.c      | 211 +++++++------------
 gb.openal/src/c_alc.c     | 420 ++++++++++++++++++++++++++++++++++++++
 gb.openal/src/c_alc.h     |  50 +++++
 gb.openal/src/main.c      |   2 +
 gb.openal/src/main.h      |   1 +
 6 files changed, 549 insertions(+), 140 deletions(-)
 create mode 100644 gb.openal/src/c_alc.c
 create mode 100644 gb.openal/src/c_alc.h

diff --git a/gb.openal/src/Makefile.am b/gb.openal/src/Makefile.am
index f6cca1008..d5bfbca4f 100644
--- a/gb.openal/src/Makefile.am
+++ b/gb.openal/src/Makefile.am
@@ -1,7 +1,10 @@
 COMPONENT = gb.openal
 include $(top_srcdir)/component.am
+
 gblib_LTLIBRARIES = gb.openal.la
+
 gb_openal_la_LIBADD = @OPENAL_LIB@
 gb_openal_la_LDFLAGS = -module @LD_FLAGS@ @OPENAL_LDFLAGS@
 gb_openal_la_CPPFLAGS = @OPENAL_INC@
-gb_openal_la_SOURCES = main.c main.h c_al.h c_al.c
+
+gb_openal_la_SOURCES = main.c main.h c_al.h c_al.c c_alc.h c_alc.c
diff --git a/gb.openal/src/c_al.c b/gb.openal/src/c_al.c
index 67b0f2607..c54a35a20 100644
--- a/gb.openal/src/c_al.c
+++ b/gb.openal/src/c_al.c
@@ -511,97 +511,97 @@ GB_DESC ALDesc[] =
 {
 	GB_DECLARE_VIRTUAL("Al"),
 	
-	GB_METHOD("GetError", "i", AL_GetError, NULL),
+	GB_STATIC_METHOD("GetError", "i", AL_GetError, NULL),
 	
-	GB_METHOD("Enable", NULL, AL_Enable, "(Capability)i"),
-	GB_METHOD("Disable", NULL, AL_Disable, "(Capability)i"),
-	GB_METHOD("IsEnabled", "b", AL_IsEnabled, "(Capability)i"),
+	GB_STATIC_METHOD("Enable", NULL, AL_Enable, "(Capability)i"),
+	GB_STATIC_METHOD("Disable", NULL, AL_Disable, "(Capability)i"),
+	GB_STATIC_METHOD("IsEnabled", "b", AL_IsEnabled, "(Capability)i"),
 	
-	GB_METHOD("GetBoolean", "b", AL_GetBoolean, "(Param)i"),
-	GB_METHOD("GetInteger", "i", AL_GetInteger, "(Param)i"),
-	GB_METHOD("GetFloat", "g", AL_GetFloat, "(Param)i"),
-	GB_METHOD("GetDouble", "f", AL_GetDouble, "(Param)i"),
+	GB_STATIC_METHOD("GetBoolean", "b", AL_GetBoolean, "(Param)i"),
+	GB_STATIC_METHOD("GetInteger", "i", AL_GetInteger, "(Param)i"),
+	GB_STATIC_METHOD("GetFloat", "g", AL_GetFloat, "(Param)i"),
+	GB_STATIC_METHOD("GetDouble", "f", AL_GetDouble, "(Param)i"),
 
-	//GB_METHOD("GetBooleanv", "Boolean[]", AL_GetBooleanv, "(Param)i"),
-	//GB_METHOD("GetIntegerv", "Integer[]", AL_GetIntegerv, "(Param)i"),
-	//GB_METHOD("GetFloatv", "Single[]", AL_GetFloatv, "(Param)i"),
-	//GB_METHOD("GetDoublev", "Float[]", AL_GetDoublev, "(Param)i"),
+	//GB_STATIC_METHOD("GetBooleanv", "Boolean[]", AL_GetBooleanv, "(Param)i"),
+	//GB_STATIC_METHOD("GetIntegerv", "Integer[]", AL_GetIntegerv, "(Param)i"),
+	//GB_STATIC_METHOD("GetFloatv", "Single[]", AL_GetFloatv, "(Param)i"),
+	//GB_STATIC_METHOD("GetDoublev", "Float[]", AL_GetDoublev, "(Param)i"),
 
-	GB_METHOD("GetString", "s", AL_GetString, "(Param)i"),
+	GB_STATIC_METHOD("GetString", "s", AL_GetString, "(Param)i"),
 
-	GB_METHOD("IsExtensionPresent", "b", AL_IsExtensionPresent, "(Name)s"),
+	GB_STATIC_METHOD("IsExtensionPresent", "b", AL_IsExtensionPresent, "(Name)s"),
 
-	GB_METHOD("GetEnumValue", "i", AL_GetEnumValue, "(Name)s"),
+	GB_STATIC_METHOD("GetEnumValue", "i", AL_GetEnumValue, "(Name)s"),
 
-	GB_METHOD("Listenerf", NULL, AL_Listenerf, "(Param)i(Value)g"),
-	GB_METHOD("Listener3f", NULL, AL_Listener3f, "(Param)i(Value1)g(Value2)g(Value3)g"),
-	GB_METHOD("Listenerfv", NULL, AL_Listenerfv, "(Param)i(Values)Single[];"),
-	GB_METHOD("Listeneri", NULL, AL_Listeneri, "(Param)i(Value)i"),
-	GB_METHOD("Listener3i", NULL, AL_Listener3i, "(Param)i(Value1)i(Value2)i(Value3)i"),
-	GB_METHOD("Listeneriv", NULL, AL_Listeneriv, "(Param)i(Values)Integer[];"),
+	GB_STATIC_METHOD("Listenerf", NULL, AL_Listenerf, "(Param)i(Value)g"),
+	GB_STATIC_METHOD("Listener3f", NULL, AL_Listener3f, "(Param)i(Value1)g(Value2)g(Value3)g"),
+	GB_STATIC_METHOD("Listenerfv", NULL, AL_Listenerfv, "(Param)i(Values)Single[];"),
+	GB_STATIC_METHOD("Listeneri", NULL, AL_Listeneri, "(Param)i(Value)i"),
+	GB_STATIC_METHOD("Listener3i", NULL, AL_Listener3i, "(Param)i(Value1)i(Value2)i(Value3)i"),
+	GB_STATIC_METHOD("Listeneriv", NULL, AL_Listeneriv, "(Param)i(Values)Integer[];"),
 
-	GB_METHOD("GetListenerf", "g", AL_GetListenerf, "(Param)i"),
-	GB_METHOD("GetListener3f", "Single[]", AL_GetListenerfv, "(Param)i"),
-	GB_METHOD("GetListenerfv", "Single[]", AL_GetListenerfv, "(Param)i"),
-	GB_METHOD("GetListeneri", "i", AL_GetListenerf, "(Param)i"),
-	GB_METHOD("GetListener3i", "Integer[]", AL_GetListenerfv, "(Param)i"),
-	GB_METHOD("GetListeneriv", "Integer[]", AL_GetListenerfv, "(Param)i"),
+	GB_STATIC_METHOD("GetListenerf", "g", AL_GetListenerf, "(Param)i"),
+	GB_STATIC_METHOD("GetListener3f", "Single[]", AL_GetListenerfv, "(Param)i"),
+	GB_STATIC_METHOD("GetListenerfv", "Single[]", AL_GetListenerfv, "(Param)i"),
+	GB_STATIC_METHOD("GetListeneri", "i", AL_GetListenerf, "(Param)i"),
+	GB_STATIC_METHOD("GetListener3i", "Integer[]", AL_GetListenerfv, "(Param)i"),
+	GB_STATIC_METHOD("GetListeneriv", "Integer[]", AL_GetListenerfv, "(Param)i"),
 
-	GB_METHOD("GenSources", "Integer[]", AL_GenSources, "(Count)i"),
-	GB_METHOD("DeleteSources", NULL, AL_DeleteSources, "(Sources)Integer[];"),
-	GB_METHOD("IsSource", "b", AL_IsSource, "(Source)i"),
+	GB_STATIC_METHOD("GenSources", "Integer[]", AL_GenSources, "(Count)i"),
+	GB_STATIC_METHOD("DeleteSources", NULL, AL_DeleteSources, "(Sources)Integer[];"),
+	GB_STATIC_METHOD("IsSource", "b", AL_IsSource, "(Source)i"),
 
-	GB_METHOD("Sourcef", NULL, AL_Sourcef, "(Source)i(Param)i(Value)g"),
-	GB_METHOD("Source3f", NULL, AL_Source3f, "(Source)i(Param)i(Value1)g(Value2)g(Value3)g"),
-	GB_METHOD("Sourcefv", NULL, AL_Sourcefv, "(Source)i(Param)i(Values)Single[];"),
-	GB_METHOD("Sourcei", NULL, AL_Sourcei, "(Source)i(Param)i(Value)i"),
-	GB_METHOD("Source3i", NULL, AL_Source3i, "(Source)i(Param)i(Value1)i(Value2)i(Value3)i"),
-	GB_METHOD("Sourceiv", NULL, AL_Sourceiv, "(Source)i(Param)i(Values)Integer[];"),
+	GB_STATIC_METHOD("Sourcef", NULL, AL_Sourcef, "(Source)i(Param)i(Value)g"),
+	GB_STATIC_METHOD("Source3f", NULL, AL_Source3f, "(Source)i(Param)i(Value1)g(Value2)g(Value3)g"),
+	GB_STATIC_METHOD("Sourcefv", NULL, AL_Sourcefv, "(Source)i(Param)i(Values)Single[];"),
+	GB_STATIC_METHOD("Sourcei", NULL, AL_Sourcei, "(Source)i(Param)i(Value)i"),
+	GB_STATIC_METHOD("Source3i", NULL, AL_Source3i, "(Source)i(Param)i(Value1)i(Value2)i(Value3)i"),
+	GB_STATIC_METHOD("Sourceiv", NULL, AL_Sourceiv, "(Source)i(Param)i(Values)Integer[];"),
 
-	GB_METHOD("GetSourcef", "g", AL_GetSourcef, "(Source)i(Param)i"),
-	GB_METHOD("GetSource3f", "Single[]", AL_GetSourcefv, "(Source)i(Param)i"),
-	GB_METHOD("GetSourcefv", "Single[]", AL_GetSourcefv, "(Source)i(Param)i"),
-	GB_METHOD("GetSourcei", "i", AL_GetSourcef, "(Source)i(Param)i"),
-	GB_METHOD("GetSource3i", "Integer[]", AL_GetSourcefv, "(Source)i(Param)i"),
-	GB_METHOD("GetSourceiv", "Integer[]", AL_GetSourcefv, "(Source)i(Param)i"),
+	GB_STATIC_METHOD("GetSourcef", "g", AL_GetSourcef, "(Source)i(Param)i"),
+	GB_STATIC_METHOD("GetSource3f", "Single[]", AL_GetSourcefv, "(Source)i(Param)i"),
+	GB_STATIC_METHOD("GetSourcefv", "Single[]", AL_GetSourcefv, "(Source)i(Param)i"),
+	GB_STATIC_METHOD("GetSourcei", "i", AL_GetSourcef, "(Source)i(Param)i"),
+	GB_STATIC_METHOD("GetSource3i", "Integer[]", AL_GetSourcefv, "(Source)i(Param)i"),
+	GB_STATIC_METHOD("GetSourceiv", "Integer[]", AL_GetSourcefv, "(Source)i(Param)i"),
 
-	GB_METHOD("SourcePlay", NULL, AL_SourcePlay, "(Source)i"),
-	GB_METHOD("SourceStop", NULL, AL_SourceStop, "(Source)i"),
-	GB_METHOD("SourceRewind", NULL, AL_SourceRewind, "(Source)i"),
-	GB_METHOD("SourcePause", NULL, AL_SourcePause, "(Source)i"),
+	GB_STATIC_METHOD("SourcePlay", NULL, AL_SourcePlay, "(Source)i"),
+	GB_STATIC_METHOD("SourceStop", NULL, AL_SourceStop, "(Source)i"),
+	GB_STATIC_METHOD("SourceRewind", NULL, AL_SourceRewind, "(Source)i"),
+	GB_STATIC_METHOD("SourcePause", NULL, AL_SourcePause, "(Source)i"),
 
-	GB_METHOD("SourcePlayv", NULL, AL_SourcePlayv, "(Sources)Integer[];"),
-	GB_METHOD("SourceStopv", NULL, AL_SourceStopv, "(Sources)Integer[];"),
-	GB_METHOD("SourceRewindv", NULL, AL_SourceRewindv, "(Sources)Integer[];"),
-	GB_METHOD("SourcePausev", NULL, AL_SourcePausev, "(Sources)Integer[];"),
+	GB_STATIC_METHOD("SourcePlayv", NULL, AL_SourcePlayv, "(Sources)Integer[];"),
+	GB_STATIC_METHOD("SourceStopv", NULL, AL_SourceStopv, "(Sources)Integer[];"),
+	GB_STATIC_METHOD("SourceRewindv", NULL, AL_SourceRewindv, "(Sources)Integer[];"),
+	GB_STATIC_METHOD("SourcePausev", NULL, AL_SourcePausev, "(Sources)Integer[];"),
 
-	GB_METHOD("SourceQueueBuffers", NULL, AL_SourceQueueBuffers, "(Source)i(Buffers)Integer[];"),
-	GB_METHOD("SourceUnqueueBuffers", NULL, AL_SourceUnqueueBuffers, "(Source)i(Buffers)Integer[];"),
+	GB_STATIC_METHOD("SourceQueueBuffers", NULL, AL_SourceQueueBuffers, "(Source)i(Buffers)Integer[];"),
+	GB_STATIC_METHOD("SourceUnqueueBuffers", NULL, AL_SourceUnqueueBuffers, "(Source)i(Buffers)Integer[];"),
 
-	GB_METHOD("GenBuffers", "Integer[]", AL_GenBuffers, "(Count)i"),
-	GB_METHOD("DeleteBuffers", NULL, AL_DeleteBuffers, "(Buffers)Integer[];"),
-	GB_METHOD("IsBuffer", "b", AL_IsBuffer, "(Buffer)i"),
+	GB_STATIC_METHOD("GenBuffers", "Integer[]", AL_GenBuffers, "(Count)i"),
+	GB_STATIC_METHOD("DeleteBuffers", NULL, AL_DeleteBuffers, "(Buffers)Integer[];"),
+	GB_STATIC_METHOD("IsBuffer", "b", AL_IsBuffer, "(Buffer)i"),
 
-	GB_METHOD("BufferData", NULL, AL_BufferData, "(Buffer)i(Format)i(Data)v[(Size)i(Frequency)i]"),
+	GB_STATIC_METHOD("BufferData", NULL, AL_BufferData, "(Buffer)i(Format)i(Data)v[(Size)i(Frequency)i]"),
 
-	GB_METHOD("Bufferf", NULL, AL_Bufferf, "(Buffer)i(Param)i(Value)g"),
-	GB_METHOD("Buffer3f", NULL, AL_Buffer3f, "(Buffer)i(Param)i(Value1)g(Value2)g(Value3)g"),
-	GB_METHOD("Bufferfv", NULL, AL_Bufferfv, "(Buffer)i(Param)i(Values)Single[];"),
-	GB_METHOD("Bufferi", NULL, AL_Bufferi, "(Buffer)i(Param)i(Value)i"),
-	GB_METHOD("Buffer3i", NULL, AL_Buffer3i, "(Buffer)i(Param)i(Value1)i(Value2)i(Value3)i"),
-	GB_METHOD("Bufferiv", NULL, AL_Bufferiv, "(Buffer)i(Param)i(Values)Integer[];"),
+	GB_STATIC_METHOD("Bufferf", NULL, AL_Bufferf, "(Buffer)i(Param)i(Value)g"),
+	GB_STATIC_METHOD("Buffer3f", NULL, AL_Buffer3f, "(Buffer)i(Param)i(Value1)g(Value2)g(Value3)g"),
+	GB_STATIC_METHOD("Bufferfv", NULL, AL_Bufferfv, "(Buffer)i(Param)i(Values)Single[];"),
+	GB_STATIC_METHOD("Bufferi", NULL, AL_Bufferi, "(Buffer)i(Param)i(Value)i"),
+	GB_STATIC_METHOD("Buffer3i", NULL, AL_Buffer3i, "(Buffer)i(Param)i(Value1)i(Value2)i(Value3)i"),
+	GB_STATIC_METHOD("Bufferiv", NULL, AL_Bufferiv, "(Buffer)i(Param)i(Values)Integer[];"),
 
-	GB_METHOD("GetBufferf", "g", AL_GetBufferf, "(Buffer)i(Param)i"),
-	GB_METHOD("GetBuffer3f", "Single[]", AL_GetBufferfv, "(Buffer)i(Param)i"),
-	GB_METHOD("GetBufferfv", "Single[]", AL_GetBufferfv, "(Buffer)i(Param)i"),
-	GB_METHOD("GetBufferi", "i", AL_GetBufferf, "(Buffer)i(Param)i"),
-	GB_METHOD("GetBuffer3i", "Integer[]", AL_GetBufferfv, "(Buffer)i(Param)i"),
-	GB_METHOD("GetBufferiv", "Integer[]", AL_GetBufferfv, "(Buffer)i(Param)i"),
+	GB_STATIC_METHOD("GetBufferf", "g", AL_GetBufferf, "(Buffer)i(Param)i"),
+	GB_STATIC_METHOD("GetBuffer3f", "Single[]", AL_GetBufferfv, "(Buffer)i(Param)i"),
+	GB_STATIC_METHOD("GetBufferfv", "Single[]", AL_GetBufferfv, "(Buffer)i(Param)i"),
+	GB_STATIC_METHOD("GetBufferi", "i", AL_GetBufferf, "(Buffer)i(Param)i"),
+	GB_STATIC_METHOD("GetBuffer3i", "Integer[]", AL_GetBufferfv, "(Buffer)i(Param)i"),
+	GB_STATIC_METHOD("GetBufferiv", "Integer[]", AL_GetBufferfv, "(Buffer)i(Param)i"),
 
-	GB_METHOD("DopplerFactor", NULL, AL_DopplerFactor, "(DopplerFactor)f"),
-	GB_METHOD("DopplerVelocity", NULL, AL_DopplerVelocity, "(DopplerVelocity)f"),
-	GB_METHOD("SpeedOfSound", NULL, AL_SpeedOfSound, "(SpeedOfSound)f"),
-	GB_METHOD("DistanceModel", NULL, AL_DistanceModel, "(DistanceModel)i"),
+	GB_STATIC_METHOD("DopplerFactor", NULL, AL_DopplerFactor, "(DopplerFactor)f"),
+	GB_STATIC_METHOD("DopplerVelocity", NULL, AL_DopplerVelocity, "(DopplerVelocity)f"),
+	GB_STATIC_METHOD("SpeedOfSound", NULL, AL_SpeedOfSound, "(SpeedOfSound)f"),
+	GB_STATIC_METHOD("DistanceModel", NULL, AL_DistanceModel, "(DistanceModel)i"),
 
 	GB_CONSTANT("NONE", "i",                       AL_NONE),
 	GB_CONSTANT("FALSE", "i",                      AL_FALSE),
@@ -671,70 +671,3 @@ GB_DESC ALDesc[] =
 
 	GB_END_DECLARE
 };
-
-#ifdef TOTO
-// AL_API void AL_APIENTRY alGetBooleanv( ALenum param, ALboolean* data );
-// AL_API void AL_APIENTRY alGetIntegerv( ALenum param, ALint* data );
-// AL_API void AL_APIENTRY alGetFloatv( ALenum param, ALfloat* data );
-// AL_API void AL_APIENTRY alGetDoublev( ALenum param, ALdouble* data );
-
-// AL_API void* AL_APIENTRY alGetProcAddress( const ALchar* fname );
-// AL_API ALenum AL_APIENTRY alGetEnumValue( const ALchar* ename );
-// AL_API void AL_APIENTRY alListenerf( ALenum param, ALfloat value );
-// AL_API void AL_APIENTRY alListener3f( ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
-// AL_API void AL_APIENTRY alListenerfv( ALenum param, const ALfloat* values );
-// AL_API void AL_APIENTRY alListeneri( ALenum param, ALint value );
-// AL_API void AL_APIENTRY alListener3i( ALenum param, ALint value1, ALint value2, ALint value3 );
-// AL_API void AL_APIENTRY alListeneriv( ALenum param, const ALint* values );
-// AL_API void AL_APIENTRY alGetListenerf( ALenum param, ALfloat* value );
-// AL_API void AL_APIENTRY alGetListener3f( ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3 );
-// AL_API void AL_APIENTRY alGetListenerfv( ALenum param, ALfloat* values );
-// AL_API void AL_APIENTRY alGetListeneri( ALenum param, ALint* value );
-// AL_API void AL_APIENTRY alGetListener3i( ALenum param, ALint *value1, ALint *value2, ALint *value3 );
-// AL_API void AL_APIENTRY alGetListeneriv( ALenum param, ALint* values );
-// AL_API void AL_APIENTRY alGenSources( ALsizei n, ALuint* sources );
-// AL_API void AL_APIENTRY alDeleteSources( ALsizei n, const ALuint* sources );
-// AL_API ALboolean AL_APIENTRY alIsSource( ALuint sid );
-// AL_API void AL_APIENTRY alSourcef( ALuint sid, ALenum param, ALfloat value );
-// AL_API void AL_APIENTRY alSource3f( ALuint sid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
-// AL_API void AL_APIENTRY alSourcefv( ALuint sid, ALenum param, const ALfloat* values );
-// AL_API void AL_APIENTRY alSourcei( ALuint sid, ALenum param, ALint value );
-// AL_API void AL_APIENTRY alSource3i( ALuint sid, ALenum param, ALint value1, ALint value2, ALint value3 );
-// AL_API void AL_APIENTRY alSourceiv( ALuint sid, ALenum param, const ALint* values );
-// AL_API void AL_APIENTRY alGetSourcef( ALuint sid, ALenum param, ALfloat* value );
-// AL_API void AL_APIENTRY alGetSource3f( ALuint sid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3);
-// AL_API void AL_APIENTRY alGetSourcefv( ALuint sid, ALenum param, ALfloat* values );
-// AL_API void AL_APIENTRY alGetSourcei( ALuint sid,  ALenum param, ALint* value );
-// AL_API void AL_APIENTRY alGetSource3i( ALuint sid, ALenum param, ALint* value1, ALint* value2, ALint* value3);
-// AL_API void AL_APIENTRY alGetSourceiv( ALuint sid,  ALenum param, ALint* values );
-// AL_API void AL_APIENTRY alSourcePlayv( ALsizei ns, const ALuint *sids );
-// AL_API void AL_APIENTRY alSourceStopv( ALsizei ns, const ALuint *sids );
-// AL_API void AL_APIENTRY alSourceRewindv( ALsizei ns, const ALuint *sids );
-// AL_API void AL_APIENTRY alSourcePausev( ALsizei ns, const ALuint *sids );
-// AL_API void AL_APIENTRY alSourcePlay( ALuint sid );
-// AL_API void AL_APIENTRY alSourceStop( ALuint sid );
-// AL_API void AL_APIENTRY alSourceRewind( ALuint sid );
-// AL_API void AL_APIENTRY alSourcePause( ALuint sid );
-// AL_API void AL_APIENTRY alSourceQueueBuffers( ALuint sid, ALsizei numEntries, const ALuint *bids );
-// AL_API void AL_APIENTRY alSourceUnqueueBuffers( ALuint sid, ALsizei numEntries, ALuint *bids );
-// AL_API void AL_APIENTRY alGenBuffers( ALsizei n, ALuint* buffers );
-// AL_API void AL_APIENTRY alDeleteBuffers( ALsizei n, const ALuint* buffers );
-// AL_API ALboolean AL_APIENTRY alIsBuffer( ALuint bid );
-// AL_API void AL_APIENTRY alBufferData( ALuint bid, ALenum format, const ALvoid* data, ALsizei size, ALsizei freq );
-// AL_API void AL_APIENTRY alBufferf( ALuint bid, ALenum param, ALfloat value );
-// AL_API void AL_APIENTRY alBuffer3f( ALuint bid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
-// AL_API void AL_APIENTRY alBufferfv( ALuint bid, ALenum param, const ALfloat* values );
-// AL_API void AL_APIENTRY alBufferi( ALuint bid, ALenum param, ALint value );
-// AL_API void AL_APIENTRY alBuffer3i( ALuint bid, ALenum param, ALint value1, ALint value2, ALint value3 );
-// AL_API void AL_APIENTRY alBufferiv( ALuint bid, ALenum param, const ALint* values );
-// AL_API void AL_APIENTRY alGetBufferf( ALuint bid, ALenum param, ALfloat* value );
-// AL_API void AL_APIENTRY alGetBuffer3f( ALuint bid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3);
-// AL_API void AL_APIENTRY alGetBufferfv( ALuint bid, ALenum param, ALfloat* values );
-// AL_API void AL_APIENTRY alGetBufferi( ALuint bid, ALenum param, ALint* value );
-// AL_API void AL_APIENTRY alGetBuffer3i( ALuint bid, ALenum param, ALint* value1, ALint* value2, ALint* value3);
-// AL_API void AL_APIENTRY alGetBufferiv( ALuint bid, ALenum param, ALint* values );
-AL_API void AL_APIENTRY alDopplerFactor( ALfloat value );
-AL_API void AL_APIENTRY alDopplerVelocity( ALfloat value );
-AL_API void AL_APIENTRY alSpeedOfSound( ALfloat value );
-AL_API void AL_APIENTRY alDistanceModel( ALenum distanceModel );
-#endif
diff --git a/gb.openal/src/c_alc.c b/gb.openal/src/c_alc.c
new file mode 100644
index 000000000..d6156140b
--- /dev/null
+++ b/gb.openal/src/c_alc.c
@@ -0,0 +1,420 @@
+/***************************************************************************
+
+  c_alc.c
+
+  (c) 2013 Benoît Minisini <gambas@users.sourceforge.net>
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2, or (at your option)
+  any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+  MA 02110-1301, USA.
+
+***************************************************************************/
+
+#define __C_ALC_C
+
+#include "c_alc.h"
+
+//---------------------------------------------------------------------------
+
+#define THIS ((CALCCONTEXT *)_object)
+
+static CALCCONTEXT *_current_context = NULL;
+
+static int check_context(void *_object)
+{
+	return THIS->context == NULL;
+}
+
+static void init_context(CALCCONTEXT *_object, CALCDEVICE *device, GB_ARRAY array)
+{
+	ALCint *attrs = NULL;
+	int count;
+
+	if (GB.CheckObject(device))
+		return;
+
+	if (array)
+	{
+		count = GB.Array.Count(array);
+		if (count)
+		{
+			attrs = alloca(sizeof(ALCint) * (count + 1));
+			memcpy(attrs, GB.Array.Get(array, 0), count * sizeof(ALCint));
+			attrs[count] = 0;
+		}
+	}
+
+	THIS->context = alcCreateContext(device->device, attrs);
+	THIS->device = device;
+	GB.Ref(device);
+}
+
+static void set_current_context(CALCCONTEXT *_object)
+{
+	if (_current_context == THIS)
+		return;
+
+	GB.Unref(POINTER(&_current_context));
+
+	_current_context = THIS;
+
+	if (THIS)
+		GB.Ref(THIS);
+}
+
+static void destroy_context(CALCCONTEXT *_object)
+{
+	if (_current_context == THIS)
+		set_current_context(NULL);
+
+	if (!THIS->context)
+		return;
+
+	alcDestroyContext(THIS->context);
+
+	THIS->context = NULL;
+
+	GB.Unref(POINTER(&THIS->device));
+}
+
+BEGIN_METHOD_VOID(AlcContext_exit)
+
+	GB.Unref(POINTER(&_current_context));
+
+END_METHOD
+
+BEGIN_METHOD(AlcContext_new, GB_OBJECT device; GB_OBJECT attrs)
+
+	init_context(THIS, VARG(device), VARGOPT(attrs, NULL));
+
+END_METHOD
+
+BEGIN_METHOD_VOID(AlcContext_free)
+
+	destroy_context(THIS);
+
+END_METHOD
+
+BEGIN_METHOD_VOID(AlcContext_MakeCurrent)
+
+	ALCboolean err = alcMakeContextCurrent(THIS->context);
+	if (err == ALC_FALSE)
+		set_current_context(THIS);
+	GB.ReturnBoolean(err);
+
+END_METHOD
+
+//---------------------------------------------------------------------------
+
+#undef THIS
+#define THIS ((CALCDEVICE *)_object)
+
+static int check_device(void *_object)
+{
+	return THIS->device == NULL;
+}
+
+static CALCDEVICE *create_device(const char *name)
+{
+	ALCdevice *device;
+	CALCDEVICE *_object;
+
+	device = alcOpenDevice(name);
+	if (!device)
+		return NULL;
+
+	_object = GB.New(GB.FindClass("AlcDevice"), NULL, NULL);
+	THIS->device = alcOpenDevice(name);
+	return THIS;
+}
+
+static bool close_device(CALCDEVICE *_object)
+{
+	bool err = FALSE;
+
+	if (THIS->device)
+	{
+		err = alcCloseDevice(THIS->device);
+		THIS->device = NULL;
+	}
+
+	return err;
+}
+
+BEGIN_METHOD_VOID(AlcDevice_free)
+
+	close_device(THIS);
+
+END_METHOD
+
+//---------------------------------------------------------------------------
+
+BEGIN_METHOD(ALC_CreateContext, GB_OBJECT device; GB_OBJECT attrs)
+
+	CALCCONTEXT *context;
+
+	context = GB.Create(GB.FindClass("AlcContext"), NULL, NULL);
+	init_context(context, VARG(device), VARGOPT(attrs, NULL));
+	if (context->context)
+		GB.ReturnObject(context);
+	else
+	{
+		GB.Unref(POINTER(&context));
+		GB.ReturnNull();
+	}
+
+END_METHOD
+
+#define GET_CONTEXT() \
+	CALCCONTEXT *context = VARG(context); \
+	if (GB.CheckObject(context)) \
+		return; \
+
+BEGIN_METHOD(ALC_MakeContextCurrent, GB_OBJECT context)
+
+	CALCCONTEXT *context = VARG(context);
+	ALCboolean err = alcMakeContextCurrent(context ? context->context : NULL);
+	if (err == ALC_FALSE)
+		set_current_context(context);
+	GB.ReturnBoolean(err);
+
+END_METHOD
+
+BEGIN_METHOD(ALC_ProcessContext, GB_OBJECT context)
+
+	GET_CONTEXT();
+	alcProcessContext(context->context);
+
+END_METHOD
+
+BEGIN_METHOD(ALC_SuspendContext, GB_OBJECT context)
+
+	GET_CONTEXT();
+	alcSuspendContext(context->context);
+
+END_METHOD
+
+BEGIN_METHOD(ALC_DestroyContext, GB_OBJECT context)
+
+	GET_CONTEXT();
+	destroy_context(context);
+
+END_METHOD
+
+BEGIN_METHOD_VOID(ALC_GetCurrentContext)
+
+	GB.ReturnObject(_current_context);
+
+END_METHOD
+
+BEGIN_METHOD(ALC_GetContextsDevice, GB_OBJECT context)
+
+	GET_CONTEXT();
+	GB.ReturnObject(THIS->device);
+
+END_METHOD
+
+BEGIN_METHOD(ALC_OpenDevice, GB_STRING name)
+
+	GB.ReturnObject(create_device(GB.ToZeroString(ARG(name))));
+
+END_METHOD
+
+#define GET_DEVICE() \
+	CALCDEVICE *device = VARG(device); \
+	if (GB.CheckObject(device)) \
+		return; \
+
+BEGIN_METHOD(ALC_CloseDevice, GB_OBJECT device)
+
+	GET_DEVICE();
+	GB.ReturnBoolean(close_device(device));
+
+END_METHOD
+
+BEGIN_METHOD(ALC_GetError, GB_OBJECT device)
+
+	GET_DEVICE();
+	GB.ReturnInteger(alcGetError(device->device));
+
+END_METHOD
+
+BEGIN_METHOD(ALC_IsExtensionPresent, GB_OBJECT device; GB_STRING ext)
+
+	GET_DEVICE();
+	GB.ReturnBoolean(alcIsExtensionPresent(device->device, GB.ToZeroString(ARG(ext))));
+
+END_METHOD
+
+BEGIN_METHOD(ALC_GetString, GB_OBJECT device; GB_INTEGER param)
+
+	CALCDEVICE *device = VARG(device);
+	ALCenum param = VARG(param);
+
+	if (device && GB.CheckObject(device))
+		return;
+
+	if (!device && (param == ALC_DEVICE_SPECIFIER || param == ALC_CAPTURE_DEVICE_SPECIFIER))
+	{
+		GB.Error("This query actually returns a string array. Use ALC_GetStringv instead");
+		return;
+	}
+
+	GB.ReturnNewZeroString(alcGetString(device ? device->device : NULL, param));
+
+END_METHOD
+
+BEGIN_METHOD(ALC_GetStringv, GB_OBJECT device; GB_INTEGER param)
+
+	CALCDEVICE *device = VARG(device);
+	ALCenum param = VARG(param);
+	const char *result, *p;
+	int len;
+	GB_ARRAY array;
+
+	if (!(!device && (param == ALC_DEVICE_SPECIFIER || param == ALC_CAPTURE_DEVICE_SPECIFIER)))
+	{
+		GB.ReturnNull();
+		return;
+	}
+
+	result = alcGetString(NULL, param);
+	if (!result)
+	{
+		GB.ReturnNull();
+		return;
+	}
+
+	GB.Array.New(&array, GB_T_STRING, 0);
+
+	for(;;)
+	{
+		p = index(result, 0);
+		if (!p)
+			break;
+		len = p - result;
+		if (len <= 0)
+			break;
+
+		*((char **)GB.Array.Add(array)) = GB.NewString(result, len);
+		result = p + 1;
+	}
+
+	GB.ReturnObject(array);
+
+END_METHOD
+
+//---------------------------------------------------------------------------
+
+GB_DESC AlcDeviceDesc[] =
+{
+	GB_DECLARE("AlcDevice", sizeof(CALCDEVICE)),
+	GB_NOT_CREATABLE(),
+	GB_HOOK_CHECK(check_device),
+
+	GB_METHOD("_free", NULL, AlcDevice_free, NULL),
+
+	GB_END_DECLARE
+};
+
+GB_DESC AlcContextDesc[] =
+{
+	GB_DECLARE("AlcContext", sizeof(CALCCONTEXT)),
+	GB_HOOK_CHECK(check_context),
+
+	GB_STATIC_METHOD("_exit", NULL, AlcContext_exit, NULL),
+
+	GB_METHOD("_new", NULL, AlcContext_new, "(Device)AlcDevice;[(Attributes)Integer[];]"),
+	GB_METHOD("MakeCurrent", "b", AlcContext_MakeCurrent, NULL),
+
+	GB_END_DECLARE
+};
+
+GB_DESC ALCDesc[] =
+{
+	GB_DECLARE_VIRTUAL("Alc"),
+	
+	GB_CONSTANT("FALSE", "i",                             ALC_FALSE),
+	GB_CONSTANT("TRUE", "i",                              ALC_TRUE),
+	GB_CONSTANT("FREQUENCY", "i",                         ALC_FREQUENCY),
+	GB_CONSTANT("REFRESH", "i",                           ALC_REFRESH),
+	GB_CONSTANT("SYNC", "i",                              ALC_SYNC),
+	GB_CONSTANT("MONO_SOURCES", "i",                      ALC_MONO_SOURCES),
+	GB_CONSTANT("STEREO_SOURCES", "i",                    ALC_STEREO_SOURCES),
+	GB_CONSTANT("NO_ERROR", "i",                          ALC_NO_ERROR),
+	GB_CONSTANT("INVALID_DEVICE", "i",                    ALC_INVALID_DEVICE),
+	GB_CONSTANT("INVALID_CONTEXT", "i",                   ALC_INVALID_CONTEXT),
+	GB_CONSTANT("INVALID_ENUM", "i",                      ALC_INVALID_ENUM),
+	GB_CONSTANT("INVALID_VALUE", "i",                     ALC_INVALID_VALUE),
+	GB_CONSTANT("OUT_OF_MEMORY", "i",                     ALC_OUT_OF_MEMORY),
+	GB_CONSTANT("DEFAULT_DEVICE_SPECIFIER", "i",          ALC_DEFAULT_DEVICE_SPECIFIER),
+	GB_CONSTANT("DEVICE_SPECIFIER", "i",                  ALC_DEVICE_SPECIFIER),
+	GB_CONSTANT("EXTENSIONS", "i",                        ALC_EXTENSIONS),
+	GB_CONSTANT("MAJOR_VERSION", "i",                     ALC_MAJOR_VERSION),
+	GB_CONSTANT("MINOR_VERSION", "i",                     ALC_MINOR_VERSION),
+	GB_CONSTANT("ATTRIBUTES_SIZE", "i",                   ALC_ATTRIBUTES_SIZE),
+	GB_CONSTANT("ALL_ATTRIBUTES", "i",                    ALC_ALL_ATTRIBUTES),
+	GB_CONSTANT("EXT_CAPTURE", "i",                       ALC_EXT_CAPTURE),
+	GB_CONSTANT("CAPTURE_DEVICE_SPECIFIER", "i",          ALC_CAPTURE_DEVICE_SPECIFIER),
+	GB_CONSTANT("CAPTURE_DEFAULT_DEVICE_SPECIFIER", "i",  ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER),
+	GB_CONSTANT("CAPTURE_SAMPLES", "i",                   ALC_CAPTURE_SAMPLES),
+	GB_CONSTANT("ENUMERATE_ALL_EXT", "i",                 ALC_ENUMERATE_ALL_EXT),
+	GB_CONSTANT("DEFAULT_ALL_DEVICES_SPECIFIER", "i",     ALC_DEFAULT_ALL_DEVICES_SPECIFIER),
+	GB_CONSTANT("ALL_DEVICES_SPECIFIER", "i",             ALC_ALL_DEVICES_SPECIFIER),
+
+	GB_STATIC_METHOD("CreateContext", "AlcContext", ALC_CreateContext, "(Device)AlcDevice;[(Attributes)Integer[];]"),
+	GB_STATIC_METHOD("MakeContextCurrent", "b", ALC_MakeContextCurrent, "(Context)AlcContext;"),
+	GB_STATIC_METHOD("ProcessContext", NULL, ALC_ProcessContext, "(Context)AlcContext;"),
+	GB_STATIC_METHOD("SuspendContext", NULL, ALC_SuspendContext, "(Context)AlcContext;"),
+	GB_STATIC_METHOD("DestroyContext", NULL, ALC_DestroyContext, "(Context)AlcContext;"),
+	GB_STATIC_METHOD("GetCurrentContext", "AlcContext", ALC_GetCurrentContext, NULL),
+	GB_STATIC_METHOD("GetContextsDevice", "AlcDevice", ALC_GetContextsDevice, "(Context)AlcContext;"),
+	GB_STATIC_METHOD("OpenDevice", "AlcDevice", ALC_OpenDevice, "(Name)s"),
+	GB_STATIC_METHOD("CloseDevice", "b", ALC_CloseDevice, "(Device)AlcDevice;"),
+	GB_STATIC_METHOD("GetError", "i", ALC_GetError, "(Device)AlcDevice;"),
+	GB_STATIC_METHOD("IsExtensionPresent", "b", ALC_IsExtensionPresent, "(Device)AlcDevice;(ExtensionName)s"),
+	GB_STATIC_METHOD("GetString", "s", ALC_GetString, "(Device)AlcDevice;(Param)i"),
+	GB_STATIC_METHOD("GetStringv", "String[]", ALC_GetStringv, "(Device)AlcDevice;(Param)i"),
+	//GB_STATIC_METHOD("GetIntegerv", "Integer[]", ALC_GetIntegerv, "(Device)AlcDevice;(Param)i;(Size)i"),
+	//GB_STATIC_METHOD("CaptureOpenDevice", "AlcDevice", ALC_CaptureOpenDevice, "(Name)s(Frequency)i(Format)i(BufferSize)i"),
+	//GB_STATIC_METHOD("CaptureCloseDevice", "b", ALC_CaptureCloseDevice, "(Device)AlcDevice;"),
+	//GB_STATIC_METHOD("CaptureStart", NULL, ALC_CaptureStart, "(Device)AlcDevice;"),
+	//GB_STATIC_METHOD("CaptureStop", NULL, ALC_CaptureStop, "(Device)AlcDevice;"),
+	//GB_STATIC_METHOD("CaptureSamples", "v", ALC_CaptureSamples, "(Device)AlcDevice;(Samples)i"),
+
+	GB_END_DECLARE
+};
+
+#ifdef TOTO
+// ALC_API ALCcontext *    ALC_APIENTRY alcCreateContext( ALCdevice *device, const ALCint* attrlist );
+// ALC_API ALCboolean      ALC_APIENTRY alcMakeContextCurrent( ALCcontext *context );
+// ALC_API void            ALC_APIENTRY alcProcessContext( ALCcontext *context );
+// ALC_API void            ALC_APIENTRY alcSuspendContext( ALCcontext *context );
+// ALC_API void            ALC_APIENTRY alcDestroyContext( ALCcontext *context );
+// ALC_API ALCcontext *    ALC_APIENTRY alcGetCurrentContext( void );
+// ALC_API ALCdevice*      ALC_APIENTRY alcGetContextsDevice( ALCcontext *context );
+// ALC_API ALCdevice *     ALC_APIENTRY alcOpenDevice( const ALCchar *devicename );
+// ALC_API ALCboolean      ALC_APIENTRY alcCloseDevice( ALCdevice *device );
+// ALC_API ALCenum         ALC_APIENTRY alcGetError( ALCdevice *device );
+// ALC_API ALCboolean      ALC_APIENTRY alcIsExtensionPresent( ALCdevice *device, const ALCchar *extname );
+// ALC_API void  *         ALC_APIENTRY alcGetProcAddress( ALCdevice *device, const ALCchar *funcname );
+// ALC_API ALCenum         ALC_APIENTRY alcGetEnumValue( ALCdevice *device, const ALCchar *enumname );
+// ALC_API const ALCchar * ALC_APIENTRY alcGetString( ALCdevice *device, ALCenum param );
+ALC_API void            ALC_APIENTRY alcGetIntegerv( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *data );
+ALC_API ALCdevice*      ALC_APIENTRY alcCaptureOpenDevice( const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize );
+ALC_API ALCboolean      ALC_APIENTRY alcCaptureCloseDevice( ALCdevice *device );
+ALC_API void            ALC_APIENTRY alcCaptureStart( ALCdevice *device );
+ALC_API void            ALC_APIENTRY alcCaptureStop( ALCdevice *device );
+ALC_API void            ALC_APIENTRY alcCaptureSamples( ALCdevice *device, ALCvoid *buffer, ALCsizei samples );
+#endif
diff --git a/gb.openal/src/c_alc.h b/gb.openal/src/c_alc.h
new file mode 100644
index 000000000..b8220d2a4
--- /dev/null
+++ b/gb.openal/src/c_alc.h
@@ -0,0 +1,50 @@
+/***************************************************************************
+
+  c_alc.h
+
+  (c) 2013 Benoît Minisini <gambas@users.sourceforge.net>
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2, or (at your option)
+  any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+  MA 02110-1301, USA.
+
+***************************************************************************/
+
+#ifndef __C_ALC_H
+#define __C_ALC_H
+
+#include "main.h"
+
+#ifndef __C_AL_C
+extern GB_DESC ALCDesc[];
+extern GB_DESC AlcContextDesc[];
+extern GB_DESC AlcDeviceDesc[];
+#endif
+
+typedef
+	struct {
+		GB_BASE ob;
+		ALCdevice *device;
+	}
+	CALCDEVICE;
+
+typedef
+	struct {
+		GB_BASE ob;
+		ALCcontext *context;
+		CALCDEVICE *device;
+	}
+	CALCCONTEXT;
+
+#endif
diff --git a/gb.openal/src/main.c b/gb.openal/src/main.c
index 41628a74a..7a62903bb 100644
--- a/gb.openal/src/main.c
+++ b/gb.openal/src/main.c
@@ -26,6 +26,7 @@
 #define __MAIN_C
 
 #include "c_al.h"
+#include "c_alc.h"
 
 #include "main.h"
 
@@ -35,6 +36,7 @@ GB_INTERFACE GB EXPORT;
 GB_DESC *GB_CLASSES[] EXPORT =
 {
 	ALDesc,
+	ALCDesc,
 	NULL
 };
 
diff --git a/gb.openal/src/main.h b/gb.openal/src/main.h
index 44f1aadca..22f78a709 100644
--- a/gb.openal/src/main.h
+++ b/gb.openal/src/main.h
@@ -26,6 +26,7 @@
 #ifndef __MAIN_H
 #define __MAIN_H
 
+#include "gb_common.h"
 #include "gambas.h"
 
 #include <AL/al.h>