aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-04-21 15:48:39 -0700
committerChris Robinson <[email protected]>2017-04-21 15:48:39 -0700
commitd2d5f1d7bd8afa6b1c483c106bec88eec1d3923c (patch)
tree3ed4e578c558f1e432667f6cc3ae82721397e2e8
parent44f026220fba39a3211b82d5c1fa5ad071ea461e (diff)
Add the ability to change the source resampler
-rw-r--r--Alc/ALc.c3
-rw-r--r--OpenAL32/alSource.c22
2 files changed, 24 insertions, 1 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 175cb139..808580f3 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -732,7 +732,8 @@ static const ALchar alExtList[] =
"AL_EXT_source_distance_model AL_EXT_SOURCE_RADIUS AL_EXT_STEREO_ANGLES "
"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_MSADPCM AL_SOFT_source_latency AL_SOFT_source_length "
+ "AL_SOFTX_source_resampler";
static ATOMIC(ALCenum) LastNullDeviceError = ATOMIC_INIT_STATIC(ALC_NO_ERROR);
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c
index 1caea5ef..23b4fb5a 100644
--- a/OpenAL32/alSource.c
+++ b/OpenAL32/alSource.c
@@ -116,6 +116,9 @@ typedef enum SourceProp {
/* AL_EXT_BFORMAT */
srcOrientation = AL_ORIENTATION,
+
+ /* AL_SOFT_source_resampler */
+ srcResampler = AL_SOURCE_RESAMPLER_SOFT,
} SourceProp;
static ALboolean SetSourcefv(ALsource *Source, ALCcontext *Context, SourceProp prop, const ALfloat *values);
@@ -214,6 +217,7 @@ static ALint FloatValsByProp(ALenum prop)
case AL_SAMPLE_LENGTH_SOFT:
case AL_SEC_LENGTH_SOFT:
case AL_SOURCE_RADIUS:
+ case AL_SOURCE_RESAMPLER_SOFT:
return 1;
case AL_STEREO_ANGLES:
@@ -277,6 +281,7 @@ static ALint DoubleValsByProp(ALenum prop)
case AL_SAMPLE_LENGTH_SOFT:
case AL_SEC_LENGTH_SOFT:
case AL_SOURCE_RADIUS:
+ case AL_SOURCE_RESAMPLER_SOFT:
return 1;
case AL_SEC_OFFSET_LATENCY_SOFT:
@@ -341,6 +346,7 @@ static ALint IntValsByProp(ALenum prop)
case AL_SAMPLE_LENGTH_SOFT:
case AL_SEC_LENGTH_SOFT:
case AL_SOURCE_RADIUS:
+ case AL_SOURCE_RESAMPLER_SOFT:
return 1;
case AL_POSITION:
@@ -401,6 +407,7 @@ static ALint Int64ValsByProp(ALenum prop)
case AL_SAMPLE_LENGTH_SOFT:
case AL_SEC_LENGTH_SOFT:
case AL_SOURCE_RADIUS:
+ case AL_SOURCE_RESAMPLER_SOFT:
return 1;
case AL_SAMPLE_OFFSET_LATENCY_SOFT:
@@ -648,6 +655,7 @@ static ALboolean SetSourcefv(ALsource *Source, ALCcontext *Context, SourceProp p
case AL_AUXILIARY_SEND_FILTER_GAIN_AUTO:
case AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO:
case AL_DIRECT_CHANNELS_SOFT:
+ case AL_SOURCE_RESAMPLER_SOFT:
ival = (ALint)values[0];
return SetSourceiv(Source, Context, prop, &ival);
@@ -873,6 +881,13 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p
DO_UPDATEPROPS();
return AL_TRUE;
+ case AL_SOURCE_RESAMPLER_SOFT:
+ CHECKVAL(*values >= 0 && *values <= ResamplerMax);
+
+ Source->Resampler = *values;
+ DO_UPDATEPROPS();
+ return AL_TRUE;
+
case AL_AUXILIARY_SEND_FILTER:
LockEffectSlotsRead(Context);
@@ -1013,6 +1028,7 @@ static ALboolean SetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp
case AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO:
case AL_DIRECT_CHANNELS_SOFT:
case AL_DISTANCE_MODEL:
+ case AL_SOURCE_RESAMPLER_SOFT:
CHECKVAL(*values <= INT_MAX && *values >= INT_MIN);
ivals[0] = (ALint)*values;
@@ -1252,6 +1268,7 @@ static ALboolean GetSourcedv(ALsource *Source, ALCcontext *Context, SourceProp p
case AL_BYTE_LENGTH_SOFT:
case AL_SAMPLE_LENGTH_SOFT:
case AL_DISTANCE_MODEL:
+ case AL_SOURCE_RESAMPLER_SOFT:
if((err=GetSourceiv(Source, Context, (int)prop, ivals)) != AL_FALSE)
*values = (ALdouble)ivals[0];
return err;
@@ -1421,6 +1438,10 @@ static ALboolean GetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p
*values = Source->DistanceModel;
return AL_TRUE;
+ case AL_SOURCE_RESAMPLER_SOFT:
+ *values = Source->Resampler;
+ return AL_TRUE;
+
/* 1x float/double */
case AL_CONE_INNER_ANGLE:
case AL_CONE_OUTER_ANGLE:
@@ -1579,6 +1600,7 @@ static ALboolean GetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp
case AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO:
case AL_DIRECT_CHANNELS_SOFT:
case AL_DISTANCE_MODEL:
+ case AL_SOURCE_RESAMPLER_SOFT:
if((err=GetSourceiv(Source, Context, prop, ivals)) != AL_FALSE)
*values = ivals[0];
return err;