aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/Include/alSource.h5
-rw-r--r--OpenAL32/alSource.c36
2 files changed, 41 insertions, 0 deletions
diff --git a/OpenAL32/Include/alSource.h b/OpenAL32/Include/alSource.h
index bf589e8d..b7c08fcd 100644
--- a/OpenAL32/Include/alSource.h
+++ b/OpenAL32/Include/alSource.h
@@ -76,6 +76,11 @@ typedef struct ALsource {
volatile ALfloat RoomRolloffFactor;
volatile ALfloat DopplerFactor;
+ /* NOTE: Stereo pan angles are specified in radians, counter-clockwise
+ * rather than clockwise.
+ */
+ volatile ALfloat StereoPan[2];
+
volatile ALfloat Radius;
/**
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c
index 250c9d1e..d7b68185 100644
--- a/OpenAL32/alSource.c
+++ b/OpenAL32/alSource.c
@@ -104,6 +104,9 @@ typedef enum SourceProp {
srcSampleOffsetLatencySOFT = AL_SAMPLE_OFFSET_LATENCY_SOFT,
srcSecOffsetLatencySOFT = AL_SEC_OFFSET_LATENCY_SOFT,
+ /* AL_EXT_STEREO_ANGLES */
+ srcAngles = AL_STEREO_ANGLES,
+
/* AL_EXT_BFORMAT */
srcOrientation = AL_ORIENTATION,
} SourceProp;
@@ -157,6 +160,7 @@ static ALint FloatValsByProp(ALenum prop)
case AL_SAMPLE_RW_OFFSETS_SOFT:
case AL_BYTE_RW_OFFSETS_SOFT:
+ case AL_STEREO_ANGLES:
return 2;
case AL_POSITION:
@@ -221,6 +225,7 @@ static ALint DoubleValsByProp(ALenum prop)
case AL_SAMPLE_RW_OFFSETS_SOFT:
case AL_BYTE_RW_OFFSETS_SOFT:
case AL_SEC_OFFSET_LATENCY_SOFT:
+ case AL_STEREO_ANGLES:
return 2;
case AL_POSITION:
@@ -299,6 +304,8 @@ static ALint IntValsByProp(ALenum prop)
break; /* i64 only */
case AL_SEC_OFFSET_LATENCY_SOFT:
break; /* Double only */
+ case AL_STEREO_ANGLES:
+ break; /* Float/double only */
}
return 0;
}
@@ -359,6 +366,8 @@ static ALint Int64ValsByProp(ALenum prop)
case AL_SEC_OFFSET_LATENCY_SOFT:
break; /* Double only */
+ case AL_STEREO_ANGLES:
+ break; /* Float/double only */
}
return 0;
}
@@ -507,6 +516,17 @@ static ALboolean SetSourcefv(ALsource *Source, ALCcontext *Context, SourceProp p
return AL_TRUE;
+ case AL_STEREO_ANGLES:
+ CHECKVAL(isfinite(values[0]) && isfinite(values[1]));
+
+ LockContext(Context);
+ Source->StereoPan[0] = values[0];
+ Source->StereoPan[1] = values[1];
+ UnlockContext(Context);
+ ATOMIC_STORE(&Source->NeedsUpdate, AL_TRUE);
+ return AL_TRUE;
+
+
case AL_POSITION:
CHECKVAL(isfinite(values[0]) && isfinite(values[1]) && isfinite(values[2]));
@@ -830,6 +850,7 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p
case AL_SAMPLE_OFFSET_LATENCY_SOFT:
case AL_SEC_OFFSET_LATENCY_SOFT:
+ case AL_STEREO_ANGLES:
break;
}
@@ -931,6 +952,7 @@ static ALboolean SetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp
return SetSourcefv(Source, Context, (int)prop, fvals);
case AL_SEC_OFFSET_LATENCY_SOFT:
+ case AL_STEREO_ANGLES:
break;
}
@@ -1054,6 +1076,13 @@ static ALboolean GetSourcedv(ALsource *Source, ALCcontext *Context, SourceProp p
UnlockContext(Context);
return AL_TRUE;
+ case AL_STEREO_ANGLES:
+ LockContext(Context);
+ values[0] = Source->StereoPan[0];
+ values[1] = Source->StereoPan[1];
+ UnlockContext(Context);
+ return AL_TRUE;
+
case AL_POSITION:
LockContext(Context);
values[0] = Source->Position.v[0];
@@ -1325,6 +1354,8 @@ static ALboolean GetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p
break; /* i64 only */
case AL_SEC_OFFSET_LATENCY_SOFT:
break; /* Double only */
+ case AL_STEREO_ANGLES:
+ break; /* Float/double only */
case AL_DIRECT_FILTER:
case AL_AUXILIARY_SEND_FILTER:
@@ -1446,6 +1477,8 @@ static ALboolean GetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp
case AL_SEC_OFFSET_LATENCY_SOFT:
break; /* Double only */
+ case AL_STEREO_ANGLES:
+ break; /* Float/double only */
}
ERR("Unexpected property: 0x%04x\n", prop);
@@ -2530,6 +2563,9 @@ static ALvoid InitSourceParams(ALsource *Source)
Source->DopplerFactor = 1.0f;
Source->DirectChannels = AL_FALSE;
+ Source->StereoPan[0] = DEG2RAD( 30.0f);
+ Source->StereoPan[1] = DEG2RAD(-30.0f);
+
Source->Radius = 0.0f;
Source->DistanceModel = DefaultDistanceModel;