bongozone / vcvrack-rtlsdr

📻 FM radio for rtl-sdr USB dongles in the VCVRack environment
https://vcvrack.com/plugins.html#SDR
GNU General Public License v2.0
21 stars 7 forks source link

update api for 0.6.x #32

Closed wizardishungry closed 6 years ago

wizardishungry commented 6 years ago

see VCVRack/Rack#258

wizardishungry commented 6 years ago

Done for now but tracking

davephillips commented 6 years ago

Hi Jon,

I've built, loaded, and tested the module successfully in Rack-master (pre-0.6.x-dev or whatever the hell it's called). Just thought you'd want to know.

Incidentally, I hope that you can accommodate existing local system libraries in place of a git submodule system for libusb and librtlsdr, at least for Linux.

Best regards,

dp

wizardishungry commented 6 years ago

I'm curious what the purpose of using system libraries over static linking is. I wouldn't be opposed to a Makefile option that forces dynamic linking.

davephillips commented 6 years ago

I was concerned about the possibility of a submodule's source code not building on a particular platform, but as I thought about it I figured it shouldn't really be a problem.

dizzisound commented 6 years ago

@WIZARDISHUNGRY Hi Jon, I noted you were tracking the update, and I read the comment on your last commit about some crash on loading. I didn't tell you that finally I got my dongle a couple of weeks ago, and it's working fine (so fun tweaking!) on PQ version 0.5. I remind you I'm building and testing on a Windows 8.1 machine. So now I thought to build and try the ported version amongst the last Rack sources. No worries with the build, but same crash on loading, also when the dongle was connected. Here the log from gdb:

Thread 16 received signal SIGSEGV, Segmentation fault.
[Switching to Thread 32000.0x7dbc]
0x0000000064942f56 in ?? () from /mingw64/bin/libwinpthread-1.dll
(gdb) traceback
Undefined command: "traceback".  Try "help".
(gdb) backtrace
#0  0x0000000064942f56 in ?? () from /mingw64/bin/libwinpthread-1.dll
#1  0x0000000004a61ada in SDR::step (this=0xa3f3650) at src/sdr/SDR.cpp:80
#2  0x0000000000427372 in rack::engineStep () at src/engine.cpp:91
#3  rack::engineRun () at src/engine.cpp:135
#4  0x000000000055d1ef in execute_native_thread_routine ()
#5  0x0000000064944b04 in ?? () from /mingw64/bin/libwinpthread-1.dll
#6  0x00007ff9aef70b13 in msvcrt!_strupr () from /c/WINDOWS/system32/msvcrt.dll
#7  0x00007ff9aef70bcd in msvcrt!_endthreadex () from /c/WINDOWS/system32/msvcrt.dll
#8  0x00007ff9aecc13d2 in KERNEL32!BaseThreadInitThunk () from /c/WINDOWS/system32/KERNEL32.DLL
#9  0x00007ff9afaa54f4 in ntdll!RtlUserThreadStart () from /c/WINDOWS/SYSTEM32/ntdll.dll
#10 0x0000000000000000 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
(gdb)

I can tell you that I could fix the segmentation fault error when I tried and restored a RtlSdr_init(&radio, (int)engineGetSampleRate()); call in the SDR Module constructor (line 53 of SDR.cpp). Here my session log when I loaded the PQ plugin into Rack:

danielez@sfmi-nb-tec113 MINGW64 /vcvrack/Rack
$ make debug
env PATH="/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl":dep/bin gdb -ex run ./Rack
GNU gdb (GDB) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-msys".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Traceback (most recent call last):
  File "<string>", line 3, in <module>
ImportError: No module named libstdcxx.v6.printers
/etc/gdbinit:6: Error in sourced command file:
Error while executing Python code.
Reading symbols from ./Rack...done.
Starting program: /vcvrack/Rack/Rack
[New Thread 34008.0x5b7c]
[info] Rack master
[info] Current working directory: C:\msys64\vcvrack\Rack
[info] Global directory: ./
[info] Local directory: ./
[info] Loading plugins from ./plugins
[info] Loaded plugin ./plugins/Fundamental/plugin.dll
[info] Loaded plugin ./plugins/mscHack-dev-0.6/plugin.dll
[info] Loaded plugin ./plugins/PulsumQuadratum-SDR/plugin.dll
[info] Loaded plugin ./plugins/RODENTMODULES/plugin.dll
[info] Loaded plugin ./plugins/stochasm/plugin.dll
[info] Loaded plugin ./plugins/The-XOR/plugin.dll
[info] Loaded plugin ./plugins/VCVRack-Simple/plugin.dll
[New Thread 34008.0x2ac0]
[info] Bridge server started
[New Thread 34008.0xad0]
[New Thread 34008.0x6498]
[New Thread 34008.0xa20]
[info] Loaded font ./res/fonts/DejaVuSans.ttf
[info] Loading settings ./settings.json
[info] Saving settings ./settings.json
[info] Loading patch ./autosave.vcv
[info] Loaded SVG ./res/Core/AudioInterface.svg
[info] Loaded SVG ./res/ComponentLibrary/ScrewSilver.svg
[info] Loaded SVG ./res/ComponentLibrary/PJ301M.svg
[info] Loaded font ./res/fonts/ShareTechMono-Regular.ttf
[New Thread 34008.0x37c4]
[New Thread 34008.0x7d4]
[New Thread 34008.0x4f74]
[New Thread 34008.0x637c]
[Thread 34008.0x7d4 exited with code 0]
[Thread 34008.0x4f74 exited with code 0]
[New Thread 34008.0x32dc]
[New Thread 34008.0x71b0]
[Thread 34008.0x32dc exited with code 0]
[Thread 34008.0x37c4 exited with code 0]
[New Thread 34008.0x65f0]
[Thread 34008.0x65f0 exited with code 0]
[info] Opening audio RtAudio device 0 with 2 in 2 out
[New Thread 34008.0x5894]
[Thread 34008.0x5894 exited with code 0]
[New Thread 34008.0x33e0]
[info] Starting RtAudio stream 0
[New Thread 34008.0x5108]
[info] Loaded SVG ./plugins/Fundamental/res/Scope.svg
[info] Loaded font ./plugins/Fundamental/res/fonts/Sudo.ttf
[info] Loaded SVG ./res/ComponentLibrary/RoundBlackKnob.svg
[info] Loaded SVG ./res/ComponentLibrary/CKD6_0.svg
[info] Loaded SVG ./res/ComponentLibrary/CKD6_1.svg
[info] Loaded SVG ./plugins/stochasm/res/Resonator.svg
[info] Loaded SVG ./plugins/stochasm/res/MintKnobLarge.svg
[info] Loaded SVG ./plugins/stochasm/res/MintKnob.svg
[info] Loaded SVG ./plugins/stochasm/res/MintMomentary0.svg
[info] Loaded SVG ./plugins/stochasm/res/MintMomentary1.svg
[info] Loaded SVG ./plugins/Fundamental/res/VCO-1.svg
[info] Loaded SVG ./res/ComponentLibrary/CKSS_0.svg
[info] Loaded SVG ./res/ComponentLibrary/CKSS_1.svg
[info] Loaded SVG ./res/ComponentLibrary/RoundHugeBlackKnob.svg
[info] Loaded SVG ./res/ComponentLibrary/RoundLargeBlackKnob.svg
[New Thread 34008.0x2ff4]
[Thread 34008.0x2ff4 exited with code 0]
[New Thread 34008.0x4ecc]
[Thread 34008.0x4ecc exited with code 0]
[New Thread 34008.0x6230]
[Thread 34008.0x6230 exited with code 0]
Found 1 device(s):
  0:  Realtek, RTL2838UHIDIR, SN: 00000001

Using device 0: Generic RTL2832U OEM
[debug] Audio Interface IO underflow
[New Thread 34008.0x3fcc]
[debug] Audio Interface IO underflow
[debug] Audio Interface IO underflow
[debug] Audio Interface IO underflow
Found Rafael Micro R820T tuner
[debug] Audio Interface IO underflow
[debug] Audio Interface IO underflow
Tuner gain set to automatic.
[debug] Audio Interface IO underflow
[New Thread 34008.0x338c]
[New Thread 34008.0x3834]
[New Thread 34008.0x3a30]
[info] Loaded SVG ./res/ComponentLibrary/RoundSmallBlackKnob.svg
[info] Loaded SVG ./res/ComponentLibrary/CKSSThree_0.svg
[info] Loaded SVG ./res/ComponentLibrary/CKSSThree_1.svg
[info] Loaded SVG ./res/ComponentLibrary/CKSSThree_2.svg
[New Thread 34008.0x1f7c]
Tuned to 100571000 Hz.
Oversampling input by: 6x.
Oversampling output by: 1x.
Buffer size: 8.03ms
Exact sample rate is: 1020000.026345 Hz
Sampling at 1020000 S/s.
Output at 170000 Hz.
[info] Saving patch ./autosave.vcv
[info] Saving settings ./settings.json
[info] Saving patch ./autosave.vcv
[info] Saving settings ./settings.json
[info] Saving patch ./autosave.vcv
[info] Saving settings ./settings.json
[info] Saving patch ./autosave.vcv
[info] Saving settings ./settings.json
[Thread 34008.0x637c exited with code 0]
[info] Saving patch ./autosave.vcv
[info] Saving settings ./settings.json
[info] Saving patch ./autosave.vcv
[info] Saving settings ./settings.json
[info] Saving patch ./autosave.vcv
[info] Saving settings ./settings.json
[Thread 34008.0x71b0 exited with code 0]
[info] Saving patch ./autosave.vcv
[info] Saving settings ./settings.json
[info] Saving patch ./autosave.vcv
[info] Saving settings ./settings.json
[info] Saving patch ./autosave.vcv
[info] Saving settings ./settings.json
[info] Saving patch ./autosave.vcv
[info] Saving settings ./settings.json
[Thread 34008.0x1f7c exited with code 0]
[info] Saving patch ./autosave.vcv
[info] Saving settings ./settings.json
[info] Stopping RtAudio stream 0
[Thread 34008.0x5108 exited with code 0]
[info] Closing RtAudio stream 0
[Thread 34008.0x33e0 exited with code 0]
[Thread 34008.0x3a30 exited with code 0]
[Thread 34008.0x3834 exited with code 0]
[Thread 34008.0x338c exited with code 0]
[Thread 34008.0x3fcc exited with code 0]
[Thread 34008.0xa20 exited with code 0]
[Thread 34008.0x6498 exited with code 0]
Signal caught, exiting!
[info] Bridge server closed
warning: Invalid parameter passed to C runtime function.
[Thread 34008.0x2ac0 exited with code 0]
📻 RtlSdr_init at sample rate 44100
📻 mutex busy
📻 RtlSdr_end
[Thread 34008.0xad0 exited with code 0]
[Inferior 1 (process 34008) exited normally]
(gdb) Quit

I attach the screenshot of the Rack session related to the above log.

pq-06-test-screenshot

Hope this can help for non-Windows environments too. Best

davephillips commented 6 years ago

I've noted that Jon's module often crashes Rack on a first try, but on restarting and Rack and reloading the module it works fine. Any reason why that should work ? @dizzisound : I'll also give your fix a try just to check it out on Linux.

wizardishungry commented 6 years ago

may relate to #28 – I don't have my head in this module right now because I'm working on more generally useful modules for 0.6, but I'd like to revisit this after 0.6 is out.

davephillips commented 6 years ago

@dizzisound Hey, I restored the line per your advice, that does seem to fix the segfault. Btw, your example screenshot looks interesting but is everything connected as it should be ? The resonator isn't doing anything AFAICT. Just curious, I'm happy that Jon's rtlsdr module is working again.

dizzisound commented 6 years ago

@davephillips Glad that worked, although I'm sure Jon will take a more in-depth look and do a better work, when he will be back at the module. Regarding the screenshot... :-D ah ah! I simply worked loading a previous test-patch, a minimal wiring I had made to test the Stochasm Bitstream Resonator, that I updated to 0.6 API... so I just quickly disconnected some cables, loaded the PQ plugin and connected it to the Scope and the Audio Interface. I had my dongle connected but not even mounted the antenna, as you can see!

dizzisound commented 6 years ago

@WIZARDISHUNGRY Found a little mismatch in Makefile, just opened a PR (including the quick-fix described above), shouldn't you prefer to directly review and fix it.

wizardishungry commented 6 years ago

I think we're good for 0.6, despite stability bugs.