Implement opening and closing devices in the router
[openal-soft.git] / Alc / bformatdec.h
blob162f265223997ec8c75c93ee9c1c6fa61c284aea
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 void bformatdec_reset(struct BFormatDec *dec, const struct AmbDecConf *conf, ALsizei chancount, ALuint srate, const ALsizei chanmap[MAX_OUTPUT_CHANNELS]);
33 /* Decodes the ambisonic input to the given output channels. */
34 void bformatdec_process(struct BFormatDec *dec, ALfloat (*restrict OutBuffer)[BUFFERSIZE], ALsizei OutChannels, const ALfloat (*restrict InSamples)[BUFFERSIZE], ALsizei SamplesToDo);
36 /* Up-samples a first-order input to the decoder's configuration. */
37 void bformatdec_upSample(struct BFormatDec *dec, ALfloat (*restrict OutBuffer)[BUFFERSIZE], const ALfloat (*restrict InSamples)[BUFFERSIZE], ALsizei InChannels, ALsizei SamplesToDo);
40 /* Stand-alone first-order upsampler. Kept here because it shares some stuff
41 * with bformatdec.
43 struct AmbiUpsampler *ambiup_alloc();
44 void ambiup_free(struct AmbiUpsampler *ambiup);
45 void ambiup_reset(struct AmbiUpsampler *ambiup, const ALCdevice *device);
47 void ambiup_process(struct AmbiUpsampler *ambiup, ALfloat (*restrict OutBuffer)[BUFFERSIZE], ALsizei OutChannels, const ALfloat (*restrict InSamples)[BUFFERSIZE], ALsizei SamplesToDo);
50 /* Band splitter. Splits a signal into two phase-matching frequency bands. */
51 typedef struct BandSplitter {
52 ALfloat coeff;
53 ALfloat lp_z1;
54 ALfloat lp_z2;
55 ALfloat hp_z1;
56 } BandSplitter;
58 void bandsplit_init(BandSplitter *splitter, ALfloat freq_mult);
59 void bandsplit_clear(BandSplitter *splitter);
60 void bandsplit_process(BandSplitter *splitter, ALfloat *restrict hpout, ALfloat *restrict lpout,
61 const ALfloat *input, ALsizei count);
63 #endif /* BFORMATDEC_H */