Mach1 Spatial SDK
Loading...
Searching...
No Matches
Mach1Encode< PCM > Class Template Reference

Public Member Functions

 Mach1Encode (const Mach1Encode &other)
 
Mach1Encodeoperator= (const Mach1Encode &other)
 
 Mach1Encode (Mach1Encode &&other) noexcept
 
Mach1Encodeoperator= (Mach1Encode &&other) noexcept
 
std::vector< Mach1Point3DgetPoints ()
 Returns the control center reference point's normalized coordinate location (XYZ) within the vector panning space.
 
std::vector< std::vector< PCM > > getGains ()
 Returns an array per input channel, resulting in an array of array results each internal array (per input channel) is a list of the needed coefficients to encode to a Mach1 VVBP/SPS format (depending on the selected output mode).
 
std::vector< std::string > getPointsNames ()
 Return the string name for each input channel/point.
 
std::vector< float > getGainsForInputChannelNamed (const std::string &pointName)
 Given the name of an input channel/point, return array of gain coefficients.
 
void generatePointResults ()
 Recalculate and update the encoder with the currently set spatial configuration.
 
int getPointsCount ()
 Get the number of point results that have been generated after a call to generatePointResults.
 
Mach1EncodeInputMode getInputMode ()
 Get the format in which this Mach1Encode expects to receive audio for encoding.
 
void setInputMode (Mach1EncodeInputMode inputMode)
 
Mach1EncodeOutputMode getOutputMode ()
 Get the format in which this Mach1Encode will output encoded audio.
 
void setOutputMode (Mach1EncodeOutputMode outputMode)
 Set the format in which this Mach1Encode will output encoded audio.
 
Mach1EncodePannerMode getPannerMode ()
 Get the calculation strategy by which the points in this Mach1Encode are calculated.
 
void setPannerMode (enum Mach1EncodePannerMode pannerMode)
 Sets the style and mode of panner input calculation.
 
bool getAutoOrbit ()
 Get whether auto-orbit mode is enabled. If true, then orbit rotation is extrapolated from the currently set azimuth.
 
int getInputChannelsCount ()
 Get the number of input channels that this Mach1Encode expects to receive for encoding, depending on the selected input mode.
 
int getOutputChannelsCount ()
 Get the number of output channels that this Mach1Encode expects to receive for encoding, depending on the selected output mode.
 
void setAzimuth (float azimuthFromMinus1To1)
 Sets the point(s) azimuth rotation of the vector space.
 
void setAzimuthDegrees (float azimuthDegrees)
 Sets the point(s) azimuth rotation of the vector space.
 
void setAzimuthRadians (float azimuthRadians)
 Sets the point(s) azimuth rotation of the vector space.
 
void setElevation (float elevationFromMinus1to1)
 Sets the point(s) up/down the vector space.
 
void setElevationDegrees (float elevationFromMinus90to90)
 Sets the point(s) up/down the vector space.
 
void setElevationRadians (float elevationFromMinusHalfPItoHalfPI)
 Sets the point(s) up/down the vector space.
 
void setFrontSurroundPerspective (bool frontSurroundPerspective)
 
float getOutputGain (bool isDecibel)
 
void setOutputGain (float outputGainMultipler, bool isDecibel)
 
float getGainCompensation (bool isDecibel)
 Gets the current gain compensation value.
 
bool getGainCompensationActive ()
 Gets whether gain compensation is active.
 
void setGainCompensationActive (bool active)
 Sets whether gain compensation is active.
 
void setOrbitRotation (float orbitRotationFromMinusOnetoOne)
 Sets the two stereo points around the axis of the center point between them.
 
void setOrbitRotationDegrees (float orbitRotationDegrees)
 Sets the two stereo points around the axis of the center point between them.
 
void setOrbitRotationRadians (float orbitRotationRadians)
 Sets the two stereo points around the axis of the center point between them.
 
void setDiverge (float divergeFromMinus1To1)
 Sets the point(s) to/from center origin of the vector space.
 
void setStereoSpread (float sSpreadFrom0to1)
 Sets the space between the two stereo points.
 
void setAutoOrbit (bool autoOrbit)
 Sets whether encoding behavior acts evenly with distribution across all azimuth/rotation angles and all altitude/pitch angles.
 
void encodeBuffer (std::vector< std::vector< PCM > > &in, std::vector< std::vector< PCM > > &out, int size)
 
void encodeBufferRebuffer (std::vector< std::vector< PCM > > &in, std::vector< std::vector< PCM > > &out, int size)
 
void encodeBufferInPlaceRebuffer (std::vector< std::vector< PCM > > &buffer, size_t buffer_size)
 
void encodeBufferInPlace (std::vector< std::vector< PCM > > &buffer, size_t buffer_size)
 

Member Function Documentation

◆ encodeBuffer()

template<typename PCM >
void Mach1Encode< PCM >::encodeBuffer ( std::vector< std::vector< PCM > > &  in,
std::vector< std::vector< PCM > > &  out,
int  size 
)
inline

Encode the input buffers and emplace the result into the specified output buffers. Each channel of the buffers are expected to be of the specified size. Processing is performed by directly modifying the output buffer for every iteration of the algorithm.

◆ encodeBufferInPlace()

template<typename PCM >
void Mach1Encode< PCM >::encodeBufferInPlace ( std::vector< std::vector< PCM > > &  buffer,
size_t  buffer_size 
)
inline

Encode the specified buffer in-place. Each channel of the buffer is expected to be of the specified size. Processing is performed by directly modifying the buffer for every iteration of the algorithm.

◆ encodeBufferInPlaceRebuffer()

template<typename PCM >
void Mach1Encode< PCM >::encodeBufferInPlaceRebuffer ( std::vector< std::vector< PCM > > &  buffer,
size_t  buffer_size 
)
inline

Encode the specified buffer in-place. Each channel of the buffer is expected to be of the specified size. Processing is performed by directly modifying the buffer for every iteration of the algorithm.

◆ encodeBufferRebuffer()

template<typename PCM >
void Mach1Encode< PCM >::encodeBufferRebuffer ( std::vector< std::vector< PCM > > &  in,
std::vector< std::vector< PCM > > &  out,
int  size 
)
inline

Encode the input buffers and emplace the result into the specified output buffers. Each channel of the buffers are expected to be of the specified size. Processing is performed by storing the result of the computation in an intermediary buffer and then copying over the result from the intermediary buffer into the output buffer.

◆ generatePointResults()

template<typename PCM >
void Mach1Encode< PCM >::generatePointResults ( )

Recalculate and update the encoder with the currently set spatial configuration.

Note
Call when an update to Mach1 vector calculations is desired.

◆ getGainCompensation()

template<typename PCM >
float Mach1Encode< PCM >::getGainCompensation ( bool  isDecibel)

Gets the current gain compensation value.

Parameters
isDecibeltrue if the gain compensation is in decibels, false to return as a linear multiplier

◆ getGains()

template<typename PCM >
std::vector< std::vector< PCM > > Mach1Encode< PCM >::getGains ( )

Returns an array per input channel, resulting in an array of array results each internal array (per input channel) is a list of the needed coefficients to encode to a Mach1 VVBP/SPS format (depending on the selected output mode).

Returns
A 2D vector, whose layout is as follows:
  • 1st dimension of array is the number of input channels/points
  • 2nd dimension of array is the resulting coefficient gains to be applied for encode

◆ getGainsForInputChannelNamed()

template<typename PCM >
std::vector< float > Mach1Encode< PCM >::getGainsForInputChannelNamed ( const std::string &  pointName)

Given the name of an input channel/point, return array of gain coefficients.

Parameters
pointNameThe name of the requested point/channel.
Returns
Vector of N gain coefficients, where N is the amount channels that this Mach1Encode object is configured to output to.

◆ getOutputGain()

template<typename PCM >
float Mach1Encode< PCM >::getOutputGain ( bool  isDecibel)

Gets the current global gain multiplier which is applied to all output channels equally. Can be calculated with a linear amplitude multiplier or a decibel multiplier.

Note
+6dB gain is applied by default upon the construction of a new Mach1Encode instance.

◆ getPannerMode()

template<typename PCM >
Mach1EncodePannerMode Mach1Encode< PCM >::getPannerMode ( )

Get the calculation strategy by which the points in this Mach1Encode are calculated.

Panner modes govern how Mach1Encode distributes your input signal(s) across the Mach1 output points.

Returns
Which Mach1EncodePannerMode the Mach1Encode instance is currently using.

◆ getPoints()

template<typename PCM >
std::vector< Mach1Point3D > Mach1Encode< PCM >::getPoints ( )

Returns the control center reference point's normalized coordinate location (XYZ) within the vector panning space.

Returns
Vector of Mach1Point3Ds, where the components of each point are as follows:
  • X: front-back (0.0 (back) -> 1.0 (front))
  • Y: up-down (0.0 (down) -> 1.0 (up))
  • Z: left-right (0.0 (left) -> 1.0 (right))

◆ setAutoOrbit()

template<typename PCM >
void Mach1Encode< PCM >::setAutoOrbit ( bool  autoOrbit)

Sets whether encoding behavior acts evenly with distribution across all azimuth/rotation angles and all altitude/pitch angles.

Note
Is true by default upon the construction of a new Mach1Encode instance.

◆ setAzimuth()

template<typename PCM >
void Mach1Encode< PCM >::setAzimuth ( float  azimuthFromMinus1To1)

Sets the point(s) azimuth rotation of the vector space.

Parameters
azimuthFromMinus1To1floating point value in the range [-1.0; 1.0]

◆ setAzimuthDegrees()

template<typename PCM >
void Mach1Encode< PCM >::setAzimuthDegrees ( float  azimuthDegrees)

Sets the point(s) azimuth rotation of the vector space.

Parameters
azimuthDegreesfloating point value in the range [0.0; 360.0]

◆ setAzimuthRadians()

template<typename PCM >
void Mach1Encode< PCM >::setAzimuthRadians ( float  azimuthRadians)

Sets the point(s) azimuth rotation of the vector space.

Parameters
azimuthRadiansfloating point value in the range [-PI; PI]

◆ setDiverge()

template<typename PCM >
void Mach1Encode< PCM >::setDiverge ( float  divergeFromMinus1To1)

Sets the point(s) to/from center origin of the vector space.

Parameters
divergeFromMinus1To1floating point value between -1.0 and 1.0

◆ setElevation()

template<typename PCM >
void Mach1Encode< PCM >::setElevation ( float  elevationFromMinus1to1)

Sets the point(s) up/down the vector space.

Parameters
elevationFromMinus1to1floating point value in the range [-1.0; 1.0]

◆ setElevationDegrees()

template<typename PCM >
void Mach1Encode< PCM >::setElevationDegrees ( float  elevationFromMinus90to90)

Sets the point(s) up/down the vector space.

Parameters
elevationFromMinus90to90floating point value in the range [-90.0; 90.0]

◆ setElevationRadians()

template<typename PCM >
void Mach1Encode< PCM >::setElevationRadians ( float  elevationFromMinusHalfPItoHalfPI)

Sets the point(s) up/down the vector space.

Parameters
elevationFromMinus90to90floating point value in the range [-PI / 2.0; PI / 2.0]

◆ setFrontSurroundPerspective()

template<typename PCM >
void Mach1Encode< PCM >::setFrontSurroundPerspective ( bool  frontSurroundPerspective)

Sets the encoding behavior of the Center input channels of relevant Surround format, when true the encoding behavior assumes first person perspective encoding Center channels toward the front of the sound field, when false we use Center channel literally making it encoded MONO and omni-directional.

Note
Is true by default upon the construction of a new Mach1Encode instance.

◆ setGainCompensationActive()

template<typename PCM >
void Mach1Encode< PCM >::setGainCompensationActive ( bool  active)

Sets whether gain compensation is active.

Parameters
activetrue if gain compensation is active, false if it is not

Gain compensation is an automatic adjustment to the gain of the output channels to compensate for the gain loss on Mach1Decode side based on the number of output channels of Mach1Encode. This can be useful for ensuring that Mach1Encode instances have the same gain structure when setting a new output mode.

Note
Is true by default upon the construction of a new Mach1Encode instance.

◆ setInputMode()

template<typename PCM >
void Mach1Encode< PCM >::setInputMode ( Mach1EncodeInputMode  inputMode)

Set the format in which this Mach1Encode expects to receive audio for encoding.

◆ setOrbitRotation()

template<typename PCM >
void Mach1Encode< PCM >::setOrbitRotation ( float  orbitRotationFromMinusOnetoOne)

Sets the two stereo points around the axis of the center point between them.

Parameters
orbitRotationFromMinusOnetoOnefloating point value in the range [-1.0; 1.0]

◆ setOrbitRotationDegrees()

template<typename PCM >
void Mach1Encode< PCM >::setOrbitRotationDegrees ( float  orbitRotationDegrees)

Sets the two stereo points around the axis of the center point between them.

Parameters
orbitRotationDegreesfloating point value in the range [-180.0; 180.0]

◆ setOrbitRotationRadians()

template<typename PCM >
void Mach1Encode< PCM >::setOrbitRotationRadians ( float  orbitRotationRadians)

Sets the two stereo points around the axis of the center point between them.

Parameters
orbitRotationRadiansfloating point value in the range [-PI -> PI]

◆ setOutputGain()

template<typename PCM >
void Mach1Encode< PCM >::setOutputGain ( float  outputGainMultipler,
bool  isDecibel 
)

Applies an additional gain multiplier to all output channels equally. Can be calculated with a linear amplitude multiplier or a decibel multiplier.

Note
+6dB gain is applied by default upon the construction of a new Mach1Encode instance.

◆ setPannerMode()

template<typename PCM >
void Mach1Encode< PCM >::setPannerMode ( enum Mach1EncodePannerMode  pannerMode)

Sets the style and mode of panner input calculation.

Panner modes govern how Mach1Encode distributes your input signal(s) across the Mach1 output points. The following modes exist:

  • MODE_ISOTROPICLINEAR: Distributes signal without prioritizing any particular direction. More natural expectations of signal distribution.
  • MODE_ISOTROPICEQUALPOWER: Uses an equal-power distribution approach for smoother panning and also applies an additional gain multiplier based on the diverge value to the center point.
  • MODE_PERIPHONICLINEAR: Naturally distributes signal horizontally but crossfades between channels vertically.
Parameters
pannerModeThe Mach1EncodePannerMode to use for calculation.

◆ setStereoSpread()

template<typename PCM >
void Mach1Encode< PCM >::setStereoSpread ( float  sSpreadFrom0to1)

Sets the space between the two stereo points.

Parameters
sSpreadFrom0to1floating point value between 0.0 and 1.0

The documentation for this class was generated from the following file: