LASP 1.0
Library for Acoustic Signal Processing
|
Data coming from / going to DAQ. Non-interleaved format, which means data in buffer is ordered by channel: _ptr[frame+channel*nframes]. More...
#include <lasp_daqdata.h>
Public Member Functions | |
DaqData (const us nframes, const us nchannels, const DataTypeDescriptor::DataType dtype) | |
Initialize an empty frame of data. | |
DaqData (const DaqData &) | |
Initialize using no allocation. | |
DaqData (DaqData &&) | |
DaqData & | operator= (const DaqData &)=delete |
~DaqData () | |
byte_t * | raw_ptr (const us frame=0, const us channel=0) |
Return pointer to the raw data corresponding to a certain sample (frame, channel combo). | |
const byte_t * | raw_ptr (const us frame=0, const us channel=0) const |
us | size_bytes () const |
Return the total number of bytes. | |
void | copyInFromRaw (const std::vector< byte_t * > &ptrs) |
Copy data from a set of raw pointers of uninterleaved data. Overwrites any existing available data. | |
void | copyInFromRaw (const us channel, const byte_t *ptr) |
Copy data from a set of raw pointers of uninterleaved data. Overwrites any existing available data. | |
void | copyToRaw (const us channel, byte_t *ptr) |
Copy contents of DaqData for a certain channel to a raw pointer. | |
arma::Mat< d > | toFloat () const |
Convert samples to floating point values and return a nframes x nchannels array of floats. For data that is not already floating-point, the data is scaled back from MAX_INT to +1.0. | |
arma::Col< d > | toFloat (const us channel_no) const |
Convert samples to floating point value; and return a nframes column vector of floats. For data that is not already floating-point, the data is scaled back from MAX_INT to +1.0. | |
d | toFloat (const us frame_no, const us channel_no) const |
Convert single sample to floating point value; and return a nframes column vector of floats. For data that is not already floating-point, the data is scaled back from MAX_INT to +1.0. | |
void | fromFloat (const us frame_no, const us channel_no, const d data) |
Convert to channel data of native type from floating point values. Useful for 'changing' raw data in any way. | |
void | fromFloat (const us channel, const arma::Col< d > &data) |
Convert to channel data of native type from floating point values. Useful for 'changing' raw data in any way. | |
template<typename T > | |
T & | value (const us frame, const us channel) |
template<typename T > | |
const T & | value (const us frame, const us channel) const |
void | print () const |
For debugging purposes: prints some stats. | |
template<typename T > | |
vd | toFloat (const us channel) const |
template<typename T > | |
dmat | toFloat () const |
Public Attributes | |
us | nframes |
The number of frames in this block of data. | |
us | nchannels |
The number of channels. | |
DataTypeDescriptor::DataType | dtype |
The data type corresponding to a sample. | |
DataTypeDescriptor | dtype_descr |
The data type description corresponding to a sample. | |
us | sw |
The number of bytes per sample (sample width, sw) | |
Protected Member Functions | |
template<typename T > | |
void | check_type () const |
template<typename T > | |
arma::Mat< d > | toFloat () const |
template<typename T > | |
arma::Col< d > | toFloat (const us channel_no) const |
template<typename T > | |
d | toFloat (const us frame_no, const us channel_no) const |
template<typename T > | |
void | fromFloat (const us channel_no, const arma::Col< d > &vals) |
template<typename T > | |
void | fromFloat (const us frame_no, const us channel_no, const d val) |
Protected Attributes | |
byte_t * | _data |
Storage for the actual data. | |
Data coming from / going to DAQ. Non-interleaved format, which means data in buffer is ordered by channel: _ptr[frame+channel*nframes].
Definition at line 22 of file lasp_daqdata.h.
DaqData::DaqData | ( | const us | nframes, |
const us | nchannels, | ||
const DataTypeDescriptor::DataType | dtype | ||
) |
Initialize an empty frame of data.
Constructors and destructors.
nframes | The number of frames |
nchannels | The number of channels |
dtype | The data type |
Definition at line 19 of file lasp_daqdata.cpp.
DaqData::DaqData | ( | const DaqData & | o | ) |
Initialize using no allocation.
Definition at line 36 of file lasp_daqdata.cpp.
DaqData::DaqData | ( | DaqData && | o | ) |
DaqData::~DaqData | ( | ) |
Definition at line 54 of file lasp_daqdata.cpp.
|
inlineprotected |
Definition at line 196 of file lasp_daqdata.h.
void DaqData::copyInFromRaw | ( | const std::vector< byte_t * > & | ptrs | ) |
Copy data from a set of raw pointers of uninterleaved data. Overwrites any existing available data.
ptrs | Pointers to data from channels |
Definition at line 60 of file lasp_daqdata.cpp.
Copy data from a set of raw pointers of uninterleaved data. Overwrites any existing available data.
channel | The channel to copy to |
ptr | Pointers to data from channels |
Definition at line 69 of file lasp_daqdata.cpp.
Copy contents of DaqData for a certain channel to a raw pointer.
channel | The channel to copy. |
ptr | The pointer where data is copied to. |
Definition at line 75 of file lasp_daqdata.cpp.
void DaqData::fromFloat | ( | const us | channel, |
const arma::Col< d > & | data | ||
) |
Convert to channel data of native type from floating point values. Useful for 'changing' raw data in any way.
channel | The channel to convert |
data | Data to convert from float values |
Definition at line 250 of file lasp_daqdata.cpp.
|
protected |
Convert to channel data of native type from floating point values. Useful for 'changing' raw data in any way.
frame_no | The frame |
channel_no | The channel |
data | The value |
Definition at line 226 of file lasp_daqdata.cpp.
|
protected |
Definition at line 213 of file lasp_daqdata.cpp.
void DaqData::print | ( | ) | const |
For debugging purposes: prints some stats.
Definition at line 286 of file lasp_daqdata.cpp.
Return pointer to the raw data corresponding to a certain sample (frame, channel combo).
frame | The frame number |
channel | The channel number |
Definition at line 81 of file lasp_daqdata.h.
Definition at line 86 of file lasp_daqdata.h.
|
inline |
Return the total number of bytes.
Definition at line 97 of file lasp_daqdata.h.
dmat DaqData::toFloat | ( | ) | const |
Definition at line 104 of file lasp_daqdata.cpp.
dmat DaqData::toFloat | ( | ) | const |
Convert samples to floating point values and return a nframes x nchannels array of floats. For data that is not already floating-point, the data is scaled back from MAX_INT to +1.0.
Definition at line 175 of file lasp_daqdata.cpp.
|
protected |
Definition at line 93 of file lasp_daqdata.cpp.
Convert samples to floating point value; and return a nframes column vector of floats. For data that is not already floating-point, the data is scaled back from MAX_INT to +1.0.
channel_no | The channel number to convert |
Definition at line 147 of file lasp_daqdata.cpp.
|
protected |
Convert single sample to floating point value; and return a nframes column vector of floats. For data that is not already floating-point, the data is scaled back from MAX_INT to +1.0.
frame_no | The frame number to convert |
channel_no | The channel number to convert |
Definition at line 120 of file lasp_daqdata.cpp.
Definition at line 83 of file lasp_daqdata.cpp.
Definition at line 177 of file lasp_daqdata.h.
Definition at line 183 of file lasp_daqdata.h.
|
protected |
Storage for the actual data.
Definition at line 27 of file lasp_daqdata.h.
DataTypeDescriptor::DataType DaqData::dtype |
The data type corresponding to a sample.
Definition at line 43 of file lasp_daqdata.h.
DataTypeDescriptor DaqData::dtype_descr |
The data type description corresponding to a sample.
Definition at line 48 of file lasp_daqdata.h.
us DaqData::nchannels |
The number of channels.
Definition at line 38 of file lasp_daqdata.h.
us DaqData::nframes |
The number of frames in this block of data.
Definition at line 33 of file lasp_daqdata.h.
us DaqData::sw |
The number of bytes per sample (sample width, sw)
Definition at line 53 of file lasp_daqdata.h.