diff --git a/make/build.xml b/make/build.xml
index de590c2..6e96af8 100755
--- a/make/build.xml
+++ b/make/build.xml
@@ -172,6 +172,8 @@
+
+
@@ -271,6 +273,25 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/make/joal-alext-constants.cfg b/make/joal-alext-constants.cfg
new file mode 100644
index 0000000..e645bb8
--- /dev/null
+++ b/make/joal-alext-constants.cfg
@@ -0,0 +1,9 @@
+# This .cfg file is used to generate the ALCConstants interface.
+Include joal-common.cfg
+
+Style InterfaceOnly
+JavaClass ALExtConstants
+
+# Factor out the OpenAL constants into their own interface
+#IgnoreNot ^ALC_.+
+IgnoreNot ^AL.+
diff --git a/make/joal-alext.cfg b/make/joal-alext.cfg
new file mode 100644
index 0000000..11ee9e1
--- /dev/null
+++ b/make/joal-alext.cfg
@@ -0,0 +1,50 @@
+# This .cfg file is used to generate the JOAL interface.
+Include joal-common.cfg
+
+Style InterfaceAndImpl
+JavaClass ALExt
+ImplPackage jogamp.openal
+ImplJavaClass ALExtAbstractImpl
+AccessControl ALExtAbstractImpl PUBLIC_ABSTRACT
+Extends ALExt ALExtConstants
+
+EmitProcAddressTable true
+ProcAddressTableClassName ALExtProcAddressTable
+GetProcAddressTableExpr alExtProcAddressTable
+ProcAddressNameExpr LP $UPPERCASE({0})
+
+Import java.io.UnsupportedEncodingException
+Import java.util.*
+Import com.jogamp.openal.*
+Import jogamp.openal.*
+
+# Factor out the OpenAL constants into their own interface
+Ignore ^AL_.+
+Ignore ^ALC_.+
+
+# This routine is ignored. The analogous routine alGetProcAddress is
+# broken at least up through OpenAL 1.1 so there is no point in trying
+# to use this routine to look up the ALC function pointers.
+#Ignore alcGetProcAddress
+
+# Note that we don't declare this as "ReturnsString" because we're
+# going to wrap it in another method
+#IncludeAs CustomJavaCode ALC joal-alc-CustomJavaCode.java
+IncludeAs CustomJavaCode ALExtAbstractImpl joal-alextabstract-CustomJavaCode.java
+
+# These routines use strings
+#ArgumentIsString alcIsExtensionPresent 1
+#ArgumentIsString alcOpenDevice 0
+
+# Mappings for data types
+Opaque boolean ALCboolean
+
+# Provide #includes to native code
+CustomCCode #include "alext.h"
+
+# Indicate that the direct buffers for ALCcontext, etc. are "opaque",
+# i.e., the user shouldn't be poking around in them
+ReturnValueCapacity alcLoopbackOpenDeviceSOFT 0
+
+IncludeAs CustomCCode joal-common-CustomCCode.c
+#IncludeAs CustomCCode joal-alc-impl-CustomCCode.c
diff --git a/make/joal-alextabstract-CustomJavaCode.java b/make/joal-alextabstract-CustomJavaCode.java
new file mode 100644
index 0000000..e73dc60
--- /dev/null
+++ b/make/joal-alextabstract-CustomJavaCode.java
@@ -0,0 +1,12 @@
+private static final ALExtProcAddressTable alExtProcAddressTable;
+
+static {
+ alExtProcAddressTable = new ALExtProcAddressTable();
+ if(null==alExtProcAddressTable) {
+ throw new RuntimeException("Couldn't instantiate ALExtProcAddressTable");
+ }
+ alExtProcAddressTable.reset(ALImpl.alDynamicLookupHelper);
+}
+
+public static ALExtProcAddressTable getALExtProcAddressTable() { return alExtProcAddressTable; }
+
diff --git a/make/stub_includes/openal/alext.h b/make/stub_includes/openal/alext.h
index 4549d3d..be5e5cd 100644
--- a/make/stub_includes/openal/alext.h
+++ b/make/stub_includes/openal/alext.h
@@ -25,6 +25,97 @@
extern "C" {
#endif
+#define AL_API
+#define ALC_API
+#define AL_APIENTRY
+#define ALC_APIENTRY
+#define AL_ALEXT_PROTOTYPES 1
+
+typedef struct ALCdevice_struct ALCdevice;
+typedef struct ALCcontext_struct ALCcontext;
+
+/** 8-bit boolean */
+typedef char ALboolean;
+
+/** character */
+typedef char ALchar;
+
+/** signed 8-bit 2's complement integer */
+typedef char ALbyte;
+
+/** unsigned 8-bit integer */
+typedef unsigned char ALubyte;
+
+/** signed 16-bit 2's complement integer */
+typedef short ALshort;
+
+/** unsigned 16-bit integer */
+typedef unsigned short ALushort;
+
+/** signed 32-bit 2's complement integer */
+typedef int ALint;
+
+/** unsigned 32-bit integer */
+typedef unsigned int ALuint;
+
+/** non-negative 32-bit binary integer size */
+typedef int ALsizei;
+
+/** enumerated 32-bit value */
+typedef int ALenum;
+
+/** 32-bit IEEE754 floating-point */
+typedef float ALfloat;
+
+/** 64-bit IEEE754 floating-point */
+typedef double ALdouble;
+
+/** void type (for opaque pointers only) */
+typedef void ALvoid;
+
+/** Function pointer type */
+typedef void* ALproc;
+
+/** 8-bit boolean */
+typedef char ALCboolean;
+
+/** character */
+typedef char ALCchar;
+
+/** signed 8-bit 2's complement integer */
+typedef char ALCbyte;
+
+/** unsigned 8-bit integer */
+typedef unsigned char ALCubyte;
+
+/** signed 16-bit 2's complement integer */
+typedef short ALCshort;
+
+/** unsigned 16-bit integer */
+typedef unsigned short ALCushort;
+
+/** signed 32-bit 2's complement integer */
+typedef int ALCint;
+
+/** unsigned 32-bit integer */
+typedef unsigned int ALCuint;
+
+/** non-negative 32-bit binary integer size */
+typedef int ALCsizei;
+
+/** enumerated 32-bit value */
+typedef int ALCenum;
+
+/** 32-bit IEEE754 floating-point */
+typedef float ALCfloat;
+
+/** 64-bit IEEE754 floating-point */
+typedef double ALCdouble;
+
+/** void type (for opaque pointers only) */
+typedef void ALCvoid;
+
+
#ifndef AL_LOKI_IMA_ADPCM_format
#define AL_LOKI_IMA_ADPCM_format 1
#define AL_FORMAT_IMA_ADPCM_MONO16_EXT 0x10000
@@ -96,9 +187,166 @@ extern "C" {
#define AL_BYTE_RW_OFFSETS_EXT 0x1031
#define AL_SAMPLE_RW_OFFSETS_EXT 0x1032
#define AL_SEC_RW_OFFSETS_EXT 0x1033
-typedef ALvoid (AL_APIENTRY*PFNALBUFFERSUBDATAEXTPROC)(ALuint,ALenum,const ALvoid*,ALsizei,ALsizei);
+
+// Added/changed for joal
+ALvoid alBufferSubDataEXT(ALuint,ALenum,const ALvoid*,ALsizei,ALsizei);
+
+typedef ALvoid (AL_APIENTRY *LPALBUFFERSUBDATAEXT)(ALuint,ALenum,const ALvoid*,ALsizei,ALsizei);
#endif
+#ifndef AL_EXT_STATIC_BUFFER
+#define AL_EXT_STATIC_BUFFER 1
+typedef ALvoid (AL_APIENTRY*LPALBUFFERDATASTATIC)(const ALint,ALenum,ALvoid*,ALsizei,ALsizei);
+#ifdef AL_ALEXT_PROTOTYPES
+AL_API ALvoid AL_APIENTRY alBufferDataStatic(const ALint buffer, ALenum format, ALvoid *data, ALsizei len, ALsizei freq);
+#endif
+#endif
+
+#ifndef ALC_EXT_disconnect
+#define ALC_EXT_disconnect 1
+#define ALC_CONNECTED 0x313
+#endif
+
+#ifndef ALC_EXT_thread_local_context
+#define ALC_EXT_thread_local_context 1
+typedef ALCboolean (ALC_APIENTRY*LPALCSETTHREADCONTEXT)(ALCcontext *context);
+typedef ALCcontext* (ALC_APIENTRY*LPALCGETTHREADCONTEXT)(void);
+#ifdef AL_ALEXT_PROTOTYPES
+ALC_API ALCboolean ALC_APIENTRY alcSetThreadContext(ALCcontext *context);
+ALC_API ALCcontext* ALC_APIENTRY alcGetThreadContext(void);
+#endif
+#endif
+
+#ifndef AL_EXT_source_distance_model
+#define AL_EXT_source_distance_model 1
+#define AL_SOURCE_DISTANCE_MODEL 0x200
+#endif
+
+#ifndef AL_SOFT_buffer_sub_data
+#define AL_SOFT_buffer_sub_data 1
+#define AL_BYTE_RW_OFFSETS_SOFT 0x1031
+#define AL_SAMPLE_RW_OFFSETS_SOFT 0x1032
+typedef ALvoid (AL_APIENTRY*LPALBUFFERSUBDATASOFT)(ALuint,ALenum,const ALvoid*,ALsizei,ALsizei);
+#ifdef AL_ALEXT_PROTOTYPES
+AL_API ALvoid AL_APIENTRY alBufferSubDataSOFT(ALuint buffer,ALenum format,const ALvoid *data,ALsizei offset,ALsizei length);
+#endif
+#endif
+
+#ifndef AL_SOFT_loop_points
+#define AL_SOFT_loop_points 1
+#define AL_LOOP_POINTS_SOFT 0x2015
+#endif
+
+ /*
+joal: need custom binding code for callbacks
+#ifndef AL_EXT_FOLDBACK
+#define AL_EXT_FOLDBACK 1
+#define AL_EXT_FOLDBACK_NAME "AL_EXT_FOLDBACK"
+#define AL_FOLDBACK_EVENT_BLOCK 0x4112
+#define AL_FOLDBACK_EVENT_START 0x4111
+#define AL_FOLDBACK_EVENT_STOP 0x4113
+#define AL_FOLDBACK_MODE_MONO 0x4101
+#define AL_FOLDBACK_MODE_STEREO 0x4102
+typedef void (AL_APIENTRY*LPALFOLDBACKCALLBACK)(ALenum,ALsizei);
+typedef void (AL_APIENTRY*LPALREQUESTFOLDBACKSTART)(ALenum,ALsizei,ALsizei,ALfloat*,LPALFOLDBACKCALLBACK);
+typedef void (AL_APIENTRY*LPALREQUESTFOLDBACKSTOP)(void);
+#ifdef AL_ALEXT_PROTOTYPES
+AL_API void AL_APIENTRY alRequestFoldbackStart(ALenum mode,ALsizei count,ALsizei length,ALfloat *mem,LPALFOLDBACKCALLBACK callback);
+AL_API void AL_APIENTRY alRequestFoldbackStop(void);
+#endif
+#endif
+ */
+
+#ifndef ALC_EXT_DEDICATED
+#define ALC_EXT_DEDICATED 1
+#define AL_DEDICATED_GAIN 0x0001
+#define AL_EFFECT_DEDICATED_DIALOGUE 0x9001
+#define AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT 0x9000
+#endif
+
+#ifndef AL_SOFT_buffer_samples
+#define AL_SOFT_buffer_samples 1
+/* Channel configurations */
+#define AL_MONO_SOFT 0x1500
+#define AL_STEREO_SOFT 0x1501
+#define AL_REAR_SOFT 0x1502
+#define AL_QUAD_SOFT 0x1503
+#define AL_5POINT1_SOFT 0x1504
+#define AL_6POINT1_SOFT 0x1505
+#define AL_7POINT1_SOFT 0x1506
+
+/* Sample types */
+#define AL_BYTE_SOFT 0x1400
+#define AL_UNSIGNED_BYTE_SOFT 0x1401
+#define AL_SHORT_SOFT 0x1402
+#define AL_UNSIGNED_SHORT_SOFT 0x1403
+#define AL_INT_SOFT 0x1404
+#define AL_UNSIGNED_INT_SOFT 0x1405
+#define AL_FLOAT_SOFT 0x1406
+#define AL_DOUBLE_SOFT 0x1407
+#define AL_BYTE3_SOFT 0x1408
+#define AL_UNSIGNED_BYTE3_SOFT 0x1409
+
+/* Storage formats */
+#define AL_MONO8_SOFT 0x1100
+#define AL_MONO16_SOFT 0x1101
+#define AL_MONO32F_SOFT 0x10010
+#define AL_STEREO8_SOFT 0x1102
+#define AL_STEREO16_SOFT 0x1103
+#define AL_STEREO32F_SOFT 0x10011
+#define AL_QUAD8_SOFT 0x1204
+#define AL_QUAD16_SOFT 0x1205
+#define AL_QUAD32F_SOFT 0x1206
+#define AL_REAR8_SOFT 0x1207
+#define AL_REAR16_SOFT 0x1208
+#define AL_REAR32F_SOFT 0x1209
+#define AL_5POINT1_8_SOFT 0x120A
+#define AL_5POINT1_16_SOFT 0x120B
+#define AL_5POINT1_32F_SOFT 0x120C
+#define AL_6POINT1_8_SOFT 0x120D
+#define AL_6POINT1_16_SOFT 0x120E
+#define AL_6POINT1_32F_SOFT 0x120F
+#define AL_7POINT1_8_SOFT 0x1210
+#define AL_7POINT1_16_SOFT 0x1211
+#define AL_7POINT1_32F_SOFT 0x1212
+
+/* Buffer attributes */
+#define AL_INTERNAL_FORMAT_SOFT 0x2008
+#define AL_BYTE_LENGTH_SOFT 0x2009
+#define AL_SAMPLE_LENGTH_SOFT 0x200A
+#define AL_SEC_LENGTH_SOFT 0x200B
+
+typedef void (AL_APIENTRY*LPALBUFFERSAMPLESSOFT)(ALuint,ALuint,ALenum,ALsizei,ALenum,ALenum,const ALvoid*);
+typedef void (AL_APIENTRY*LPALBUFFERSUBSAMPLESSOFT)(ALuint,ALsizei,ALsizei,ALenum,ALenum,const ALvoid*);
+typedef void (AL_APIENTRY*LPALGETBUFFERSAMPLESSOFT)(ALuint,ALsizei,ALsizei,ALenum,ALenum,ALvoid*);
+typedef ALboolean (AL_APIENTRY*LPALISBUFFERFORMATSUPPORTEDSOFT)(ALenum);
+#ifdef AL_ALEXT_PROTOTYPES
+AL_API void AL_APIENTRY alBufferSamplesSOFT(ALuint buffer, ALuint samplerate, ALenum internalformat, ALsizei samples, ALenum channels, ALenum type, const ALvoid *data);
+AL_API void AL_APIENTRY alBufferSubSamplesSOFT(ALuint buffer, ALsizei offset, ALsizei samples, ALenum channels, ALenum type, const ALvoid *data);
+AL_API void AL_APIENTRY alGetBufferSamplesSOFT(ALuint buffer, ALsizei offset, ALsizei samples, ALenum channels, ALenum type, ALvoid *data);
+AL_API ALboolean AL_APIENTRY alIsBufferFormatSupportedSOFT(ALenum format);
+#endif
+#endif
+
+// This is still experiemental in openal-soft
+#ifndef ALC_SOFT_device_loopback
+#define ALC_SOFT_device_loopback 1
+#define ALC_FORMAT_CHANNELS_SOFT 0x1990
+#define ALC_FORMAT_TYPE_SOFT 0x1991
+
+// Added for joal
+ALCdevice* alcLoopbackOpenDeviceSOFT(void);
+ALCboolean alcIsRenderFormatSupportedSOFT(ALCdevice *device, ALCsizei freq, ALenum channels, ALenum type);
+ALCvoid alcRenderSamplesSOFT(ALCdevice *device, ALCvoid *buffer, ALCsizei samples);
+
+
+typedef ALCdevice* (ALC_APIENTRY *LPALCLOOPBACKOPENDEVICESOFT)(void);
+typedef ALCboolean (ALC_APIENTRY *LPALCISRENDERFORMATSUPPORTEDSOFT)(ALCdevice *device, ALCsizei freq, ALenum channels, ALenum type);
+typedef ALCvoid (ALC_APIENTRY *LPALCRENDERSAMPLESSOFT)(ALCdevice *device, ALCvoid *buffer, ALCsizei samples);
+
+#endif
+
+
#ifdef __cplusplus
}
#endif
diff --git a/src/java/com/jogamp/openal/ALFactory.java b/src/java/com/jogamp/openal/ALFactory.java
index 29174ba..f442f00 100644
--- a/src/java/com/jogamp/openal/ALFactory.java
+++ b/src/java/com/jogamp/openal/ALFactory.java
@@ -36,6 +36,7 @@ package com.jogamp.openal;
import com.jogamp.common.os.Platform;
import com.jogamp.openal.AL;
import com.jogamp.openal.ALC;
+import com.jogamp.openal.ALExt;
import jogamp.openal.*;
/**
@@ -50,6 +51,7 @@ public class ALFactory {
private static boolean initialized = false;
private static AL al;
private static ALC alc;
+ private static ALExt alext;
private ALFactory() {}
@@ -97,4 +99,18 @@ public class ALFactory {
}
return alc;
}
+
+ /**
+ * Get the default ALExt object. This object is used to access most of the
+ * OpenAL extension functionality.
+ *
+ * @return the ALExt object
+ */
+ public static ALExt getALExt() throws ALException{
+ initialize();
+ if (alext == null) {
+ alext = new ALExtImpl();
+ }
+ return alext;
+ }
}
diff --git a/src/java/jogamp/openal/ALExtImpl.java b/src/java/jogamp/openal/ALExtImpl.java
new file mode 100644
index 0000000..affa0db
--- /dev/null
+++ b/src/java/jogamp/openal/ALExtImpl.java
@@ -0,0 +1,19 @@
+/*
+ * Created on Saturday, February 7 2012
+ */
+package jogamp.openal;
+
+import com.jogamp.common.nio.Buffers;
+import com.jogamp.openal.ALException;
+import com.jogamp.openal.ALCdevice;
+import java.io.UnsupportedEncodingException;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+
+/**
+ * ALExt implementation.
+ * @author Michael Zucchi
+ */
+public class ALExtImpl extends ALExtAbstractImpl {
+
+}