SAF
Loading...
Searching...
No Matches
rotator.h

A basic spherical harmonic signals rotator.

A basic spherical harmonic signals rotator

Files

rotator.h (include), rotator_internal.h, rotator.c, rotator_internal.c

Include Header

/*
* Copyright 2017-2018 Leo McCormack
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef __ROTATOR_H_INCLUDED__
#define __ROTATOR_H_INCLUDED__
#include "_common.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* ========================================================================== */
/* Main Functions */
/* ========================================================================== */
void rotator_create(void** const phRot);
void rotator_destroy(void** const phRot);
void rotator_init(void* const hRot,
int samplerate);
void rotator_process(void* const hRot,
const float *const * inputs,
float* const* outputs,
int nInputs,
int nOutputs,
int nSamples);
/* ========================================================================== */
/* Set Functions */
/* ========================================================================== */
void rotator_setYaw(void* const hRot, float newYaw);
void rotator_setPitch(void* const hRot, float newPitch);
void rotator_setRoll(void* const hRot, float newRoll);
void rotator_setQuaternionW(void* const hRot, float newValue);
void rotator_setQuaternionX(void* const hRot, float newValue);
void rotator_setQuaternionY(void* const hRot, float newValue);
void rotator_setQuaternionZ(void* const hRot, float newValue);
void rotator_setFlipYaw(void* const hRot, int newState);
void rotator_setFlipPitch(void* const hRot, int newState);
void rotator_setFlipRoll(void* const hRot, int newState);
void rotator_setFlipQuaternion(void* const hRot, int newState);
void rotator_setChOrder(void* const hRot, int newOrder);
void rotator_setNormType(void* const hRot, int newType);
void rotator_setOrder(void* const hRot, int newOrder);
void rotator_setRPYflag(void* const hRot, int newState);
/* ========================================================================== */
/* Get Functions */
/* ========================================================================== */
float rotator_getYaw(void* const hRot);
float rotator_getPitch(void* const hRot);
float rotator_getRoll(void* const hRot);
float rotator_getQuaternionW(void* const hRot);
float rotator_getQuaternionX(void* const hRot);
float rotator_getQuaternionY(void* const hRot);
float rotator_getQuaternionZ(void* const hRot);
int rotator_getFlipYaw(void* const hRot);
int rotator_getFlipPitch(void* const hRot);
int rotator_getFlipRoll(void* const hRot);
int rotator_getFlipQuaternion(void* const hRot);
int rotator_getRPYflag(void* const hRot);
int rotator_getChOrder(void* const hRot);
int rotator_getNormType(void* const hRot);
int rotator_getOrder(void* const hRot);
int rotator_getNSHrequired(void* const hRot);
#ifdef __cplusplus
} /* extern "C" { */
#endif /* __cplusplus */
#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