Cleaned up example code

This commit is contained in:
Anne de Jong 2022-10-10 19:29:24 +02:00
parent fae906884e
commit ebe385b9db
6 changed files with 140 additions and 1093 deletions

File diff suppressed because one or more lines are too long

View File

@ -10,39 +10,12 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": null,
"id": "ac06df04", "id": "ac06df04",
"metadata": {}, "metadata": {},
"outputs": [ "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",
"\u001b[35m\u001b[1mConsolidate compiler generated dependencies of target lasp_dsp_lib\u001b[0m\n",
"make[2]: Leaving directory '/home/anne/wip/mycode/lasp'\n",
"[ 42%] Built target lasp_dsp_lib\n",
"make[2]: Entering directory '/home/anne/wip/mycode/lasp'\n",
"\u001b[35m\u001b[1mConsolidate compiler generated dependencies of target lasp_device_lib\u001b[0m\n",
"make[2]: Leaving directory '/home/anne/wip/mycode/lasp'\n",
"[ 67%] Built target lasp_device_lib\n",
"make[2]: Entering directory '/home/anne/wip/mycode/lasp'\n",
"\u001b[35m\u001b[1mConsolidate compiler generated dependencies of target lasp_cpp\u001b[0m\n",
"make[2]: Leaving directory '/home/anne/wip/mycode/lasp'\n",
"make[2]: Entering directory '/home/anne/wip/mycode/lasp'\n",
"[ 71%] \u001b[32mBuilding CXX object src/lasp/CMakeFiles/lasp_cpp.dir/pybind11/lasp_dsp_pybind.cpp.o\u001b[0m\n",
"[ 75%] \u001b[32m\u001b[1mLinking CXX shared module lasp_cpp.cpython-310-x86_64-linux-gnu.so\u001b[0m\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": [ "source": [
"# !make -j -C ~/wip/mycode/lasp" "!make -j -C ~/wip/mycode/lasp"
] ]
}, },
{ {
@ -57,6 +30,16 @@
"mgr = lasp.StreamMgr.getInstance()" "mgr = lasp.StreamMgr.getInstance()"
] ]
}, },
{
"cell_type": "code",
"execution_count": null,
"id": "9ad46772-a969-4693-b4e6-d78a67183787",
"metadata": {},
"outputs": [],
"source": [
"mgr.rescanDAQDevices()"
]
},
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
@ -129,14 +112,28 @@
"# Start a stream with a configuration\n", "# Start a stream with a configuration\n",
"mgr.startStream(config)\n", "mgr.startStream(config)\n",
"\n", "\n",
"def reset_cb():\n",
" print('Reset called')\n",
"\n",
"def cb(data):\n", "def cb(data):\n",
" # raise RuntimeError('hh')\n", " # Print something on callback\n",
" print(data.shape)\n", " print(data.shape)\n",
"i = lasp.InDataHandler(mgr, cb)\n", "\n",
"import time\n", "import time\n",
"#time.sleep(4)" "#time.sleep(4)"
] ]
}, },
{
"cell_type": "code",
"execution_count": null,
"id": "dc751e51-3d09-41c8-a2dd-02d9568181da",
"metadata": {},
"outputs": [],
"source": [
"# Attach the indata handler to the stream\n",
"i = lasp.InDataHandler(mgr, cb, reset_cb)"
]
},
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
@ -158,6 +155,22 @@
"source": [ "source": [
"del i" "del i"
] ]
},
{
"cell_type": "code",
"execution_count": null,
"id": "99342a4d-16ff-4b0c-8994-4c7e6b3f97b8",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "5bd21b65-5bfd-4f83-b420-8491ca3ade57",
"metadata": {},
"outputs": [],
"source": []
} }
], ],
"metadata": { "metadata": {

View File

@ -10,59 +10,20 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 4, "execution_count": null,
"id": "ac06df04", "id": "ac06df04",
"metadata": {}, "metadata": {},
"outputs": [ "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",
"[ 44%] 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",
"[ 68%] 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": [ "source": [
"!make -j -C ~/wip/mycode/lasp" "#!make -j -C ~/wip/mycode/lasp"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 5, "execution_count": null,
"id": "ce0dd691", "id": "ce0dd691",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [],
{
"name": "stderr",
"output_type": "stream",
"text": [
"2022-10-03 13:39:03+0200 DebugTrace-cpp 2.0.0a2 (g++ 9.4.0)\n",
"2022-10-03 13:39:03+0200 \n",
"2022-10-03 13:39:03+0200 Enter getInstance (lasp_streammgr.cpp: 40)\n",
"2022-10-03 13:39:03+0200 | Enter StreamMgr (lasp_streammgr.cpp: 45)\n",
"2022-10-03 13:39:03+0200 | | Enter rescanDAQDevices (lasp_streammgr.cpp: 60)\n",
"2022-10-03 13:39:03+0200 | | | Enter rescanDAQDevices_impl (lasp_streammgr.cpp: 80)\n",
"2022-10-03 13:39:04+0200 | | | | Enter fillRtAudioDeviceInfo (lasp_rtaudiodaq.cpp: 20)\n",
"2022-10-03 13:39:04+0200 | | | | Leave fillRtAudioDeviceInfo (lasp_rtaudiodaq.cpp)\n",
"2022-10-03 13:39:04+0200 | | | Leave rescanDAQDevices_impl (lasp_streammgr.cpp)\n",
"2022-10-03 13:39:04+0200 | | Leave rescanDAQDevices (lasp_streammgr.cpp)\n",
"2022-10-03 13:39:04+0200 | Leave StreamMgr (lasp_streammgr.cpp)\n",
"2022-10-03 13:39:04+0200 Leave getInstance (lasp_streammgr.cpp)\n"
]
}
],
"source": [ "source": [
"import lasp\n", "import lasp\n",
"# Get handle to stream manager\n", "# Get handle to stream manager\n",
@ -71,7 +32,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 6, "execution_count": null,
"id": "3cd242a8", "id": "3cd242a8",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -81,21 +42,10 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 7, "execution_count": null,
"id": "a5d878e9", "id": "a5d878e9",
"metadata": {}, "metadata": {},
"outputs": [ "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: Baffin HDMI/DP Audio [Radeon RX 550 640SP / RX 560/560X] Digital Stereo (HDMI)\n",
"3: Monitor of Baffin HDMI/DP Audio [Radeon RX 550 640SP / RX 560/560X] Digital Stereo (HDMI)\n"
]
}
],
"source": [ "source": [
"# Search for a device\n", "# Search for a device\n",
"for i, d in enumerate(ds):\n", "for i, d in enumerate(ds):\n",
@ -105,7 +55,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 8, "execution_count": null,
"id": "6d5b281e", "id": "6d5b281e",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -120,19 +70,10 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 9, "execution_count": null,
"id": "1ead3995", "id": "1ead3995",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [],
{
"name": "stdout",
"output_type": "stream",
"text": [
"Out channels: 0\n",
"In channels: 2\n"
]
}
],
"source": [ "source": [
"print('Out channels:',d.noutchannels)\n", "print('Out channels:',d.noutchannels)\n",
"print('In channels:',d.ninchannels)" "print('In channels:',d.ninchannels)"
@ -140,36 +81,12 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 10, "execution_count": null,
"id": "12db8306", "id": "12db8306",
"metadata": { "metadata": {
"tags": [] "tags": []
}, },
"outputs": [ "outputs": [],
{
"name": "stderr",
"output_type": "stream",
"text": [
"2022-10-03 13:39:06+0200 \n",
"2022-10-03 13:39:06+0200 Enter startStream (lasp_streammgr.cpp: 209)\n",
"2022-10-03 13:39:06+0200 | Enter createDaq (lasp_daq.cpp: 18)\n",
"2022-10-03 13:39:06+0200 | | Enter Daq (lasp_daq.cpp: 37)\n",
"2022-10-03 13:39:06+0200 | | Leave Daq (lasp_daq.cpp)\n",
"2022-10-03 13:39:06+0200 | | \n",
"2022-10-03 13:39:06+0200 | | Enter RtAudioDaq (lasp_rtaudiodaq.cpp: 135)\n",
"2022-10-03 13:39:06+0200 | | | Enter samplerate (lasp_daq.cpp: 58)\n",
"2022-10-03 13:39:06+0200 | | | Leave samplerate (lasp_daq.cpp)\n",
"2022-10-03 13:39:07+0200 | | Leave RtAudioDaq (lasp_rtaudiodaq.cpp)\n",
"2022-10-03 13:39:07+0200 | Leave createDaq (lasp_daq.cpp)\n",
"2022-10-03 13:39:07+0200 | isInput = true\n",
"2022-10-03 13:39:07+0200 | isOutput = false\n",
"2022-10-03 13:39:07+0200 | \n",
"2022-10-03 13:39:07+0200 | Enter start (lasp_rtaudiodaq.cpp: 215)\n",
"2022-10-03 13:39:07+0200 | Leave start (lasp_rtaudiodaq.cpp)\n",
"2022-10-03 13:39:07+0200 Leave startStream (lasp_streammgr.cpp)\n"
]
}
],
"source": [ "source": [
"# Start a stream with a configuration\n", "# Start a stream with a configuration\n",
"mgr.startStream(config)" "mgr.startStream(config)"
@ -177,183 +94,20 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 11, "execution_count": null,
"id": "5323356f-4239-4f0b-ad58-0025501bf7a3", "id": "5323356f-4239-4f0b-ad58-0025501bf7a3",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [],
{
"name": "stderr",
"output_type": "stream",
"text": [
"2022-10-03 13:39:09+0200 \n",
"2022-10-03 13:39:09+0200 Enter InDataHandler (lasp_streammgr.cpp: 14)\n",
"2022-10-03 13:39:09+0200 Leave InDataHandler (lasp_streammgr.cpp)\n",
"2022-10-03 13:39:09+0200 \n",
"2022-10-03 13:39:09+0200 Enter ThreadedInDataHandler (lasp_threadedindatahandler.cpp: 13)\n",
"2022-10-03 13:39:09+0200 Leave ThreadedInDataHandler (lasp_threadedindatahandler.cpp)\n",
"2022-10-03 13:39:09+0200 \n",
"2022-10-03 13:39:09+0200 Enter PPMHandler (lasp_ppm.cpp: 14)\n",
"2022-10-03 13:39:09+0200 | Enter start (lasp_streammgr.cpp: 16)\n",
"2022-10-03 13:39:09+0200 | | Enter reset (lasp_ppm.cpp: 65)\n",
"2022-10-03 13:39:09+0200 | | | Enter samplerate (lasp_daq.cpp: 58)\n",
"2022-10-03 13:39:09+0200 | | | Leave samplerate (lasp_daq.cpp)\n",
"2022-10-03 13:39:09+0200 | | | fs = 44100.000000\n",
"2022-10-03 13:39:09+0200 | | Leave reset (lasp_ppm.cpp)\n",
"2022-10-03 13:39:09+0200 | Leave start (lasp_streammgr.cpp)\n",
"2022-10-03 13:39:09+0200 Leave PPMHandler (lasp_ppm.cpp)\n",
"2022-10-03 13:39:09+0200 \n",
"2022-10-03 13:39:09+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:09+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:09+0200 \n",
"2022-10-03 13:39:09+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:09+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:09+0200 \n",
"2022-10-03 13:39:09+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:09+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:10+0200 \n",
"2022-10-03 13:39:10+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:10+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:10+0200 \n",
"2022-10-03 13:39:10+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:10+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:10+0200 \n",
"2022-10-03 13:39:10+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:10+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:10+0200 \n",
"2022-10-03 13:39:10+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:10+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:11+0200 \n",
"2022-10-03 13:39:11+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:11+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:11+0200 \n",
"2022-10-03 13:39:11+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:11+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:11+0200 \n",
"2022-10-03 13:39:11+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:11+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:11+0200 \n",
"2022-10-03 13:39:11+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:11+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:11+0200 \n",
"2022-10-03 13:39:11+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:11+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:12+0200 \n",
"2022-10-03 13:39:12+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:12+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:12+0200 \n",
"2022-10-03 13:39:12+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:12+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:12+0200 \n",
"2022-10-03 13:39:12+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:12+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:12+0200 \n",
"2022-10-03 13:39:12+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:12+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:12+0200 \n",
"2022-10-03 13:39:12+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:12+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:13+0200 \n",
"2022-10-03 13:39:13+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:13+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:13+0200 \n",
"2022-10-03 13:39:13+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:13+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:13+0200 \n",
"2022-10-03 13:39:13+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:13+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:13+0200 \n",
"2022-10-03 13:39:13+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:13+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:14+0200 \n",
"2022-10-03 13:39:14+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:14+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:14+0200 \n",
"2022-10-03 13:39:14+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:14+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:14+0200 \n",
"2022-10-03 13:39:14+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:14+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:14+0200 \n",
"2022-10-03 13:39:14+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:14+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:14+0200 \n",
"2022-10-03 13:39:14+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:14+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:15+0200 \n",
"2022-10-03 13:39:15+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:15+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:15+0200 \n",
"2022-10-03 13:39:15+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:15+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n"
]
}
],
"source": [ "source": [
"ppm = lasp.PPMHandler(mgr)" "ppm = lasp.PPMHandler(mgr)"
] ]
}, },
{
"cell_type": "code",
"execution_count": 9,
"id": "169c52c4-687f-4371-af04-19a414feb73d",
"metadata": {},
"outputs": [
{
"ename": "NameError",
"evalue": "name 'a' is not defined",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m/tmp/ipykernel_24491/2167009006.py\u001b[0m in \u001b[0;36m<cell line: 1>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0ma\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;31mNameError\u001b[0m: name 'a' is not defined"
]
}
],
"source": [
"a"
]
},
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"id": "688d41ae-a3b1-4a31-b1e3-278bb4eaae4c",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 12,
"id": "4d9f0103", "id": "4d9f0103",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [],
{
"name": "stdout",
"output_type": "stream",
"text": [
"Monitor of Starship/Matisse HD Audio Controller Analog Stereo\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2022-10-03 13:39:15+0200 \n",
"2022-10-03 13:39:15+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:15+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:15+0200 \n",
"2022-10-03 13:39:15+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:15+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:15+0200 \n",
"2022-10-03 13:39:15+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:15+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:16+0200 \n",
"2022-10-03 13:39:16+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:16+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n"
]
}
],
"source": [ "source": [
"daq = mgr.getDaq(lasp.StreamMgr.StreamType.input)\n", "daq = mgr.getDaq(lasp.StreamMgr.StreamType.input)\n",
"print(daq)" "print(daq)"
@ -361,227 +115,27 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 13, "execution_count": null,
"id": "26277ef0-3389-4581-9cc5-2c500e789dfa", "id": "26277ef0-3389-4581-9cc5-2c500e789dfa",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [],
{
"name": "stderr",
"output_type": "stream",
"text": [
"2022-10-03 13:39:16+0200 \n",
"2022-10-03 13:39:16+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:16+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n"
]
},
{
"ename": "RuntimeError",
"evalue": "Mat::init(): requested size is not compatible with column vector layout",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mRuntimeError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m/tmp/ipykernel_24664/1896157402.py\u001b[0m in \u001b[0;36m<cell line: 3>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0mtime\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msleep\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m0.1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0mt\u001b[0m \u001b[0;34m+=\u001b[0m \u001b[0;36m0.1\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 6\u001b[0;31m \u001b[0mlevel\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mclip\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mppm\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgetCurrentValue\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 7\u001b[0m \u001b[0;31m#print('\\r {\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mRuntimeError\u001b[0m: Mat::init(): requested size is not compatible with column vector layout"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2022-10-03 13:39:16+0200 \n",
"2022-10-03 13:39:16+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:16+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:17+0200 \n",
"2022-10-03 13:39:17+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:17+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:17+0200 \n",
"2022-10-03 13:39:17+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:17+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:17+0200 \n",
"2022-10-03 13:39:17+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:17+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:17+0200 \n",
"2022-10-03 13:39:17+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:17+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:17+0200 \n",
"2022-10-03 13:39:17+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:17+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:18+0200 \n",
"2022-10-03 13:39:18+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:18+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:18+0200 \n",
"2022-10-03 13:39:18+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:18+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:18+0200 \n",
"2022-10-03 13:39:18+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:18+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:18+0200 \n",
"2022-10-03 13:39:18+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:18+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:19+0200 \n",
"2022-10-03 13:39:19+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:19+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:19+0200 \n",
"2022-10-03 13:39:19+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:19+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:19+0200 \n",
"2022-10-03 13:39:19+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:19+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:19+0200 \n",
"2022-10-03 13:39:19+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:19+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:20+0200 \n",
"2022-10-03 13:39:20+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:20+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:20+0200 \n",
"2022-10-03 13:39:20+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:20+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:20+0200 \n",
"2022-10-03 13:39:20+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:20+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:20+0200 \n",
"2022-10-03 13:39:20+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:20+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:20+0200 \n",
"2022-10-03 13:39:20+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:20+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:20+0200 \n",
"2022-10-03 13:39:20+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:20+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:21+0200 \n",
"2022-10-03 13:39:21+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:21+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:21+0200 \n",
"2022-10-03 13:39:21+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:21+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:21+0200 \n",
"2022-10-03 13:39:21+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:21+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:21+0200 \n",
"2022-10-03 13:39:21+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:21+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:22+0200 \n",
"2022-10-03 13:39:22+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:22+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:22+0200 \n",
"2022-10-03 13:39:22+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:22+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:22+0200 \n",
"2022-10-03 13:39:22+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:22+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:22+0200 \n",
"2022-10-03 13:39:22+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:22+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:23+0200 \n",
"2022-10-03 13:39:23+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:23+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:23+0200 \n",
"2022-10-03 13:39:23+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:23+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:23+0200 \n",
"2022-10-03 13:39:23+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:23+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:23+0200 \n",
"2022-10-03 13:39:23+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:23+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:23+0200 \n",
"2022-10-03 13:39:23+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:23+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:23+0200 \n",
"2022-10-03 13:39:23+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:23+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:24+0200 \n",
"2022-10-03 13:39:24+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:24+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:24+0200 \n",
"2022-10-03 13:39:24+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:24+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:24+0200 \n",
"2022-10-03 13:39:24+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:24+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:24+0200 \n",
"2022-10-03 13:39:24+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:24+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:24+0200 \n",
"2022-10-03 13:39:24+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:24+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:25+0200 \n",
"2022-10-03 13:39:25+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:25+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:25+0200 \n",
"2022-10-03 13:39:25+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:25+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:25+0200 \n",
"2022-10-03 13:39:25+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:25+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:25+0200 \n",
"2022-10-03 13:39:25+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:25+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:25+0200 \n",
"2022-10-03 13:39:25+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:25+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:26+0200 \n",
"2022-10-03 13:39:26+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:26+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:26+0200 \n",
"2022-10-03 13:39:26+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:26+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:26+0200 \n",
"2022-10-03 13:39:26+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:26+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:26+0200 \n",
"2022-10-03 13:39:26+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:26+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:26+0200 \n",
"2022-10-03 13:39:26+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:26+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:26+0200 \n",
"2022-10-03 13:39:26+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:26+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:27+0200 \n",
"2022-10-03 13:39:27+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:27+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:27+0200 \n",
"2022-10-03 13:39:27+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:27+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:27+0200 \n",
"2022-10-03 13:39:27+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:27+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n",
"2022-10-03 13:39:27+0200 \n",
"2022-10-03 13:39:27+0200 Enter inCallback_threaded (lasp_ppm.cpp: 18)\n",
"2022-10-03 13:39:27+0200 Leave inCallback_threaded (lasp_ppm.cpp)\n"
]
}
],
"source": [ "source": [
"ppm.start()\n",
"import time\n", "import time\n",
"t=0\n", "t=0\n",
"while t < 1:\n", "while t < 1:\n",
" time.sleep(0.1)\n", " time.sleep(0.1)\n",
" t += 0.1\n", " t += 0.1\n",
" level, clip = ppm.getCurrentValue()\n", " level, clip = ppm.getCurrentValue()\n",
" #print('\\r {" " print(f'\\r {levels[0]:.1f}')"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 14, "execution_count": null,
"id": "30b77ce0-40ee-4b88-89fa-83b7a62e493c", "id": "30b77ce0-40ee-4b88-89fa-83b7a62e493c",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [],
{
"name": "stderr",
"output_type": "stream",
"text": [
"2022-10-03 13:39:27+0200 \n",
"2022-10-03 13:39:27+0200 Enter stopAllStreams (lasp_streammgr.cpp: 202)\n",
"2022-10-03 13:39:27+0200 | Enter ~Daq (lasp_daq.cpp: 14)\n",
"2022-10-03 13:39:27+0200 | Leave ~Daq (lasp_daq.cpp)\n",
"2022-10-03 13:39:27+0200 Leave stopAllStreams (lasp_streammgr.cpp)\n"
]
}
],
"source": [ "source": [
"mgr.stopAllStreams()" "mgr.stopAllStreams()"
] ]

View File

@ -10,62 +10,20 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": null,
"id": "e3d3280f", "id": "e3d3280f",
"metadata": {}, "metadata": {},
"outputs": [ "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",
"[ 42%] 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",
"[ 67%] 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": [ "source": [
" !make -j -C ~/wip/mycode/lasp" "# !make -j -C ~/wip/mycode/lasp"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 2, "execution_count": null,
"id": "d12f103c", "id": "d12f103c",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [],
{
"name": "stderr",
"output_type": "stream",
"text": [
"2022-09-27 22:08:01+0200 DebugTrace-cpp 2.0.0a2 (g++ 12.2.0)\n",
"2022-09-27 22:08:01+0200 \n",
"2022-09-27 22:08:01+0200 Enter getInstance (lasp_streammgr.cpp: 40)\n",
"2022-09-27 22:08:01+0200 | Enter StreamMgr (lasp_streammgr.cpp: 45)\n",
"2022-09-27 22:08:01+0200 | | Enter rescanDAQDevices (lasp_streammgr.cpp: 60)\n",
"2022-09-27 22:08:01+0200 | | | Enter rescanDAQDevices_impl (lasp_streammgr.cpp: 80)\n",
"2022-09-27 22:08:01+0200 | | | | Enter fillRtAudioDeviceInfo (lasp_rtaudiodaq.cpp: 20)\n",
"\n",
"RtApiAlsa::getDeviceInfo: snd_pcm_open error for device (hw:1,0), Device or resource busy.\n",
"\n",
"2022-09-27 22:08:01+0200 | | | | Leave fillRtAudioDeviceInfo (lasp_rtaudiodaq.cpp)\n",
"2022-09-27 22:08:01+0200 | | | Leave rescanDAQDevices_impl (lasp_streammgr.cpp)\n",
"2022-09-27 22:08:01+0200 | | Leave rescanDAQDevices (lasp_streammgr.cpp)\n",
"2022-09-27 22:08:01+0200 | Leave StreamMgr (lasp_streammgr.cpp)\n",
"2022-09-27 22:08:01+0200 Leave getInstance (lasp_streammgr.cpp)\n"
]
}
],
"source": [ "source": [
"import lasp\n", "import lasp\n",
"# Get handle to stream manager\n", "# Get handle to stream manager\n",
@ -74,7 +32,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 3, "execution_count": null,
"id": "f44b1946", "id": "f44b1946",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -84,30 +42,10 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 4, "execution_count": null,
"id": "db0f3bb7", "id": "db0f3bb7",
"metadata": {}, "metadata": {},
"outputs": [ "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",
"4: default\n",
"5: hw:HDA NVidia,3\n",
"6: hw:HDA NVidia,7\n",
"7: hw:HDA NVidia,8\n",
"8: hw:HDA NVidia,9\n",
"9: hw:HDA NVidia,10\n",
"10: hw:HD-Audio Generic,0\n",
"11: hw:HD-Audio Generic,1\n",
"12: hw:HD-Audio Generic,2\n"
]
}
],
"source": [ "source": [
"# Search for a device\n", "# Search for a device\n",
"for i, d in enumerate(ds):\n", "for i, d in enumerate(ds):\n",
@ -117,29 +55,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 5, "execution_count": null,
"id": "f97c13d5",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[512, 1024, 2048, 4096, 8192]"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Check the available block sizes\n",
"d.availableFramesPerBlock"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "5c84d454", "id": "5c84d454",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -154,19 +70,10 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 7, "execution_count": null,
"id": "a020f86f", "id": "a020f86f",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [],
{
"name": "stdout",
"output_type": "stream",
"text": [
"Out channels: 0\n",
"In channels: 2\n"
]
}
],
"source": [ "source": [
"print('Out channels:',d.noutchannels)\n", "print('Out channels:',d.noutchannels)\n",
"print('In channels:',d.ninchannels)" "print('In channels:',d.ninchannels)"
@ -174,34 +81,10 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 8, "execution_count": null,
"id": "034b5f5e", "id": "034b5f5e",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [],
{
"name": "stderr",
"output_type": "stream",
"text": [
"2022-09-27 22:08:02+0200 \n",
"2022-09-27 22:08:02+0200 Enter startStream (lasp_streammgr.cpp: 209)\n",
"2022-09-27 22:08:02+0200 | Enter createDaq (lasp_daq.cpp: 18)\n",
"2022-09-27 22:08:02+0200 | | Enter Daq (lasp_daq.cpp: 37)\n",
"2022-09-27 22:08:02+0200 | | Leave Daq (lasp_daq.cpp)\n",
"2022-09-27 22:08:02+0200 | | \n",
"2022-09-27 22:08:02+0200 | | Enter RtAudioDaq (lasp_rtaudiodaq.cpp: 135)\n",
"2022-09-27 22:08:02+0200 | | | Enter samplerate (lasp_daq.cpp: 58)\n",
"2022-09-27 22:08:02+0200 | | | Leave samplerate (lasp_daq.cpp)\n",
"2022-09-27 22:08:02+0200 | | Leave RtAudioDaq (lasp_rtaudiodaq.cpp)\n",
"2022-09-27 22:08:02+0200 | Leave createDaq (lasp_daq.cpp)\n",
"2022-09-27 22:08:02+0200 | isInput = true\n",
"2022-09-27 22:08:02+0200 | isOutput = false\n",
"2022-09-27 22:08:02+0200 | \n",
"2022-09-27 22:08:02+0200 | Enter start (lasp_rtaudiodaq.cpp: 215)\n",
"2022-09-27 22:08:02+0200 | Leave start (lasp_rtaudiodaq.cpp)\n",
"2022-09-27 22:08:02+0200 Leave startStream (lasp_streammgr.cpp)\n"
]
}
],
"source": [ "source": [
"# Start a stream with a configuration\n", "# Start a stream with a configuration\n",
"mgr.startStream(config)" "mgr.startStream(config)"
@ -209,282 +92,38 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 9, "execution_count": null,
"id": "59326eda-f249-4a9b-9191-a784b01694b9", "id": "59326eda-f249-4a9b-9191-a784b01694b9",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [],
{
"name": "stderr",
"output_type": "stream",
"text": [
"2022-09-27 22:08:02+0200 \n",
"2022-09-27 22:08:02+0200 Enter InDataHandler (lasp_streammgr.cpp: 14)\n",
"2022-09-27 22:08:02+0200 Leave InDataHandler (lasp_streammgr.cpp)\n",
"2022-09-27 22:08:02+0200 \n",
"2022-09-27 22:08:02+0200 Enter ThreadedInDataHandler (lasp_threadedindatahandler.cpp: 13)\n",
"2022-09-27 22:08:02+0200 Leave ThreadedInDataHandler (lasp_threadedindatahandler.cpp)\n",
"2022-09-27 22:08:02+0200 \n",
"2022-09-27 22:08:02+0200 Enter PyIndataHandler (lasp_pyindatahandler.cpp: 78)\n",
"2022-09-27 22:08:02+0200 | Enter start (lasp_streammgr.cpp: 16)\n",
"2022-09-27 22:08:02+0200 | Leave start (lasp_streammgr.cpp)\n",
"2022-09-27 22:08:02+0200 Leave PyIndataHandler (lasp_pyindatahandler.cpp)\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"."
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2022-09-27 22:08:02+0200 \n",
"2022-09-27 22:08:02+0200 Enter samplerate (lasp_daq.cpp: 58)\n",
"2022-09-27 22:08:02+0200 Leave samplerate (lasp_daq.cpp)\n",
"2022-09-27 22:08:02+0200 \n",
"2022-09-27 22:08:02+0200 Enter samplerate (lasp_daq.cpp: 58)\n",
"2022-09-27 22:08:02+0200 Leave samplerate (lasp_daq.cpp)\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
".....1....2.....3....4....5.....6....7.....8....9....10"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2022-09-27 22:08:12+0200 \n",
"2022-09-27 22:08:12+0200 Enter ~PyIndataHandler (lasp_pyindatahandler.cpp: 87)\n",
"2022-09-27 22:08:12+0200 Leave ~PyIndataHandler (lasp_pyindatahandler.cpp)\n",
"2022-09-27 22:08:12+0200 \n",
"2022-09-27 22:08:12+0200 Enter ~ThreadedInDataHandler (lasp_threadedindatahandler.cpp: 38)\n",
"2022-09-27 22:08:12+0200 Leave ~ThreadedInDataHandler (lasp_threadedindatahandler.cpp)\n",
"2022-09-27 22:08:12+0200 \n",
"2022-09-27 22:08:12+0200 Enter ~InDataHandler (lasp_streammgr.cpp: 27)\n",
"2022-09-27 22:08:12+0200 Leave ~InDataHandler (lasp_streammgr.cpp)\n"
]
}
],
"source": [ "source": [
"rec = lasp.Recording('test', mgr, 10.0)" "rec = lasp.Recording('test', mgr, 1.0)"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 10, "execution_count": null,
"id": "5defa804", "id": "5defa804",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [],
{
"name": "stderr",
"output_type": "stream",
"text": [
"2022-09-27 22:08:12+0200 \n",
"2022-09-27 22:08:12+0200 Enter stopStream (lasp_streammgr.cpp: 287)\n",
"2022-09-27 22:08:12+0200 | Enter ~Daq (lasp_daq.cpp: 14)\n",
"2022-09-27 22:08:12+0200 | Leave ~Daq (lasp_daq.cpp)\n",
"2022-09-27 22:08:12+0200 Leave stopStream (lasp_streammgr.cpp)\n"
]
}
],
"source": [ "source": [
"mgr.stopStream(lasp.StreamMgr.StreamType.input)" "mgr.stopStream(lasp.StreamMgr.StreamType.input)"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 11, "execution_count": null,
"id": "d12f8c4a", "id": "d12f8c4a",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [],
{
"name": "stderr",
"output_type": "stream",
"text": [
"2022-09-27 22:08:12+0200 \n",
"2022-09-27 22:08:12+0200 Enter stopAllStreams (lasp_streammgr.cpp: 202)\n",
"2022-09-27 22:08:12+0200 Leave stopAllStreams (lasp_streammgr.cpp)\n"
]
}
],
"source": [ "source": [
"mgr.stopAllStreams()" "mgr.stopAllStreams()"
] ]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "83b1713b",
"metadata": {},
"outputs": [],
"source": [
"def cb(data):\n",
" # raise RuntimeError('hh')\n",
" print(data.shape)"
]
},
{
"cell_type": "code",
"execution_count": 13,
"id": "ff7c1e03",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"2022-09-27 22:08:12+0200 \n",
"2022-09-27 22:08:12+0200 Enter InDataHandler (lasp_streammgr.cpp: 14)\n",
"2022-09-27 22:08:12+0200 Leave InDataHandler (lasp_streammgr.cpp)\n",
"2022-09-27 22:08:12+0200 \n",
"2022-09-27 22:08:12+0200 Enter ThreadedInDataHandler (lasp_threadedindatahandler.cpp: 13)\n",
"2022-09-27 22:08:12+0200 Leave ThreadedInDataHandler (lasp_threadedindatahandler.cpp)\n",
"2022-09-27 22:08:12+0200 \n",
"2022-09-27 22:08:12+0200 Enter PyIndataHandler (lasp_pyindatahandler.cpp: 78)\n",
"2022-09-27 22:08:12+0200 | Enter start (lasp_streammgr.cpp: 16)\n",
"2022-09-27 22:08:12+0200 | Leave start (lasp_streammgr.cpp)\n",
"2022-09-27 22:08:12+0200 Leave PyIndataHandler (lasp_pyindatahandler.cpp)\n"
]
}
],
"source": [
"i = lasp.InDataHandler(mgr, cb)\n",
"import time\n",
"#time.sleep(4)"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "9ba54238",
"metadata": {
"scrolled": true
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"2022-09-27 22:08:12+0200 \n",
"2022-09-27 22:08:12+0200 Enter ~PyIndataHandler (lasp_pyindatahandler.cpp: 87)\n",
"2022-09-27 22:08:12+0200 Leave ~PyIndataHandler (lasp_pyindatahandler.cpp)\n",
"2022-09-27 22:08:12+0200 \n",
"2022-09-27 22:08:12+0200 Enter ~ThreadedInDataHandler (lasp_threadedindatahandler.cpp: 38)\n",
"2022-09-27 22:08:12+0200 Leave ~ThreadedInDataHandler (lasp_threadedindatahandler.cpp)\n",
"2022-09-27 22:08:12+0200 \n",
"2022-09-27 22:08:12+0200 Enter ~InDataHandler (lasp_streammgr.cpp: 27)\n",
"2022-09-27 22:08:12+0200 Leave ~InDataHandler (lasp_streammgr.cpp)\n"
]
}
],
"source": [
"del i"
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "0f0edc36",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"numpy.ndarray"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import numpy as np\n",
"a = np.array([1,2,3])\n",
"type(a)"
]
},
{
"cell_type": "code",
"execution_count": 16,
"id": "ee546114-a879-4ebe-a6eb-e2354b2247fd",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"dtype('int64')"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a.dtype"
]
},
{
"cell_type": "code",
"execution_count": 17,
"id": "5d033d6d-3052-42ce-9441-faa917ece6a9",
"metadata": {},
"outputs": [],
"source": [
"from lasp import DaqChannel"
]
},
{
"cell_type": "code",
"execution_count": 18,
"id": "bb99ec99-b921-4fb2-bd79-87db8dfcdb03",
"metadata": {},
"outputs": [],
"source": [
"d = DaqChannel()"
]
},
{
"cell_type": "code",
"execution_count": 19,
"id": "ad67d273-45aa-4358-9405-de5924f087a2",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0"
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"d.qty.value"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "53ab5c8f-f904-4f9f-b591-6a5dd1581ddd",
"metadata": {},
"outputs": [],
"source": []
} }
], ],
"metadata": { "metadata": {
"kernelspec": { "kernelspec": {
"display_name": "Python 3", "display_name": "Python 3 (ipykernel)",
"language": "python", "language": "python",
"name": "python3" "name": "python3"
}, },
@ -498,7 +137,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.10.7" "version": "3.8.10"
} }
}, },
"nbformat": 4, "nbformat": 4,

View File

@ -1,36 +0,0 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 15 19:45:33 2018
@author: anne
"""
import numpy as np
from lasp import FilterBank, cls
cls()
nfft=50
P = 4
L = nfft-P+2
nfilters = 1
print('nfft:',nfft)
h = np.zeros((P,nfilters),order='F')
h[P-1,0] = 1.
#h[0,1] = 1.
fb = FilterBank(h,nfft)
# %%
#data = np.zeros(nfft//2,order = 'F')
data = np.zeros(L,order = 'F')
data[:] = 1
#data[:] = 1.
#data[1] = 1.
#data[2] = 1.
res = fb.filter_(data)
print('res shape %i:\n' %res.shape[0])
print(res)
#for i in range(4):
# res = fb.filter_(data)
# print('res:\n',res)

View File

@ -1,26 +0,0 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 15 19:45:33 2018
@author: anne
"""
import numpy as np
from lasp.wrappers import SosFilterBank
fb = SosFilterBank(1, 2)
newfilter1 = np.array([0,1.,0.,1.,0.,0.])[:,np.newaxis] # Unit sample delay
newfilter2 = np.array([0,1.,0.,1.,0.,0.])[:,np.newaxis] # Unit sample delay
newfilter = np.vstack((newfilter1, newfilter2))
fb.setFilter(0, newfilter)
x = np.zeros(10)
x[5]=1
x[8] = 3
x = x[:,np.newaxis]
y = fb.filter_(x)
print(x)
print(y)
y = fb.filter_(x)
print(y)