aboutsummaryrefslogtreecommitdiffstats
path: root/alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2020-02-02 16:11:43 -0800
committerChris Robinson <[email protected]>2020-02-08 15:00:58 -0800
commit3ee0906c81e3af184c7be5029fdfc5c0b4703179 (patch)
treee6becaf8e693bbc5967a8dc0bbf7867b3176660c /alc
parente72a02c5e285670d07b9013c34e02919def4c31d (diff)
Use std::array and span for the HRTF delays
Diffstat (limited to 'alc')
-rw-r--r--alc/hrtf.cpp2
-rw-r--r--alc/hrtf.h4
-rw-r--r--alc/voice.cpp6
-rw-r--r--alc/voice.h2
4 files changed, 6 insertions, 8 deletions
diff --git a/alc/hrtf.cpp b/alc/hrtf.cpp
index 47e41df9..ff133f1a 100644
--- a/alc/hrtf.cpp
+++ b/alc/hrtf.cpp
@@ -210,7 +210,7 @@ IdxBlend CalcAzIndex(ALuint azcount, float az)
* and azimuth in radians. The coefficients are normalized.
*/
void GetHrtfCoeffs(const HrtfStore *Hrtf, float elevation, float azimuth, float distance,
- float spread, HrirArray &coeffs, ALuint (&delays)[2])
+ float spread, HrirArray &coeffs, const al::span<ALuint,2> delays)
{
const float dirfact{1.0f - (spread / al::MathDefs<float>::Tau())};
diff --git a/alc/hrtf.h b/alc/hrtf.h
index 25811cda..46b71920 100644
--- a/alc/hrtf.h
+++ b/alc/hrtf.h
@@ -63,7 +63,7 @@ struct HrtfStore {
struct HrtfFilter {
alignas(16) HrirArray Coeffs;
- ALuint Delay[2];
+ std::array<ALuint,2> Delay;
float Gain;
};
@@ -91,7 +91,7 @@ al::vector<std::string> EnumerateHrtf(const char *devname);
HrtfStore *GetLoadedHrtf(const std::string &name, const char *devname, const ALuint devrate);
void GetHrtfCoeffs(const HrtfStore *Hrtf, float elevation, float azimuth, float distance,
- float spread, HrirArray &coeffs, ALuint (&delays)[2]);
+ float spread, HrirArray &coeffs, const al::span<ALuint,2> delays);
/**
* Produces HRTF filter coefficients for decoding B-Format, given a set of
diff --git a/alc/voice.cpp b/alc/voice.cpp
index 14b3607b..1bcde31c 100644
--- a/alc/voice.cpp
+++ b/alc/voice.cpp
@@ -458,8 +458,7 @@ void DoHrtfMix(const float *samples, const ALuint DstBufferSize, DirectParams &p
}
MixHrtfFilter hrtfparams;
hrtfparams.Coeffs = &parms.Hrtf.Target.Coeffs;
- hrtfparams.Delay[0] = parms.Hrtf.Target.Delay[0];
- hrtfparams.Delay[1] = parms.Hrtf.Target.Delay[1];
+ hrtfparams.Delay = parms.Hrtf.Target.Delay;
hrtfparams.Gain = 0.0f;
hrtfparams.GainStep = gain / static_cast<float>(fademix);
@@ -487,8 +486,7 @@ void DoHrtfMix(const float *samples, const ALuint DstBufferSize, DirectParams &p
MixHrtfFilter hrtfparams;
hrtfparams.Coeffs = &parms.Hrtf.Target.Coeffs;
- hrtfparams.Delay[0] = parms.Hrtf.Target.Delay[0];
- hrtfparams.Delay[1] = parms.Hrtf.Target.Delay[1];
+ hrtfparams.Delay = parms.Hrtf.Target.Delay;
hrtfparams.Gain = parms.Hrtf.Old.Gain;
hrtfparams.GainStep = (gain - parms.Hrtf.Old.Gain) / static_cast<float>(todo);
MixHrtfSamples(HrtfSamples+fademix, AccumSamples+OutPos, IrSize, &hrtfparams, todo);
diff --git a/alc/voice.h b/alc/voice.h
index 9e96bdc5..07abe0eb 100644
--- a/alc/voice.h
+++ b/alc/voice.h
@@ -86,7 +86,7 @@ enum {
struct MixHrtfFilter {
const HrirArray *Coeffs;
- ALuint Delay[2];
+ std::array<ALuint,2> Delay;
float Gain;
float GainStep;
};