aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2023-12-20 01:53:27 -0800
committerChris Robinson <[email protected]>2023-12-20 01:53:27 -0800
commitaa6e04a5562052db172117043165ae999683b052 (patch)
tree11b36fabd9a542aca0f5ad234d365ce8067dd46d /core
parent59c466077fd6f16af64afcc6260bb61aa4e632dc (diff)
Ensure struct members are initialized
Diffstat (limited to 'core')
-rw-r--r--core/bformatdec.h6
-rw-r--r--core/device.h10
-rw-r--r--core/filters/nfc.h24
-rw-r--r--core/hrtf.h2
-rw-r--r--core/uhjfilter.h2
-rw-r--r--core/voice.h50
6 files changed, 47 insertions, 47 deletions
diff --git a/core/bformatdec.h b/core/bformatdec.h
index 35cf20a2..8513db03 100644
--- a/core/bformatdec.h
+++ b/core/bformatdec.h
@@ -25,15 +25,15 @@ class BFormatDec {
static constexpr size_t sNumBands{2};
struct ChannelDecoderSingle {
- std::array<float,MaxOutputChannels> mGains;
+ std::array<float,MaxOutputChannels> mGains{};
};
struct ChannelDecoderDual {
BandSplitter mXOver;
- std::array<std::array<float,MaxOutputChannels>,sNumBands> mGains;
+ std::array<std::array<float,MaxOutputChannels>,sNumBands> mGains{};
};
- alignas(16) std::array<FloatBufferLine,2> mSamples;
+ alignas(16) std::array<FloatBufferLine,2> mSamples{};
const std::unique_ptr<FrontStablizer> mStablizer;
diff --git a/core/device.h b/core/device.h
index d85b9254..f02700c6 100644
--- a/core/device.h
+++ b/core/device.h
@@ -237,17 +237,17 @@ struct DeviceBase {
static constexpr size_t MixerLineSize{BufferLineSize + DecoderBase::sMaxPadding};
static constexpr size_t MixerChannelsMax{16};
using MixerBufferLine = std::array<float,MixerLineSize>;
- alignas(16) std::array<MixerBufferLine,MixerChannelsMax> mSampleData;
- alignas(16) std::array<float,MixerLineSize+MaxResamplerPadding> mResampleData;
+ alignas(16) std::array<MixerBufferLine,MixerChannelsMax> mSampleData{};
+ alignas(16) std::array<float,MixerLineSize+MaxResamplerPadding> mResampleData{};
- alignas(16) std::array<float,BufferLineSize> FilteredData;
+ alignas(16) std::array<float,BufferLineSize> FilteredData{};
union {
- alignas(16) std::array<float,BufferLineSize+HrtfHistoryLength> HrtfSourceData;
+ alignas(16) std::array<float,BufferLineSize+HrtfHistoryLength> HrtfSourceData{};
alignas(16) std::array<float,BufferLineSize> NfcSampleData;
};
/* Persistent storage for HRTF mixing. */
- alignas(16) std::array<float2,BufferLineSize+HrirLength> HrtfAccumData;
+ alignas(16) std::array<float2,BufferLineSize+HrirLength> HrtfAccumData{};
/* Mixing buffer used by the Dry mix and Real output. */
al::vector<FloatBufferLine, 16> MixBuffer;
diff --git a/core/filters/nfc.h b/core/filters/nfc.h
index 7d0a7488..9c58f863 100644
--- a/core/filters/nfc.h
+++ b/core/filters/nfc.h
@@ -8,24 +8,24 @@
struct NfcFilter1 {
- float base_gain, gain;
- float b1, a1;
- std::array<float,1> z;
+ float base_gain{1.0f}, gain{1.0f};
+ float b1{}, a1{};
+ std::array<float,1> z{};
};
struct NfcFilter2 {
- float base_gain, gain;
- float b1, b2, a1, a2;
- std::array<float,2> z;
+ float base_gain{1.0f}, gain{1.0f};
+ float b1{}, b2{}, a1{}, a2{};
+ std::array<float,2> z{};
};
struct NfcFilter3 {
- float base_gain, gain;
- float b1, b2, b3, a1, a2, a3;
- std::array<float,3> z;
+ float base_gain{1.0f}, gain{1.0f};
+ float b1{}, b2{}, b3{}, a1{}, a2{}, a3{};
+ std::array<float,3> z{};
};
struct NfcFilter4 {
- float base_gain, gain;
- float b1, b2, b3, b4, a1, a2, a3, a4;
- std::array<float,4> z;
+ float base_gain{1.0f}, gain{1.0f};
+ float b1{}, b2{}, b3{}, b4{}, a1{}, a2{}, a3{}, a4{};
+ std::array<float,4> z{};
};
class NfcFilter {
diff --git a/core/hrtf.h b/core/hrtf.h
index e0263493..7a1a8b69 100644
--- a/core/hrtf.h
+++ b/core/hrtf.h
@@ -61,7 +61,7 @@ struct AngularPoint {
struct DirectHrtfState {
- std::array<float,BufferLineSize> mTemp;
+ std::array<float,BufferLineSize> mTemp{};
/* HRTF filter state for dry buffer content */
uint mIrSize{0};
diff --git a/core/uhjfilter.h b/core/uhjfilter.h
index 58576beb..74ff2167 100644
--- a/core/uhjfilter.h
+++ b/core/uhjfilter.h
@@ -25,7 +25,7 @@ extern UhjQualityType UhjEncodeQuality;
struct UhjAllPassFilter {
struct AllPassState {
/* Last two delayed components for direct form II. */
- std::array<float,2> z;
+ std::array<float,2> z{};
};
std::array<AllPassState,4> mState;
diff --git a/core/voice.h b/core/voice.h
index 2ecc8148..aaf1c5fd 100644
--- a/core/voice.h
+++ b/core/voice.h
@@ -66,14 +66,14 @@ struct DirectParams {
NfcFilter NFCtrlFilter;
struct {
- HrtfFilter Old;
- HrtfFilter Target;
- alignas(16) std::array<float,HrtfHistoryLength> History;
+ HrtfFilter Old{};
+ HrtfFilter Target{};
+ alignas(16) std::array<float,HrtfHistoryLength> History{};
} Hrtf;
struct {
- std::array<float,MaxOutputChannels> Current;
- std::array<float,MaxOutputChannels> Target;
+ std::array<float,MaxOutputChannels> Current{};
+ std::array<float,MaxOutputChannels> Target{};
} Gains;
};
@@ -82,8 +82,8 @@ struct SendParams {
BiquadFilter HighPass;
struct {
- std::array<float,MaxAmbiChannels> Current;
- std::array<float,MaxAmbiChannels> Target;
+ std::array<float,MaxAmbiChannels> Current{};
+ std::array<float,MaxAmbiChannels> Target{};
} Gains;
};
@@ -184,7 +184,7 @@ struct Voice {
std::atomic<VoicePropsItem*> mUpdate{nullptr};
- VoiceProps mProps;
+ VoiceProps mProps{};
std::atomic<uint> mSourceID{0u};
std::atomic<State> mPlayState{Stopped};
@@ -194,30 +194,30 @@ struct Voice {
* Source offset in samples, relative to the currently playing buffer, NOT
* the whole queue.
*/
- std::atomic<int> mPosition;
+ std::atomic<int> mPosition{};
/** Fractional (fixed-point) offset to the next sample. */
- std::atomic<uint> mPositionFrac;
+ std::atomic<uint> mPositionFrac{};
/* Current buffer queue item being played. */
- std::atomic<VoiceBufferItem*> mCurrentBuffer;
+ std::atomic<VoiceBufferItem*> mCurrentBuffer{};
/* Buffer queue item to loop to at end of queue (will be NULL for non-
* looping voices).
*/
- std::atomic<VoiceBufferItem*> mLoopBuffer;
+ std::atomic<VoiceBufferItem*> mLoopBuffer{};
std::chrono::nanoseconds mStartTime{};
/* Properties for the attached buffer(s). */
- FmtChannels mFmtChannels;
- FmtType mFmtType;
- uint mFrequency;
- uint mFrameStep; /**< In steps of the sample type size. */
- uint mBytesPerBlock; /**< Or for PCM formats, BytesPerFrame. */
- uint mSamplesPerBlock; /**< Always 1 for PCM formats. */
- AmbiLayout mAmbiLayout;
- AmbiScaling mAmbiScaling;
- uint mAmbiOrder;
+ FmtChannels mFmtChannels{};
+ FmtType mFmtType{};
+ uint mFrequency{};
+ uint mFrameStep{}; /**< In steps of the sample type size. */
+ uint mBytesPerBlock{}; /**< Or for PCM formats, BytesPerFrame. */
+ uint mSamplesPerBlock{}; /**< Always 1 for PCM formats. */
+ AmbiLayout mAmbiLayout{};
+ AmbiScaling mAmbiScaling{};
+ uint mAmbiOrder{};
std::unique_ptr<DecoderBase> mDecoder;
uint mDecoderPadding{};
@@ -225,16 +225,16 @@ struct Voice {
/** Current target parameters used for mixing. */
uint mStep{0};
- ResamplerFunc mResampler;
+ ResamplerFunc mResampler{};
- InterpState mResampleState;
+ InterpState mResampleState{};
std::bitset<VoiceFlagCount> mFlags{};
uint mNumCallbackBlocks{0};
uint mCallbackBlockBase{0};
struct TargetData {
- int FilterType;
+ int FilterType{};
al::span<FloatBufferLine> Buffer;
};
TargetData mDirect;
@@ -249,7 +249,7 @@ struct Voice {
al::vector<HistoryLine,16> mPrevSamples{2};
struct ChannelData {
- float mAmbiHFScale, mAmbiLFScale;
+ float mAmbiHFScale{}, mAmbiLFScale{};
BandSplitter mAmbiSplitter;
DirectParams mDryParams;