2#include "debugtrace.hpp"
11using Lck = std::scoped_lock<std::mutex>;
12using rte = std::runtime_error;
26 dmat data = d.toFloat();
28 const us nchannels = d.nchannels;
29 assert(data.n_cols == nchannels);
31 if (nchannels != _clip_time.size()) {
32 DEBUGTRACE_PRINT(
"Resizing clip indication");
33 _clip_time =
vd(nchannels, arma::fill::value(-1));
38 vd maxabs = arma::max(arma::abs(data), 0).as_col() / _max_range;
41 arma::uvec clips = maxabs > clip_point;
43 for (
us i = 0; i < nchannels; i++) {
47 }
else if (_clip_time(i) > clip_indication_time) {
50 }
else if (_clip_time(i) >= 0) {
62 arma::uvec clips(_clip_time.size(), arma::fill::zeros);
63 clips.elem(arma::find(_clip_time >= 0)).fill(1);
76 _max_range.resize(nchannels);
79 assert(ranges.size() == nchannels);
81 _max_range[i] = ranges[i];
ClipHandler(SmgrHandle mgr)
Constructs Clipping indicator.
arma::uvec getCurrentValue() const
Get the current values of the clip handler. Returns a vector of of True's.
void inCallback(const DaqData &)
Data coming from / going to DAQ. Non-interleaved format, which means data in buffer is ordered by cha...
Base cass for all DAQ (Data Acquisition) interfaces. A DAQ can be a custom device,...
us neninchannels(bool include_monitorchannels=true) const
Returns the number of enabled input channels.
double samplerate() const
Returns current sample rate.
us framesPerBlock() const
The number of frames that is send in a block of DaqData.
dvec inputRangeForEnabledChannels(const bool include_monitor=true) const
Returns the input range for each channel. Maximum allowed absolute value of the signal that can pass ...
void startThread()
This method should be called from the derived class' constructor, to start the thread and data is inc...
void stopThread()
This method SHOULD be called from all classes that derive on ThreadedInDataHandler....
A bit of curiously recurring template pattern, to connect the specific handlers and connect the prope...
std::scoped_lock< std::mutex > Lck
std::vector< double > dvec
std::shared_ptr< StreamMgr > SmgrHandle
std::scoped_lock< std::mutex > lck
size_t us
We often use boolean values.