LASP 1.0
Library for Acoustic Signal Processing
|
Base cass for all DAQ (Data Acquisition) interfaces. A DAQ can be a custom device, or for example a sound card. More...
#include <lasp_daq.h>
Classes | |
class | StreamException |
Used for internal throwing of exceptions. More... | |
class | StreamStatus |
Information regarding a stream. More... | |
Public Types | |
using | rte = std::runtime_error |
Public Member Functions | |
virtual void | start (InDaqCallback inCallback, OutDaqCallback outCallback)=0 |
Start the Daq. | |
virtual void | stop ()=0 |
Stop the Daq device. Throws an exception if the device is not running at the time this method is called. | |
virtual | ~Daq ()=0 |
us | neninchannels (bool include_monitorchannels=true) const |
Returns the number of enabled input channels. | |
us | nenoutchannels () const |
Returns the number of enabled output channels. | |
boolvec | eninchannels (const bool include_monitor=true) const |
Create a vector of boolean values of the enabled input channels. | |
boolvec | enoutchannels () const |
Create an array of booleans for each enabled output channel. | |
double | samplerate () const |
Returns current sample rate. | |
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 unclipped. | |
DataTypeDescriptor::DataType | dataType () const |
Returns datatype (enum) corresponding to the datatype of the samples. | |
const DataTypeDescriptor & | dtypeDescr () const |
More elaborate description of the datatypes. | |
us | framesPerBlock () const |
The number of frames that is send in a block of DaqData. | |
virtual StreamStatus | getStreamStatus () const =0 |
Get stream status corresponding to current DAQ. | |
bool | duplexMode () const |
Whether the device runs in duplex mode (both input and output), or false if only input / only output. | |
Public Member Functions inherited from DaqConfiguration | |
std::string | toTOML () const |
Export the class to TOML markup language. | |
std::vector< DaqChannel > | enabledInChannels (const bool include_monitor=true) const |
Return list of enabled input channels. | |
DaqConfiguration (const DeviceInfo &deviceinfo) | |
Create a default configuration, with all channels disabled on both input and output, and default channel names. | |
DaqConfiguration () | |
bool | match (const DeviceInfo &devinfo) const |
Check to see whether the DAQ configuration matches with the device. This means, some basic checks are done on channels, sampling rate, etc, and that the name corresponds with the device name. | |
int | getHighestEnabledInChannel () const |
Get the enabled highest channel number from the list of enabled input channels. | |
int | getHighestEnabledOutChannel () const |
Get the highest channel number from the list of enabled output channels. | |
int | getLowestEnabledInChannel () const |
Get the lowest channel number from the list of enabled input channels. | |
int | getLowestEnabledOutChannel () const |
Get the lowest channel number from the list of enabled output channels. | |
void | setAllInputEnabled (bool val) |
Set all input channels to enabled / disabled state. | |
void | setAllOutputEnabled (bool val) |
Set all output channels to enabled / disabled state. | |
Public Member Functions inherited from DeviceInfo | |
virtual | ~DeviceInfo () |
Virtual desctructor. Can be derived class. | |
DeviceInfo & | operator= (const DeviceInfo &)=delete |
virtual std::unique_ptr< DeviceInfo > | clone () const |
Clone a device info. | |
double | prefSampleRate () const |
operator string () const | |
String representation of DeviceInfo. | |
Static Public Member Functions | |
static std::unique_ptr< Daq > | createDaq (const DeviceInfo &devinfo, const DaqConfiguration &config) |
Create a Daq based on given device info and configuration. | |
Static Public Member Functions inherited from DaqConfiguration | |
static DaqConfiguration | fromTOML (const std::string &toml) |
Load in a DAQConfiguration from TOML. | |
Static Public Member Functions inherited from DeviceInfo | |
static DeviceInfoList | getDeviceInfo () |
Create a list of DeviceInfo's that are at call time avalable. | |
Protected Member Functions | |
Daq (const DeviceInfo &devinfo, const DaqConfiguration &config) | |
Daq (const Daq &)=delete | |
Additional Inherited Members | |
Public Attributes inherited from DaqConfiguration | |
DaqApi | api |
string | device_name |
The internal device name this DAQ configuration applies to. | |
std::vector< DaqChannel > | inchannel_config |
Channel configuration for input channels. | |
std::vector< DaqChannel > | outchannel_config |
Channel configuration for output channels. | |
int | sampleRateIndex = 0 |
Index in list of sample rates that are available for the device. | |
int | dataTypeIndex = 0 |
Required datatype for output, should be present in the list. | |
int | framesPerBlockIndex = 0 |
The index in the array of frames per block that can be used for the device. | |
bool | monitorOutput = false |
If set to true and if the device has this capability, the output channels are added as input channels as well. | |
Public Attributes inherited from DeviceInfo | |
DaqApi | api |
Backend API corresponding to device. | |
string | device_name = "" |
The name of the device. | |
std::vector< DataTypeDescriptor::DataType > | availableDataTypes |
The available data types the device can output. | |
int | prefDataTypeIndex = 0 |
The device's prefferd data type. | |
dvec | availableSampleRates |
Available sample rates the device can run on. | |
int | prefSampleRateIndex = -1 |
Preferred setting for the sample rate. | |
usvec | availableFramesPerBlock |
Available latency-setting (number of frames passed in each callback). | |
us | prefFramesPerBlockIndex = 0 |
Preffered number of frames per callback. | |
dvec | availableInputRanges |
Available ranges for the input, i.e. +/- 1V and/or +/- 10 V etc. | |
int | prefInputRangeIndex = 0 |
Its preffered range. | |
unsigned | ninchannels = 0 |
The number of input channels available for the device. | |
unsigned | noutchannels = 0 |
The number of output channels available for the device. | |
bool | hasInputIEPE = false |
Whether the device is capable to provide IEPE constant current power supply. | |
bool | hasInputACCouplingSwitch = false |
Whether the device is capable of enabling a hardware AC-coupling. | |
bool | hasInputTrigger = false |
Whether the device is able to trigger on input. | |
bool | hasInternalOutputMonitor = false |
Whether the device has an internal monitor of the output signal. If true, the device is able to monitor output signals internally and able to present output signals as virtual input signals. This only works together Daq's that are able to run in full duplex mode. | |
bool | duplexModeForced = false |
This flag is used to be able to indicate that the device cannot run input and output streams independently, without opening the device in duplex mode. This is for example true for the UlDaq: only one handle to the device can be given at the same time. | |
DaqChannel::Qty | physicalOutputQty = DaqChannel::Qty::Number |
The physical quantity of the output signal. For 'normal' audio devices, this is typically a 'number' between +/- full scale. For some devices however, the output quantity corresponds to a physical signal, such a Volts. | |
Base cass for all DAQ (Data Acquisition) interfaces. A DAQ can be a custom device, or for example a sound card.
Definition at line 29 of file lasp_daq.h.
using Daq::rte = std::runtime_error |
Definition at line 86 of file lasp_daq.h.
|
protected |
Definition at line 43 of file lasp_daq.cpp.
|
protecteddelete |
|
pure virtual |
Definition at line 18 of file lasp_daq.cpp.
|
static |
Create a Daq based on given device info and configuration.
devinfo | Device information of device to be used. |
config | Configuation to apply to the deviec |
Definition at line 20 of file lasp_daq.cpp.
DataTypeDescriptor::DataType Daq::dataType | ( | ) | const |
Returns datatype (enum) corresponding to the datatype of the samples.
Definition at line 83 of file lasp_daq.cpp.
const DataTypeDescriptor & Daq::dtypeDescr | ( | ) | const |
More elaborate description of the datatypes.
Definition at line 86 of file lasp_daq.cpp.
|
inline |
Whether the device runs in duplex mode (both input and output), or false if only input / only output.
Definition at line 224 of file lasp_daq.h.
boolvec Daq::eninchannels | ( | const bool | include_monitor = true | ) | const |
Create a vector of boolean values of the enabled input channels.
include_monitor | If set to true and a monitor channel is available, the first index in the array will correspond to the monitor channel, and whether it is enabled |
Definition at line 109 of file lasp_daq.cpp.
boolvec Daq::enoutchannels | ( | ) | const |
Create an array of booleans for each enabled output channel.
Definition at line 120 of file lasp_daq.cpp.
|
inline |
The number of frames that is send in a block of DaqData.
Definition at line 207 of file lasp_daq.h.
|
pure virtual |
dvec Daq::inputRangeForEnabledChannels | ( | const bool | include_monitor = true | ) | const |
Returns the input range for each channel. Maximum allowed absolute value of the signal that can pass unclipped.
include_monitor | If set to true and a monitor channel is available, the first index in the array will correspond to the monitor channel. |
Definition at line 90 of file lasp_daq.cpp.
us Daq::neninchannels | ( | bool | include_monitorchannels = true | ) | const |
Returns the number of enabled input channels.
include_monitorchannels | if true, all channels that are internally monitored are added to the list. |
Definition at line 99 of file lasp_daq.cpp.
us Daq::nenoutchannels | ( | ) | const |
Returns the number of enabled output channels.
Definition at line 104 of file lasp_daq.cpp.
double Daq::samplerate | ( | ) | const |
|
pure virtual |
Start the Daq.
inCallback | Function that is called with input data as argument, and which expects output data as a return value. If no input data is required, this callback should be unset. |
outCallback | Function that is called when output data is required. If the stream does not require output data, this callback should be unset. |
Implemented in DT9837A.
|
pure virtual |