aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-07-06 19:09:26 -0700
committerChris Robinson <[email protected]>2019-07-06 19:09:26 -0700
commitc2305548512db20a266528097dd0985e329f119b (patch)
tree95b431e9bb7b2e1d0e82eca39b28d043b0fcf2d9 /Alc
parentb95bf8d7c1d2d2aa30edc58fdd5c9bbf71fc8200 (diff)
Clamp NFC reference distance between 0.1m and 10m
Diffstat (limited to 'Alc')
-rw-r--r--Alc/panning.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/Alc/panning.cpp b/Alc/panning.cpp
index d1add5d5..e8f80069 100644
--- a/Alc/panning.cpp
+++ b/Alc/panning.cpp
@@ -258,17 +258,17 @@ constexpr ChannelMap MonoCfg[1] = {
};
void InitNearFieldCtrl(ALCdevice *device, ALfloat ctrl_dist, ALsizei order,
- const ALuint *RESTRICT chans_per_order)
+ const al::span<const ALuint,MAX_AMBI_ORDER+1> chans_per_order)
{
/* NFC is only used when AvgSpeakerDist is greater than 0. */
const char *devname{device->DeviceName.c_str()};
if(!GetConfigValueBool(devname, "decoder", "nfc", 0) || !(ctrl_dist > 0.0f))
return;
- device->AvgSpeakerDist = minf(ctrl_dist, 10.0f);
+ device->AvgSpeakerDist = clampf(ctrl_dist, 0.1f, 10.0f);
TRACE("Using near-field reference distance: %.2f meters\n", device->AvgSpeakerDist);
- auto iter = std::copy(chans_per_order, chans_per_order+order+1,
+ auto iter = std::copy(chans_per_order.begin(), chans_per_order.begin()+order+1,
std::begin(device->NumChannelsPerOrder));
std::fill(iter, std::end(device->NumChannelsPerOrder), 0u);
}
@@ -410,7 +410,6 @@ void InitPanning(ALCdevice *device)
if(nfc_delay > 0.0f)
{
static constexpr ALuint chans_per_order[MAX_AMBI_ORDER+1]{ 1, 3, 5, 7 };
- nfc_delay = clampf(nfc_delay, 0.001f, 1000.0f);
InitNearFieldCtrl(device, nfc_delay * SPEEDOFSOUNDMETRESPERSEC, device->mAmbiOrder,
chans_per_order);
}