aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2016-03-26 17:52:42 -0700
committerChris Robinson <[email protected]>2016-03-26 17:52:42 -0700
commit1dcb04157c158fc22390dd99a89469a523dd0109 (patch)
tree0463f4db6606290ad1601e3f49d601fa1684000d /Alc
parent67db77452fcff2db20294c2e062ffb3684a0b710 (diff)
Add a config option for distance compensation
Diffstat (limited to 'Alc')
-rw-r--r--Alc/bformatdec.c4
-rw-r--r--Alc/bformatdec.h6
-rw-r--r--Alc/panning.c10
3 files changed, 15 insertions, 5 deletions
diff --git a/Alc/bformatdec.c b/Alc/bformatdec.c
index 7c202228..463a1969 100644
--- a/Alc/bformatdec.c
+++ b/Alc/bformatdec.c
@@ -233,7 +233,7 @@ int bformatdec_getOrder(const struct BFormatDec *dec)
return 0;
}
-void bformatdec_reset(BFormatDec *dec, const AmbDecConf *conf, ALuint chancount, ALuint srate, const ALuint chanmap[MAX_OUTPUT_CHANNELS])
+void bformatdec_reset(BFormatDec *dec, const AmbDecConf *conf, ALuint chancount, ALuint srate, const ALuint chanmap[MAX_OUTPUT_CHANNELS], int flags)
{
static const ALuint map2DTo3D[7] = {
0, 1, 3, 4, 8, 9, 15
@@ -362,7 +362,7 @@ void bformatdec_reset(BFormatDec *dec, const AmbDecConf *conf, ALuint chancount,
maxdist = maxf(maxdist, conf->Speakers[i].Distance);
memset(dec->Delay, 0, sizeof(dec->Delay));
- if(maxdist > 0.0f)
+ if((flags&BFDF_DistanceComp) && maxdist > 0.0f)
{
for(i = 0;i < conf->NumSpeakers;i++)
{
diff --git a/Alc/bformatdec.h b/Alc/bformatdec.h
index 623e7b09..3ad06373 100644
--- a/Alc/bformatdec.h
+++ b/Alc/bformatdec.h
@@ -6,10 +6,14 @@
struct AmbDecConf;
struct BFormatDec;
+enum BFormatDecFlags {
+ BFDF_DistanceComp = 1<<0
+};
+
struct BFormatDec *bformatdec_alloc();
void bformatdec_free(struct BFormatDec *dec);
int bformatdec_getOrder(const struct BFormatDec *dec);
-void bformatdec_reset(struct BFormatDec *dec, const struct AmbDecConf *conf, ALuint chancount, ALuint srate, const ALuint chanmap[MAX_OUTPUT_CHANNELS]);
+void bformatdec_reset(struct BFormatDec *dec, const struct AmbDecConf *conf, ALuint chancount, ALuint srate, const ALuint chanmap[MAX_OUTPUT_CHANNELS], int flags);
/* Decodes the ambisonic input to the given output channels. */
void bformatdec_process(struct BFormatDec *dec, ALfloat (*restrict OutBuffer)[BUFFERSIZE], ALuint OutChannels, ALfloat (*restrict InSamples)[BUFFERSIZE], ALuint SamplesToDo);
diff --git a/Alc/panning.c b/Alc/panning.c
index 1ac79449..90122550 100644
--- a/Alc/panning.c
+++ b/Alc/panning.c
@@ -620,9 +620,11 @@ ALvoid aluInitPanning(ALCdevice *device)
{ Aux5, { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f } },
{ Aux6, { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f } },
};
+ const char *devname = al_string_get_cstr(device->DeviceName);
ALuint speakermap[MAX_OUTPUT_CHANNELS];
const char *fname = "";
const char *layout;
+ int decflags = 0;
AmbDecConf conf;
ambdec_init(&conf);
@@ -630,9 +632,12 @@ ALvoid aluInitPanning(ALCdevice *device)
layout = GetChannelLayoutName(device->FmtChans);
if(!layout) goto ambi_fail;
- if(!ConfigValueStr(al_string_get_cstr(device->DeviceName), "decoder", layout, &fname))
+ if(!ConfigValueStr(devname, "decoder", layout, &fname))
goto ambi_fail;
+ if(GetConfigValueBool(devname, "decoder", "distance-comp", 1))
+ decflags |= BFDF_DistanceComp;
+
if(!ambdec_load(&conf, fname))
{
ERR("Failed to load %s\n", fname);
@@ -677,7 +682,8 @@ ALvoid aluInitPanning(ALCdevice *device)
(conf.ChanMask > 0xf) ? (conf.ChanMask > 0x1ff) ? "third" : "second" : "first",
(conf.ChanMask & ~0x831b) ? " periphonic" : ""
);
- bformatdec_reset(device->AmbiDecoder, &conf, count, device->Frequency, speakermap);
+ bformatdec_reset(device->AmbiDecoder, &conf, count, device->Frequency,
+ speakermap, decflags);
ambdec_deinit(&conf);
if(bformatdec_getOrder(device->AmbiDecoder) < 2)