2016-03-15 05:08:05 -07:00
|
|
|
#ifndef BFORMATDEC_H
|
|
|
|
#define BFORMATDEC_H
|
|
|
|
|
|
|
|
#include "alMain.h"
|
|
|
|
|
2018-11-03 15:32:09 -07:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2017-01-24 19:03:51 -08:00
|
|
|
|
|
|
|
/* These are the necessary scales for first-order HF responses to play over
|
|
|
|
* higher-order 2D (non-periphonic) decoders.
|
|
|
|
*/
|
2018-02-09 18:43:34 -08:00
|
|
|
#define W_SCALE_2H0P 1.224744871f /* sqrt(1.5) */
|
|
|
|
#define XYZ_SCALE_2H0P 1.0f
|
|
|
|
#define W_SCALE_3H0P 1.414213562f /* sqrt(2) */
|
|
|
|
#define XYZ_SCALE_3H0P 1.082392196f
|
2017-01-24 19:03:51 -08:00
|
|
|
|
|
|
|
/* These are the necessary scales for first-order HF responses to play over
|
|
|
|
* higher-order 3D (periphonic) decoders.
|
|
|
|
*/
|
2018-02-09 18:43:34 -08:00
|
|
|
#define W_SCALE_2H2P 1.341640787f /* sqrt(1.8) */
|
|
|
|
#define XYZ_SCALE_2H2P 1.0f
|
|
|
|
#define W_SCALE_3H3P 1.695486018f
|
|
|
|
#define XYZ_SCALE_3H3P 1.136697713f
|
2017-01-24 19:03:51 -08:00
|
|
|
|
|
|
|
|
2018-02-13 13:47:35 -08:00
|
|
|
/* NOTE: These are scale factors as applied to Ambisonics content. Decoder
|
|
|
|
* coefficients should be divided by these values to get proper N3D scalings.
|
|
|
|
*/
|
2018-11-03 15:32:09 -07:00
|
|
|
extern const ALfloat N3D2N3DScale[MAX_AMBI_COEFFS];
|
|
|
|
extern const ALfloat SN3D2N3DScale[MAX_AMBI_COEFFS];
|
|
|
|
extern const ALfloat FuMa2N3DScale[MAX_AMBI_COEFFS];
|
2018-02-13 13:47:35 -08:00
|
|
|
|
|
|
|
|
2016-03-15 05:08:05 -07:00
|
|
|
struct AmbDecConf;
|
|
|
|
struct BFormatDec;
|
2016-07-30 09:29:21 -07:00
|
|
|
struct AmbiUpsampler;
|
2016-03-15 05:08:05 -07:00
|
|
|
|
2016-03-26 17:52:42 -07:00
|
|
|
|
2016-03-15 05:08:05 -07:00
|
|
|
struct BFormatDec *bformatdec_alloc();
|
2018-02-12 20:48:28 -08:00
|
|
|
void bformatdec_free(struct BFormatDec **dec);
|
2017-02-19 22:47:59 -08:00
|
|
|
void bformatdec_reset(struct BFormatDec *dec, const struct AmbDecConf *conf, ALsizei chancount, ALuint srate, const ALsizei chanmap[MAX_OUTPUT_CHANNELS]);
|
2016-03-23 12:53:36 -07:00
|
|
|
|
|
|
|
/* Decodes the ambisonic input to the given output channels. */
|
2018-10-29 11:32:50 -07:00
|
|
|
void bformatdec_process(struct BFormatDec *dec, ALfloat (*RESTRICT OutBuffer)[BUFFERSIZE], ALsizei OutChannels, const ALfloat (*RESTRICT InSamples)[BUFFERSIZE], ALsizei SamplesToDo);
|
2016-03-15 05:08:05 -07:00
|
|
|
|
2016-03-23 12:53:36 -07:00
|
|
|
/* Up-samples a first-order input to the decoder's configuration. */
|
2018-10-29 11:32:50 -07:00
|
|
|
void bformatdec_upSample(struct BFormatDec *dec, ALfloat (*RESTRICT OutBuffer)[BUFFERSIZE], const ALfloat (*RESTRICT InSamples)[BUFFERSIZE], ALsizei InChannels, ALsizei SamplesToDo);
|
2016-03-23 12:53:36 -07:00
|
|
|
|
2016-08-21 03:05:42 -07:00
|
|
|
|
2016-07-30 09:29:21 -07:00
|
|
|
/* Stand-alone first-order upsampler. Kept here because it shares some stuff
|
2018-02-13 03:03:26 -08:00
|
|
|
* with bformatdec. Assumes a periphonic (4-channel) input mix!
|
2016-07-30 09:29:21 -07:00
|
|
|
*/
|
|
|
|
struct AmbiUpsampler *ambiup_alloc();
|
2018-02-12 20:48:28 -08:00
|
|
|
void ambiup_free(struct AmbiUpsampler **ambiup);
|
2018-02-13 03:03:26 -08:00
|
|
|
void ambiup_reset(struct AmbiUpsampler *ambiup, const ALCdevice *device, ALfloat w_scale, ALfloat xyz_scale);
|
2016-07-30 09:29:21 -07:00
|
|
|
|
2018-10-29 11:32:50 -07:00
|
|
|
void ambiup_process(struct AmbiUpsampler *ambiup, ALfloat (*RESTRICT OutBuffer)[BUFFERSIZE], ALsizei OutChannels, const ALfloat (*RESTRICT InSamples)[BUFFERSIZE], ALsizei SamplesToDo);
|
2016-07-30 09:29:21 -07:00
|
|
|
|
2018-11-03 15:32:09 -07:00
|
|
|
#ifdef __cplusplus
|
|
|
|
} // extern "C"
|
|
|
|
#endif
|
|
|
|
|
2016-03-15 05:08:05 -07:00
|
|
|
#endif /* BFORMATDEC_H */
|