lasp/cpp_src/dsp/lasp_clip.h

78 lines
1.5 KiB
C
Raw Normal View History

2023-01-27 13:56:46 +00:00
// lasp_clip.h
//
// Author: J.A. de Jong, C.R.D. Jansen - ASCEE
2023-01-27 13:56:46 +00:00
//
// Description: Clip handler
2023-01-27 13:56:46 +00:00
#pragma once
#include <memory>
#include "lasp_filter.h"
#include "lasp_mathtypes.h"
#include "lasp_threadedindatahandler.h"
/**
* \addtogroup dsp
* @{
*
* \addtogroup rt
* @{
*/
/**
* @brief Clipping detector (Clip). Detects when a signal overdrives the input
* */
class ClipHandler: public ThreadedInDataHandler<ClipHandler> {
2023-01-27 13:56:46 +00:00
/**
* @brief Assuming full scale of a signal is +/- 1.0. If a value is found
*/
static inline const d clip_point = 0.98;
/**
* @brief How long it takes in [s] after a clip event has happened, that we
* are actually still in 'clip' mode.
*/
static inline const d clip_indication_time = 2.0;
/**
* @brief Inverse of block sampling frequency [s]: (framesPerBlock/fs)
*/
d _dt;
mutable std::mutex _mtx;
/**
* @brief How long ago the last clip has happened. Negative in case no clip
* has happened.
*/
vd _clip_time;
/**
* @brief Storage for maximum values
*/
vd _max_range;
public:
/**
* @brief Constructs Clipping indicator
*
* @param mgr Stream Mgr to operate on
*/
ClipHandler(SmgrHandle mgr);
2023-01-27 13:56:46 +00:00
~ClipHandler();
/**
* @brief Get the current values of the clip handler. Returns a vector of of True's.
*
* @return clipping indication
*/
arma::uvec getCurrentValue() const;
void inCallback(const DaqData& );
void reset(const Daq*);
2023-01-27 13:56:46 +00:00
};
/** @} */
/** @} */