diff options
-rw-r--r-- | Alc/converter.cpp | 9 | ||||
-rw-r--r-- | Alc/converter.h | 37 |
2 files changed, 22 insertions, 24 deletions
diff --git a/Alc/converter.cpp b/Alc/converter.cpp index 958936a1..3effddd8 100644 --- a/Alc/converter.cpp +++ b/Alc/converter.cpp @@ -341,18 +341,13 @@ ALsizei SampleConverterInput(SampleConverter *converter, const ALvoid **src, ALs } -ChannelConverter *CreateChannelConverter(enum DevFmtType srcType, enum DevFmtChannels srcChans, enum DevFmtChannels dstChans) +ChannelConverter *CreateChannelConverter(DevFmtType srcType, DevFmtChannels srcChans, DevFmtChannels dstChans) { if(srcChans != dstChans && !((srcChans == DevFmtMono && dstChans == DevFmtStereo) || (srcChans == DevFmtStereo && dstChans == DevFmtMono))) return nullptr; - auto converter = new (al_calloc(DEF_ALIGN, sizeof(ChannelConverter))) ChannelConverter{}; - converter->mSrcType = srcType; - converter->mSrcChans = srcChans; - converter->mDstChans = dstChans; - - return converter; + return new ChannelConverter{srcType, srcChans, dstChans}; } void DestroyChannelConverter(ChannelConverter **converter) diff --git a/Alc/converter.h b/Alc/converter.h index e0aeb7d4..7444d4fa 100644 --- a/Alc/converter.h +++ b/Alc/converter.h @@ -6,21 +6,21 @@ #include "almalloc.h" struct SampleConverter { - enum DevFmtType mSrcType; - enum DevFmtType mDstType; - ALsizei mNumChannels; - ALsizei mSrcTypeSize; - ALsizei mDstTypeSize; + DevFmtType mSrcType{}; + DevFmtType mDstType{}; + ALsizei mNumChannels{}; + ALsizei mSrcTypeSize{}; + ALsizei mDstTypeSize{}; - ALint mSrcPrepCount; + ALint mSrcPrepCount{}; - ALsizei mFracOffset; - ALsizei mIncrement; - InterpState mState; - ResamplerFunc mResample; + ALsizei mFracOffset{}; + ALsizei mIncrement{}; + InterpState mState{}; + ResamplerFunc mResample{}; - alignas(16) ALfloat mSrcSamples[BUFFERSIZE]; - alignas(16) ALfloat mDstSamples[BUFFERSIZE]; + alignas(16) ALfloat mSrcSamples[BUFFERSIZE]{}; + alignas(16) ALfloat mDstSamples[BUFFERSIZE]{}; struct { alignas(16) ALfloat mPrevSamples[MAX_RESAMPLE_PADDING*2]; @@ -39,11 +39,14 @@ ALsizei SampleConverterAvailableOut(SampleConverter *converter, ALsizei srcframe struct ChannelConverter { - enum DevFmtType mSrcType; - enum DevFmtChannels mSrcChans; - enum DevFmtChannels mDstChans; - - DEF_PLACE_NEWDEL() + DevFmtType mSrcType; + DevFmtChannels mSrcChans; + DevFmtChannels mDstChans; + + ChannelConverter(DevFmtType srctype, DevFmtChannels srcchans, DevFmtChannels dstchans) + : mSrcType(srctype), mSrcChans(srcchans), mDstChans(dstchans) + { } + DEF_NEWDEL(ChannelConverter) }; ChannelConverter *CreateChannelConverter(enum DevFmtType srcType, enum DevFmtChannels srcChans, enum DevFmtChannels dstChans); |