Use the bsinc resampler for the converter
[openal-soft.git] / Alc / converter.h
blob9934fa4b63f0d188f49ae41d0fc98852e1fd571d
1 #ifndef CONVERTER_H
2 #define CONVERTER_H
4 #include "alMain.h"
5 #include "alu.h"
7 #ifdef __cpluspluc
8 extern "C" {
9 #endif
11 typedef struct SampleConverter {
12 enum DevFmtType mSrcType;
13 enum DevFmtType mDstType;
14 ALsizei mNumChannels;
15 ALsizei mSrcTypeSize;
16 ALsizei mDstTypeSize;
18 ALint mSrcPrepCount;
20 ALsizei mFracOffset;
21 ALsizei mIncrement;
22 InterpState mState;
23 ResamplerFunc mResample;
25 alignas(16) ALfloat mSrcSamples[BUFFERSIZE];
26 alignas(16) ALfloat mDstSamples[BUFFERSIZE];
28 struct {
29 alignas(16) ALfloat mPrevSamples[MAX_PRE_SAMPLES+MAX_POST_SAMPLES];
30 } Chan[];
31 } SampleConverter;
33 SampleConverter *CreateSampleConverter(enum DevFmtType srcType, enum DevFmtType dstType, ALsizei numchans, ALsizei srcRate, ALsizei dstRate);
34 void DestroySampleConverter(SampleConverter **converter);
36 ALsizei SampleConverterInput(SampleConverter *converter, const ALvoid **src, ALsizei *srcframes, ALvoid *dst, ALsizei dstframes);
37 ALsizei SampleConverterAvailableOut(SampleConverter *converter, ALsizei srcframes);
40 typedef struct ChannelConverter {
41 enum DevFmtType mSrcType;
42 enum DevFmtChannels mSrcChans;
43 enum DevFmtChannels mDstChans;
44 } ChannelConverter;
46 ChannelConverter *CreateChannelConverter(enum DevFmtType srcType, enum DevFmtChannels srcChans, enum DevFmtChannels dstChans);
47 void DestroyChannelConverter(ChannelConverter **converter);
49 void ChannelConverterInput(ChannelConverter *converter, const ALvoid *src, ALfloat *dst, ALsizei frames);
51 #ifdef __cpluspluc
53 #endif
55 #endif /* CONVERTER_H */