Use a variable counter for an array size limit
[openal-soft.git] / Alc / bformatdec.h
blob889d59f4f1a623e0242c45a8a2b51a95aa165c76
1 #ifndef BFORMATDEC_H
2 #define BFORMATDEC_H
4 #include "alMain.h"
7 /* These are the necessary scales for first-order HF responses to play over
8 * higher-order 2D (non-periphonic) decoders.
9 */
10 #define W_SCALE2D_SECOND 1.224744871f /* sqrt(1.5) */
11 #define XYZ_SCALE2D_SECOND 1.0f
12 #define W_SCALE2D_THIRD 1.414213562f /* sqrt(2) */
13 #define XYZ_SCALE2D_THIRD 1.082392196f
15 /* These are the necessary scales for first-order HF responses to play over
16 * higher-order 3D (periphonic) decoders.
18 #define W_SCALE3D_SECOND 1.341640787f /* sqrt(1.8) */
19 #define XYZ_SCALE3D_SECOND 1.0f
20 #define W_SCALE3D_THIRD 1.695486018f
21 #define XYZ_SCALE3D_THIRD 1.136697713f
24 struct AmbDecConf;
25 struct BFormatDec;
26 struct AmbiUpsampler;
29 struct BFormatDec *bformatdec_alloc();
30 void bformatdec_free(struct BFormatDec *dec);
31 int bformatdec_getOrder(const struct BFormatDec *dec);
32 void bformatdec_reset(struct BFormatDec *dec, const struct AmbDecConf *conf, ALsizei chancount, ALuint srate, const ALsizei chanmap[MAX_OUTPUT_CHANNELS]);
34 /* Decodes the ambisonic input to the given output channels. */
35 void bformatdec_process(struct BFormatDec *dec, ALfloat (*restrict OutBuffer)[BUFFERSIZE], ALsizei OutChannels, const ALfloat (*restrict InSamples)[BUFFERSIZE], ALsizei SamplesToDo);
37 /* Up-samples a first-order input to the decoder's configuration. */
38 void bformatdec_upSample(struct BFormatDec *dec, ALfloat (*restrict OutBuffer)[BUFFERSIZE], const ALfloat (*restrict InSamples)[BUFFERSIZE], ALsizei InChannels, ALsizei SamplesToDo);
41 /* Stand-alone first-order upsampler. Kept here because it shares some stuff
42 * with bformatdec.
44 struct AmbiUpsampler *ambiup_alloc();
45 void ambiup_free(struct AmbiUpsampler *ambiup);
46 void ambiup_reset(struct AmbiUpsampler *ambiup, const ALCdevice *device);
48 void ambiup_process(struct AmbiUpsampler *ambiup, ALfloat (*restrict OutBuffer)[BUFFERSIZE], ALsizei OutChannels, const ALfloat (*restrict InSamples)[BUFFERSIZE], ALsizei SamplesToDo);
51 /* Band splitter. Splits a signal into two phase-matching frequency bands. */
52 typedef struct BandSplitter {
53 ALfloat coeff;
54 ALfloat lp_z1;
55 ALfloat lp_z2;
56 ALfloat hp_z1;
57 } BandSplitter;
59 void bandsplit_init(BandSplitter *splitter, ALfloat freq_mult);
60 void bandsplit_clear(BandSplitter *splitter);
61 void bandsplit_process(BandSplitter *splitter, ALfloat *restrict hpout, ALfloat *restrict lpout,
62 const ALfloat *input, ALsizei count);
64 #endif /* BFORMATDEC_H */