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

Public Member Functions

int getInputFormat ()
 Get the input format that this Mach1Transcode has been configured to process.
 
int getOutputFormat ()
 Get the output format that this Mach1Transcode has been configured to process.
 
int getInputNumChannels ()
 Get the number of channels that this Mach1Transcode has been configured to process, based on the input format.
 
void setInputFormat (int inFmt)
 Sets the input format for transcoding from this Mach1Transcode options.
 
int getOutputNumChannels ()
 Get the number of channels that this Mach1Transcode has been configured to convert to, based on the output format.
 
void setOutputFormat (int outFmt)
 Sets the output format for transcoding from this Mach1Transcode options.
 
int getFormatFromString (std::string str)
 the enum for indicated format's string name.
 
std::string getFormatName (int fmt)
 Given an input/output format index, return its human-readable name.
 
std::vector< std::string > getAllFormatNames ()
 Get a list of all the names of available formats in Mach1Transcode API.
 
int getFormatsCount ()
 Get the amount of available formats in Mach1Transcode API.
 
PCM processNormalization (std::vector< std::vector< PCM > > &bufs)
 Get the largest PCM value in the given buffer, which would be used for normalization.
 
PCM processNormalization (PCM **bufs, int numSamples)
 Get the largest PCM value in the given buffer, which would be used for normalization.
 
void processMasterGain (std::vector< std::vector< PCM > > &bufs, PCM masterGain)
 Apply an input gain to the output sound field.
 
void processMasterGain (PCM **bufs, int numSamples, PCM masterGain)
 Apply an input gain to the output sound field.
 
void setLFESub (std::vector< int > subChannelIndices, int sampleRate)
 Apply a low pass filter (LPF) to each indicated channel index of the input format and sound field.
 
void setSpatialDownmixer (float corrThreshold=0.1)
 Sets the threshold float for getSpatialDownmixerPossibility calculation.
 
bool getSpatialDownmixerPossibility ()
 Get whether the compared signals are less than the setSpatialDownmixer(corrThreshold).
 
void setInputFormatCustomPointsJson (std::string inJson)
 Sets the input format for transcoding from CustomPoints directly.
 
void setInputFormatCustomPoints (std::vector< Mach1Point3D > points)
 Sets the input format for transcoding from CustomPoints directly.
 
void setOutputFormatCustomPointsJson (std::string outJson)
 Sets the output format for transcoding from an external JSON source.
 
void setOutputFormatCustomPoints (std::vector< Mach1Point3D > points)
 Sets the output format for transcoding from CustomPoints directly.
 
void setCustomPointsSamplerCallback (Mach1Point3D *(*callback)(long long, int &))
 
bool processConversionPath ()
 Use this function to control when to call for calculating the format transcoding calculations.
 
std::vector< std::vector< PCM > > getMatrixConversion ()
 Get the transcoding matrix of coefficients based on the set input and output formats.
 
std::vector< int > getFormatConversionPath ()
 Get the shortest found conversion path to get from input format X to output format Y, both set by Mach1Transcode::setInputFormat(int inFmt) and Mach1Transcode::setOutputFormat(int outFmt)
 
void processConversion (std::vector< std::vector< PCM > > &in, std::vector< std::vector< PCM > > &out, int numSamples)
 Process the conversion as set by previous functions.
 
void processConversion (PCM **inBufs, PCM **outBufs, int numSamples)
 Process the conversion as set by previous functions.
 
void processConversionRebuffer (std::vector< std::vector< PCM > > &in, std::vector< std::vector< PCM > > &out, int numSamples)
 Process the conversion as set by previous functions.
 
std::vector< PCM > getAvgSamplesDiff ()
 
PCM db2level (PCM db)
 
PCM level2db (PCM level)
 

Member Function Documentation

◆ getAllFormatNames()

template<typename PCM >
std::vector< std::string > Mach1Transcode< PCM >::getAllFormatNames ( )

Get a list of all the names of available formats in Mach1Transcode API.

Returns
vector of strings of the names of all formats.

◆ getFormatConversionPath()

template<typename PCM >
std::vector< int > Mach1Transcode< PCM >::getFormatConversionPath ( )

Get the shortest found conversion path to get from input format X to output format Y, both set by Mach1Transcode::setInputFormat(int inFmt) and Mach1Transcode::setOutputFormat(int outFmt)

Note
Majority of format instances will use Mach1Spatial as the middle format for non-Mach1-format -> non-Mach1-format transcoding. This is due to Mach1 Spatial being a platonic solid format, ideal for safe calculations without loss

◆ getFormatFromString()

template<typename PCM >
int Mach1Transcode< PCM >::getFormatFromString ( std::string  str)

the enum for indicated format's string name.

Parameters
stdString representing the human-readable name of the format.
Returns
integer representing aforementioned format.

◆ getFormatName()

template<typename PCM >
std::string Mach1Transcode< PCM >::getFormatName ( int  fmt)

Given an input/output format index, return its human-readable name.

Parameters
fmtinteger representing aforementioned format.
Returns
String representing the human-readable name of the format.

◆ getMatrixConversion()

template<typename PCM >
std::vector< std::vector< PCM > > Mach1Transcode< PCM >::getMatrixConversion ( )

Get the transcoding matrix of coefficients based on the set input and output formats.

Returns
vector of vector of coefficients

◆ getSpatialDownmixerPossibility()

template<typename PCM >
bool Mach1Transcode< PCM >::getSpatialDownmixerPossibility ( )

Get whether the compared signals are less than the setSpatialDownmixer(corrThreshold).

Returns
true if the compared signal difference is less then the setSpatialDownmixer(corrThreshold)
Note
when true; transcodings that are set to ouput to Mach1Spatial will process an additional conversion to Mach1Horizon

◆ processConversionPath()

template<typename PCM >
bool Mach1Transcode< PCM >::processConversionPath ( )

Use this function to control when to call for calculating the format transcoding calculations.

Returns
true if successful, false when no conversion path is found (used for error handling)
Note
Needs to be called before processConversion() is called.

◆ processConversionRebuffer()

template<typename PCM >
void Mach1Transcode< PCM >::processConversionRebuffer ( std::vector< std::vector< PCM > > &  in,
std::vector< std::vector< PCM > > &  out,
int  numSamples 
)

Process the conversion as set by previous functions.

Note
Process the input buffer in an intermediary buffer, and then move it to the output buffer

◆ processMasterGain() [1/2]

template<typename PCM >
void Mach1Transcode< PCM >::processMasterGain ( PCM **  bufs,
int  numSamples,
PCM  masterGain 
)

Apply an input gain to the output sound field.

Parameters
bufsinput buffer
numSamplesinput number of samples
masterGainfloat for gain multiplier

◆ processMasterGain() [2/2]

template<typename PCM >
void Mach1Transcode< PCM >::processMasterGain ( std::vector< std::vector< PCM > > &  bufs,
PCM  masterGain 
)

Apply an input gain to the output sound field.

Parameters
bufsinput buffer
masterGainfloat for gain multiplier

◆ processNormalization()

template<typename PCM >
PCM Mach1Transcode< PCM >::processNormalization ( PCM **  bufs,
int  numSamples 
)

Get the largest PCM value in the given buffer, which would be used for normalization.

Note
bufs is expected to hold getOutputNumChannels amount of arrays of size numSamples.

◆ setInputFormat()

template<typename PCM >
void Mach1Transcode< PCM >::setInputFormat ( int  inFmt)

Sets the input format for transcoding from this Mach1Transcode options.

Note
All available preset formats are in Mach1TranscodeConstants.h

◆ setInputFormatCustomPoints()

template<typename PCM >
void Mach1Transcode< PCM >::setInputFormatCustomPoints ( std::vector< Mach1Point3D points)

Sets the input format for transcoding from CustomPoints directly.

Note
View the JSON spec for describing a format here: https://dev.mach1.tech/#json-descriptions

◆ setInputFormatCustomPointsJson()

template<typename PCM >
void Mach1Transcode< PCM >::setInputFormatCustomPointsJson ( std::string  inJson)

Sets the input format for transcoding from CustomPoints directly.

Note
View the JSON spec for describing a format here: https://dev.mach1.tech/#json-descriptions

◆ setLFESub()

template<typename PCM >
void Mach1Transcode< PCM >::setLFESub ( std::vector< int >  subChannelIndices,
int  sampleRate 
)

Apply a low pass filter (LPF) to each indicated channel index of the input format and sound field.

Parameters
subChannelIndicesinteger inputs for channel indices to be processed
sampleRateinteger for samplerate

◆ setOutputFormat()

template<typename PCM >
void Mach1Transcode< PCM >::setOutputFormat ( int  outFmt)

Sets the output format for transcoding from this Mach1Transcode options.

Note
All available preset formats are in Mach1TranscodeConstants.h

◆ setOutputFormatCustomPoints()

template<typename PCM >
void Mach1Transcode< PCM >::setOutputFormatCustomPoints ( std::vector< Mach1Point3D points)

Sets the output format for transcoding from CustomPoints directly.

Note
View the JSON spec for describing a format here: https://dev.mach1.tech/#json-descriptions

◆ setOutputFormatCustomPointsJson()

template<typename PCM >
void Mach1Transcode< PCM >::setOutputFormatCustomPointsJson ( std::string  outJson)

Sets the output format for transcoding from an external JSON source.

Note
View the JSON spec for describing a format here: https://dev.mach1.tech/#json-descriptions

◆ setSpatialDownmixer()

template<typename PCM >
void Mach1Transcode< PCM >::setSpatialDownmixer ( float  corrThreshold = 0.1)

Sets the threshold float for getSpatialDownmixerPossibility calculation.

Parameters
corrThresholdfloat from 0.0 to 1.0 where 0.0 no difference and incrementing to 1.0 is more difference

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