Don't inline the utf8 converters
[openal-soft.git] / alc / converter.h
blobd8fe7ba9eba25e3569d8fb0563a5c8183180eed9
1 #ifndef CONVERTER_H
2 #define CONVERTER_H
4 #include <cstddef>
5 #include <memory>
7 #include "AL/al.h"
9 #include "alcmain.h"
10 #include "almalloc.h"
11 #include "alnumeric.h"
12 #include "alu.h"
13 #include "devformat.h"
16 struct SampleConverter {
17 DevFmtType mSrcType{};
18 DevFmtType mDstType{};
19 ALuint mSrcTypeSize{};
20 ALuint mDstTypeSize{};
22 ALint mSrcPrepCount{};
24 ALuint mFracOffset{};
25 ALuint mIncrement{};
26 InterpState mState{};
27 ResamplerFunc mResample{};
29 alignas(16) ALfloat mSrcSamples[BUFFERSIZE]{};
30 alignas(16) ALfloat mDstSamples[BUFFERSIZE]{};
32 struct ChanSamples {
33 alignas(16) ALfloat PrevSamples[MAX_RESAMPLER_PADDING];
35 al::FlexArray<ChanSamples> mChan;
37 SampleConverter(size_t numchans) : mChan{numchans} { }
39 ALuint convert(const ALvoid **src, ALuint *srcframes, ALvoid *dst, ALuint dstframes);
40 ALuint availableOut(ALuint srcframes) const;
42 DEF_FAM_NEWDEL(SampleConverter, mChan)
44 using SampleConverterPtr = std::unique_ptr<SampleConverter>;
46 SampleConverterPtr CreateSampleConverter(DevFmtType srcType, DevFmtType dstType, size_t numchans,
47 ALuint srcRate, ALuint dstRate, Resampler resampler);
50 struct ChannelConverter {
51 DevFmtType mSrcType;
52 DevFmtChannels mSrcChans;
53 DevFmtChannels mDstChans;
55 bool is_active() const noexcept { return mSrcChans != mDstChans; }
57 void convert(const ALvoid *src, ALfloat *dst, ALuint frames) const;
60 #endif /* CONVERTER_H */