diff options
author | Chris Robinson <[email protected]> | 2020-06-16 14:01:39 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2020-06-16 14:01:39 -0700 |
commit | b0b720c6097542a3c437684a6e9ff273e3037dd7 (patch) | |
tree | 6097bc408c89408568fda227db97ed7dea57a3a4 | |
parent | bd0144065a343c936b6a12be6e546e114575217b (diff) |
Avoid an unnecessary local variable
-rw-r--r-- | alc/panning.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/alc/panning.cpp b/alc/panning.cpp index f8f3a8bb..28202fa3 100644 --- a/alc/panning.cpp +++ b/alc/panning.cpp @@ -227,6 +227,9 @@ bool MakeSpeakerMap(ALCdevice *device, const AmbDecConf *conf, ALuint (&speakerm void InitNearFieldCtrl(ALCdevice *device, float ctrl_dist, ALuint order, bool is3d) { + static const ALuint chans_per_order2d[MAX_AMBI_ORDER+1]{ 1, 2, 2, 2 }; + static const ALuint chans_per_order3d[MAX_AMBI_ORDER+1]{ 1, 3, 5, 7 }; + /* 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)) @@ -235,12 +238,7 @@ void InitNearFieldCtrl(ALCdevice *device, float ctrl_dist, ALuint order, bool is device->AvgSpeakerDist = clampf(ctrl_dist, 0.1f, 10.0f); TRACE("Using near-field reference distance: %.2f meters\n", device->AvgSpeakerDist); - static const ALuint chans_per_order2d[MAX_AMBI_ORDER+1]{ 1, 2, 2, 2 }; - static const ALuint chans_per_order3d[MAX_AMBI_ORDER+1]{ 1, 3, 5, 7 }; - const al::span<const ALuint> chans_per_order{is3d ? chans_per_order3d : chans_per_order2d, - order+1u}; - - auto iter = std::copy(chans_per_order.begin(), chans_per_order.end(), + auto iter = std::copy_n(is3d ? chans_per_order3d : chans_per_order2d, order+1u, std::begin(device->NumChannelsPerOrder)); std::fill(iter, std::end(device->NumChannelsPerOrder), 0u); } |