10 /* These are the necessary scales for first-order HF responses to play over
11 * higher-order 2D (non-periphonic) decoders.
13 #define W_SCALE_2H0P 1.224744871f /* sqrt(1.5) */
14 #define XYZ_SCALE_2H0P 1.0f
15 #define W_SCALE_3H0P 1.414213562f /* sqrt(2) */
16 #define XYZ_SCALE_3H0P 1.082392196f
18 /* These are the necessary scales for first-order HF responses to play over
19 * higher-order 3D (periphonic) decoders.
21 #define W_SCALE_2H2P 1.341640787f /* sqrt(1.8) */
22 #define XYZ_SCALE_2H2P 1.0f
23 #define W_SCALE_3H3P 1.695486018f
24 #define XYZ_SCALE_3H3P 1.136697713f
27 /* NOTE: These are scale factors as applied to Ambisonics content. Decoder
28 * coefficients should be divided by these values to get proper N3D scalings.
30 extern const ALfloat N3D2N3DScale
[MAX_AMBI_COEFFS
];
31 extern const ALfloat SN3D2N3DScale
[MAX_AMBI_COEFFS
];
32 extern const ALfloat FuMa2N3DScale
[MAX_AMBI_COEFFS
];
40 struct BFormatDec
*bformatdec_alloc();
41 void bformatdec_free(struct BFormatDec
**dec
);
42 void bformatdec_reset(struct BFormatDec
*dec
, const struct AmbDecConf
*conf
, ALsizei chancount
, ALuint srate
, const ALsizei chanmap
[MAX_OUTPUT_CHANNELS
]);
44 /* Decodes the ambisonic input to the given output channels. */
45 void bformatdec_process(struct BFormatDec
*dec
, ALfloat (*RESTRICT OutBuffer
)[BUFFERSIZE
], ALsizei OutChannels
, const ALfloat (*RESTRICT InSamples
)[BUFFERSIZE
], ALsizei SamplesToDo
);
47 /* Up-samples a first-order input to the decoder's configuration. */
48 void bformatdec_upSample(struct BFormatDec
*dec
, ALfloat (*RESTRICT OutBuffer
)[BUFFERSIZE
], const ALfloat (*RESTRICT InSamples
)[BUFFERSIZE
], ALsizei InChannels
, ALsizei SamplesToDo
);
51 /* Stand-alone first-order upsampler. Kept here because it shares some stuff
52 * with bformatdec. Assumes a periphonic (4-channel) input mix!
54 struct AmbiUpsampler
*ambiup_alloc();
55 void ambiup_free(struct AmbiUpsampler
**ambiup
);
56 void ambiup_reset(struct AmbiUpsampler
*ambiup
, const ALCdevice
*device
, ALfloat w_scale
, ALfloat xyz_scale
);
58 void ambiup_process(struct AmbiUpsampler
*ambiup
, ALfloat (*RESTRICT OutBuffer
)[BUFFERSIZE
], ALsizei OutChannels
, const ALfloat (*RESTRICT InSamples
)[BUFFERSIZE
], ALsizei SamplesToDo
);
64 #endif /* BFORMATDEC_H */