SAF
Loading...
Searching...
No Matches
rotator_internal.h
Go to the documentation of this file.
1/*
2 * Copyright 2017-2018 Leo McCormack
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
9 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10 * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
11 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14 * PERFORMANCE OF THIS SOFTWARE.
15 */
16
34#ifndef __ROTATOR_INTERNAL_H_INCLUDED__
35#define __ROTATOR_INTERNAL_H_INCLUDED__
36
37#include "rotator.h" /* Include header for this example */
38#include "saf.h" /* Main include header for SAF */
39#include "saf_externals.h" /* To also include SAF dependencies (cblas etc.) */
40
41#ifdef __cplusplus
42extern "C" {
43#endif /* __cplusplus */
44
45/* ========================================================================== */
46/* Internal Parameters */
47/* ========================================================================== */
48
49#if !defined(ROTATOR_FRAME_SIZE)
50# if defined(FRAME_SIZE) /* Use the global framesize if it is specified: */
51# define ROTATOR_FRAME_SIZE ( FRAME_SIZE )
52# else /* Otherwise, the default framesize for this example is: */
53# define ROTATOR_FRAME_SIZE ( 64 )
54# endif
55#endif
56
57/* ========================================================================== */
58/* Structures */
59/* ========================================================================== */
60
67
69typedef struct _rotator
70{
71 /* Internal buffers */
73 float prev_inputFrameTD[MAX_NUM_SH_SIGNALS][ROTATOR_FRAME_SIZE];
75 float tempFrame_fadeOut[MAX_NUM_SH_SIGNALS][ROTATOR_FRAME_SIZE];
76 float outputFrameTD[MAX_NUM_SH_SIGNALS][ROTATOR_FRAME_SIZE];
77 float outputFrameTD_fadeIn[MAX_NUM_SH_SIGNALS][ROTATOR_FRAME_SIZE];
79 /* Internal variables */
80 float interpolator_fadeIn[ROTATOR_FRAME_SIZE];
81 float interpolator_fadeOut[ROTATOR_FRAME_SIZE];
85 int fs;
87 /* user parameters */
90 float yaw;
91 float roll;
92 float pitch;
102
103
104#ifdef __cplusplus
105} /* extern "C" { */
106#endif /* __cplusplus */
107
108#endif /* __ROTATOR_INTERNAL_H_INCLUDED__ */
NORM_TYPES
Available Ambisonic normalisation conventions.
Definition _common.h:74
CH_ORDER
Available Ambisonic channel ordering conventions.
Definition _common.h:59
#define MAX_NUM_SH_SIGNALS
Maximum number of spherical harmonic components/signals supported.
Definition _common.h:239
SH_ORDERS
Available spherical harmonic (SH) input/output order options.
Definition _common.h:38
A basic spherical harmonic/ Ambisonic signals rotator, based on the recursive approach detailed in [1...
M_ROT_STATUS
Available Ambisonic channel ordering conventions.
@ M_ROT_READY
M_rot is ready.
@ M_ROT_RECOMPUTE_QUATERNION
Use Quaternions to recompute M_rot.
@ M_ROT_RECOMPUTE_EULER
Use Euler angles to recompute M_rot.
#define ROTATOR_FRAME_SIZE
Framesize, in time-domain samples.
Main include header for the Spatial_Audio_Framework (SAF)
Include header for SAF externals.
Quaternion data structure.
Main struct for the rotator.
float pitch
pitch (Euler) rotation angle, in degrees
int bFlipRoll
flag to flip the sign of the roll rotation angle
int useRollPitchYawFlag
rotation order flag, 1: r-p-y, 0: y-p-r
M_ROT_STATUS M_rot_status
see M_ROT_STATUS
NORM_TYPES norm
Ambisonic normalisation convention (see NORM_TYPES)
float roll
roll (Euler) rotation angle, in degrees
SH_ORDERS inputOrder
current input/output SH order
int bFlipQuaternion
1: invert quaternion, 0: no inversion
float yaw
yaw (Euler) rotation angle, in degrees
int bFlipYaw
flag to flip the sign of the yaw rotation angle
int fs
Host sampling rate, in Hz.
quaternion_data Q
Quaternion used for rotation.
CH_ORDER chOrdering
Ambisonic channel order convention (see CH_ORDER)
int bFlipPitch
flag to flip the sign of the pitch rotation angle