Fixed a deadlock and set one debugtrace to disabled in siggen_impl.
This commit is contained in:
parent
a581226f3d
commit
2363c11450
305
examples/test_rtaps.ipynb
Normal file
305
examples/test_rtaps.ipynb
Normal file
@ -0,0 +1,305 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "740b4091",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Test RtAps"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"id": "ac06df04",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"make: Entering directory '/home/anne/wip/mycode/lasp'\n",
|
||||
"make[1]: Entering directory '/home/anne/wip/mycode/lasp'\n",
|
||||
"make[2]: Entering directory '/home/anne/wip/mycode/lasp'\n",
|
||||
"make[2]: Leaving directory '/home/anne/wip/mycode/lasp'\n",
|
||||
"make[2]: Entering directory '/home/anne/wip/mycode/lasp'\n",
|
||||
"[ 1%] Built target rtaudio\n",
|
||||
"make[2]: Entering directory '/home/anne/wip/mycode/lasp'\n",
|
||||
"make[2]: Entering directory '/home/anne/wip/mycode/lasp'\n",
|
||||
"make[2]: Entering directory '/home/anne/wip/mycode/lasp'\n",
|
||||
"make[2]: Entering directory '/home/anne/wip/mycode/lasp'\n",
|
||||
"make[2]: Entering directory '/home/anne/wip/mycode/lasp'\n",
|
||||
"\u001b[35m\u001b[1mConsolidate compiler generated dependencies of target lasp_dsp_lib\u001b[0m\n",
|
||||
"make[2]: Entering directory '/home/anne/wip/mycode/lasp'\n",
|
||||
"make[2]: Entering directory '/home/anne/wip/mycode/lasp'\n",
|
||||
"make[2]: Entering directory '/home/anne/wip/mycode/lasp'\n",
|
||||
"make[2]: Leaving directory '/home/anne/wip/mycode/lasp'\n",
|
||||
"make[2]: Leaving directory '/home/anne/wip/mycode/lasp'\n",
|
||||
"make[2]: Leaving directory '/home/anne/wip/mycode/lasp'\n",
|
||||
"make[2]: Leaving directory '/home/anne/wip/mycode/lasp'\n",
|
||||
"make[2]: Entering directory '/home/anne/wip/mycode/lasp'\n",
|
||||
"make[2]: Leaving directory '/home/anne/wip/mycode/lasp'\n",
|
||||
"make[2]: Leaving directory '/home/anne/wip/mycode/lasp'\n",
|
||||
"make[2]: Leaving directory '/home/anne/wip/mycode/lasp'\n",
|
||||
"make[2]: Leaving directory '/home/anne/wip/mycode/lasp'\n",
|
||||
"[ 2%] Built target record\n",
|
||||
"[ 3%] Built target teststops\n",
|
||||
"[ 4%] Built target duplex\n",
|
||||
"[ 5%] Built target audioprobe\n",
|
||||
"[ 6%] Built target apinames\n",
|
||||
"[ 6%] Built target playsaw\n",
|
||||
"[ 7%] Built target playraw\n",
|
||||
"[ 8%] Built target testall\n",
|
||||
"make[2]: Leaving directory '/home/anne/wip/mycode/lasp'\n",
|
||||
"make[2]: Leaving directory '/home/anne/wip/mycode/lasp'\n",
|
||||
"[ 87%] Built target uldaq\n",
|
||||
"[ 93%] Built target lasp_dsp_lib\n",
|
||||
"make[2]: Entering directory '/home/anne/wip/mycode/lasp'\n",
|
||||
"make[2]: Leaving directory '/home/anne/wip/mycode/lasp'\n",
|
||||
"[ 96%] Built target lasp_device_lib\n",
|
||||
"make[2]: Entering directory '/home/anne/wip/mycode/lasp'\n",
|
||||
"make[2]: Leaving directory '/home/anne/wip/mycode/lasp'\n",
|
||||
"[100%] Built target lasp_cpp\n",
|
||||
"make[1]: Leaving directory '/home/anne/wip/mycode/lasp'\n",
|
||||
"make: Leaving directory '/home/anne/wip/mycode/lasp'\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"!make -j -C ~/wip/mycode/lasp"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"id": "ce0dd691",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"2022-10-06 18:19:17+0200 DebugTrace-cpp 2.0.0a2 (g++ 12.2.0)\n",
|
||||
"2022-10-06 18:19:17+0200 \n",
|
||||
"2022-10-06 18:19:17+0200 Enter getInstance (lasp_streammgr.cpp: 40)\n",
|
||||
"2022-10-06 18:19:17+0200 | Enter StreamMgr (lasp_streammgr.cpp: 45)\n",
|
||||
"2022-10-06 18:19:17+0200 | | Enter rescanDAQDevices (lasp_streammgr.cpp: 60)\n",
|
||||
"2022-10-06 18:19:17+0200 | | Leave rescanDAQDevices (lasp_streammgr.cpp)\n",
|
||||
"2022-10-06 18:19:17+0200 | Leave StreamMgr (lasp_streammgr.cpp)\n",
|
||||
"2022-10-06 18:19:17+0200 | \n",
|
||||
"2022-10-06 18:19:17+0200 Leave getInstance (lasp_streammgr.cpp)\n",
|
||||
"2022-10-06 18:19:17+0200 Enter rescanDAQDevices_impl (lasp_streammgr.cpp: 80)\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import lasp\n",
|
||||
"# Get handle to stream manager\n",
|
||||
"mgr = lasp.StreamMgr.getInstance()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"id": "3cd242a8",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"2022-10-06 18:19:18+0200 Leave rescanDAQDevices_impl (lasp_streammgr.cpp)\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"ds = mgr.getDeviceInfo()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"id": "a5d878e9",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"0: Monitor of Starship/Matisse HD Audio Controller Analog Stereo\n",
|
||||
"1: Starship/Matisse HD Audio Controller Analog Stereo\n",
|
||||
"2: GP108 High Definition Audio Controller Digital Stereo (HDMI)\n",
|
||||
"3: Monitor of GP108 High Definition Audio Controller Digital Stereo (HDMI)\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# Search for a device\n",
|
||||
"for i, d in enumerate(ds):\n",
|
||||
" print(f'{i}: ' + d.device_name)\n",
|
||||
"d = ds[0]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"id": "6d5b281e",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Create a configuration and enable some input channels\n",
|
||||
"config = lasp.DaqConfiguration(d)\n",
|
||||
"config.inchannel_config[0].enabled = True\n",
|
||||
"config.inchannel_config[1].enabled = True\n",
|
||||
"# Choose a different number of frames per block\n",
|
||||
"config.framesPerBlockIndex = 4"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"id": "1ead3995",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Out channels: 0\n",
|
||||
"In channels: 2\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"print('Out channels:',d.noutchannels)\n",
|
||||
"print('In channels:',d.ninchannels)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"id": "12db8306",
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"2022-10-06 18:19:18+0200 \n",
|
||||
"2022-10-06 18:19:18+0200 Enter startStream (lasp_streammgr.cpp: 209)\n",
|
||||
"2022-10-06 18:19:18+0200 | isInput = true\n",
|
||||
"2022-10-06 18:19:18+0200 | isOutput = false\n",
|
||||
"2022-10-06 18:19:18+0200 Leave startStream (lasp_streammgr.cpp)\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# Start a stream with a configuration\n",
|
||||
"mgr.startStream(config)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"id": "5323356f-4239-4f0b-ad58-0025501bf7a3",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"2022-10-06 18:19:18+0200 \n",
|
||||
"2022-10-06 18:19:18+0200 Enter InDataHandler (lasp_streammgr.cpp: 14)\n",
|
||||
"2022-10-06 18:19:18+0200 Leave InDataHandler (lasp_streammgr.cpp)\n",
|
||||
"2022-10-06 18:19:18+0200 \n",
|
||||
"2022-10-06 18:19:18+0200 Enter start (lasp_streammgr.cpp: 16)\n",
|
||||
"2022-10-06 18:19:18+0200 | Enter addInDataHandler (lasp_streammgr.cpp: 321)\n",
|
||||
"2022-10-06 18:19:18+0200 | | Enter reset (lasp_rtaps.cpp: 33)\n",
|
||||
"2022-10-06 18:19:18+0200 | | Leave reset (lasp_rtaps.cpp)\n",
|
||||
"2022-10-06 18:19:18+0200 | Leave addInDataHandler (lasp_streammgr.cpp)\n",
|
||||
"2022-10-06 18:19:18+0200 Leave start (lasp_streammgr.cpp)\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"rtaps = lasp.RtAps(mgr, None)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "688d41ae-a3b1-4a31-b1e3-278bb4eaae4c",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"id": "4d9f0103",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# daq = mgr.getDaq(lasp.StreamMgr.StreamType.input)\n",
|
||||
"# print(daq)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "26277ef0-3389-4581-9cc5-2c500e789dfa",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import time\n",
|
||||
"t=0\n",
|
||||
"while True:\n",
|
||||
" time.sleep(0.1)\n",
|
||||
" t += 0.1\n",
|
||||
" levels = rtaps.getCurrentValue()\n",
|
||||
" print(levels)\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "30b77ce0-40ee-4b88-89fa-83b7a62e493c",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"mgr.stopAllStreams()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "78cc8353-0e0b-4d96-a263-f4ad3fe4ee4c",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.10.7"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
@ -12,7 +12,8 @@ using rte = std::runtime_error;
|
||||
PPMHandler::PPMHandler(StreamMgr &mgr, const d decay_dBps)
|
||||
: ThreadedInDataHandler(mgr), _decay_dBps(decay_dBps) {
|
||||
DEBUGTRACE_ENTER;
|
||||
std::scoped_lock<std::mutex> lck(_mtx);
|
||||
// This results in a deadlock!
|
||||
/* std::scoped_lock<std::mutex> lck(_mtx); */
|
||||
start();
|
||||
}
|
||||
bool PPMHandler::inCallback_threaded(const DaqData &d) {
|
||||
|
@ -44,10 +44,12 @@ class RtAps : public ThreadedInDataHandler {
|
||||
: ThreadedInDataHandler(mgr),
|
||||
_ps(nfft, w, overlap_percentage, time_constant) {
|
||||
|
||||
{
|
||||
std::scoped_lock<std::mutex> lck(_mtx);
|
||||
if (freqWeightingFilter != nullptr) {
|
||||
_filterPrototype = freqWeightingFilter->clone();
|
||||
}
|
||||
}
|
||||
start();
|
||||
}
|
||||
~RtAps() {
|
||||
|
@ -5,7 +5,7 @@
|
||||
// Description:
|
||||
// Signal generators implementation
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
#define DEBUGTRACE_ENABLED
|
||||
/* #define DEBUGTRACE_ENABLED */
|
||||
#include "debugtrace.hpp"
|
||||
#include "lasp_siggen_impl.h"
|
||||
#include "debugtrace.hpp"
|
||||
|
Loading…
Reference in New Issue
Block a user