diff options
author | Chris Robinson <[email protected]> | 2020-03-23 15:04:26 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2020-03-23 15:04:26 -0700 |
commit | b53294e291c0e00b94639527ae84d03037029f1a (patch) | |
tree | 70e6851b61e771aa8cbb65b6d8b2f20daae920cf /al/source.h | |
parent | 5d0f90fed0bd9f6516d5b0ce94fa6d58057c2e48 (diff) |
Use inline initialization more for sources
Diffstat (limited to 'al/source.h')
-rw-r--r-- | al/source.h | 90 |
1 files changed, 46 insertions, 44 deletions
diff --git a/al/source.h b/al/source.h index 4a6a2531..a800f299 100644 --- a/al/source.h +++ b/al/source.h @@ -5,6 +5,7 @@ #include <atomic> #include <cstddef> #include <iterator> +#include <limits> #include "AL/al.h" #include "AL/alc.h" @@ -13,6 +14,7 @@ #include "almalloc.h" #include "alnumeric.h" #include "alu.h" +#include "math_defs.h" #include "vector.h" struct ALbuffer; @@ -34,59 +36,59 @@ struct ALbufferlistitem { struct ALsource { /** Source properties. */ - ALfloat Pitch; - ALfloat Gain; - ALfloat OuterGain; - ALfloat MinGain; - ALfloat MaxGain; - ALfloat InnerAngle; - ALfloat OuterAngle; - ALfloat RefDistance; - ALfloat MaxDistance; - ALfloat RolloffFactor; - std::array<ALfloat,3> Position; - std::array<ALfloat,3> Velocity; - std::array<ALfloat,3> Direction; - std::array<ALfloat,3> OrientAt; - std::array<ALfloat,3> OrientUp; - bool HeadRelative; - bool Looping; - DistanceModel mDistanceModel; - Resampler mResampler; - DirectMode DirectChannels; - SpatializeMode mSpatialize; - - bool DryGainHFAuto; - bool WetGainAuto; - bool WetGainHFAuto; - ALfloat OuterGainHF; - - ALfloat AirAbsorptionFactor; - ALfloat RoomRolloffFactor; - ALfloat DopplerFactor; + float Pitch{1.0f}; + float Gain{1.0f}; + float OuterGain{0.0f}; + float MinGain{0.0f}; + float MaxGain{1.0f}; + float InnerAngle{360.0f}; + float OuterAngle{360.0f}; + float RefDistance{1.0f}; + float MaxDistance{std::numeric_limits<float>::max()}; + float RolloffFactor{1.0f}; + std::array<float,3> Position{{0.0f, 0.0f, 0.0f}}; + std::array<float,3> Velocity{{0.0f, 0.0f, 0.0f}}; + std::array<float,3> Direction{{0.0f, 0.0f, 0.0f}}; + std::array<float,3> OrientAt{{0.0f, 0.0f, -1.0f}}; + std::array<float,3> OrientUp{{0.0f, 1.0f, 0.0f}}; + bool HeadRelative{false}; + bool Looping{false}; + DistanceModel mDistanceModel{DistanceModel::Default}; + Resampler mResampler{ResamplerDefault}; + DirectMode DirectChannels{DirectMode::Off}; + SpatializeMode mSpatialize{SpatializeAuto}; + + bool DryGainHFAuto{true}; + bool WetGainAuto{true}; + bool WetGainHFAuto{true}; + float OuterGainHF{1.0f}; + + float AirAbsorptionFactor{0.0f}; + float RoomRolloffFactor{0.0f}; + float DopplerFactor{1.0f}; /* NOTE: Stereo pan angles are specified in radians, counter-clockwise * rather than clockwise. */ - std::array<ALfloat,2> StereoPan; + std::array<float,2> StereoPan{{Deg2Rad( 30.0f), Deg2Rad(-30.0f)}}; - ALfloat Radius; + float Radius{0.0f}; /** Direct filter and auxiliary send info. */ struct { - ALfloat Gain; - ALfloat GainHF; - ALfloat HFReference; - ALfloat GainLF; - ALfloat LFReference; + float Gain; + float GainHF; + float HFReference; + float GainLF; + float LFReference; } Direct; struct SendData { ALeffectslot *Slot; - ALfloat Gain; - ALfloat GainHF; - ALfloat HFReference; - ALfloat GainLF; - ALfloat LFReference; + float Gain; + float GainHF; + float HFReference; + float GainLF; + float LFReference; }; std::array<SendData,MAX_SENDS> Send; @@ -94,8 +96,8 @@ struct ALsource { * Last user-specified offset, and the offset type (bytes, samples, or * seconds). */ - ALdouble Offset{0.0}; - ALenum OffsetType{AL_NONE}; + double Offset{0.0}; + ALenum OffsetType{AL_NONE}; /** Source type (static, streaming, or undetermined) */ ALenum SourceType{AL_UNDETERMINED}; |