aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2011-06-29 23:18:49 -0700
committerChris Robinson <[email protected]>2011-06-29 23:18:49 -0700
commit5736bbc3e43145aa59d3e611ad95e4e73fb836df (patch)
treebeb6f03976fa2887260493fe9ac978d2d5738611 /OpenAL32
parent1b773a858534693056161c90702c4cdb013e8a64 (diff)
Add a source property to skip channel virtualization for multi-channel buffers
With virtualization disabled, channels are mapped directly from input to output and any input channel that is missing an output is dropped. Any virtualization effects (such as HRTF filters) for positional cues are also skipped. The idea is to allow applications a way to play pre-filtered audio that channel vitualization effects could interfere with.
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/Include/alMain.h5
-rw-r--r--OpenAL32/Include/alSource.h1
-rw-r--r--OpenAL32/alExtension.c1
-rw-r--r--OpenAL32/alSource.c17
4 files changed, 24 insertions, 0 deletions
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index 3264d5ed..ebf1b20e 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -93,6 +93,11 @@ AL_API ALboolean AL_APIENTRY alIsBufferFormatSupportedSOFT(ALenum format);
#endif
#endif
+#ifndef AL_SOFT_non_virtual_channels
+#define AL_SOFT_non_virtual_channels 1
+#define AL_VIRTUAL_CHANNELS_SOFT 0x1033
+#endif
+
#if defined(HAVE_STDINT_H)
#include <stdint.h>
diff --git a/OpenAL32/Include/alSource.h b/OpenAL32/Include/alSource.h
index 9cbd7f54..8afe8281 100644
--- a/OpenAL32/Include/alSource.h
+++ b/OpenAL32/Include/alSource.h
@@ -46,6 +46,7 @@ typedef struct ALsource
ALboolean bHeadRelative;
ALboolean bLooping;
ALenum DistanceModel;
+ ALboolean VirtualChannels;
resampler_t Resampler;
diff --git a/OpenAL32/alExtension.c b/OpenAL32/alExtension.c
index eb0f46a8..ebb2e252 100644
--- a/OpenAL32/alExtension.c
+++ b/OpenAL32/alExtension.c
@@ -75,6 +75,7 @@ static const ALenums enumeration[] = {
{ "AL_STREAMING", AL_STREAMING },
{ "AL_UNDETERMINED", AL_UNDETERMINED },
{ "AL_METERS_PER_UNIT", AL_METERS_PER_UNIT },
+ { "AL_VIRTUAL_CHANNELS_SOFT", AL_VIRTUAL_CHANNELS_SOFT },
// Source EFX Properties
{ "AL_DIRECT_FILTER", AL_DIRECT_FILTER },
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c
index e91206eb..a1319005 100644
--- a/OpenAL32/alSource.c
+++ b/OpenAL32/alSource.c
@@ -680,6 +680,16 @@ AL_API ALvoid AL_APIENTRY alSourcei(ALuint source,ALenum eParam,ALint lValue)
alSetError(pContext, AL_INVALID_VALUE);
break;
+ case AL_VIRTUAL_CHANNELS_SOFT:
+ if(lValue == AL_TRUE || lValue == AL_FALSE)
+ {
+ Source->VirtualChannels = lValue;
+ Source->NeedsUpdate = AL_TRUE;
+ }
+ else
+ alSetError(pContext, AL_INVALID_VALUE);
+ break;
+
case AL_DISTANCE_MODEL:
if(lValue == AL_NONE ||
lValue == AL_INVERSE_DISTANCE ||
@@ -801,6 +811,7 @@ AL_API void AL_APIENTRY alSourceiv(ALuint source, ALenum eParam, const ALint* pl
case AL_AUXILIARY_SEND_FILTER_GAIN_AUTO:
case AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO:
case AL_DISTANCE_MODEL:
+ case AL_VIRTUAL_CHANNELS_SOFT:
alSourcei(source, eParam, plValues[0]);
return;
@@ -1149,6 +1160,10 @@ AL_API ALvoid AL_APIENTRY alGetSourcei(ALuint source, ALenum eParam, ALint *plVa
*plValue = (ALint)Source->DopplerFactor;
break;
+ case AL_VIRTUAL_CHANNELS_SOFT:
+ *plValue = Source->VirtualChannels;
+ break;
+
case AL_DISTANCE_MODEL:
*plValue = Source->DistanceModel;
break;
@@ -1245,6 +1260,7 @@ AL_API void AL_APIENTRY alGetSourceiv(ALuint source, ALenum eParam, ALint* plVal
case AL_AUXILIARY_SEND_FILTER_GAIN_AUTO:
case AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO:
case AL_DISTANCE_MODEL:
+ case AL_VIRTUAL_CHANNELS_SOFT:
alGetSourcei(source, eParam, plValues);
return;
@@ -1807,6 +1823,7 @@ static ALvoid InitSourceParams(ALsource *Source)
Source->AirAbsorptionFactor = 0.0f;
Source->RoomRolloffFactor = 0.0f;
Source->DopplerFactor = 1.0f;
+ Source->VirtualChannels = AL_TRUE;
Source->DistanceModel = AL_INVERSE_DISTANCE_CLAMPED;