Try to pacify MSVC's missing a suitable default constructor

This commit is contained in:
Chris Robinson
2018-12-01 11:28:11 -08:00
parent cc161fe7c1
commit 255c07def9
2 changed files with 21 additions and 23 deletions
+2 -7
View File
@@ -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)
+19 -16
View File
@@ -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;
DevFmtType mSrcType;
DevFmtChannels mSrcChans;
DevFmtChannels mDstChans;
DEF_PLACE_NEWDEL()
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);