spandsp 3.0.0
power_meter.c File Reference
#include <inttypes.h>
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#include <float.h>
#include "spandsp/stdbool.h"
#include "floating_fudge.h"
#include <assert.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/power_meter.h"
#include "spandsp/private/power_meter.h"

Functions

power_meter_tpower_meter_damping (power_meter_t *s, int shift)
 Change the damping factor of a power meter context.
 
int32_t power_meter_update (power_meter_t *s, int16_t amp)
 Update a power meter.
 
int32_t power_meter_rx (power_meter_t *s, int16_t amp[], int len)
 Update a power meter.
 
int32_t power_meter_level_dbm0 (float level)
 Get the current power meter reading, in dBm0.
 
int32_t power_meter_level_dbov (float level)
 Get the current power meter reading, in dBOv.
 
int32_t power_meter_current (power_meter_t *s)
 Get the current power meter reading.
 
float power_meter_current_dbm0 (power_meter_t *s)
 Get the current power meter reading, in dBm0.
 
float power_meter_current_dbov (power_meter_t *s)
 Get the current power meter reading, in dBOv.
 
power_meter_tpower_meter_init (power_meter_t *s, int shift)
 Initialise a power meter context.
 
int power_meter_release (power_meter_t *s)
 
int power_meter_free (power_meter_t *s)
 
int32_t power_surge_detector (power_surge_detector_state_t *s, int16_t amp)
 
float power_surge_detector_current_dbm0 (power_surge_detector_state_t *s)
 Get the current surge detector meter reading, in dBm0.
 
float power_surge_detector_current_dbov (power_surge_detector_state_t *s)
 Get the current surge detector meter reading, in dBOv.
 
power_surge_detector_state_tpower_surge_detector_init (power_surge_detector_state_t *s, float min, float surge)
 
int power_surge_detector_release (power_surge_detector_state_t *s)
 
int power_surge_detector_free (power_surge_detector_state_t *s)
 

Function Documentation

◆ power_meter_current()

int32_t power_meter_current ( power_meter_t * s)

Get the current power meter reading.

Get the current power meter reading.

Parameters
sThe power meter context.
Returns
The current power meter reading.

References power_meter_s::reading.

◆ power_meter_current_dbm0()

float power_meter_current_dbm0 ( power_meter_t * s)

Get the current power meter reading, in dBm0.

Get the current power meter reading, in dBm0.

Parameters
sThe power meter context.
Returns
The current power meter reading, in dBm0.

References power_meter_s::reading.

Referenced by fsk_rx_signal_power(), power_surge_detector_current_dbm0(), v17_rx_signal_power(), v22bis_rx_signal_power(), v27ter_rx_signal_power(), and v29_rx_signal_power().

◆ power_meter_current_dbov()

float power_meter_current_dbov ( power_meter_t * s)

Get the current power meter reading, in dBOv.

Get the current power meter reading, in dBOv.

Parameters
sThe power meter context.
Returns
The current power meter reading, in dBOv.

References power_meter_s::reading.

Referenced by power_surge_detector_current_dbov().

◆ power_meter_damping()

power_meter_t * power_meter_damping ( power_meter_t * s,
int shift )

Change the damping factor of a power meter context.

Change the damping factor of a power meter context.

Parameters
sThe power meter context.
shiftThe new shift to be used by the IIR filter.
Returns
The power meter context.

References power_meter_s::shift.

◆ power_meter_init()

power_meter_t * power_meter_init ( power_meter_t * s,
int shift )

Initialise a power meter context.

Initialise a power meter context.

Parameters
sThe power meter context.
shiftThe shift to be used by the IIR filter.
Returns
The power meter context.

References power_meter_s::reading, and power_meter_s::shift.

Referenced by sig_tone_rx_init(), t31_init(), v17_rx_restart(), v22bis_rx_restart(), v27ter_rx_restart(), and v29_rx_restart().

◆ power_meter_level_dbm0()

int32_t power_meter_level_dbm0 ( float level)

Get the current power meter reading, in dBm0.

Get the power meter reading which represents a specified power level in dBm0.

Parameters
levelA power level, in dB0m.
Returns
The equivalent power meter reading.

Referenced by fsk_rx_set_signal_cutoff(), sig_tone_rx_init(), t31_init(), v17_rx_set_signal_cutoff(), v22bis_rx_set_signal_cutoff(), v27ter_rx_set_signal_cutoff(), v29_rx_set_signal_cutoff(), and v34_rx_set_signal_cutoff().

◆ power_meter_level_dbov()

int32_t power_meter_level_dbov ( float level)

Get the current power meter reading, in dBOv.

Get the power meter reading which represents a specified power level in dBOv.

Parameters
levelA power level, in dBOv.
Returns
The equivalent power meter reading.

◆ power_meter_rx()

int32_t power_meter_rx ( power_meter_t * s,
int16_t amp[],
int len )

Update a power meter.

Update a power meter with a block of samples.

Parameters
sThe power meter context.
ampThe amplitude of the new audio sample.
lenThe number of samples
Returns
The current power meter reading.

References power_meter_s::reading, and power_meter_s::shift.

◆ power_meter_update()

int32_t power_meter_update ( power_meter_t * s,
int16_t amp )

Update a power meter.

Update a power meter with a signal sample.

Parameters
sThe power meter context.
ampThe amplitude of the new audio sample.
Returns
The current power meter reading.

References power_meter_s::reading, and power_meter_s::shift.

Referenced by fsk_rx(), sig_tone_rx(), t31_rx(), and v22bis_rx().

◆ power_surge_detector_current_dbm0()

float power_surge_detector_current_dbm0 ( power_surge_detector_state_t * s)

Get the current surge detector meter reading, in dBm0.

Get the current surge detector short term meter reading, in dBm0.

Parameters
sThe power surge detector context.
Returns
The current power surge detector power reading, in dBm0.

References power_meter_current_dbm0().

◆ power_surge_detector_current_dbov()

float power_surge_detector_current_dbov ( power_surge_detector_state_t * s)

Get the current surge detector meter reading, in dBOv.

Get the current surge detector short term meter reading, in dBOv.

Parameters
sThe power surge detector context.
Returns
The current power surge detector power reading, in dBOv.

References power_meter_current_dbov().