SAF
Loading...
Searching...
No Matches
rotator.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
43#ifndef __ROTATOR_H_INCLUDED__
44#define __ROTATOR_H_INCLUDED__
45
46#include "_common.h"
47
48#ifdef __cplusplus
49extern "C" {
50#endif /* __cplusplus */
51
52/* ========================================================================== */
53/* Main Functions */
54/* ========================================================================== */
55
61void rotator_create(void** const phRot);
62
68void rotator_destroy(void** const phRot);
69
76void rotator_init(void* const hRot,
77 int samplerate);
78
89void rotator_process(void* const hRot,
90 const float *const * inputs,
91 float* const* outputs,
92 int nInputs,
93 int nOutputs,
94 int nSamples);
95
96
97/* ========================================================================== */
98/* Set Functions */
99/* ========================================================================== */
100
105int rotator_getFrameSize(void);
106
108void rotator_setYaw(void* const hRot, float newYaw);
109
111void rotator_setPitch(void* const hRot, float newPitch);
112
114void rotator_setRoll(void* const hRot, float newRoll);
115
117void rotator_setQuaternionW(void* const hRot, float newValue);
118
120void rotator_setQuaternionX(void* const hRot, float newValue);
121
123void rotator_setQuaternionY(void* const hRot, float newValue);
124
126void rotator_setQuaternionZ(void* const hRot, float newValue);
127
132void rotator_setFlipYaw(void* const hRot, int newState);
133
138void rotator_setFlipPitch(void* const hRot, int newState);
139
144void rotator_setFlipRoll(void* const hRot, int newState);
145
150void rotator_setFlipQuaternion(void* const hRot, int newState);
151
156void rotator_setChOrder(void* const hRot, int newOrder);
157
162void rotator_setNormType(void* const hRot, int newType);
163
165void rotator_setOrder(void* const hRot, int newOrder);
166
171void rotator_setRPYflag(void* const hRot, int newState);
172
173
174/* ========================================================================== */
175/* Get Functions */
176/* ========================================================================== */
177
179float rotator_getYaw(void* const hRot);
180
182float rotator_getPitch(void* const hRot);
183
185float rotator_getRoll(void* const hRot);
186
188float rotator_getQuaternionW(void* const hRot);
189
191float rotator_getQuaternionX(void* const hRot);
192
194float rotator_getQuaternionY(void* const hRot);
195
197float rotator_getQuaternionZ(void* const hRot);
198
203int rotator_getFlipYaw(void* const hRot);
204
209int rotator_getFlipPitch(void* const hRot);
210
215int rotator_getFlipRoll(void* const hRot);
216
221int rotator_getFlipQuaternion(void* const hRot);
222
227int rotator_getRPYflag(void* const hRot);
228
234int rotator_getChOrder(void* const hRot);
235
241int rotator_getNormType(void* const hRot);
242
244int rotator_getOrder(void* const hRot);
245
250int rotator_getNSHrequired(void* const hRot);
251
257
258
259#ifdef __cplusplus
260} /* extern "C" { */
261#endif /* __cplusplus */
262
263#endif /* __ROTATOR_H_INCLUDED__ */
A bunch of things that are common to many of the saf examples.
void rotator_setQuaternionW(void *const hRot, float newValue)
Sets the quaternion 'W' value [-1..1].
Definition rotator.c:232
int rotator_getRPYflag(void *const hRot)
Returns a flag as to whether to use "yaw-pitch-roll" (0) or "roll-pitch-yaw" (1) rotation order.
Definition rotator.c:404
int rotator_getNSHrequired(void *const hRot)
Returns the number of spherical harmonic signals required by the current input/output order: (current...
Definition rotator.c:428
int rotator_getFrameSize(void)
Returns the processing framesize (i.e., number of samples processed with every _process() call )
Definition rotator.c:333
int rotator_getNormType(void *const hRot)
Returns the Ambisonic normalisation convention currently being usedto decode with,...
Definition rotator.c:416
void rotator_setPitch(void *const hRot, float newPitch)
Sets the 'pitch' rotation angle, in DEGREES.
Definition rotator.c:218
float rotator_getQuaternionY(void *const hRot)
Returns the quaternion 'Y' value [-1..1].
Definition rotator.c:368
void rotator_setFlipPitch(void *const hRot, int newState)
Sets a flag as to whether to "flip" the sign of the current 'pitch' angle (0: do not flip sign,...
Definition rotator.c:269
void rotator_create(void **const phRot)
Creates an instance of rotator.
Definition rotator.c:38
void rotator_setFlipRoll(void *const hRot, int newState)
Sets a flag as to whether to "flip" the sign of the current 'roll' angle (0: do not flip sign,...
Definition rotator.c:278
int rotator_getProcessingDelay(void)
Returns the processing delay in samples (may be used for delay compensation features)
Definition rotator.c:434
float rotator_getQuaternionW(void *const hRot)
Returns the quaternion 'W' value [-1..1].
Definition rotator.c:356
int rotator_getFlipRoll(void *const hRot)
Returns a flag as to whether to "flip" the sign of the current 'roll' angle (0: do not flip sign,...
Definition rotator.c:392
void rotator_setRPYflag(void *const hRot, int newState)
Sets a flag as to whether to use "yaw-pitch-roll" (0) or "roll-pitch-yaw" (1) rotation order.
Definition rotator.c:298
float rotator_getQuaternionZ(void *const hRot)
Returns the quaternion 'Z' value [-1..1].
Definition rotator.c:374
float rotator_getPitch(void *const hRot)
Returns the 'pitch' rotation angle, in DEGREES.
Definition rotator.c:344
int rotator_getChOrder(void *const hRot)
Returns the Ambisonic channel ordering convention currently being used to decode with,...
Definition rotator.c:410
void rotator_init(void *const hRot, int samplerate)
Initialises an instance of rotator with default settings.
Definition rotator.c:80
void rotator_destroy(void **const phRot)
Destroys an instance of rotator.
Definition rotator.c:67
void rotator_setQuaternionZ(void *const hRot, float newValue)
Sets the quaternion 'Z' value [-1..1].
Definition rotator.c:253
float rotator_getYaw(void *const hRot)
Returns the 'yaw' rotation angle, in DEGREES.
Definition rotator.c:338
int rotator_getOrder(void *const hRot)
Returns the input/output order (see SH_ORDERS enum)
Definition rotator.c:422
int rotator_getFlipYaw(void *const hRot)
Returns a flag as to whether to "flip" the sign of the current 'yaw' angle (0: do not flip sign,...
Definition rotator.c:380
void rotator_setRoll(void *const hRot, float newRoll)
Sets the 'roll' rotation angle , in DEGREES.
Definition rotator.c:225
float rotator_getRoll(void *const hRot)
Returns the 'roll' rotation angle, in DEGREES.
Definition rotator.c:350
int rotator_getFlipQuaternion(void *const hRot)
Returns a flag as to whether to invert the quaternion used for rotation (0: do not flip sign,...
Definition rotator.c:398
void rotator_setQuaternionX(void *const hRot, float newValue)
Sets the quaternion 'X' value [-1..1].
Definition rotator.c:239
void rotator_setNormType(void *const hRot, int newType)
Sets the Ambisonic normalisation convention to decode with, in order to match with the convention emp...
Definition rotator.c:311
void rotator_setChOrder(void *const hRot, int newOrder)
Sets the Ambisonic channel ordering convention to decode with, in order to match the convention emplo...
Definition rotator.c:304
float rotator_getQuaternionX(void *const hRot)
Returns the quaternion 'X' value [-1..1].
Definition rotator.c:362
void rotator_setFlipYaw(void *const hRot, int newState)
Sets a flag as to whether to "flip" the sign of the current 'yaw' angle (0: do not flip sign,...
Definition rotator.c:260
void rotator_process(void *const hRot, const float *const *inputs, float *const *outputs, int nInputs, int nOutputs, int nSamples)
Rotates the input spherical harmonic signals.
Definition rotator.c:102
void rotator_setQuaternionY(void *const hRot, float newValue)
Sets the quaternion 'Y' value [-1..1].
Definition rotator.c:246
int rotator_getFlipPitch(void *const hRot)
Returns a flag as to whether to "flip" the sign of the current 'pitch' angle (0: do not flip sign,...
Definition rotator.c:386
void rotator_setYaw(void *const hRot, float newYaw)
Sets the 'yaw' rotation angle, in DEGREES.
Definition rotator.c:211
void rotator_setFlipQuaternion(void *const hRot, int newState)
Sets a flag as to whether to invert the quaternion used for rotation (0: do not flip sign,...
Definition rotator.c:287
void rotator_setOrder(void *const hRot, int newOrder)
Sets the input/output order (see SH_ORDERS enum)
Definition rotator.c:318