vdr-plugin-softhddevice-drm-gles 1.6.7
cAudioProcessor Class Reference

Audio Manipulation. More...

#include <audioprocessor.h>

Public Member Functions

 cAudioProcessor (const int)
 Create a new audio processoror.
 
void Normalize (uint16_t *, int)
 Normalize audio samples.
 
void SetNormalizer (int)
 Set normalize volume parameters.
 
void ResetNormalizer (void)
 
void Compress (uint16_t *, int)
 Compress audio samples.
 
void SetCompressor (int)
 Set volume compression parameters.
 
void ResetCompressor (void)
 
void SetEqualizer (int[18])
 Set equalizer bands.
 
std::string GetEqualizerOptions (void) const
 Get equalizer filter options.
 
void Amplify (int16_t *, int, int)
 Amplify the samples in software.
 
void SetAmplifier (int volume)
 

Private Attributes

const int m_bytesPerSample
 
int m_normalizeCounter
 normalize sample counter
 
uint32_t m_normalizeAverage [NORMALIZE_MAX_INDEX]
 average of n last normalize sample blocks
 
int m_normalizeIndex
 index into normalize average table
 
int m_normalizeReady
 index normalize counter
 
int m_normalizeFactor
 current normalize factor
 
int m_normalizeMaxFactor
 max. normalize factor
 
int m_compressionFactor = 0
 current compression factor
 
int m_compressionMaxFactor
 max. compression factor
 
float m_equalizerBand [18]
 equalizer band
 
int m_amplifier
 software volume amplify factor
 

Static Private Attributes

static constexpr int NORMALIZE_MAX_INDEX = 128
 number of normalize average samples
 
static constexpr int NORMALIZE_SAMPLES = 4096
 number of normalize samples
 
static constexpr int NORMALIZE_DEFAULT_FACTOR = 1000
 default normalize factor
 
static constexpr int NORMALIZE_MIN_FACTOR = 100
 min. normalize factor
 
static constexpr int COMPRESSION_DEFAULT_FACTOR = 1000
 default compression factor
 
static constexpr int COMPRESSION_DEFAULT_MAX_FACTOR = 2000
 default compression max. factor
 

Detailed Description

Audio Manipulation.

Definition at line 24 of file audioprocessor.h.

Constructor & Destructor Documentation

◆ cAudioProcessor()

cAudioProcessor::cAudioProcessor ( const int  bytesPerSample)

Create a new audio processoror.

Parameters
bytesPerSamplebytes per sampler (hardcoded to 2)

Definition at line 31 of file audioprocessor.cpp.

Member Function Documentation

◆ Amplify()

void cAudioProcessor::Amplify ( int16_t samples,
int  count,
int  volume 
)

Amplify the samples in software.

Parameters
samplessample buffer
countnumber of bytes in sample buffer
Todo:
FIXME: this does hard clipping

Definition at line 286 of file audioprocessor.cpp.

References m_amplifier, and m_bytesPerSample.

Referenced by cSoftHdAudio::SendAudio().

◆ Compress()

void cAudioProcessor::Compress ( uint16_t samples,
int  count 
)

Compress audio samples.

Parameters
samplessample buffer
countnumber of bytes in sample buffer

Definition at line 144 of file audioprocessor.cpp.

References L_SOUND, LOGDEBUG2, m_bytesPerSample, m_compressionFactor, and m_compressionMaxFactor.

Referenced by cSoftHdAudio::EnqueueFrame().

◆ GetEqualizerOptions()

std::string cAudioProcessor::GetEqualizerOptions ( void  ) const

Get equalizer filter options.

Definition at line 257 of file audioprocessor.cpp.

References m_equalizerBand.

Referenced by cSoftHdAudio::InitFilter().

◆ Normalize()

void cAudioProcessor::Normalize ( uint16_t samples,
int  count 
)

Normalize audio samples.

Parameters
samplessample buffer
countnumber of bytes in sample buffer

Definition at line 42 of file audioprocessor.cpp.

References L_SOUND, LOGDEBUG2, m_bytesPerSample, m_normalizeAverage, m_normalizeCounter, m_normalizeFactor, m_normalizeIndex, m_normalizeMaxFactor, m_normalizeReady, NORMALIZE_MAX_INDEX, NORMALIZE_MIN_FACTOR, and NORMALIZE_SAMPLES.

Referenced by cSoftHdAudio::EnqueueFrame().

◆ ResetCompressor()

void cAudioProcessor::ResetCompressor ( void  )

◆ ResetNormalizer()

◆ SetAmplifier()

void cAudioProcessor::SetAmplifier ( int  volume)
inline

Definition at line 40 of file audioprocessor.h.

References m_amplifier.

Referenced by cSoftHdAudio::SetVolume().

◆ SetCompressor()

void cAudioProcessor::SetCompressor ( int  maxfac)

Set volume compression parameters.

Parameters
maxfacmax. factor of compression / 1000

Definition at line 198 of file audioprocessor.cpp.

References COMPRESSION_DEFAULT_FACTOR, m_compressionFactor, and m_compressionMaxFactor.

Referenced by cSoftHdAudio::SetCompression().

◆ SetEqualizer()

void cAudioProcessor::SetEqualizer ( int  band[18])

Set equalizer bands.

Parameters
bandsetting frequenz bands

Definition at line 222 of file audioprocessor.cpp.

References m_equalizerBand.

Referenced by cSoftHdAudio::SetEqualizer().

◆ SetNormalizer()

void cAudioProcessor::SetNormalizer ( int  maxfac)

Set normalize volume parameters.

Parameters
maxfacmax. factor of normalize / 1000

Definition at line 122 of file audioprocessor.cpp.

References m_normalizeMaxFactor.

Referenced by cSoftHdAudio::SetNormalize().

Member Data Documentation

◆ COMPRESSION_DEFAULT_FACTOR

constexpr int cAudioProcessor::COMPRESSION_DEFAULT_FACTOR = 1000
staticconstexprprivate

default compression factor

Definition at line 58 of file audioprocessor.h.

Referenced by SetCompressor().

◆ COMPRESSION_DEFAULT_MAX_FACTOR

constexpr int cAudioProcessor::COMPRESSION_DEFAULT_MAX_FACTOR = 2000
staticconstexprprivate

default compression max. factor

Definition at line 59 of file audioprocessor.h.

Referenced by ResetCompressor().

◆ m_amplifier

int cAudioProcessor::m_amplifier
private

software volume amplify factor

Definition at line 67 of file audioprocessor.h.

Referenced by Amplify(), and SetAmplifier().

◆ m_bytesPerSample

const int cAudioProcessor::m_bytesPerSample
private

Definition at line 43 of file audioprocessor.h.

Referenced by Amplify(), Compress(), and Normalize().

◆ m_compressionFactor

int cAudioProcessor::m_compressionFactor = 0
private

current compression factor

Definition at line 60 of file audioprocessor.h.

Referenced by Compress(), ResetCompressor(), and SetCompressor().

◆ m_compressionMaxFactor

int cAudioProcessor::m_compressionMaxFactor
private

max. compression factor

Definition at line 61 of file audioprocessor.h.

Referenced by Compress(), ResetCompressor(), and SetCompressor().

◆ m_equalizerBand

float cAudioProcessor::m_equalizerBand[18]
private

equalizer band

Definition at line 64 of file audioprocessor.h.

Referenced by GetEqualizerOptions(), and SetEqualizer().

◆ m_normalizeAverage

uint32_t cAudioProcessor::m_normalizeAverage[NORMALIZE_MAX_INDEX]
private

average of n last normalize sample blocks

Definition at line 51 of file audioprocessor.h.

Referenced by Normalize(), and ResetNormalizer().

◆ m_normalizeCounter

int cAudioProcessor::m_normalizeCounter
private

normalize sample counter

Definition at line 50 of file audioprocessor.h.

Referenced by Normalize(), and ResetNormalizer().

◆ m_normalizeFactor

int cAudioProcessor::m_normalizeFactor
private

current normalize factor

Definition at line 54 of file audioprocessor.h.

Referenced by Normalize(), and ResetNormalizer().

◆ m_normalizeIndex

int cAudioProcessor::m_normalizeIndex
private

index into normalize average table

Definition at line 52 of file audioprocessor.h.

Referenced by Normalize().

◆ m_normalizeMaxFactor

int cAudioProcessor::m_normalizeMaxFactor
private

max. normalize factor

Definition at line 55 of file audioprocessor.h.

Referenced by Normalize(), and SetNormalizer().

◆ m_normalizeReady

int cAudioProcessor::m_normalizeReady
private

index normalize counter

Definition at line 53 of file audioprocessor.h.

Referenced by Normalize(), and ResetNormalizer().

◆ NORMALIZE_DEFAULT_FACTOR

constexpr int cAudioProcessor::NORMALIZE_DEFAULT_FACTOR = 1000
staticconstexprprivate

default normalize factor

Definition at line 48 of file audioprocessor.h.

Referenced by ResetNormalizer().

◆ NORMALIZE_MAX_INDEX

constexpr int cAudioProcessor::NORMALIZE_MAX_INDEX = 128
staticconstexprprivate

number of normalize average samples

Definition at line 46 of file audioprocessor.h.

Referenced by Normalize(), and ResetNormalizer().

◆ NORMALIZE_MIN_FACTOR

constexpr int cAudioProcessor::NORMALIZE_MIN_FACTOR = 100
staticconstexprprivate

min. normalize factor

Definition at line 49 of file audioprocessor.h.

Referenced by Normalize().

◆ NORMALIZE_SAMPLES

constexpr int cAudioProcessor::NORMALIZE_SAMPLES = 4096
staticconstexprprivate

number of normalize samples

Definition at line 47 of file audioprocessor.h.

Referenced by Normalize().


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