aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Alc/alc.cpp4
-rw-r--r--Alc/backends/coreaudio.cpp2
-rw-r--r--Alc/backends/wasapi.cpp2
-rw-r--r--Alc/backends/winmm.cpp4
-rw-r--r--Alc/bformatdec.cpp6
-rw-r--r--Alc/bformatdec.h4
-rw-r--r--Alc/bs2b.cpp2
-rw-r--r--Alc/effects/reverb.cpp6
-rw-r--r--Alc/panning.cpp40
-rw-r--r--Alc/ringbuffer.cpp2
-rw-r--r--OpenAL32/Include/alu.h6
-rw-r--r--OpenAL32/alAuxEffectSlot.cpp2
-rw-r--r--common/almalloc.cpp4
13 files changed, 38 insertions, 46 deletions
diff --git a/Alc/alc.cpp b/Alc/alc.cpp
index 810cba10..1d36dcbd 100644
--- a/Alc/alc.cpp
+++ b/Alc/alc.cpp
@@ -1263,8 +1263,8 @@ static void alc_deinit(void)
alc_cleanup();
- memset(&PlaybackBackend, 0, sizeof(PlaybackBackend));
- memset(&CaptureBackend, 0, sizeof(CaptureBackend));
+ PlaybackBackend = BackendInfo{};
+ CaptureBackend = BackendInfo{};
for(i = 0;i < BackendListSize;i++)
BackendList[i].getFactory().deinit();
diff --git a/Alc/backends/coreaudio.cpp b/Alc/backends/coreaudio.cpp
index f5574965..b2f6d2d3 100644
--- a/Alc/backends/coreaudio.cpp
+++ b/Alc/backends/coreaudio.cpp
@@ -68,7 +68,7 @@ static void ALCcoreAudioPlayback_Construct(ALCcoreAudioPlayback *self, ALCdevice
SET_VTABLE2(ALCcoreAudioPlayback, ALCbackend, self);
self->FrameSize = 0;
- memset(&self->Format, 0, sizeof(self->Format));
+ self->Format = AudioStreamBasicDescription{};
}
static void ALCcoreAudioPlayback_Destruct(ALCcoreAudioPlayback *self)
diff --git a/Alc/backends/wasapi.cpp b/Alc/backends/wasapi.cpp
index 04afe807..b928682f 100644
--- a/Alc/backends/wasapi.cpp
+++ b/Alc/backends/wasapi.cpp
@@ -637,7 +637,7 @@ FORCE_ALIGN int ALCwasapiPlayback_mixerProc(ALCwasapiPlayback *self)
ALCboolean MakeExtensible(WAVEFORMATEXTENSIBLE *out, const WAVEFORMATEX *in)
{
- memset(out, 0, sizeof(*out));
+ *out = WAVEFORMATEXTENSIBLE{};
if(in->wFormatTag == WAVE_FORMAT_EXTENSIBLE)
*out = *(const WAVEFORMATEXTENSIBLE*)in;
else if(in->wFormatTag == WAVE_FORMAT_PCM)
diff --git a/Alc/backends/winmm.cpp b/Alc/backends/winmm.cpp
index c88a43b6..32cabbde 100644
--- a/Alc/backends/winmm.cpp
+++ b/Alc/backends/winmm.cpp
@@ -246,7 +246,7 @@ ALCenum ALCwinmmPlayback_open(ALCwinmmPlayback *self, const ALCchar *deviceName)
UINT DeviceID{static_cast<UINT>(std::distance(PlaybackDevices.cbegin(), iter))};
retry_open:
- memset(&self->Format, 0, sizeof(WAVEFORMATEX));
+ self->Format = WAVEFORMATEX{};
if(device->FmtType == DevFmtFloat)
{
self->Format.wFormatTag = WAVE_FORMAT_IEEE_FLOAT;
@@ -554,7 +554,7 @@ ALCenum ALCwinmmCapture_open(ALCwinmmCapture *self, const ALCchar *deviceName)
return ALC_INVALID_ENUM;
}
- memset(&self->Format, 0, sizeof(WAVEFORMATEX));
+ self->Format = WAVEFORMATEX{};
self->Format.wFormatTag = (device->FmtType == DevFmtFloat) ?
WAVE_FORMAT_IEEE_FLOAT : WAVE_FORMAT_PCM;
self->Format.nChannels = ChannelsFromDevFmt(device->FmtChans, device->mAmbiOrder);
diff --git a/Alc/bformatdec.cpp b/Alc/bformatdec.cpp
index 7af3a864..60e52b1b 100644
--- a/Alc/bformatdec.cpp
+++ b/Alc/bformatdec.cpp
@@ -170,7 +170,7 @@ void BFormatDec::reset(const AmbDecConf *conf, ALsizei chancount, ALuint srate,
mUpSampler[3].Gains[LF_BAND] = 0.0f;
}
- memset(&mMatrix, 0, sizeof(mMatrix));
+ mMatrix = MatrixU{};
if(conf->FreqBands == 1)
{
mDualBand = AL_FALSE;
@@ -358,7 +358,7 @@ void AmbiUpsampler::reset(const ALCdevice *device, const ALfloat w_scale, const
mXOver[0].init(400.0f / (float)device->Frequency);
std::fill(std::begin(mXOver)+1, std::end(mXOver), mXOver[0]);
- memset(mGains, 0, sizeof(mGains));
+ mGains.fill({});
if(device->Dry.CoeffCount > 0)
{
ALfloat encgains[8][MAX_OUTPUT_CHANNELS];
@@ -411,6 +411,6 @@ void AmbiUpsampler::process(ALfloat (*RESTRICT OutBuffer)[BUFFERSIZE], const ALs
mXOver[i].process(mSamples[HF_BAND], mSamples[LF_BAND], InSamples[i], SamplesToDo);
for(ALsizei j{0};j < OutChannels;j++)
- MixRowSamples(OutBuffer[j], mGains[i][j], mSamples, sNumBands, 0, SamplesToDo);
+ MixRowSamples(OutBuffer[j], mGains[i][j].data(), mSamples, sNumBands, 0, SamplesToDo);
}
}
diff --git a/Alc/bformatdec.h b/Alc/bformatdec.h
index 73754be8..f2cdcdfb 100644
--- a/Alc/bformatdec.h
+++ b/Alc/bformatdec.h
@@ -41,7 +41,7 @@ public:
private:
ALuint mEnabled; /* Bitfield of enabled channels. */
- union {
+ union MatrixU {
alignas(16) ALfloat Dual[MAX_OUTPUT_CHANNELS][sNumBands][MAX_AMBI_COEFFS];
alignas(16) ALfloat Single[MAX_OUTPUT_CHANNELS][MAX_AMBI_COEFFS];
} mMatrix;
@@ -89,7 +89,7 @@ private:
BandSplitter mXOver[4];
- ALfloat mGains[4][MAX_OUTPUT_CHANNELS][sNumBands];
+ std::array<std::array<std::array<ALfloat,sNumBands>,MAX_OUTPUT_CHANNELS>,4> mGains;
public:
void reset(const ALCdevice *device, const ALfloat w_scale, const ALfloat xyz_scale);
diff --git a/Alc/bs2b.cpp b/Alc/bs2b.cpp
index 1307e5c1..b1833b8c 100644
--- a/Alc/bs2b.cpp
+++ b/Alc/bs2b.cpp
@@ -127,7 +127,7 @@ int bs2b_get_srate(struct bs2b *bs2b)
void bs2b_clear(struct bs2b *bs2b)
{
- std::memset(&bs2b->last_sample, 0, sizeof(bs2b->last_sample));
+ std::fill(std::begin(bs2b->last_sample), std::end(bs2b->last_sample), bs2b::t_last_sample{});
} /* bs2b_clear */
void bs2b_cross_feed(struct bs2b *bs2b, float *RESTRICT Left, float *RESTRICT Right, int SamplesToDo)
diff --git a/Alc/effects/reverb.cpp b/Alc/effects/reverb.cpp
index ce7a9946..b5e6dd94 100644
--- a/Alc/effects/reverb.cpp
+++ b/Alc/effects/reverb.cpp
@@ -821,14 +821,12 @@ static ALvoid Update3DPanning(const ALCdevice *Device, const ALfloat *Reflection
*/
rot = GetTransformFromVector(ReflectionsPan);
MATRIX_MULT(transform, rot, A2B);
- memset(&State->mEarly.PanGain, 0, sizeof(State->mEarly.PanGain));
for(i = 0;i < MAX_EFFECT_CHANNELS;i++)
ComputePanGains(&Device->FOAOut, transform.m[i], earlyGain,
State->mEarly.PanGain[i]);
rot = GetTransformFromVector(LateReverbPan);
MATRIX_MULT(transform, rot, A2B);
- memset(&State->mLate.PanGain, 0, sizeof(State->mLate.PanGain));
for(i = 0;i < MAX_EFFECT_CHANNELS;i++)
ComputePanGains(&Device->FOAOut, transform.m[i], lateGain,
State->mLate.PanGain[i]);
@@ -1379,11 +1377,13 @@ void ReverbState::process(ALsizei SamplesToDo, const ALfloat (*RESTRICT SamplesI
todo &= ~3;
/* Convert B-Format to A-Format for processing. */
- memset(afmt, 0, sizeof(*afmt)*NUM_LINES);
for(c = 0;c < NUM_LINES;c++)
+ {
+ std::fill(std::begin(afmt[c]), std::end(afmt[c]), 0.0f);
MixRowSamples(afmt[c], B2A.m[c],
SamplesIn, MAX_EFFECT_CHANNELS, base, todo
);
+ }
/* Process the samples for reverb. */
for(c = 0;c < NUM_LINES;c++)
diff --git a/Alc/panning.cpp b/Alc/panning.cpp
index f970799b..a8d593ce 100644
--- a/Alc/panning.cpp
+++ b/Alc/panning.cpp
@@ -26,6 +26,8 @@
#include <ctype.h>
#include <assert.h>
+#include <algorithm>
+
#include "alMain.h"
#include "alAuxEffectSlot.h"
#include "alu.h"
@@ -147,29 +149,25 @@ void CalcAmbiCoeffs(const ALfloat y, const ALfloat z, const ALfloat x, const ALf
}
-void ComputePanningGainsMC(const ChannelConfig *chancoeffs, ALsizei numchans, ALsizei numcoeffs, const ALfloat*RESTRICT coeffs, ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS])
+void ComputePanningGainsMC(const ChannelConfig *chancoeffs, ALsizei numchans, ALsizei numcoeffs, const ALfloat*RESTRICT coeffs, ALfloat ingain, ALfloat (&gains)[MAX_OUTPUT_CHANNELS])
{
- ALsizei i, j;
-
+ ALsizei i;
for(i = 0;i < numchans;i++)
{
float gain = 0.0f;
- for(j = 0;j < numcoeffs;j++)
+ for(ALsizei j{0};j < numcoeffs;j++)
gain += chancoeffs[i][j]*coeffs[j];
gains[i] = clampf(gain, 0.0f, 1.0f) * ingain;
}
- for(;i < MAX_OUTPUT_CHANNELS;i++)
- gains[i] = 0.0f;
+ std::fill(std::begin(gains)+i, std::end(gains), 0.0f);
}
-void ComputePanningGainsBF(const BFChannelConfig *chanmap, ALsizei numchans, const ALfloat*RESTRICT coeffs, ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS])
+void ComputePanningGainsBF(const BFChannelConfig *chanmap, ALsizei numchans, const ALfloat*RESTRICT coeffs, ALfloat ingain, ALfloat (&gains)[MAX_OUTPUT_CHANNELS])
{
ALsizei i;
-
for(i = 0;i < numchans;i++)
gains[i] = chanmap[i].Scale * coeffs[chanmap[i].Index] * ingain;
- for(;i < MAX_OUTPUT_CHANNELS;i++)
- gains[i] = 0.0f;
+ std::fill(std::begin(gains)+i, std::end(gains), 0.0f);
}
@@ -543,7 +541,7 @@ static void InitPanning(ALCdevice *device)
/* FOA output is always ACN+N3D for higher-order ambisonic output.
* The upsampler expects this and will convert it for output.
*/
- memset(&device->FOAOut.Ambi, 0, sizeof(device->FOAOut.Ambi));
+ device->FOAOut.Ambi = AmbiConfig{};
for(i = 0;i < 4;i++)
{
device->FOAOut.Ambi.Map[i].Scale = 1.0f;
@@ -588,7 +586,7 @@ static void InitPanning(ALCdevice *device)
xyz_scale = (device->Dry.CoeffCount > 9) ? XYZ_SCALE_3H0P :
(device->Dry.CoeffCount > 4) ? XYZ_SCALE_2H0P : 1.0f;
- memset(&device->FOAOut.Ambi, 0, sizeof(device->FOAOut.Ambi));
+ device->FOAOut.Ambi = AmbiConfig{};
for(i = 0;i < device->Dry.NumChannels;i++)
{
device->FOAOut.Ambi.Coeffs[i][0] = device->Dry.Ambi.Coeffs[i][0] * w_scale;
@@ -671,7 +669,7 @@ static void InitCustomPanning(ALCdevice *device, const AmbDecConf *conf, const A
device->Dry.CoeffCount = (conf->ChanMask > 0x1ff) ? 16 :
(conf->ChanMask > 0xf) ? 9 : 4;
- memset(&device->FOAOut.Ambi, 0, sizeof(device->FOAOut.Ambi));
+ device->FOAOut.Ambi = AmbiConfig{};
for(i = 0;i < device->Dry.NumChannels;i++)
{
device->FOAOut.Ambi.Coeffs[i][0] = device->Dry.Ambi.Coeffs[i][0] * w_scale;
@@ -734,7 +732,7 @@ static void InitHQPanning(ALCdevice *device, const AmbDecConf *conf, const ALsiz
}
else
{
- memset(&device->FOAOut.Ambi, 0, sizeof(device->FOAOut.Ambi));
+ device->FOAOut.Ambi = AmbiConfig{};
if((conf->ChanMask&AMBI_PERIPHONIC_MASK))
{
count = 4;
@@ -869,7 +867,7 @@ static void InitHrtfPanning(ALCdevice *device)
if(device->AmbiUp)
{
- memset(&device->FOAOut.Ambi, 0, sizeof(device->FOAOut.Ambi));
+ device->FOAOut.Ambi = AmbiConfig{};
for(i = 0;i < 4;i++)
{
device->FOAOut.Ambi.Map[i].Scale = 1.0f;
@@ -1207,15 +1205,11 @@ no_hrtf:
void aluInitEffectPanning(ALeffectslot *slot)
{
- ALsizei i;
-
- memset(slot->ChanMap, 0, sizeof(slot->ChanMap));
- slot->NumChannels = 0;
-
- for(i = 0;i < MAX_EFFECT_CHANNELS;i++)
+ ALsizei i{0};
+ for(auto &chanmap : slot->ChanMap)
{
- slot->ChanMap[i].Scale = 1.0f;
- slot->ChanMap[i].Index = i;
+ chanmap.Scale = 1.0f;
+ chanmap.Index = i++;
}
slot->NumChannels = i;
}
diff --git a/Alc/ringbuffer.cpp b/Alc/ringbuffer.cpp
index db44f8ae..5ee2616f 100644
--- a/Alc/ringbuffer.cpp
+++ b/Alc/ringbuffer.cpp
@@ -84,7 +84,7 @@ void ll_ringbuffer_reset(ll_ringbuffer_t *rb)
{
rb->write_ptr.store(0, std::memory_order_relaxed);
rb->read_ptr.store(0, std::memory_order_relaxed);
- memset(rb->buf, 0, (rb->size_mask+1)*rb->elem_size);
+ std::fill_n(rb->buf+0, (rb->size_mask+1)*rb->elem_size, 0);
}
diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h
index 8a11b500..3cd9b557 100644
--- a/OpenAL32/Include/alu.h
+++ b/OpenAL32/Include/alu.h
@@ -457,8 +457,8 @@ inline float ScaleAzimuthFront(float azimuth, float scale)
}
-void ComputePanningGainsMC(const ChannelConfig *chancoeffs, ALsizei numchans, ALsizei numcoeffs, const ALfloat*RESTRICT coeffs, ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]);
-void ComputePanningGainsBF(const BFChannelConfig *chanmap, ALsizei numchans, const ALfloat*RESTRICT coeffs, ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]);
+void ComputePanningGainsMC(const ChannelConfig *chancoeffs, ALsizei numchans, ALsizei numcoeffs, const ALfloat*RESTRICT coeffs, ALfloat ingain, ALfloat (&gains)[MAX_OUTPUT_CHANNELS]);
+void ComputePanningGainsBF(const BFChannelConfig *chanmap, ALsizei numchans, const ALfloat*RESTRICT coeffs, ALfloat ingain, ALfloat (&gains)[MAX_OUTPUT_CHANNELS]);
/**
* ComputePanGains
@@ -468,7 +468,7 @@ void ComputePanningGainsBF(const BFChannelConfig *chanmap, ALsizei numchans, con
* coeffs are a 'slice' of a transform matrix for the input channel, used to
* scale and orient the sound samples.
*/
-inline void ComputePanGains(const MixParams *dry, const ALfloat*RESTRICT coeffs, ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS])
+inline void ComputePanGains(const MixParams *dry, const ALfloat*RESTRICT coeffs, ALfloat ingain, ALfloat (&gains)[MAX_OUTPUT_CHANNELS])
{
if(dry->CoeffCount > 0)
ComputePanningGainsMC(dry->Ambi.Coeffs, dry->NumChannels, dry->CoeffCount,
diff --git a/OpenAL32/alAuxEffectSlot.cpp b/OpenAL32/alAuxEffectSlot.cpp
index ad33fe50..1e841c43 100644
--- a/OpenAL32/alAuxEffectSlot.cpp
+++ b/OpenAL32/alAuxEffectSlot.cpp
@@ -532,7 +532,7 @@ ALenum InitializeEffect(ALCcontext *Context, ALeffectslot *EffectSlot, ALeffect
if(!effect)
{
EffectSlot->Effect.Type = AL_EFFECT_NULL;
- memset(&EffectSlot->Effect.Props, 0, sizeof(EffectSlot->Effect.Props));
+ EffectSlot->Effect.Props = ALeffectProps{};
}
else
{
diff --git a/common/almalloc.cpp b/common/almalloc.cpp
index 6dcb6cfc..7e83672b 100644
--- a/common/almalloc.cpp
+++ b/common/almalloc.cpp
@@ -88,9 +88,7 @@ size_t al_get_page_size(void) noexcept
#ifdef _WIN32
if(!psize)
{
- SYSTEM_INFO sysinfo;
- memset(&sysinfo, 0, sizeof(sysinfo));
-
+ SYSTEM_INFO sysinfo{};
GetSystemInfo(&sysinfo);
psize = sysinfo.dwPageSize;
}