aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-05-05 02:41:34 -0700
committerChris Robinson <[email protected]>2017-05-05 02:41:34 -0700
commit9c9ad2f60aead15416c8b582e20fadf847a13ce8 (patch)
tree79f8026ca8eadbbcd8940056cc8a1e81d63f5a50
parentb639bc99132015217ff173680e1a43f44fad2ce3 (diff)
Start an extension to change the source's spatialize property
-rw-r--r--Alc/ALc.c5
-rw-r--r--OpenAL32/Include/alMain.h6
-rw-r--r--OpenAL32/Include/alu.h6
-rw-r--r--OpenAL32/alSource.c22
4 files changed, 35 insertions, 4 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 40786a42..f1319b16 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -701,6 +701,9 @@ static const struct {
DECL(AL_DEFAULT_RESAMPLER_SOFT),
DECL(AL_SOURCE_RESAMPLER_SOFT),
DECL(AL_RESAMPLER_NAME_SOFT),
+
+ DECL(AL_SOURCE_SPATIALIZE_SOFT),
+ DECL(AL_AUTO_SOFT),
};
#undef DECL
@@ -735,7 +738,7 @@ static const ALchar alExtList[] =
"AL_LOKI_quadriphonic AL_SOFT_block_alignment AL_SOFT_deferred_updates "
"AL_SOFT_direct_channels AL_SOFT_gain_clamp_ex AL_SOFT_loop_points "
"AL_SOFT_MSADPCM AL_SOFT_source_latency AL_SOFT_source_length "
- "AL_SOFT_source_resampler";
+ "AL_SOFT_source_resampler AL_SOFTX_source_spatialize";
static ATOMIC(ALCenum) LastNullDeviceError = ATOMIC_INIT_STATIC(ALC_NO_ERROR);
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index 1ace123c..1b1b1909 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -144,6 +144,12 @@ AL_API ALboolean AL_APIENTRY alIsBufferFormatSupportedSOFT(ALenum format);
#define ALC_OUTPUT_LIMITER_SOFT 0x199A
#endif
+#ifndef AL_SOFT_source_spatialize
+#define AL_SOFT_source_spatialize
+#define AL_SOURCE_SPATIALIZE_SOFT 0x1213
+#define AL_AUTO_SOFT 0x0002
+#endif
+
#if defined(_WIN64)
#define SZFMT "%I64u"
diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h
index cccc9719..5cd233b9 100644
--- a/OpenAL32/Include/alu.h
+++ b/OpenAL32/Include/alu.h
@@ -41,9 +41,9 @@ struct ALeffectslot;
enum SpatializeMode {
- SpatializeOff,
- SpatializeOn,
- SpatializeAuto
+ SpatializeOff = AL_FALSE,
+ SpatializeOn = AL_TRUE,
+ SpatializeAuto = AL_AUTO_SOFT
};
enum Resampler {
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c
index 9ef9a4eb..6030bd3c 100644
--- a/OpenAL32/alSource.c
+++ b/OpenAL32/alSource.c
@@ -119,6 +119,9 @@ typedef enum SourceProp {
/* AL_SOFT_source_resampler */
srcResampler = AL_SOURCE_RESAMPLER_SOFT,
+
+ /* AL_SOFT_source_spatialize */
+ srcSpatialize = AL_SOURCE_SPATIALIZE_SOFT,
} SourceProp;
static ALboolean SetSourcefv(ALsource *Source, ALCcontext *Context, SourceProp prop, const ALfloat *values);
@@ -218,6 +221,7 @@ static ALint FloatValsByProp(ALenum prop)
case AL_SEC_LENGTH_SOFT:
case AL_SOURCE_RADIUS:
case AL_SOURCE_RESAMPLER_SOFT:
+ case AL_SOURCE_SPATIALIZE_SOFT:
return 1;
case AL_STEREO_ANGLES:
@@ -282,6 +286,7 @@ static ALint DoubleValsByProp(ALenum prop)
case AL_SEC_LENGTH_SOFT:
case AL_SOURCE_RADIUS:
case AL_SOURCE_RESAMPLER_SOFT:
+ case AL_SOURCE_SPATIALIZE_SOFT:
return 1;
case AL_SEC_OFFSET_LATENCY_SOFT:
@@ -347,6 +352,7 @@ static ALint IntValsByProp(ALenum prop)
case AL_SEC_LENGTH_SOFT:
case AL_SOURCE_RADIUS:
case AL_SOURCE_RESAMPLER_SOFT:
+ case AL_SOURCE_SPATIALIZE_SOFT:
return 1;
case AL_POSITION:
@@ -408,6 +414,7 @@ static ALint Int64ValsByProp(ALenum prop)
case AL_SEC_LENGTH_SOFT:
case AL_SOURCE_RADIUS:
case AL_SOURCE_RESAMPLER_SOFT:
+ case AL_SOURCE_SPATIALIZE_SOFT:
return 1;
case AL_SAMPLE_OFFSET_LATENCY_SOFT:
@@ -656,6 +663,7 @@ static ALboolean SetSourcefv(ALsource *Source, ALCcontext *Context, SourceProp p
case AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO:
case AL_DIRECT_CHANNELS_SOFT:
case AL_SOURCE_RESAMPLER_SOFT:
+ case AL_SOURCE_SPATIALIZE_SOFT:
ival = (ALint)values[0];
return SetSourceiv(Source, Context, prop, &ival);
@@ -888,6 +896,13 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p
DO_UPDATEPROPS();
return AL_TRUE;
+ case AL_SOURCE_SPATIALIZE_SOFT:
+ CHECKVAL(*values >= AL_FALSE && *values <= AL_AUTO_SOFT);
+
+ Source->Spatialize = *values;
+ DO_UPDATEPROPS();
+ return AL_TRUE;
+
case AL_AUXILIARY_SEND_FILTER:
LockEffectSlotsRead(Context);
@@ -1029,6 +1044,7 @@ static ALboolean SetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp
case AL_DIRECT_CHANNELS_SOFT:
case AL_DISTANCE_MODEL:
case AL_SOURCE_RESAMPLER_SOFT:
+ case AL_SOURCE_SPATIALIZE_SOFT:
CHECKVAL(*values <= INT_MAX && *values >= INT_MIN);
ivals[0] = (ALint)*values;
@@ -1269,6 +1285,7 @@ static ALboolean GetSourcedv(ALsource *Source, ALCcontext *Context, SourceProp p
case AL_SAMPLE_LENGTH_SOFT:
case AL_DISTANCE_MODEL:
case AL_SOURCE_RESAMPLER_SOFT:
+ case AL_SOURCE_SPATIALIZE_SOFT:
if((err=GetSourceiv(Source, Context, (int)prop, ivals)) != AL_FALSE)
*values = (ALdouble)ivals[0];
return err;
@@ -1443,6 +1460,10 @@ static ALboolean GetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p
*values = Source->Resampler;
return AL_TRUE;
+ case AL_SOURCE_SPATIALIZE_SOFT:
+ *values = Source->Spatialize;
+ return AL_TRUE;
+
/* 1x float/double */
case AL_CONE_INNER_ANGLE:
case AL_CONE_OUTER_ANGLE:
@@ -1602,6 +1623,7 @@ static ALboolean GetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp
case AL_DIRECT_CHANNELS_SOFT:
case AL_DISTANCE_MODEL:
case AL_SOURCE_RESAMPLER_SOFT:
+ case AL_SOURCE_SPATIALIZE_SOFT:
if((err=GetSourceiv(Source, Context, prop, ivals)) != AL_FALSE)
*values = ivals[0];
return err;