aboutsummaryrefslogtreecommitdiffstats
path: root/alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-12-30 21:04:10 -0800
committerChris Robinson <[email protected]>2019-12-30 21:04:10 -0800
commit8b3a1ed9e44f0e8ed4266eb62f50a6d7d8c4184b (patch)
tree9cee3d2e44af1e5845ff20be6ff150a648b1ac93 /alc
parentcfc8a829515034e29f0e12d8233acfc038bae462 (diff)
Use an array type for the HRIR delay pair
Diffstat (limited to 'alc')
-rw-r--r--alc/hrtf.cpp12
-rw-r--r--alc/hrtf.h3
2 files changed, 5 insertions, 10 deletions
diff --git a/alc/hrtf.cpp b/alc/hrtf.cpp
index 781a07fd..0d4bf393 100644
--- a/alc/hrtf.cpp
+++ b/alc/hrtf.cpp
@@ -479,8 +479,6 @@ void BuildBFormatHrtf(const HrtfStore *Hrtf, DirectHrtfState *state,
namespace {
-using ubyte2 = std::array<ALubyte,2>;
-
std::unique_ptr<HrtfStore> CreateHrtfStore(ALuint rate, ALushort irSize, const ALuint fdCount,
const ALubyte *evCount, const ALushort *distance, const ALushort *azCount,
const ALushort *irOffset, ALushort irCount, const HrirArray *coeffs, const ubyte2 *delays,
@@ -524,7 +522,7 @@ std::unique_ptr<HrtfStore> CreateHrtfStore(ALuint rate, ALushort irSize, const A
auto coeffs_ = reinterpret_cast<HrirArray*>(base + offset);
offset += sizeof(coeffs_[0])*irCount;
- auto delays_ = reinterpret_cast<ALubyte(*)[2]>(base + offset);
+ auto delays_ = reinterpret_cast<ubyte2*>(base + offset);
offset += sizeof(delays_[0])*irCount;
assert(offset == total);
@@ -541,11 +539,7 @@ std::unique_ptr<HrtfStore> CreateHrtfStore(ALuint rate, ALushort irSize, const A
elev_[i].irOffset = irOffset[i];
}
std::copy_n(coeffs, irCount, coeffs_);
- for(ALuint i{0};i < irCount;i++)
- {
- delays_[i][0] = delays[i][0];
- delays_[i][1] = delays[i][1];
- }
+ std::copy_n(delays, irCount, delays_);
/* Finally, assign the storage pointers. */
Hrtf->field = field_;
@@ -1378,7 +1372,7 @@ HrtfStore *GetLoadedHrtf(const std::string &name, const char *devname, const ALu
const ALuint srate{hrtf->sampleRate};
for(size_t i{0};i < irCount;++i)
{
- for(ALubyte &delay : const_cast<ALubyte(&)[2]>(hrtf->delays[i]))
+ for(ALubyte &delay : const_cast<ubyte2&>(hrtf->delays[i]))
delay = static_cast<ALubyte>(minu64(MAX_HRIR_DELAY*HRIR_DELAY_FRACONE,
(uint64_t{delay}*devrate + srate/2) / srate));
}
diff --git a/alc/hrtf.h b/alc/hrtf.h
index 89a54c1f..0762ee7d 100644
--- a/alc/hrtf.h
+++ b/alc/hrtf.h
@@ -27,6 +27,7 @@
using float2 = std::array<float,2>;
using HrirArray = std::array<float2,HRIR_LENGTH>;
+using ubyte2 = std::array<ALubyte,2>;
struct HrtfStore {
@@ -51,7 +52,7 @@ struct HrtfStore {
};
Elevation *elev;
const HrirArray *coeffs;
- const ALubyte (*delays)[2];
+ const ubyte2 *delays;
void IncRef();
void DecRef();