LASP 1.0
Library for Acoustic Signal Processing
Loading...
Searching...
No Matches
lasp_uldaq_bufhandler.h
Go to the documentation of this file.
1#pragma once
2#include <uldaq.h>
3#include "lasp_types.h"
4#include "lasp_uldaq_impl.h"
5#include "lasp_uldaq_common.h"
6
7
8
17class DT9837A;
19protected:
35 double samplerate;
39 std::vector<double> buf;
43 bool topenqueued = false;
48 bool botenqueued = false;
49
55 long long buffer_mid_idx;
56
57public:
65 : daq(daq), dtype_descr(daq.dtypeDescr()), nchannels(nchannels),
66 nFramesPerBlock(daq.framesPerBlock()), samplerate(daq.samplerate()),
67 buf(2 * nchannels *
68 nFramesPerBlock, // Watch the two here, the top and the bottom!
69 0),
71 assert(nchannels > 0);
72 assert(nFramesPerBlock > 0);
73 }
74};
78class InBufHandler : public BufHandler {
79 bool monitorOutput;
81
82public:
84 void start();
90 bool operator()();
92};
93class OutBufHandler : public BufHandler {
95
96public:
98 void start();
105
107};
double samplerate
Sampling frequency in Hz.
const DataTypeDescriptor dtype_descr
The type of data, in this case always double precision floats.
std::vector< double > buf
Storage capacity for the DAQ I/O.
us nchannels
The number of channels, number of frames per callback (block).
us totalFramesCount
Counter for the total number of frames acquired / sent since the start of the stream.
long long buffer_mid_idx
bool botenqueued
Whether the bottom part of the buffer is enqueued enqueued.
DT9837A & daq
Reference to underlying Daq.
bool topenqueued
Whether the top part of the buffer is enqueued.
BufHandler(DT9837A &daq, const us nchannels)
Initialize bufhandler.
Data translation DT9837A Daq device.
Descriptor for data types containing more detailed information.
Specific helper for the input buffer.
InBufHandler(DT9837A &daq, InDaqCallback cb)
bool operator()()
InBufHandler::operator()()
bool operator()()
OutBufHandler::operator()
OutBufHandler(DT9837A &daq, OutDaqCallback cb)
const DataTypeDescriptor dtype_desc_fl64
std::function< void(DaqData &)> OutDaqCallback
Definition lasp_daq.h:23
std::function< void(const DaqData &)> InDaqCallback
Definition lasp_daq.h:18
size_t us
We often use boolean values.
Definition lasp_types.h:29