aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Alc/hrtf.cpp12
-rw-r--r--Alc/hrtf.h2
-rw-r--r--Alc/mixvoice.cpp81
-rw-r--r--Alc/panning.cpp12
4 files changed, 53 insertions, 54 deletions
diff --git a/Alc/hrtf.cpp b/Alc/hrtf.cpp
index dc15f9e9..9fa79e22 100644
--- a/Alc/hrtf.cpp
+++ b/Alc/hrtf.cpp
@@ -292,7 +292,7 @@ std::unique_ptr<DirectHrtfState> DirectHrtfState::Create(size_t num_chans)
return std::unique_ptr<DirectHrtfState>{new (ptr) DirectHrtfState{num_chans}};
}
-void BuildBFormatHrtf(const HrtfEntry *Hrtf, DirectHrtfState *state, const ALsizei NumChannels, const AngularPoint *AmbiPoints, const ALfloat (*RESTRICT AmbiMatrix)[MAX_AMBI_CHANNELS], const ALsizei AmbiCount, const ALfloat *RESTRICT AmbiOrderHFGain)
+void BuildBFormatHrtf(const HrtfEntry *Hrtf, DirectHrtfState *state, const ALsizei NumChannels, const AngularPoint *AmbiPoints, const ALfloat (*RESTRICT AmbiMatrix)[MAX_AMBI_CHANNELS], const size_t AmbiCount, const ALfloat *RESTRICT AmbiOrderHFGain)
{
static constexpr int OrderFromChan[MAX_AMBI_CHANNELS]{
0, 1,1,1, 2,2,2,2,2, 3,3,3,3,3,3,3,
@@ -346,7 +346,7 @@ void BuildBFormatHrtf(const HrtfEntry *Hrtf, DirectHrtfState *state, const ALsiz
auto tmpres = al::vector<HrirArray<ALdouble>>(NumChannels);
auto tmpfilt = al::vector<std::array<ALdouble,HRIR_LENGTH*4>>(3);
- for(ALsizei c{0};c < AmbiCount;++c)
+ for(size_t c{0u};c < AmbiCount;++c)
{
const ALfloat (*fir)[2]{&Hrtf->coeffs[idx[c] * Hrtf->irSize]};
const ALsizei ldelay{Hrtf->delays[idx[c]][0] - min_delay + base_delay};
@@ -386,7 +386,7 @@ void BuildBFormatHrtf(const HrtfEntry *Hrtf, DirectHrtfState *state, const ALsiz
* phase-shift (+n degrees becomes -n degrees).
*/
allpass.clear();
- allpass.process(tmpfilt[2].data(), tmpfilt[2].size());
+ allpass.process(tmpfilt[2].data(), static_cast<int>(tmpfilt[2].size()));
std::reverse(tmpfilt[2].begin(), tmpfilt[2].end());
/* Now apply the band-splitter. This applies the normal phase-shift,
@@ -395,7 +395,7 @@ void BuildBFormatHrtf(const HrtfEntry *Hrtf, DirectHrtfState *state, const ALsiz
*/
splitter.clear();
splitter.process(tmpfilt[0].data(), tmpfilt[1].data(), tmpfilt[2].data(),
- tmpfilt[2].size());
+ static_cast<int>(tmpfilt[2].size()));
/* Apply left ear response with delay and HF scale. */
for(ALsizei i{0};i < NumChannels;++i)
@@ -413,12 +413,12 @@ void BuildBFormatHrtf(const HrtfEntry *Hrtf, DirectHrtfState *state, const ALsiz
[](const ALfloat (&ir)[2]) noexcept -> ALdouble { return ir[1]; });
allpass.clear();
- allpass.process(tmpfilt[2].data(), tmpfilt[2].size());
+ allpass.process(tmpfilt[2].data(), static_cast<int>(tmpfilt[2].size()));
std::reverse(tmpfilt[2].begin(), tmpfilt[2].end());
splitter.clear();
splitter.process(tmpfilt[0].data(), tmpfilt[1].data(), tmpfilt[2].data(),
- tmpfilt[2].size());
+ static_cast<int>(tmpfilt[2].size()));
for(ALsizei i{0};i < NumChannels;++i)
{
diff --git a/Alc/hrtf.h b/Alc/hrtf.h
index 29dbb248..68a4301b 100644
--- a/Alc/hrtf.h
+++ b/Alc/hrtf.h
@@ -115,6 +115,6 @@ void GetHrtfCoeffs(const HrtfEntry *Hrtf, ALfloat elevation, ALfloat azimuth, AL
* ordered and scaled according to the matrix input. Note the specified virtual
* positions should be in degrees, not radians!
*/
-void BuildBFormatHrtf(const HrtfEntry *Hrtf, DirectHrtfState *state, const ALsizei NumChannels, const AngularPoint *AmbiPoints, const ALfloat (*RESTRICT AmbiMatrix)[MAX_AMBI_CHANNELS], const ALsizei AmbiCount, const ALfloat *RESTRICT AmbiOrderHFGain);
+void BuildBFormatHrtf(const HrtfEntry *Hrtf, DirectHrtfState *state, const ALsizei NumChannels, const AngularPoint *AmbiPoints, const ALfloat (*RESTRICT AmbiMatrix)[MAX_AMBI_CHANNELS], const size_t AmbiCount, const ALfloat *RESTRICT AmbiOrderHFGain);
#endif /* ALC_HRTF_H */
diff --git a/Alc/mixvoice.cpp b/Alc/mixvoice.cpp
index b9e25dbb..e2e0a1e6 100644
--- a/Alc/mixvoice.cpp
+++ b/Alc/mixvoice.cpp
@@ -215,6 +215,42 @@ void SendSourceStoppedEvent(ALCcontext *context, ALuint id)
context->EventSem.post();
}
+
+const ALfloat *DoFilters(BiquadFilter *lpfilter, BiquadFilter *hpfilter,
+ ALfloat *RESTRICT dst, const ALfloat *RESTRICT src, ALsizei numsamples, int type)
+{
+ switch(type)
+ {
+ case AF_None:
+ lpfilter->passthru(numsamples);
+ hpfilter->passthru(numsamples);
+ break;
+
+ case AF_LowPass:
+ lpfilter->process(dst, src, numsamples);
+ hpfilter->passthru(numsamples);
+ return dst;
+ case AF_HighPass:
+ lpfilter->passthru(numsamples);
+ hpfilter->process(dst, src, numsamples);
+ return dst;
+
+ case AF_BandPass:
+ for(ALsizei i{0};i < numsamples;)
+ {
+ ALfloat temp[256];
+ ALsizei todo = mini(256, numsamples-i);
+
+ lpfilter->process(temp, src+i, todo);
+ hpfilter->process(dst+i, temp, todo);
+ i += todo;
+ }
+ return dst;
+ }
+ return src;
+}
+
+
/* Base template left undefined. Should be marked =delete, but Clang 3.8.1
* chokes on that given the inline specializations.
*/
@@ -235,7 +271,8 @@ template<> inline ALfloat LoadSample<FmtAlaw>(FmtTypeTraits<FmtAlaw>::Type val)
{ return aLawDecompressionTable[val] * (1.0f/32768.0f); }
template<FmtType T>
-inline void LoadSampleArray(ALfloat *RESTRICT dst, const void *src, ALint srcstep, ALsizei samples)
+inline void LoadSampleArray(ALfloat *RESTRICT dst, const void *src, ALint srcstep,
+ const ptrdiff_t samples)
{
using SampleType = typename FmtTypeTraits<T>::Type;
@@ -245,10 +282,9 @@ inline void LoadSampleArray(ALfloat *RESTRICT dst, const void *src, ALint srcste
}
void LoadSamples(ALfloat *RESTRICT dst, const ALvoid *RESTRICT src, ALint srcstep, FmtType srctype,
- ALsizei samples)
+ const ptrdiff_t samples)
{
-#define HANDLE_FMT(T) \
- case T: LoadSampleArray<T>(dst, src, srcstep, samples); break
+#define HANDLE_FMT(T) case T: LoadSampleArray<T>(dst, src, srcstep, samples); break
switch(srctype)
{
HANDLE_FMT(FmtUByte);
@@ -261,43 +297,6 @@ void LoadSamples(ALfloat *RESTRICT dst, const ALvoid *RESTRICT src, ALint srcste
#undef HANDLE_FMT
}
-
-const ALfloat *DoFilters(BiquadFilter *lpfilter, BiquadFilter *hpfilter,
- ALfloat *RESTRICT dst, const ALfloat *RESTRICT src,
- ALsizei numsamples, int type)
-{
- ALsizei i;
- switch(type)
- {
- case AF_None:
- lpfilter->passthru(numsamples);
- hpfilter->passthru(numsamples);
- break;
-
- case AF_LowPass:
- lpfilter->process(dst, src, numsamples);
- hpfilter->passthru(numsamples);
- return dst;
- case AF_HighPass:
- lpfilter->passthru(numsamples);
- hpfilter->process(dst, src, numsamples);
- return dst;
-
- case AF_BandPass:
- for(i = 0;i < numsamples;)
- {
- ALfloat temp[256];
- ALsizei todo = mini(256, numsamples-i);
-
- lpfilter->process(temp, src+i, todo);
- hpfilter->process(dst+i, temp, todo);
- i += todo;
- }
- return dst;
- }
- return src;
-}
-
ALfloat *LoadBufferStatic(ALbufferlistitem *BufferListItem, ALbufferlistitem *&BufferLoopItem,
const ALsizei NumChannels, const ALsizei SampleSize, const ALsizei chan, ALsizei DataPosInt,
ALfloat *SrcData, const ALfloat *const SrcDataEnd)
diff --git a/Alc/panning.cpp b/Alc/panning.cpp
index 4fbf3cc3..2b8c8143 100644
--- a/Alc/panning.cpp
+++ b/Alc/panning.cpp
@@ -457,7 +457,7 @@ void InitCustomPanning(ALCdevice *device, const AmbDecConf *conf, const ALsizei
ALsizei count;
if((conf->ChanMask&AMBI_PERIPHONIC_MASK))
{
- count = AmbiChannelsFromOrder(order);
+ count = static_cast<ALsizei>(AmbiChannelsFromOrder(order));
std::transform(AmbiIndex::From3D.begin(), AmbiIndex::From3D.begin()+count,
std::begin(device->Dry.AmbiMap),
[](const ALsizei &index) noexcept { return BFChannelConfig{1.0f, index}; }
@@ -465,7 +465,7 @@ void InitCustomPanning(ALCdevice *device, const AmbDecConf *conf, const ALsizei
}
else
{
- count = Ambi2DChannelsFromOrder(order);
+ count = static_cast<ALsizei>(Ambi2DChannelsFromOrder(order));
std::transform(AmbiIndex::From2D.begin(), AmbiIndex::From2D.begin()+count,
std::begin(device->Dry.AmbiMap),
[](const ALsizei &index) noexcept { return BFChannelConfig{1.0f, index}; }
@@ -498,7 +498,7 @@ void InitHQPanning(ALCdevice *device, const AmbDecConf *conf, const ALsizei (&sp
ALsizei count;
if((conf->ChanMask&AMBI_PERIPHONIC_MASK))
{
- count = AmbiChannelsFromOrder(order);
+ count = static_cast<ALsizei>(AmbiChannelsFromOrder(order));
std::transform(AmbiIndex::From3D.begin(), AmbiIndex::From3D.begin()+count,
std::begin(device->Dry.AmbiMap),
[](const ALsizei &index) noexcept { return BFChannelConfig{1.0f, index}; }
@@ -506,7 +506,7 @@ void InitHQPanning(ALCdevice *device, const AmbDecConf *conf, const ALsizei (&sp
}
else
{
- count = Ambi2DChannelsFromOrder(order);
+ count = static_cast<ALsizei>(Ambi2DChannelsFromOrder(order));
std::transform(AmbiIndex::From2D.begin(), AmbiIndex::From2D.begin()+count,
std::begin(device->Dry.AmbiMap),
[](const ALsizei &index) noexcept { return BFChannelConfig{1.0f, index}; }
@@ -617,12 +617,12 @@ void InitHrtfPanning(ALCdevice *device)
std::begin(device->Dry.AmbiMap),
[](const ALsizei &index) noexcept { return BFChannelConfig{1.0f, index}; }
);
- device->Dry.NumChannels = count;
+ device->Dry.NumChannels = static_cast<ALsizei>(count);
device->RealOut.NumChannels = device->channelsFromFmt();
BuildBFormatHrtf(device->mHrtf, device->mHrtfState.get(), device->Dry.NumChannels, AmbiPoints,
- AmbiMatrix, static_cast<ALsizei>(COUNTOF(AmbiPoints)), AmbiOrderHFGain);
+ AmbiMatrix, COUNTOF(AmbiPoints), AmbiOrderHFGain);
HrtfEntry *Hrtf{device->mHrtf};
InitNearFieldCtrl(device, Hrtf->field[0].distance, ambi_order, ChansPerOrder);