SAF
Loading...
Searching...
No Matches
rotator.c File Reference

A basic spherical harmonic/ Ambisonic signals rotator, based on the recursive approach detailed in [1]. More...

#include "rotator.h"
#include "rotator_internal.h"

Go to the source code of this file.

Functions

void rotator_create (void **const phRot)
 Creates an instance of rotator.
 
void rotator_destroy (void **const phRot)
 Destroys an instance of rotator.
 
void rotator_init (void *const hRot, int sampleRate)
 Initialises an instance of rotator with default settings.
 
void rotator_process (void *const hRot, const float *const *inputs, float *const *const outputs, int nInputs, int nOutputs, int nSamples)
 Rotates the input spherical harmonic signals.
 
void rotator_setYaw (void *const hRot, float newYaw)
 Sets the 'yaw' rotation angle, in DEGREES.
 
void rotator_setPitch (void *const hRot, float newPitch)
 Sets the 'pitch' rotation angle, in DEGREES.
 
void rotator_setRoll (void *const hRot, float newRoll)
 Sets the 'roll' rotation angle , in DEGREES.
 
void rotator_setQuaternionW (void *const hRot, float newValue)
 Sets the quaternion 'W' value [-1..1].
 
void rotator_setQuaternionX (void *const hRot, float newValue)
 Sets the quaternion 'X' value [-1..1].
 
void rotator_setQuaternionY (void *const hRot, float newValue)
 Sets the quaternion 'Y' value [-1..1].
 
void rotator_setQuaternionZ (void *const hRot, float newValue)
 Sets the quaternion 'Z' value [-1..1].
 
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, 1: flip the sign)
 
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, 1: flip the sign)
 
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, 1: flip the sign)
 
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, 1: flip the sign)
 
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.
 
void rotator_setChOrder (void *const hRot, int newOrder)
 Sets the Ambisonic channel ordering convention to decode with, in order to match the convention employed by the input signals (see CH_ORDER enum)
 
void rotator_setNormType (void *const hRot, int newType)
 Sets the Ambisonic normalisation convention to decode with, in order to match with the convention employed by the input signals (see NORM_TYPES enum)
 
void rotator_setOrder (void *const hRot, int newOrder)
 Sets the input/output order (see SH_ORDERS enum)
 
int rotator_getFrameSize (void)
 Returns the processing framesize (i.e., number of samples processed with every _process() call )
 
float rotator_getYaw (void *const hRot)
 Returns the 'yaw' rotation angle, in DEGREES.
 
float rotator_getPitch (void *const hRot)
 Returns the 'pitch' rotation angle, in DEGREES.
 
float rotator_getRoll (void *const hRot)
 Returns the 'roll' rotation angle, in DEGREES.
 
float rotator_getQuaternionW (void *const hRot)
 Returns the quaternion 'W' value [-1..1].
 
float rotator_getQuaternionX (void *const hRot)
 Returns the quaternion 'X' value [-1..1].
 
float rotator_getQuaternionY (void *const hRot)
 Returns the quaternion 'Y' value [-1..1].
 
float rotator_getQuaternionZ (void *const hRot)
 Returns the quaternion 'Z' value [-1..1].
 
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, 1: flip the sign)
 
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, 1: flip the sign)
 
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, 1: flip the sign)
 
int rotator_getFlipQuaternion (void *const hRot)
 Returns a flag as to whether to invert the quaternion used for rotation (0: do not flip sign, 1: flip the sign)
 
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.
 
int rotator_getChOrder (void *const hRot)
 Returns the Ambisonic channel ordering convention currently being used to decode with, which should match the convention employed by the input signals (see CH_ORDER enum)
 
int rotator_getNormType (void *const hRot)
 Returns the Ambisonic normalisation convention currently being usedto decode with, which should match the convention employed by the input signals (see NORM_TYPES enum)
 
int rotator_getOrder (void *const hRot)
 Returns the input/output order (see SH_ORDERS enum)
 
int rotator_getNSHrequired (void *const hRot)
 Returns the number of spherical harmonic signals required by the current input/output order: (current_order+1)^2.
 
int rotator_getProcessingDelay ()
 Returns the processing delay in samples (may be used for delay compensation features)
 

Detailed Description

A basic spherical harmonic/ Ambisonic signals rotator, based on the recursive approach detailed in [1].

Test
test__saf_example_rotator()
See also
[1] Ivanic, J., Ruedenberg, K. (1998). Rotation Matrices for Real Spherical Harmonics. Direct Determination by Recursion Page: Additions and Corrections. Journal of Physical Chemistry A, 102(45), 9099?9100.
Author
Leo McCormack
Date
02.11.2017
License
ISC

Definition in file rotator.c.

Function Documentation

◆ rotator_create()

void rotator_create ( void **const phRot)

Creates an instance of rotator.

Parameters
[in]phRot(&) address of rotator handle

Definition at line 37 of file rotator.c.

◆ rotator_destroy()

void rotator_destroy ( void **const phRot)

Destroys an instance of rotator.

Parameters
[in]phRot(&) address of rotator handle

Definition at line 66 of file rotator.c.

◆ rotator_getChOrder()

int rotator_getChOrder ( void *const hRot)

Returns the Ambisonic channel ordering convention currently being used to decode with, which should match the convention employed by the input signals (see CH_ORDER enum)

Definition at line 410 of file rotator.c.

◆ rotator_getFlipPitch()

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, 1: flip the sign)

Definition at line 386 of file rotator.c.

◆ rotator_getFlipQuaternion()

int rotator_getFlipQuaternion ( void *const hRot)

Returns a flag as to whether to invert the quaternion used for rotation (0: do not flip sign, 1: flip the sign)

Definition at line 398 of file rotator.c.

◆ rotator_getFlipRoll()

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, 1: flip the sign)

Definition at line 392 of file rotator.c.

◆ rotator_getFlipYaw()

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, 1: flip the sign)

Definition at line 380 of file rotator.c.

◆ rotator_getFrameSize()

int rotator_getFrameSize ( void )

Returns the processing framesize (i.e., number of samples processed with every _process() call )

Definition at line 333 of file rotator.c.

◆ rotator_getNormType()

int rotator_getNormType ( void *const hRot)

Returns the Ambisonic normalisation convention currently being usedto decode with, which should match the convention employed by the input signals (see NORM_TYPES enum)

Definition at line 416 of file rotator.c.

◆ rotator_getNSHrequired()

int rotator_getNSHrequired ( void *const hRot)

Returns the number of spherical harmonic signals required by the current input/output order: (current_order+1)^2.

Definition at line 428 of file rotator.c.

◆ rotator_getOrder()

int rotator_getOrder ( void *const hRot)

Returns the input/output order (see SH_ORDERS enum)

Definition at line 422 of file rotator.c.

◆ rotator_getPitch()

float rotator_getPitch ( void *const hRot)

Returns the 'pitch' rotation angle, in DEGREES.

Definition at line 344 of file rotator.c.

◆ rotator_getProcessingDelay()

int rotator_getProcessingDelay ( void )

Returns the processing delay in samples (may be used for delay compensation features)

Definition at line 434 of file rotator.c.

◆ rotator_getQuaternionW()

float rotator_getQuaternionW ( void *const hRot)

Returns the quaternion 'W' value [-1..1].

Definition at line 356 of file rotator.c.

◆ rotator_getQuaternionX()

float rotator_getQuaternionX ( void *const hRot)

Returns the quaternion 'X' value [-1..1].

Definition at line 362 of file rotator.c.

◆ rotator_getQuaternionY()

float rotator_getQuaternionY ( void *const hRot)

Returns the quaternion 'Y' value [-1..1].

Definition at line 368 of file rotator.c.

◆ rotator_getQuaternionZ()

float rotator_getQuaternionZ ( void *const hRot)

Returns the quaternion 'Z' value [-1..1].

Definition at line 374 of file rotator.c.

◆ rotator_getRoll()

float rotator_getRoll ( void *const hRot)

Returns the 'roll' rotation angle, in DEGREES.

Definition at line 350 of file rotator.c.

◆ rotator_getRPYflag()

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 at line 404 of file rotator.c.

◆ rotator_getYaw()

float rotator_getYaw ( void *const hRot)

Returns the 'yaw' rotation angle, in DEGREES.

Definition at line 338 of file rotator.c.

◆ rotator_init()

void rotator_init ( void *const hRot,
int samplerate )

Initialises an instance of rotator with default settings.

Parameters
[in]hRotrotator handle
[in]samplerateHost samplerate.

Definition at line 79 of file rotator.c.

◆ rotator_process()

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.

Parameters
[in]hRotrotator handle
[in]inputsInput channel buffers; 2-D array: nInputs x nSamples
[in]outputsOutput channel buffers; 2-D array: nOutputs x nSamples
[in]nInputsNumber of input channels
[in]nOutputsNumber of output channels
[in]nSamplesNumber of samples in 'inputs'/'output' matrices

Definition at line 101 of file rotator.c.

◆ rotator_setChOrder()

void rotator_setChOrder ( void *const hRot,
int newOrder )

Sets the Ambisonic channel ordering convention to decode with, in order to match the convention employed by the input signals (see CH_ORDER enum)

Definition at line 304 of file rotator.c.

◆ rotator_setFlipPitch()

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, 1: flip the sign)

Definition at line 269 of file rotator.c.

◆ rotator_setFlipQuaternion()

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, 1: flip the sign)

Definition at line 287 of file rotator.c.

◆ rotator_setFlipRoll()

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, 1: flip the sign)

Definition at line 278 of file rotator.c.

◆ rotator_setFlipYaw()

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, 1: flip the sign)

Definition at line 260 of file rotator.c.

◆ rotator_setNormType()

void rotator_setNormType ( void *const hRot,
int newType )

Sets the Ambisonic normalisation convention to decode with, in order to match with the convention employed by the input signals (see NORM_TYPES enum)

Definition at line 311 of file rotator.c.

◆ rotator_setOrder()

void rotator_setOrder ( void *const hRot,
int newOrder )

Sets the input/output order (see SH_ORDERS enum)

Definition at line 318 of file rotator.c.

◆ rotator_setPitch()

void rotator_setPitch ( void *const hRot,
float newPitch )

Sets the 'pitch' rotation angle, in DEGREES.

Definition at line 218 of file rotator.c.

◆ rotator_setQuaternionW()

void rotator_setQuaternionW ( void *const hRot,
float newValue )

Sets the quaternion 'W' value [-1..1].

Definition at line 232 of file rotator.c.

◆ rotator_setQuaternionX()

void rotator_setQuaternionX ( void *const hRot,
float newValue )

Sets the quaternion 'X' value [-1..1].

Definition at line 239 of file rotator.c.

◆ rotator_setQuaternionY()

void rotator_setQuaternionY ( void *const hRot,
float newValue )

Sets the quaternion 'Y' value [-1..1].

Definition at line 246 of file rotator.c.

◆ rotator_setQuaternionZ()

void rotator_setQuaternionZ ( void *const hRot,
float newValue )

Sets the quaternion 'Z' value [-1..1].

Definition at line 253 of file rotator.c.

◆ rotator_setRoll()

void rotator_setRoll ( void *const hRot,
float newRoll )

Sets the 'roll' rotation angle , in DEGREES.

Definition at line 225 of file rotator.c.

◆ rotator_setRPYflag()

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 at line 298 of file rotator.c.

◆ rotator_setYaw()

void rotator_setYaw ( void *const hRot,
float newYaw )

Sets the 'yaw' rotation angle, in DEGREES.

Definition at line 211 of file rotator.c.