Photon C++ Client API  5.0.7.3
Classes | Functions
ExitGames::Voice::AudioUtil Namespace Reference

Collection of Audio Utility functions and classes. More...

Classes

class  ILevelMeter
 Audio Level Metering interface. More...
 
class  IVoiceDetector
 Voice Activity Detector interface. More...
 
class  LevelMeter
 Audio Level Meter. More...
 
class  LevelMeterDummy
 Dummy Audio Level Meter that doesn't actually do anything. More...
 
class  Resampler
 
class  TempoUp
 
class  ToneAudioPusher
 IAudioPusher that provides a constant tone signal. More...
 
class  VoiceDetector
 Simple voice activity detector triggered by signal level. More...
 
class  VoiceDetectorCalibration
 Calibration Utility for Voice Detector More...
 
class  VoiceDetectorDummy
 Dummy VoiceDetector that doesn't actually do anything. More...
 
class  VoiceLevelDetectCalibrate
 Utility Audio Processor Voice Detection Calibration. More...
 

Functions

template<typename T >
void resample (const Buffer< T > &srcBuf, Buffer< T > &dstBuf, int dstSamples, int channels)
 Resample audio data so that the complete src buffer fits into dstSamples in the dst buffer. The buffers contain audio with the same number of channels. More...
 
template<typename T >
void resample (const Buffer< T > &srcBuf, int srcOffsetSamples, int srcSamples, Buffer< T > &dstBuf, int dstOffsetSamples, int dstSamples, int channels)
 Resample audio data with offsets and sizes specified for both src and dst buffers. The buffers contain audio with the same number of channels. More...
 
template<typename T >
void resample (const Buffer< T > &srcBuf, int srcOffsetSamples, int srcSamples, int srcChannels, Buffer< T > &dstBuf, int dstOffsetSamples, int dstSamples, int dstChannels)
 Resample audio data with offsets and sizes specified for both src and dst buffers. More...
 
void resampleAndConvert (const Buffer< short > &srcBuf, Buffer< float > &dstBuf, int dstCount, int channels)
 Resample audio data so that the complete src buffer fits into dstCount samples in the dst buffer, and convert short to float samples along the way. More...
 
void resampleAndConvert (const Buffer< float > &srcBuf, Buffer< short > &dstBuf, int dstCount, int channels)
 Resample audio data so that the complete src buffer fits into dstCount samples in the dst buffer, and convert float to short samples along the way. More...
 
void convert (const Buffer< float > &srcBuf, Buffer< short > &dstBuf, int dstCount)
 Convert audio buffer from float to short samples. More...
 
void convert (const Buffer< short > &srcBuf, Buffer< float > &dstBuf, int dstCount)
 Convert audio buffer from short to float samples. More...
 
template<typename T >
void forceToStereo (const Buffer< T > &srcBuf, Buffer< T > &dstBuf, int srcChannels)
 Convert audio buffer with arbitrary number of channels to stereo. More...
 
template<typename T >
static float toneAmp (void)
 
template<>
float toneAmp< float > (void)
 
template<>
float toneAmp< short > (void)
 
template<typename T >
float defaultThreshold (void)
 
template<>
float defaultThreshold< float > (void)
 
template<>
float defaultThreshold< short > (void)
 
template void resample (const Buffer< float > &srcBuf, Buffer< float > &dstBuf, int dstSamples, int channels)
 
template void resample (const Buffer< float > &srcBuf, int srcOffsetSamples, int srcSamples, Buffer< float > &dstBuf, int dstOffsetSamples, int dstSamples, int channels)
 
template void resample (const Buffer< float > &srcBuf, int srcOffsetSamples, int srcSamples, int srcChannels, Buffer< float > &dstBuf, int dstOffsetSamples, int dstSamples, int dstChannels)
 
template void resample (const Buffer< short > &srcBuf, Buffer< short > &dstBuf, int dstSamples, int channels)
 
template void resample (const Buffer< short > &srcBuf, int srcOffsetSamples, int srcSamples, Buffer< short > &dstBuf, int dstOffsetSamples, int dstSamples, int channels)
 
template void resample (const Buffer< short > &srcBuf, int srcOffsetSamples, int srcSamples, int srcChannels, Buffer< short > &dstBuf, int dstOffsetSamples, int dstSamples, int dstChannels)
 

Detailed Description

Collection of Audio Utility functions and classes.

AudioUtil

Function Documentation

◆ resample() [1/3]

void resample ( const Buffer< T > &  srcBuf,
Buffer< T > &  dstBuf,
int  dstSamples,
int  channels 
)

Resample audio data so that the complete src buffer fits into dstSamples in the dst buffer. The buffers contain audio with the same number of channels.

This implements a primitive nearest-neighbor resampling algorithm for an arbitrary number of channels.

Parameters
srcBufSource buffer.
dstBufDestination buffer.
dstSamplesDestination data size in samples.
channelsNumber of audio channels.

◆ resample() [2/3]

void resample ( const Buffer< T > &  srcBuf,
int  srcOffsetSamples,
int  srcSamples,
Buffer< T > &  dstBuf,
int  dstOffsetSamples,
int  dstSamples,
int  channels 
)

Resample audio data with offsets and sizes specified for both src and dst buffers. The buffers contain audio with the same number of channels.

This implements a primitive nearest-neighbor resampling algorithm for an arbitrary number of channels.

Parameters
srcBufSource buffer.
srcOffsetSamplesSource data offset in samples.
srcSamplesSource data size in samples.
dstBufDestination buffer.
dstOffsetSamplesDestination data offset in samples.
dstSamplesDestination data size in samples.
channelsNumber of audio channels.

◆ resample() [3/3]

void resample ( const Buffer< T > &  srcBuf,
int  srcOffsetSamples,
int  srcSamples,
int  srcChannels,
Buffer< T > &  dstBuf,
int  dstOffsetSamples,
int  dstSamples,
int  dstChannels 
)

Resample audio data with offsets and sizes specified for both src and dst buffers.

This implements a primitive nearest-neighbor resampling algorithm for an arbitrary number of channels.

Parameters
srcBufSource buffer.
srcOffsetSamplesSource data offset in samples.
srcSamplesSource data size in samples.
srcChannelsNumber of audio channels in source.
dstBufDestination buffer.
dstOffsetSamplesDestination data offset in samples.
dstSamplesDestination data size in samples.
dstChannelsNumber of audio channels in destination.

◆ resampleAndConvert() [1/2]

void resampleAndConvert ( const Buffer< short > &  srcBuf,
Buffer< float > &  dstBuf,
int  dstCount,
int  channels 
)

Resample audio data so that the complete src buffer fits into dstCount samples in the dst buffer, and convert short to float samples along the way.

This implements a primitive nearest-neighbor resampling algorithm for an arbitrary number of channels.

Parameters
srcBufSource buffer.
dstBufDestination buffer.
dstCountTarget size of destination buffer (in samples per channel).
channelsNumber of channels in the signal (1=mono, 2=stereo). Must be > 0.

◆ resampleAndConvert() [2/2]

void resampleAndConvert ( const Buffer< float > &  srcBuf,
Buffer< short > &  dstBuf,
int  dstCount,
int  channels 
)

Resample audio data so that the complete src buffer fits into dstCount samples in the dst buffer, and convert float to short samples along the way.

This implements a primitive nearest-neighbor resampling algorithm for an arbitrary number of channels.

Parameters
srcBufSource buffer.
dstBufDestination buffer.
dstCountTarget size of destination buffer (in samples per channel).
channelsNumber of channels in the signal (1=mono, 2=stereo). Must be > 0.

◆ convert() [1/2]

void convert ( const Buffer< float > &  srcBuf,
Buffer< short > &  dstBuf,
int  dstCount 
)

Convert audio buffer from float to short samples.

Parameters
srcBufSource buffer.
dstBufDestination buffer.
dstCountSize of destination buffer (in total samples), source buffer must be of same length or longer.

◆ convert() [2/2]

void convert ( const Buffer< short > &  srcBuf,
Buffer< float > &  dstBuf,
int  dstCount 
)

Convert audio buffer from short to float samples.

Parameters
srcBufSource buffer.
dstBufDestination buffer.
dstCountSize of destination buffer (in total samples), source buffer must be of same length or longer.

◆ forceToStereo()

void forceToStereo ( const Buffer< T > &  srcBuf,
Buffer< T > &  dstBuf,
int  srcChannels 
)

Convert audio buffer with arbitrary number of channels to stereo.

For mono sources (srcChannels==1), the signal will be copied to both Left and Right stereo channels. For all others, the first two available channels will be used, any other channels will be discarded.

Parameters
srcBufSource buffer.
dstBufDestination buffer.
srcChannelsNumber of (interleaved) channels in src.