2017-04-10 09:17:10 -07:00
|
|
|
#ifndef CONVERTER_H
|
|
|
|
#define CONVERTER_H
|
|
|
|
|
|
|
|
#include "alMain.h"
|
|
|
|
#include "alu.h"
|
2018-11-28 22:42:46 -08:00
|
|
|
#include "almalloc.h"
|
2017-04-10 09:17:10 -07:00
|
|
|
|
2018-11-17 07:35:11 -08:00
|
|
|
struct SampleConverter {
|
2018-12-01 11:28:11 -08:00
|
|
|
DevFmtType mSrcType{};
|
|
|
|
DevFmtType mDstType{};
|
|
|
|
ALsizei mNumChannels{};
|
|
|
|
ALsizei mSrcTypeSize{};
|
|
|
|
ALsizei mDstTypeSize{};
|
2017-04-10 09:17:10 -07:00
|
|
|
|
2018-12-01 11:28:11 -08:00
|
|
|
ALint mSrcPrepCount{};
|
2017-04-10 09:17:10 -07:00
|
|
|
|
2018-12-01 11:28:11 -08:00
|
|
|
ALsizei mFracOffset{};
|
|
|
|
ALsizei mIncrement{};
|
|
|
|
InterpState mState{};
|
|
|
|
ResamplerFunc mResample{};
|
2017-04-10 09:17:10 -07:00
|
|
|
|
2018-12-01 11:28:11 -08:00
|
|
|
alignas(16) ALfloat mSrcSamples[BUFFERSIZE]{};
|
|
|
|
alignas(16) ALfloat mDstSamples[BUFFERSIZE]{};
|
2017-04-10 09:17:10 -07:00
|
|
|
|
|
|
|
struct {
|
2018-01-09 23:55:59 -08:00
|
|
|
alignas(16) ALfloat mPrevSamples[MAX_RESAMPLE_PADDING*2];
|
2017-04-10 09:17:10 -07:00
|
|
|
} Chan[];
|
2018-11-28 22:42:46 -08:00
|
|
|
|
|
|
|
DEF_PLACE_NEWDEL()
|
2018-11-17 07:35:11 -08:00
|
|
|
};
|
2017-04-10 09:17:10 -07:00
|
|
|
|
2018-11-28 23:19:25 -08:00
|
|
|
SampleConverter *CreateSampleConverter(enum DevFmtType srcType, enum DevFmtType dstType,
|
|
|
|
ALsizei numchans, ALsizei srcRate, ALsizei dstRate,
|
|
|
|
Resampler resampler);
|
2017-04-10 09:17:10 -07:00
|
|
|
void DestroySampleConverter(SampleConverter **converter);
|
|
|
|
|
2017-04-10 13:40:45 -07:00
|
|
|
ALsizei SampleConverterInput(SampleConverter *converter, const ALvoid **src, ALsizei *srcframes, ALvoid *dst, ALsizei dstframes);
|
2017-04-10 09:17:10 -07:00
|
|
|
ALsizei SampleConverterAvailableOut(SampleConverter *converter, ALsizei srcframes);
|
|
|
|
|
2017-04-11 07:25:55 -07:00
|
|
|
|
2018-11-17 07:35:11 -08:00
|
|
|
struct ChannelConverter {
|
2018-12-01 11:28:11 -08:00
|
|
|
DevFmtType mSrcType;
|
|
|
|
DevFmtChannels mSrcChans;
|
|
|
|
DevFmtChannels mDstChans;
|
|
|
|
|
|
|
|
ChannelConverter(DevFmtType srctype, DevFmtChannels srcchans, DevFmtChannels dstchans)
|
|
|
|
: mSrcType(srctype), mSrcChans(srcchans), mDstChans(dstchans)
|
|
|
|
{ }
|
|
|
|
DEF_NEWDEL(ChannelConverter)
|
2018-11-17 07:35:11 -08:00
|
|
|
};
|
2017-04-11 07:25:55 -07:00
|
|
|
|
|
|
|
ChannelConverter *CreateChannelConverter(enum DevFmtType srcType, enum DevFmtChannels srcChans, enum DevFmtChannels dstChans);
|
|
|
|
void DestroyChannelConverter(ChannelConverter **converter);
|
|
|
|
|
|
|
|
void ChannelConverterInput(ChannelConverter *converter, const ALvoid *src, ALfloat *dst, ALsizei frames);
|
|
|
|
|
2017-04-10 09:17:10 -07:00
|
|
|
#endif /* CONVERTER_H */
|