2017-04-10 16:17:10 +00:00
|
|
|
#ifndef CONVERTER_H
|
|
|
|
#define CONVERTER_H
|
|
|
|
|
|
|
|
#include "alMain.h"
|
|
|
|
#include "alu.h"
|
2018-11-29 06:42:46 +00:00
|
|
|
#include "almalloc.h"
|
2017-04-10 16:17:10 +00:00
|
|
|
|
2018-11-17 15:35:11 +00:00
|
|
|
struct SampleConverter {
|
2017-04-10 16:17:10 +00:00
|
|
|
enum DevFmtType mSrcType;
|
|
|
|
enum DevFmtType mDstType;
|
|
|
|
ALsizei mNumChannels;
|
|
|
|
ALsizei mSrcTypeSize;
|
|
|
|
ALsizei mDstTypeSize;
|
|
|
|
|
|
|
|
ALint mSrcPrepCount;
|
|
|
|
|
|
|
|
ALsizei mFracOffset;
|
|
|
|
ALsizei mIncrement;
|
2017-06-24 17:52:26 +00:00
|
|
|
InterpState mState;
|
2017-04-10 16:17:10 +00:00
|
|
|
ResamplerFunc mResample;
|
|
|
|
|
2017-04-10 16:31:25 +00:00
|
|
|
alignas(16) ALfloat mSrcSamples[BUFFERSIZE];
|
2017-04-10 16:17:10 +00:00
|
|
|
alignas(16) ALfloat mDstSamples[BUFFERSIZE];
|
|
|
|
|
|
|
|
struct {
|
2018-01-10 07:55:59 +00:00
|
|
|
alignas(16) ALfloat mPrevSamples[MAX_RESAMPLE_PADDING*2];
|
2017-04-10 16:17:10 +00:00
|
|
|
} Chan[];
|
2018-11-29 06:42:46 +00:00
|
|
|
|
|
|
|
DEF_PLACE_NEWDEL()
|
2018-11-17 15:35:11 +00:00
|
|
|
};
|
2017-04-10 16:17:10 +00:00
|
|
|
|
2018-11-29 07:19:25 +00:00
|
|
|
SampleConverter *CreateSampleConverter(enum DevFmtType srcType, enum DevFmtType dstType,
|
|
|
|
ALsizei numchans, ALsizei srcRate, ALsizei dstRate,
|
|
|
|
Resampler resampler);
|
2017-04-10 16:17:10 +00:00
|
|
|
void DestroySampleConverter(SampleConverter **converter);
|
|
|
|
|
2017-04-10 20:40:45 +00:00
|
|
|
ALsizei SampleConverterInput(SampleConverter *converter, const ALvoid **src, ALsizei *srcframes, ALvoid *dst, ALsizei dstframes);
|
2017-04-10 16:17:10 +00:00
|
|
|
ALsizei SampleConverterAvailableOut(SampleConverter *converter, ALsizei srcframes);
|
|
|
|
|
2017-04-11 14:25:55 +00:00
|
|
|
|
2018-11-17 15:35:11 +00:00
|
|
|
struct ChannelConverter {
|
2017-04-11 14:25:55 +00:00
|
|
|
enum DevFmtType mSrcType;
|
|
|
|
enum DevFmtChannels mSrcChans;
|
|
|
|
enum DevFmtChannels mDstChans;
|
2018-11-29 06:42:46 +00:00
|
|
|
|
|
|
|
DEF_PLACE_NEWDEL()
|
2018-11-17 15:35:11 +00:00
|
|
|
};
|
2017-04-11 14:25:55 +00: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 16:17:10 +00:00
|
|
|
#endif /* CONVERTER_H */
|