LASP 1.0
Library for Acoustic Signal Processing
|
Wraps the ThreadedInDataHandler such that it calls a Python callback with a buffer of sample data. Converts DaqData objects to Numpy arrays and calls Python given as argument to the constructor. More...
Public Member Functions | |
PyIndataHandler (SmgrHandle mgr, py::function cb, py::function reset_callback) | |
Initialize PyIndataHandler. | |
~PyIndataHandler () | |
void | reset (const Daq *daq) |
Calls the reset callback in Python. | |
void | inCallback (const DaqData &d) |
Calls the Python callback method / function with a Numpy array of stream data. | |
Public Member Functions inherited from ThreadedInDataHandler< PyIndataHandler > | |
ThreadedInDataHandler (SmgrHandle mgr) | |
void | _reset (const Daq *daq) |
void | _inCallback (const DaqData &data) |
Public Member Functions inherited from ThreadedInDataHandlerBase | |
ThreadedInDataHandlerBase (SmgrHandle mgr, InCallbackType cb, InResetType reset) | |
~ThreadedInDataHandlerBase () | |
void | startThread () |
This method should be called from the derived class' constructor, to start the thread and data is incoming. | |
void | stopThread () |
This method SHOULD be called from all classes that derive on ThreadedInDataHandler. It is to make sure the inCallback_threaded() function is no longer called when the destructor of the derived class is called. Not calling this function is regarded as a BUG. | |
Wraps the ThreadedInDataHandler such that it calls a Python callback with a buffer of sample data. Converts DaqData objects to Numpy arrays and calls Python given as argument to the constructor.
Definition at line 103 of file lasp_pyindatahandler.cpp.
|
inline |
Initialize PyIndataHandler.
mgr | StreamMgr handle |
cb | Python callback that is called with Numpy input data from device |
reset_callback | Python callback that is called with a Daq pointer. Careful: do not store this handle, as it is only valid as long as reset() is called, when a stream stops, this pointer / handle will dangle. |
Start should be called externally, as at constructor time no virtual functions should be called.
Definition at line 119 of file lasp_pyindatahandler.cpp.
|
inline |
Callback cannot be called, which results in a deadlock on the GIL without this release.
Definition at line 128 of file lasp_pyindatahandler.cpp.
|
inline |
Calls the Python callback method / function with a Numpy array of stream data.
Definition at line 167 of file lasp_pyindatahandler.cpp.
|
inline |
Calls the reset callback in Python.
daq | Daq device, or nullptr in case no input stream is running. |
Throwing a runtime error here does not work out one way or another. Therefore, it is better to dive out and prevent undefined behaviour
Definition at line 140 of file lasp_pyindatahandler.cpp.