Compare commits

...

379 Commits

Author SHA1 Message Date
Charles J. Cliffe 033330367c
Merge pull request #1026 from cjcliffe/cjcliffe-readme-update-1
Update README.md
2024-03-05 20:50:29 -05:00
Charles J. Cliffe 2a2d626af9
Update README.md 2024-03-05 20:37:46 -05:00
Charles J. Cliffe b959ff3f06
Merge pull request #1014 from cjcliffe/cjcliffe-macos-bundlemod-soapy-root-to-cmake-install-prefiox
Update CMakeLists.txt
2023-10-27 01:06:03 -04:00
Charles J. Cliffe b3d25f62c7
Update CMakeLists.txt
Replace flaky SOAPY_SDR_ROOT with CMAKE_INSTALL_PREFIX; SOAPY_SDR_ROOT is now coming up blank randomly
2023-10-27 01:02:14 -04:00
Charles J. Cliffe e5149c28ad
Update CMakeLists.txt
Set default vendor to avoid CPack 'Humanity' default from prefixing itself to component
2023-10-17 21:53:26 -04:00
Charles J. Cliffe f96c1ec6bf
Merge pull request #1012 from cjcliffe/macos-code-signing-missed-files-1
Update code_sign.sh.in
2023-10-16 23:48:52 -04:00
Charles J. Cliffe 77627b6013
Update code_sign.sh.in
Update script to sign dylib in all app subfolders
2023-10-16 23:36:37 -04:00
Charles J. Cliffe 2c6716907e Actual fix was in build repo; revert ABI version reference 2023-08-17 00:51:36 -04:00
Charles J. Cliffe fcb646f385 Use prefix lib path if provided so we can override system libs for bundles 2023-08-17 00:15:32 -04:00
Charles J. Cliffe 74b52f7b97 Fix app bundle soapy module path mismatch (folder doesn't have suffix) 2023-08-16 21:47:02 -04:00
Charles J. Cliffe 1d1532e1f5
Update CubicSDR.desktop.in 2023-04-26 20:13:59 -04:00
Charles J. Cliffe 87f5d8835a
Merge pull request #999 from cjcliffe/fix-janky-bandwidth-ui
Fix modem bandwidth interaction lag; favor visual responsiveness
2023-04-17 23:38:53 -04:00
Charles J. Cliffe 5edd7ba845 Fix modem bandwidth interaction lag; favor visual responsiveness
- Trying to always show the active bandwidth state when liquid-dsp is being slow to generate resamplers makes interaction janky.  Let the audio state lag behind the visuals for a better experience.
- Minor out-of-order fixes for variable set/notify.
- Side thought; why is liquid-dsp slow at generating resamplers now?
2023-04-17 23:25:02 -04:00
Charles J. Cliffe 3426a0188e Donation/contribution list updates 2023-04-13 23:05:53 -04:00
Charles J. Cliffe 6afebe585b
Merge pull request #997 from cjcliffe/winbuild-updates
Winbuild updates
2023-04-13 21:26:15 -04:00
Charles J. Cliffe 674bfa1246
Merge branch 'master' into winbuild-updates 2023-04-13 21:22:08 -04:00
Charles J. Cliffe a93b698284 CMake v3.0 minimum breaks windows builds; go with 2.8.12 2023-04-11 21:28:09 -04:00
Charles J. Cliffe 40046b1655 Restore deleted pthread lib needed for user builds
Remove old vc redist used by installer
2023-04-11 20:41:52 -04:00
Charles J. Cliffe f9766ceaf0
Merge pull request #950 from classabbyamp/fix-build
fix build errors caused by commented parameters in function declarations
2023-03-29 01:57:08 -04:00
Charles J. Cliffe b12084d2e5
Merge branch 'master' into fix-build 2023-03-29 01:50:22 -04:00
Charles J. Cliffe 6c1cfcad65
Merge pull request #564 from f4grx/fix-liquid-libs
Avoid build failure when liquid-dsp is not in a default libdir
2023-03-29 01:45:11 -04:00
Charles J. Cliffe 9fe4841cde Merge branch 'master' into winbuild-updates 2023-03-29 00:54:21 -04:00
Charles J. Cliffe 6d65a1ca7c
Update README.md 2023-03-29 00:43:12 -04:00
Charles J. Cliffe 69a7b0b97a
Merge pull request #995 from cjcliffe/circleci-project-setup
Upgrade from Travis -> CircleCI
2023-03-29 00:34:43 -04:00
Charles J. Cliffe e1e30ed890 Delete .travis.yml 2023-03-29 00:29:59 -04:00
Charles J. Cliffe 165ace2c37 Don't use nproc on CI; it returns host threads 2023-03-29 00:10:20 -04:00
Charles J. Cliffe b3428c3ba8 Update config.yml
boost resource_class once more
2023-03-28 23:55:46 -04:00
Charles J. Cliffe b4fee0dff7 Update config.yml
needs a bit more memory to build I think; boost resource_class
2023-03-28 23:52:33 -04:00
Charles J. Cliffe c0e71c70d6 Update config.yml
wx cached; try remaining build steps
2023-03-28 23:40:45 -04:00
Charles J. Cliffe 1fd2f431cb Update config.yml
Try newer base image
2023-03-28 23:23:36 -04:00
Charles J. Cliffe 61797c2ac6 Build wx verbose (output timeout)
Disable other build steps for the moment; see if we can get a working wxwidgets cache first
2023-03-28 23:04:03 -04:00
Charles J. Cliffe 8ad45faec5 Just check build env using uname 2023-03-28 22:30:57 -04:00
Charles J. Cliffe 437a66b3bd job name not configurable? 2023-03-28 22:27:45 -04:00
Charles J. Cliffe 0b899dbdb3 Move scripts to circle-ci
Minor updates to build scripts
2023-03-28 22:24:29 -04:00
Charles J. Cliffe 2dff8948e3
Update config.yml 2023-03-28 21:46:34 -04:00
Charles J. Cliffe f4aacd11e2
Update config.yml 2023-03-28 21:43:56 -04:00
Charles J. Cliffe be641f1946
Update config.yml 2023-03-28 21:42:00 -04:00
Charles J. Cliffe eba9a18182
Update config.yml 2023-03-28 21:39:55 -04:00
Charles J. Cliffe f59e25a4bf
Update config.yml 2023-03-28 21:38:22 -04:00
Charles J. Cliffe 41d27ad357
Trying GPT-4 auto conversion from travis-ci yml 2023-03-28 21:31:34 -04:00
Charles J. Cliffe 50370cc74b Add .circleci/config.yml 2023-03-28 12:41:11 -04:00
vsonnier 071204f392 Updated Travis and Wiki to reference wxWidgets v3.2.1 at last a stable version 2023-01-14 11:11:01 +01:00
vsonnier e09e7e8381 Set maximum compatibility OpenGL profile for wxWidgets 2023-01-11 21:27:40 +01:00
vsonnier 0e3a785bd2 Fix for liquid-dsp v1.50 where msresamp_crcf_create() with mad As parameter somewhat creates crashes 2023-01-11 21:27:40 +01:00
vsonnier 8c23e370da Updates Windows liquid-dsp binaries to v1.5.0:
- Win32/64 bins liquid-dsp ref: c3e0de7e89cdcc0ec5da9ccaeb5738496263d4c0 (tag: v1.5.0)
    - Win32/64 bins using GCC 12.2 (MSYS2)
	- Arch : SSE4.1 for maximum compatibility
2023-01-11 21:27:40 +01:00
vsonnier 03ba4ff2ee Continue with version 0.28a (alpha) 2023-01-11 21:27:40 +01:00
Charles J. Cliffe 4fb3088936 Remove installer binaries; moving externals to winbuild project 2022-06-14 23:00:37 -04:00
classabbyamp 521f62900a
fix build errors caused by commented parameters in function declarations 2022-05-08 16:15:28 -04:00
vsonnier ba7a35c336 Tag version '0.2.7'
- Do not use 'a' suffix to be consistent with other releases
2022-02-05 11:36:59 +01:00
vsonnier 83617cbdc9 Merge branch 'v027' of https://github.com/SDRplay/CubicSDR into SDRplay-v027 2022-02-05 11:34:37 +01:00
vsonnier 1518364684 Updates Windows Hamlib binaries to v4.4 2022-02-03 19:36:56 +01:00
vsonnier bbc2e974de Updates Windows liquid-dsp binaries to v1.4.0:
- Win32/64 bins liquid-dsp ref: 3b8a6f07ba6780b7a3d4be148461257515d183ad (tag: v1.4.0)
- Win32/64 bins using GCC 11.2 (MSYS2)
2022-02-03 19:20:59 +01:00
SDRplay 9961e67441 Uprev to 0.2.7a 2022-01-02 20:40:25 +00:00
dforsi f461fcb94c
Fix typing errors (#935)
Found with:
codespell --skip=external --ignore-words-list=axix,bord,parm,soley,ue --write-changes --interactive 2

Co-authored-by: Daniele Forsi <iu5hkx@gmail.com>
2021-12-29 19:54:03 +01:00
vsonnier b826d58cd0 Updates Windows liquid-dsp binaries to master
- Win32/64 bins liquid-dsp ref: e77c20bbc26af260d61133ee42ff101c48e4f389
- Win32/64 bins using GCC 11.2 (MSYS2)
2021-12-11 16:43:50 +01:00
Vincent Sonnier cab1227acd
Update RtAudio to v5.20 (#927) 2021-11-21 11:39:27 +01:00
vsonnier 0831aa262c Fix #926: liquid-dsp master 'modem' changed to 'modemcf' for Digital modems, updates Windows liquid-dsp binaries to master
- Updated Windows bins dependencies to latest MSYS2
- Win32/64 bins liquid-dsp ref: 471f46660ddfab7e6713341324f473b7785da101
- Win32/64 bins using GCC 11.2 (MSYS2)
2021-11-12 11:07:17 +01:00
vsonnier 0248e5aeac Updated Windows bins dependencies to latest MSYS2 2021-08-14 10:13:59 +02:00
vsonnier b7ee0fb8ca Updated Windows liquid-dsp binaries to master
- liquid-dsp ref: 373d440d38201bb8950f65c73b322b981355f2c9
- using GCC 10.3 (MSYS2)
2021-08-14 10:06:54 +02:00
vsonnier 29e9144aa5 Hamlib : Restore usage of FILPATHLEN which valid for both v2 and v4 thanks to commit 'HAMLIB patch for updated define' 2021-08-14 09:06:27 +02:00
Aleksey Makarenko 5c78738d33 Proper OpenGL HiDPI handling. Fixes problems with size of OpenGL widgets on HiDPI screens. (PR #769) 2021-08-02 14:57:45 +02:00
Vincent Sonnier 3a08df72ad
Updated Hamlib to v4.2 (#867)
OK, looks like it should work. Let's go !
2021-08-02 14:29:29 +02:00
Charles J. Cliffe 29db1bde99
Merge pull request #885 from cjcliffe/compiler-warning-cleanup-fixes
Cleanup: C++11 updates, clean-up, warning fixes
2021-07-05 20:58:00 -04:00
Charles J. Cliffe 703ec4ac6d init sequence warning 2021-06-03 01:16:47 -04:00
Charles J. Cliffe ed193f0ec1
Update README.md 2021-06-02 22:50:03 -04:00
Charles J. Cliffe 7826006c14 HAMLIB patch for updated define 2021-06-02 22:41:50 -04:00
Charles J. Cliffe d0b4bf694b Missed updates for digital modems 2021-04-29 21:25:24 -04:00
Charles J. Cliffe dcaa5cda38 Merge remote-tracking branch 'origin/master' into compiler-warning-cleanup-fixes 2021-04-22 00:37:41 -04:00
Charles J. Cliffe a409822429 Enumerator class and warnings cleanup 2021-04-22 00:34:45 -04:00
Vincent Sonnier bd7574a3d5
Updated build script with wxWidgets 3.1.5 version, disabling EGL 2021-04-17 18:05:57 +02:00
Charles J. Cliffe f97f368a6a Cleanup: appframe, bookmarks, sessions, core app 2021-04-04 22:22:16 -04:00
Charles J. Cliffe 7aa7daa55f Cleanup: utility classes 2021-04-04 22:21:05 -04:00
Charles J. Cliffe a0f1ccf68d Cleanup: visual ui / interface panels 2021-04-04 22:20:33 -04:00
Charles J. Cliffe 690896f65d Cleanup: SDR threads, enumerator, device info 2021-04-04 22:19:24 -04:00
Charles J. Cliffe 8420f5fb4b Cleanup: rig thread 2021-04-04 22:18:50 -04:00
Charles J. Cliffe e9a6fc089c Cleanup: data, visual processor threads 2021-04-04 22:18:19 -04:00
Charles J. Cliffe 0b9bcc5a46 Cleanup: scope, meter, spectrum and waterfall panels 2021-04-04 22:17:30 -04:00
Charles J. Cliffe 9e22a1314c Cleanup: digital modems 2021-04-04 22:16:57 -04:00
Charles J. Cliffe 74f63d0e84 Cleanup: analog modems 2021-04-04 22:16:44 -04:00
Charles J. Cliffe 02fdcb2aa3 Cleanup: modem digital/analog base 2021-04-04 22:16:30 -04:00
Charles J. Cliffe 592ffa2050 Cleanup: about, digital console and device dialogs 2021-04-04 22:15:44 -04:00
Charles J. Cliffe 296f7790f1 Cleanup: bookmark mgr 2021-04-04 22:15:10 -04:00
Charles J. Cliffe 4605eaccf0 Cleanup: demodulator mgr, instances, threads 2021-04-04 22:14:31 -04:00
Charles J. Cliffe 0b97bd360a Cleanup: audio file, audio threads 2021-04-04 22:13:31 -04:00
vsonnier 19b1ecd7c2 Fixed CMake Win32/64 external binaries deployment 2021-03-21 10:56:31 +01:00
vsonnier 606a7345a0 Fix missing Win32 external dependency for liquid-dsp, updated others 2021-03-20 11:25:36 +01:00
Charles J. Cliffe a174db1725 Minor warning/formatting clean-up 2021-03-19 22:42:42 -04:00
Charles J. Cliffe 95b7a86ed9 Merge branch 'master' of https://github.com/colbyAtCRI/CubicSDR into colbyAtCRI-master 2021-03-19 22:01:33 -04:00
Charles J. Cliffe bdf31ebf76
Merge pull request #877 from cjcliffe/travis_ci_updates_feb2021
Update CI OSX/Xcode version
2021-02-22 20:28:19 -05:00
Charles J. Cliffe f571f27efc
Update CI OSX/Xcode version 2021-02-22 19:55:24 -05:00
colbyAtCRI 260b391c5e Really added the files this time 2021-01-15 07:12:54 -08:00
colbyAtCRI 4eefcd2465 Added ModemCW 2021-01-15 07:11:49 -08:00
vsonnier 0b2b90848d Updated Windows liquid-dsp binaries to master, now some functions have return values for error management.
- liquid-dsp ref: c68f5e39434433c88bd4fe19784bf4c8a32aa8e4
- using GCC 10.2 (MSYS2)
2021-01-02 12:13:17 +01:00
Paul Colby 6a709fe24b
Modified ModemAM (#865)
Works perfectly :)
2021-01-02 12:11:02 +01:00
vsonnier 7b1956f7cd Cleaner management of the device not accepting the requested sample rate 2020-11-21 11:52:34 +01:00
Vincent Sonnier 155862f703
Apparently for wxWidgets 3.1.4 some options are no longer needed for MacOS 2020-11-11 11:33:04 +01:00
Vincent Sonnier 366c0088c8
Update script for wxWidgets v3.1.4 2020-11-11 10:12:01 +01:00
Charles J. Cliffe 4f1db5544d
Merge pull request #840 from cjcliffe/feature/zeroing_and_universal_offset
Update to standard SoapySDR frequency correction, allow zero-to-right by SHIFT+Right Click freq. digits
2020-08-24 22:47:42 -04:00
vsonnier d08b0be9bd Updated Windows liquid-dsp binaries (master: 3be93e37e2556b7152e176046dd899a6d2599a58) using GCC 10.2 (MSYS2) 2020-08-14 12:41:29 +02:00
Charles J. Cliffe 850e646c6d Fix source of bandwidth display visual glitch 2020-08-10 23:16:37 -04:00
Charles J. Cliffe 2f0bbef234 Frequency dialog bw limit check 2020-08-10 23:05:28 -04:00
Charles J. Cliffe 63631cd255 Use shift-right click for zero-right instead, additional cleanup 2020-07-28 23:24:00 -04:00
Charles J. Cliffe 94ca0bbe54 Update to use SoapySDR frequency correction instead of RTL-SDR specific 2020-07-20 01:01:28 -04:00
Charles J. Cliffe 8b61aaa62f
Merge pull request #839 from cjcliffe/feature/hamlib_error_feedback
Error dialog feedback when rig thread exits unexpectedly.
2020-07-13 20:52:00 -04:00
Charles J. Cliffe 7742646794 Error dialog feedback when rig thread exits unexpectedly. 2020-07-12 23:58:24 -04:00
Charles J. Cliffe 4cc0958f7b
Merge pull request #835 from cjcliffe/bugfix/bookmark-issues-jun2020
Bugfix/bookmark issues jun2020
2020-06-22 23:46:03 -04:00
Charles J. Cliffe b4f2b611eb Update recording notification message 2020-06-22 23:36:39 -04:00
Charles J. Cliffe 50f2bb18eb Fix enter handling on mac 2020-06-22 23:26:04 -04:00
Charles J. Cliffe c5652be141 Possible workaround for label entry to keep it from breaking global key handler (Linux tested) 2020-06-17 22:05:57 -04:00
vsonnier b564a0ddde Fix #806: fix scale of Frequency and Edit Label dialogs by @jawatson
Co-Authored-By: James Watson <jimwatson@mac.com>
2020-04-19 12:13:49 +02:00
James Watson 2f4e9a9e74 Adds a fix to scale the Frequency dialog.
The dialog layout uses a sizer to scale the content automatically.  The layout wasn't very good using sizers alone as width of the dialog was being set too narrow for the title string.  The width is set manually to either the [title string width + 35%] or the [content string width +10%], whichever's the greater.
2020-04-19 10:25:05 +02:00
vsonnier 853484ff82 BookmarkMgr: Add more upper and lower amateur bands to the default ranges, also display frequency 2020-04-17 16:30:36 +02:00
vsonnier 60fa038549 Updated Windows liquid-dsp binaries to master using GCC 9.30 2020-04-17 13:09:06 +02:00
Vincent Sonnier d2f9333523
Misc. enhancements (driven by RSPDuo support needs) (#786)
* Add Device name in main window title bar

* Cleaner stopping of device in case of device loss
2020-02-26 07:11:19 +01:00
vsonnier 9c32b97910 Make Gradient constructor using doubles instead of floats, to prevent narrowing-conversion warnings down the road 2020-01-04 21:20:36 +01:00
Charles J. Cliffe 45fe1a9f3b
Merge pull request #779 from cjcliffe/2019-donation-updates
Updated donation dialog contents and fixed layout issues
2019-12-30 22:16:55 -05:00
Charles J. Cliffe 8a629b1438 Updated donation dialog contents and fixed layout issues 2019-12-30 22:07:23 -05:00
Benoît Allard f00efe7e58 Fix missing import for GLX on linux. (#767)
Haha, this looks indeed useful, so let's take it to master.
2019-12-29 17:32:53 +01:00
Vincent Sonnier 57454e4b32
Changed wxWidgets version to 3.1.3 2019-12-27 11:42:57 +01:00
antihax cd6df01166 Winsock.h was included multiple times through windows.h causing compile errors (#772)
* Prevent redefinition of winsock.

* Remove redundant windows.h import
2019-12-11 06:50:06 +01:00
antihax 58d3a02855 Stop spamming hundreds of `No SoapySDR Module` dialogs. (#773) 2019-12-09 07:19:45 +01:00
rainbow 31323fe3c2 fix build with wxWidgets 3.1.3 (#765)
AppFrame.cpp use wxToolTip() without including the library
2019-10-29 08:38:31 +01:00
Vincent Sonnier 4f7dcd4d89
Use Google Turbo Color for Default Theme WF colors (#748)
* Use Google Turbo Color for Default Theme WF colors

* Added Default Jet Waterfall as the old WF color theme

* Oups duplicate IDs for widgets is wrong
2019-09-23 07:24:04 +02:00
vsonnier e0d1e2b6ff Update Windows libraries to liquid-dsp v1.32 / Gcc 9.2.0 2019-08-17 17:17:55 +02:00
Charles J. Cliffe 21fc2d605a
Merge pull request #745 from cjcliffe/general_ux_fixes_May2019
General ux fixes
2019-07-23 22:57:17 -04:00
Charles J. Cliffe 117c1de3fb Merge remote-tracking branch 'origin/master' into general_ux_fixes_May2019 2019-07-02 20:15:10 -04:00
Charles J. Cliffe 14c546ef9e BookmarkView refresh handling cleanup; reduce flicker and layout errors 2019-06-28 00:24:39 -04:00
Charles J. Cliffe 59687d7a0b Alpha version bump; update to VS2019 redist files 2019-06-26 00:07:02 -04:00
vsonnier 9bf25b8feb Fix #739: removed usage of std::binary_function deprecated after C++11 2019-06-02 18:56:00 +02:00
Charles J. Cliffe e379cceeb2 Bookmarks: Add delete key handler, fix refresh issues, ensure active selection stays in view on refresh 2019-05-29 00:25:02 -04:00
Charles J. Cliffe 99ecbef373 Fix nudging out of view, fix keypad triggering and tuner freq entry target 2019-05-24 00:30:22 -04:00
Charles J. Cliffe 0fa818c2fb
Merge pull request #730 from cjcliffe/appimage_configload
Move config load out of commandline parse to prevent wrong path in AppImage
2019-05-13 22:59:04 -04:00
Charles J. Cliffe 1f188a3c4b Move config load out of commandline parse to prevent wrong path in AppImage 2019-05-13 22:41:22 -04:00
Charles J. Cliffe 0131c4d128
Merge pull request #729 from cjcliffe/linux_ui_fixes
Bookmark refreshing, port selection and device selector UI fixes
2019-05-13 21:44:48 -04:00
Charles J. Cliffe dcdacb0cf7 Bookmark refreshing, port selection and device selector UI fixes 2019-05-13 20:52:36 -04:00
Charles J. Cliffe 19b922a863
Merge pull request #728 from cjcliffe/rigmenu_serial
Fix port selector dialog; simplify rig model selection with manufacturer sub-menus
2019-05-08 19:01:07 -04:00
Charles J. Cliffe 8b862037da Fix port selector dialog size/layout; make rig model selection easier with submenus 2019-05-07 23:35:06 -04:00
vsonnier a000446610 Upgrade to RtAudio v5.1.0 2019-04-18 06:58:04 +02:00
Charles J. Cliffe d43f30f0c7
Merge pull request #724 from cjcliffe/liquid_dsp_ampmodem_update
Liquid dsp ampmodem/firhilbf update-related changes
2019-04-17 22:04:38 -04:00
vsonnier c6855cd099 Updated Windows liquid-dsp aligned on ampmodem API changes 2019-04-17 06:51:12 +02:00
Charles J. Cliffe 1a362152ee USB modem fix re: firhilbf c2r update 2019-04-17 00:12:54 -04:00
Charles J. Cliffe 35ae486d20 Patch for updated liquid-dsp firhilbf complex->real adding usb 2019-04-16 19:05:05 -04:00
Charles J. Cliffe 58086c17fb ampmodem parameters have changed 2019-04-16 18:53:10 -04:00
Charles J. Cliffe 8edd8a77dc
Merge pull request #723 from cjcliffe/code_quality
AppFrame refactoring
2019-04-16 18:32:47 -04:00
Charles J. Cliffe 44fd77ec50 Merge remote-tracking branch 'origin/master' into code_quality 2019-04-10 22:24:11 -04:00
vsonnier 61f6eac8cf Updated Windows liquid-dsp binaries again-again, from latest master 2019-04-02 06:49:31 +02:00
vsonnier cf8ea45fa9 Updated Updated Windows liquid-dsp binaries again, from latest master 2019-03-30 15:50:51 +01:00
Charles J. Cliffe c67330e985 menu action cleanup/refactoring 2019-03-19 00:06:01 -04:00
Charles J. Cliffe 58d4f484e4 Appframe header cleanup, sorting, move init vars 2019-03-16 18:37:52 -04:00
Charles J. Cliffe 5f3de57bd8 AppFrame Cleanup: Move config, menubar inits 2019-03-16 17:44:41 -04:00
Charles J. Cliffe 8d09d9c329 Merge remote-tracking branch 'origin/master' into code_quality 2019-03-16 16:57:10 -04:00
Vincent Sonnier c27e1e6514
Make stream deactivated before a sample-rate change and reactivated afterwards (#718)
* Make stream deactivated before a sample-rate chnage and reactivated afterwards

* Re-read sample rate and MTU AFTER stream activation to recompute CubicSDR buffers
2019-03-15 06:30:55 +01:00
Charles J. Cliffe 86c2817ba6 Merge branch 'master' into code_quality 2019-03-14 23:10:27 -04:00
Charles J. Cliffe 0f098e3cbb Compiler warnings: comment unused params 2019-03-14 23:07:51 -04:00
Charles J. Cliffe 3009da6194 Merge remote-tracking branch 'origin/master' into code_quality 2019-03-14 21:15:07 -04:00
Charles J. Cliffe ea016e6638 Merge branch 'drahosj-master' 2019-03-14 21:02:52 -04:00
Charles J. Cliffe 2a75c2776e tabs->spaces 2019-03-14 21:01:19 -04:00
vsonnier b18b609d61 Updated Windows liquid-dsp binaries again, from latest master 2019-03-12 22:04:05 +01:00
Diane Bruce f449a65457 Add __FreeBSD__ where needed to properly compile on FreeBSD + fix for Windows 2019-03-11 20:14:19 +01:00
vsonnier 9e43beec1a Updated Windows liquid-dsp binaries part II: use exact same config.h as Linux goes, removed not-relevant files 2019-03-10 18:56:01 +01:00
Dantali0n ed5993748f Fix for above 3Mhz sample rate on LimeSDR-USB
This problem could  also be present on other devices using the FX3 driver and is perhaps part of a larger general problem  in the LMS7 Soapy  module.
2019-03-09 20:33:17 +01:00
vsonnier 94e252db51 Fix wrong type for timeoutUs parameter of readStream 2019-03-09 18:23:06 +01:00
vsonnier a2bd569e5a Fix wrong type for timeoutUs parameter of readStream 2019-03-09 18:22:49 +01:00
vsonnier 6d8c9f60d2 Maybe fixing #716: Nullify readStream timeout parameter effect which some modules effectively use (LimeSDR...) but we don't care 2019-03-09 17:59:22 +01:00
vsonnier b6c81fe726 Add traces about MTU used size 2019-03-09 14:19:42 +01:00
vsonnier f13af7f357 Updated Windows liquid-dsp binaries to latest version
- Take liquid-dsp master
- Align config.h MingW and Linux one.
- Make 64bit build target SSE4.2 while 32bit stays SSE3.
- Use latest MSYS2 version, i.e. GCC 8.3 for 64bit, GCC 7.4 for 32bit.
- Updated libwinpthread-1.dll from latest MSYS2
- Removed libliquid.a from msvsc libs since Visual Studio can't possibly static link MINGW lib.
==> 1.5x perf boost in CubicSDR :)
==> Maybe the config.h was wrong all this time, for instance HAVE_MMX wasn't defined. Well well.
2019-03-09 10:41:23 +01:00
Vincent Sonnier c561292a27
Merge pull request #715 from cjcliffe/vso_spin_lock_adjustments2
More Spin locks experiments
2019-03-05 06:49:28 +01:00
vsonnier 1d2e35cbac More Spin locks experiments 2019-03-05 06:44:58 +01:00
Vincent Sonnier fd30710d14
Merge pull request #714 from cjcliffe/vso_spin_lock_adjustments
No Spin-lock for xxxProcessor, unclear what the gain was
2019-03-04 18:46:14 +01:00
vsonnier 8dbd5de53d No Spin-lock for xxxProcessor, unclear what the gain was 2019-03-04 18:44:48 +01:00
vsonnier 8dfc7503f2 Fix wrong condition in DataTree 2019-03-03 13:22:29 +01:00
Vincent Sonnier 8b0d4c2449
Merge pull request #713 from cjcliffe/vso_use_spin_locks
Let's go to production and ask for forgiveness later.
2019-03-03 13:08:44 +01:00
vsonnier 6afa3a6d6a Reduced SpinMutex scope in VisualProcessor::distribute() 2019-03-03 11:42:34 +01:00
vsonnier 5ab44e3104 Use spin-locks for short-lived, non-recursive locking sequences 2019-03-03 10:36:10 +01:00
Vincent Sonnier 792bf20a9c
Merge pull request #711 from cjcliffe/vso_dataelement_rework
Tentative fix for #760
2019-03-02 16:27:49 +01:00
vsonnier 44a9274cb1 More fake partial template specialization 2019-03-01 22:18:43 +01:00
vsonnier dd92e75cda Try to workaround explicit specialization in class scope error for GCC and friends 2019-02-28 22:05:27 +01:00
vsonnier 3b47045d28 Rework of DataElement to use more templates and much less memcpy... 2019-02-22 20:19:30 +01:00
Charles J. Cliffe 9ed085123a More AppFrame cleanup, active/current modem verbage adjustments 2019-02-11 22:59:43 -05:00
Charles J. Cliffe abaf458ea1 Merge remote-tracking branch 'origin/master' into code_quality 2019-02-11 22:57:54 -05:00
Charles J. Cliffe a958912da6 Move Session stuff to SessionMgr 2019-01-30 23:24:33 -05:00
Charles J. Cliffe 1f70f9189e AppFrame clean-up, first pass 2019-01-22 00:01:31 -05:00
Jake Drahos 4ca6e8dba9 Safer calls to setGainMode
Will call hasGainMode first - this will prevent crashes when the underlying
device situationally doesn't support setGainMode calls.
2019-01-13 21:53:37 -06:00
Charles J. Cliffe b0505b0659
Merge pull request #700 from cjcliffe/travis-ci
Add hamlib, digital lab to CI, fix several build warnings
2019-01-10 21:48:40 -05:00
Charles J. Cliffe c57a123130 Additional warning fixes; run brew update before brew install for hamlib 2019-01-10 21:23:26 -05:00
Charles J. Cliffe e75387c25d Warning cleanup, fix travis config 2019-01-10 20:49:24 -05:00
Charles J. Cliffe 3a594de37f Enable hamlib + digital lab 2019-01-10 20:04:18 -05:00
Charles J. Cliffe 29702505da
Merge pull request #699 from cjcliffe/travis-ci
Travis-CI add MacOS build
2019-01-08 22:40:16 -05:00
Charles J. Cliffe 10ff7a5453 Fix wx cache logic 2019-01-08 21:57:15 -05:00
Charles J. Cliffe 45118b44e5 Script copypasta err, unify wx cache dirs 2019-01-08 21:50:47 -05:00
Charles J. Cliffe dd49fbae4d separate build scripts and add platform logic 2019-01-08 21:44:04 -05:00
Charles J. Cliffe 5f829b2767 Rearranging scripts 2019-01-08 21:30:34 -05:00
Charles J. Cliffe d561ed6b79 common build test 2019-01-08 21:24:49 -05:00
Charles J. Cliffe 4deaaaba5d Add some more steps for MacOS 2019-01-08 21:12:00 -05:00
Charles J. Cliffe b234a51ef7 MacOS build test 2019-01-08 21:05:19 -05:00
Charles J. Cliffe 9961531620
Merge pull request #698 from cjcliffe/travis-ci
Travis-CI Build Script
2019-01-08 01:04:53 -05:00
Charles J. Cliffe c133f1294f
Update build.sh
travis-ci timeout due to lack of output; AKA don't redirect wxWidgets build output to null :)
2019-01-08 00:44:06 -05:00
Charles J. Cliffe ee4862f595
Update README.md 2019-01-08 00:05:36 -05:00
Charles J. Cliffe 9758b5670d
Update build.sh 2019-01-07 23:40:08 -05:00
Charles J. Cliffe 73aed6c9cc
Update build.sh 2019-01-07 23:32:36 -05:00
Charles J. Cliffe 849b7ca112
Update .travis.yml 2019-01-07 23:05:12 -05:00
Charles J. Cliffe 9f0d0bed71
Update build.sh 2019-01-07 23:05:10 -05:00
Charles J. Cliffe 268c7c747d
Update build.sh 2019-01-07 22:30:14 -05:00
Charles J. Cliffe 45ac3d383b
Update build.sh 2019-01-07 22:27:55 -05:00
Charles J. Cliffe 8e9d5a240a
Update build.sh 2019-01-07 22:26:13 -05:00
Charles J. Cliffe 7ff208f64d
Update .travis.yml 2019-01-07 22:22:49 -05:00
Charles J. Cliffe 3f0763ea6f
Update build.sh 2019-01-07 22:17:01 -05:00
Charles J. Cliffe 02794adb59
Update build.sh 2019-01-07 22:07:44 -05:00
Charles J. Cliffe ea294384ec
Update build.sh 2019-01-07 22:00:39 -05:00
Charles J. Cliffe 4d941de46a
Update build.sh 2019-01-07 21:56:40 -05:00
Charles J. Cliffe 1cd78bdfe2
Update .travis.yml 2019-01-07 21:54:17 -05:00
Charles J. Cliffe b539b8f50a
Update build.sh 2019-01-07 21:54:14 -05:00
Charles J. Cliffe 03e1284aaa
Update .travis.yml 2019-01-07 21:49:59 -05:00
Charles J. Cliffe 32cfb5b382
Create build.sh 2019-01-07 21:49:50 -05:00
Charles J. Cliffe 3448f4030b
Update .travis.yml 2019-01-07 21:36:30 -05:00
Charles J. Cliffe ae6fb3515f
Update .travis.yml 2019-01-07 21:17:11 -05:00
Charles J. Cliffe f1bcfe6474
Create .travis.yml 2019-01-07 21:14:36 -05:00
vsonnier b27a8890d6 Fix #689: Wrong setAudioSampleRate code, thanks @GkvJeep 2018-11-14 20:16:11 +01:00
vsonnier f03925d27f Fix #677: SDRPostThread : Do not push twice the samples in single-channel mode, refactorings and simplifications. 2018-09-15 08:33:22 +02:00
vsonnier 5db28da361 Fix #678: be clean when leaving SDRPostThread 2018-09-15 07:12:50 +02:00
vsonnier 00c0693574 Fix #675 cut-n-paste giving wrong demod data queue (thanks @GkvJeep) plus boost of AudioThread queue size to prevent stuttering at very high CPU loads 2018-08-31 20:21:45 +02:00
vsonnier 1fed3b7480 Updated Windows Hamlib binaries to latest v3.3 2018-08-20 18:53:40 +02:00
vsonnier f7ef0daa8d Update LodePNG to 2018.08.19 version 2018-08-20 18:50:14 +02:00
Charles J. Cliffe 298d9bec82 Version bump 2018-08-17 23:28:39 -04:00
Charles J. Cliffe 43f4f3d75e Donation list update 2018-08-17 22:44:13 -04:00
vsonnier f9346fc616 Regenerated forms with wxFormsBuilder v3.81 which includes small fixes for wxWidgets 3.11, fdp projects format auto-migration to this version 2018-08-12 07:54:42 +02:00
vsonnier 727af1238f Updated LodePNG to 2018.08.09 version 2018-08-12 07:54:32 +02:00
vsonnier 5e8e608a9c Updated LodePNG to 2018.06.11 version 2018-08-09 20:49:59 +02:00
vsonnier a7e4d911e9 Updated Windows64 binaries:
- liquid-dsp v1.31 compiled to latest GCC 8.2.0
- libwinpthread latest from MSYS2
2018-08-06 17:33:47 +02:00
vsonnier 2f84df3c47 Make DataTree throw exception objects, instead of dynamically allocated ones for simplicity 2018-06-08 05:58:55 +02:00
vsonnier cf06709cb4 Fix memory leak of the previous commit 2018-06-07 21:44:17 +02:00
vsonnier 3e4aadfaef Fix #659 : Allow manual editing of user_labels in normal ASCII 2018-06-06 20:49:37 +02:00
vsonnier 35482a0ede Improved CPU usage menu wording a bit 2018-05-19 16:16:36 +02:00
vsonnier f8317a6438 Fix wrong variable declaration placement preventing build w/o Hamlib 2018-05-18 17:04:39 +02:00
vsonnier 6faa2f87b3 Changed Low-perf mode into a CPU usage submenu (low, Normal, High) where High means PFBCH2 usage 2018-05-17 17:54:31 +02:00
Charles J. Cliffe 462da6cdf7
Merge pull request #651 from cjcliffe/firpbch2_mode
Firpbch2 support and SDRPostThread clean-up
2018-05-07 22:20:46 -04:00
Charles J. Cliffe 89f56284c8 Default to PFBCH until toggle for PFBCH2 preference is available 2018-05-07 22:14:50 -04:00
Charles J. Cliffe 94b0b04b59 Merge branch 'master' into firpbch2_mode 2018-05-07 20:30:19 -04:00
Charles J. Cliffe 5731a93354 Version bump, donation updates 2018-04-26 22:15:31 -04:00
Charles J. Cliffe 4240b0efc2 Merge remote-tracking branch 'origin/master' into firpbch2_mode 2018-04-26 20:09:42 -04:00
vsonnier 2239bfd3da Updated Hamlib libs to v3.2 on Windows, changed Hamlib site location to Github in README.md 2018-04-06 07:23:14 +02:00
vsonnier 1cc60bfc8d Fixes #635 round 5, Bookmarkview : let the buttons be of default color 2018-03-24 17:32:54 +01:00
vsonnier c9d38ab363 Fixes #635, round 4, Bookmarkview : always have Start/Stop Recording button irrespective of the actual demod active state 2018-03-24 09:48:18 +01:00
vsonnier a25253e745 Fix #635 round 3, BookmarkView: clear the buttons when 'Remove active' 2018-03-24 09:36:06 +01:00
vsonnier 00a864f741 Fix #635 Round 2 for Bookmarkview on Windows, should be OK now 2018-03-24 08:45:50 +01:00
vsonnier 120d394f01 Simpler #634, always use the first choice when out of bounds 2018-03-24 07:06:39 +01:00
vsonnier 4cd8735014 Fix #634 plus #534: bound checking in SDRDevices dialog selection 2018-03-21 06:35:59 +01:00
Charles J. Cliffe cdaae140fd
Merge pull request #637 from cjcliffe/master
Updates from master
2018-03-20 16:55:05 -04:00
vsonnier 225a795f31 Fixes for #635, round 1: BookmarkView 2018-03-20 20:00:59 +01:00
Vincent Sonnier 876b477ae8
Merge pull request #633 from cjcliffe/vso_wxwidgets_v311_integration 2018-03-17 09:02:36 +01:00
vsonnier e46d7f9735 Migration to wxWidgets v3.11:
- Seen on Windows: Bookmarkview slow update because the controls are self-reacting to the rebuild control events, so fix nullify them during control rebuilding.
- Update OpenGL initialization using v3.1 level context and canvas attributes instead of the deprecated calls.
2018-03-11 11:47:14 +01:00
vsonnier 8e52f232cf Visual scale is called Visual Gain in manual, so use the same naming in tooltips 2018-03-11 10:37:21 +01:00
vsonnier 10a4e391d7 Fix #630 improvement on Zoom(s) functions:
- Right-drag now does the same thing on both Spectrum and Waterfall, i.e change and hold vertical scale,
- So Right-drag on Waterfall no longer zoom bandwidth, there are already much more practical ways to do it (up/down, wheel)
- Right-click to reset vertical scale stays only enabled on Spectrum.
- Adapted mouse cursors to reflect the possible moves on Spectrum and Waterfall.
- Updated both Waterfall and Spectrum tooltips to match those features.
2018-03-11 10:04:57 +01:00
Charles J. Cliffe b193456ccb Merge branch 'master' into firpbch2_mode 2018-02-20 00:17:37 -05:00
Charles J. Cliffe 8cb5e9e244 SDRPostThread clean-up and re-factoring 2018-02-20 00:16:54 -05:00
vsonnier 7f732735ce Fix #616 wrong WAV size reported in header (thanks @nsmith-) 2018-02-18 19:49:47 +01:00
vsonnier c1e60f31f5 Fix #615 Be smarter when looking for font resources 2018-02-15 19:02:56 +01:00
Charles J. Cliffe afc29303c9 2x channel bandwidth firpfbch2_crcf optional path 2018-02-14 21:24:22 -05:00
vsonnier 490f72ceeb Fix #614: Wrong Freq offset applied if set from SDR Devices 2018-02-07 13:13:52 +01:00
vsonnier 70371890a2 Updated Windows liquid-dsp v1.31 binaries using newest MSYS2 gcc 7.3.0 2018-01-27 08:06:00 +01:00
vsonnier f2de1dd987 Fix #601 ?: Removed deadlock that prevent Audio controller threads to die. 2018-01-22 20:11:13 +01:00
vsonnier b55609c802 AudioThread: rollback some guard code because of previously wrong understanding 2018-01-22 07:26:13 +01:00
vsonnier 033bbd07df AudioThread: re-apply consistent formating 2018-01-22 07:10:45 +01:00
vsonnier fc1c1c3b4d AudioThread: rollback deviceCleanup() to only doing terminate + TEST: apply to all platforms 2018-01-22 07:04:45 +01:00
vsonnier 36224defd7 AudioThread: Rework mutex usage (again) + added proper cleanups (hopefully) 2018-01-21 18:08:46 +01:00
vsonnier d8ac9559fe BoolmarkMgr: rationalize a bit the usage of recursive_mutexes 2018-01-16 20:43:00 +01:00
Charles J. Cliffe 7fb66b6998
Merge pull request #594 from cjcliffe/audio_recording
Audio recording
2018-01-14 19:57:48 -05:00
Charles J. Cliffe 7588e77d94 Donation list update 2018-01-14 19:41:41 -05:00
Charles J. Cliffe 7baaca1216 OSX crash-on-exit fix, File menu tidying, Confirm bookmark reset 2018-01-14 18:56:30 -05:00
vsonnier 4c6d7ab4d7 Fix wrong multi-part WAV sequence management with time-limit files 2018-01-14 15:30:40 +01:00
vsonnier 3334538e64 Fix boolean usage instead of bool (we are not Java, are we ?) 2018-01-13 12:17:02 +01:00
vsonnier 4e6197c579 Fix minor cut-n-paste error in AudioSinkFileThread 2018-01-13 12:13:41 +01:00
vsonnier 26deefd606 Added #583: add periodic file generation, plus other options:
- Added a Recording menu,
git commit -m Added
2018-01-13 11:50:31 +01:00
vsonnier 4d0f3a794d Merge remote-tracking branch 'origin/master' into audio_recording 2018-01-12 19:31:33 +01:00
vsonnier 7b904bf803 Add a Reset Bookmarks menu (empty the bookmarks), similar to Reset Session 2018-01-12 19:26:22 +01:00
vsonnier 64e44d6172 Merge remote-tracking branch 'origin/master' into audio_recording 2018-01-10 19:00:04 +01:00
vsonnier 0f72a0f683 Fix #593 : Make the middle of the range always the central frequency 2018-01-09 20:22:56 +01:00
vsonnier 978cf492f8 Merge remote-tracking branch 'origin/master' into audio_recording 2018-01-09 07:07:11 +01:00
Vincent Sonnier 505ed18066
Merge pull request #596 from cjcliffe/vso_saving_bookmarks
Well, I think it works really well now, lets merge to master.
2018-01-09 07:01:40 +01:00
vsonnier f1208c7f5c When saving bookmarks, use active information when available
+ Fixed std::string <=> std::wstring conversions using wxString
+ cleanups.
2018-01-08 19:26:34 +01:00
vsonnier fc0f20f07d Removed recording duration limitation:
- Limit WAV size to 2GB for maximum compatibility,
- Continue recording on another file when size gets too big (XXX_001.wav, then XXX_002.wav and so on)
- The sequence assure up to 2000GB worth of recording which should be enough
- Changed file pattern to international Year.Month.Day so its recognizable whether you are English of French or whatever :)
2018-01-07 08:59:39 +01:00
vsonnier 8f45451df2 Choose a valid audio output if the modem-saved one is not recognized. 2018-01-06 16:15:40 +01:00
vsonnier 8daadc3603 Missing trace in AudioSink queue saturation 2018-01-06 15:10:25 +01:00
vsonnier 1dbfcedcd2 Fix to record below-squelch levels as audio silence 2018-01-06 14:19:32 +01:00
vsonnier d4251b41fb Feature #486 : Save/Load bookmarks into files 2018-01-06 10:22:14 +01:00
Charles J. Cliffe be75c62778 Menu and demod display tweaks 2018-01-02 23:51:32 -05:00
Charles J. Cliffe 8609667f33 About Dialog code update, passive vcredist install 2018-01-02 00:13:09 -05:00
Charles J. Cliffe f625cb6eea Donation list update 2018-01-01 22:12:04 -05:00
Charles J. Cliffe c3257536cf Version bump 2017-12-31 21:14:47 -05:00
Charles J. Cliffe e6cd2ae774 AppImage fix - put_time req. GCC 5+ 2017-12-31 20:59:06 -05:00
Charles J. Cliffe 9b1f7b828c Merge branch 'master' into audio_recording 2017-12-31 14:54:41 -05:00
Charles J. Cliffe 5c45c1cf6b Record muted, toggle-all recording /w shift-R, status texts 2017-12-29 22:46:39 -05:00
Charles J. Cliffe b9e4f6aeba Recording path notify, bookmark panel record buttons, tweaks and adjustments 2017-12-04 22:44:47 -05:00
vsonnier ada56440fc Fix reloading of gains at startup. 2017-11-25 09:47:43 +01:00
vsonnier 4b077af873 Fix for gain sliders not perfectly following integer gain steps from the menu (i.e RSPx RF gains) 2017-11-20 18:53:38 +01:00
vsonnier e44af72b00 Assure Gain control <==> Settings menu synchronization in case of mutually depdendent updates 2017-11-19 17:06:11 +01:00
Charles J. Cliffe 326a993a29 Sequence recording on format change; user label as filename when available 2017-11-16 23:53:30 -05:00
Charles J. Cliffe 8f31fd9f5b Recording is now writing playable .WAV files 2017-11-02 00:01:22 -04:00
Charles J. Cliffe 6af64752be Merge branch 'master' into audio_recording 2017-11-01 22:34:28 -04:00
Vincent Sonnier 6dc9b86855
Merge pull request #585 from cjcliffe/vso_squash_warnings
Halloween compiler Warnings cleanup
2017-10-31 11:29:17 +01:00
vsonnier d55d7e9b75 Halloween Warning cleanup:
- wxFont SetFont() deprecated warnings, suppressed by re-generating forms with latest wxFormBuilder,
- double-to-float implicit conversion in CubicVR2
2017-10-31 11:08:15 +01:00
vsonnier d8ff4ea1de Squash some warnings with std::shared_ptr init seen on Ubuntu 16.04 2017-10-29 15:06:24 +01:00
vsonnier 89d12ef4e3 #513 Workaround in case the number of samples rates is too much to be handled by the menu, decimate to 25 max. 2017-10-28 13:12:27 +02:00
vsonnier 230a87d8df AudioThread: Revised mutex usage for devices vs. AudioThread* due to erroneous implem., creating crashes in some cases
(damn those things are hard...)
2017-10-28 11:57:01 +02:00
vsonnier 950a4622b7 Updated Windows liquid-dsp binaries to v1.31 (gcc 7.2.0) 2017-10-26 07:04:36 +02:00
vsonnier 3cc49bdb15 Fixes #581 ?: Do not set std::shared_ptr to nullptr in constructors (useless anyway) since they could be wrongly interpreted 2017-10-16 18:50:55 +02:00
vsonnier 6019207bd4 VisualProcessor : protect against null input queue 2017-10-15 08:51:01 +02:00
vsonnier f4107c1541 Optimized VisualProcessor by using a non-recursive mutex and making some ops non-blocking, small AudioThread opt as well 2017-10-14 11:34:25 +02:00
Charles J. Cliffe 1c415afa92 Merge branch 'master' into audio_recording 2017-10-12 00:15:00 -04:00
Charles J. Cliffe 38fab6ac51 Add 'R' toggle key + fixes from initial testing 2017-10-12 00:08:22 -04:00
Charles J. Cliffe f8e51df8cd Demod instance start/stop recording setup 2017-10-09 20:07:40 -04:00
vsonnier 2c1be22c51 Well, looks like WASAPI audio create crashes on Windows, so revert to good old DirectSound for audio 2017-09-27 21:45:08 +02:00
Charles J. Cliffe c202d99a2a initial audio sink file and thread handling rough-in 2017-09-26 23:25:55 -04:00
Charles J. Cliffe 21dd062da0 Merge branch 'master' into audio_recording 2017-09-24 23:56:37 -04:00
Charles J. Cliffe a398bc57f1 Initial AudioSink thread base and recoring preference 2017-09-24 23:50:08 -04:00
vsonnier 1a73f627a2 Frequency entry dialog font is slightly too big to fit, use the same as Label dialog instead 2017-09-24 12:46:33 +02:00
vsonnier 927d727a16 Try not to use atomics in performance code 2017-09-22 22:53:59 +02:00
vsonnier aec0100f78 ThreadBlockingQueue : remove useless/dangerous operations, forbid both copy and assignment. 2017-09-10 19:35:12 +02:00
vsonnier afedca05c6 Updated liquid-dsp v1.30 Windows binaries to GCC 7.2.0 (MSYS2) 2017-09-02 21:49:20 +02:00
vsonnier 030628c5ed SDRPostThread is better using try_push, restore previous audio-related code in DemodulatorInstance 2017-09-02 16:24:25 +02:00
vsonnier 87077a89c1 Fix #574: cannot enter frequency offsets > 2GHz 2017-09-01 18:39:35 +02:00
vsonnier 252b6bf9f8 AudioThread polishing 2017-09-01 06:18:35 +02:00
vsonnier 5460863608 Upgraded RtAudio to v5.0.0, WASAPI is now the default audio backend on Windows 2017-08-31 21:30:32 +02:00
vsonnier 3a5b30dda8 Fix AudioThread nullptr check 2017-08-31 21:29:53 +02:00
vsonnier 9bbcb582e3 Fix hang when the active demodulator goes out-of-bandwwidth by changing sample rate 2017-08-31 20:51:37 +02:00
vsonnier 3842cf087f More terminate()-and-flush calls missed before 2017-08-29 18:48:59 +02:00
vsonnier dc9c67bec1 Fix a DemodulatorInstance dangling reference 2017-08-29 06:40:07 +02:00
vsonnier 03bf38fea8 Squashing an actual memory leak in SDRPostThread by simplifying the code 2017-08-28 21:22:07 +02:00
vsonnier 3f90cbb858 Flush queues on terminate() calls to unblock push()s and so ease threads termination 2017-08-28 20:53:21 +02:00
Vincent Sonnier 2d01a279e9 Merge pull request #572 from cjcliffe/vso_shared_ptr_DemodulatorInstances
Let's see if I've broken something :)
2017-08-27 14:47:10 +02:00
vsonnier b52c4ac8a6 This lock is actually needed, restore it. 2017-08-27 13:35:11 +02:00
vsonnier 3c3939e0b7 Use nullptr instead of NULL when shared_ptr is used 2017-08-27 13:00:32 +02:00
vsonnier 37712c7a81 Simplify SDRPostThread: no longer binding methods, directly use the true list of demodulators 2017-08-27 12:39:28 +02:00
vsonnier a8f8f4a7e2 Initial commit: working... 2017-08-27 11:11:30 +02:00
vsonnier c112026a2c Make processing queues timed-push, to be able to escape deadlocks. Rollback 'restart device when blocked' that is ineffective in practice. 2017-08-26 23:34:48 +02:00
vsonnier ebca762ea8 Fix crash introduced with #559, fix hanging thread at application termination 2017-08-25 18:52:33 +02:00
vsonnier a018a36100 Add a read-only TX antenna menu entry showing the active one, closing #559 2017-08-25 07:28:14 +02:00
Vincent Sonnier 8993121fc6 Merge pull request #571 from cjcliffe/vso_SoapySDR_antenna_support
Add  Antenna support (RX only), plus improved Settings menu.
2017-08-25 06:23:22 +02:00
vsonnier 2c20f728d5 Settings UI even better, fix device config not right w.r.t real antenna presence 2017-08-24 21:26:28 +02:00
vsonnier f5f4a80f23 Rollback addition of AGC,PPM in the SDRdevices menu, because not all devices support it. Keep Antenna selection, though 2017-08-23 23:49:52 +02:00
vsonnier 1042c62c3b Initial commit: Antenna support, Enhanced Settings menu, Enhanced SDR device dialog 2017-08-23 23:27:49 +02:00
vsonnier e32e687fe8 Make IOThreads terminate() fully non-blocking and misc.
- Thanks to timed-pop() usage, it is no longer needed to nudge queues with dummy to wake them
- Less bad luck to be stuck there
- Misc: leave the trace about the audio thread staturation, useful despite it raises some alarm among users...
2017-08-14 09:46:53 +02:00
vsonnier acc6d2a31d Restart the device automatically if stuck with read stream errors 2017-08-13 22:14:12 +02:00
vsonnier c64baab99d Threads vs. Queues lifetimes, cleanups.
- Ideally Queues must outlive the threads using them, but wasn't done so. Yes, std::shared_ptr them!
- Now queues are always valid in the context of the threads using them.
- No longer need tedious queues deallocation by the original owner.
- Misc cleanups.
2017-08-13 19:19:25 +02:00
vsonnier 98c7c30aee Yet another Thread termination problem found, and try killing the app if the closing turns bad 2017-08-13 12:11:14 +02:00
vsonnier 33107bfa9e Fix #565, Solo mode is now saved into session files 2017-08-12 18:09:36 +02:00
vsonnier ae74023864 Updated Windows liquid-dsp v1.30 binaries, compiled with latest MSYS2 GCC 7.1.0
- Apparently the 32bit build no longer need any dependency, so remove libgcc_s_dw2-1.dll
- Updated libwinpthread-1.dll from MSYS2 too.
2017-08-12 14:29:49 +02:00
vsonnier e67a29f5b6 Don't get stuck when closing application just because some Demodulators refuse to die 2017-08-12 11:30:32 +02:00
vsonnier 33aa0cade6 Fix bad re-loading, setting and UI glitches for Device Runtime settings, and misc.
- Quite obvious on the SDRPlay RSP2 for ex.
- Random cleanups by using the for-each construct at some places for clarity.
2017-08-12 08:17:40 +02:00
Sebastien F4GRX aa29aa41c6 Avoid build failure when liquid-dsp is not in a default libdir 2017-08-03 15:38:01 +02:00
Vincent Sonnier 695d00d966 Merge pull request #555 from lospheris/master
Change boolean to bool
2017-06-02 06:21:15 +02:00
Dell-Ray Sackett ab6cb059b9 boolean not a valid keyword
changed boolean to bool in garbageCollect
2017-06-01 21:12:06 -07:00
Dell-Ray Sackett b315bac97f Change boolean to bool
void DemodulatorMgr::garbageCollect(boolean forcedGC)
should be 
void DemodulatorMgr::garbageCollect(bool forcedGC)
2017-06-01 21:05:49 -07:00
vsonnier 3604b7f1ff Even better thread and application termination:
- Now that timed-pop()/try_pop() prevent indefinite blocking it is best to flush() on thread stopping to unblock push()
- Reworked a bit the CubicSDR::OnExit() sequence, see comments.
2017-06-01 19:57:58 +02:00
vsonnier 8f608bbf5c Cleanup: remove some unused params and variables, conversion warnings seen with #550. 2017-05-29 20:22:10 +02:00
vsonnier be3c0c9778 Pedantic change for mat4::to_ptr() 2017-05-28 17:33:44 +02:00
Vincent Sonnier 83b3bb1cb2 Merge pull request #551 from cjcliffe/vso_CubicVR2_cleaner_array_access
CubicVR2  removal of convert to pointer operators (fixes #550)
2017-05-28 17:15:38 +02:00
vsonnier dd2fa12d57 There is no need for operator bool conversion:
- it was there for != NULL checks when convert-to-pointer existed, which is no longer the case.
2017-05-28 15:20:43 +02:00
vsonnier 3095f8205a CubicVR2: more restricted operators on structures by removing convert-to-pointer. (Fix #550 ?) 2017-05-28 12:59:08 +02:00
vsonnier 56b56685e0 Yet Another Semicolon After Endif left... (#549) 2017-05-27 15:28:42 +02:00
vsonnier 3de3d3eee8 Tentative fix #549 prt 3 2017-05-27 12:36:47 +02:00
vsonnier b3dd0b0d6e Tentative fix #548 part 2 2017-05-27 09:49:19 +02:00
vsonnier d170f731c5 Fix #549, plus more usual syntax for #548 2017-05-27 07:46:28 +02:00
vsonnier fcf9f0bb82 Potential fix for #548, to be tested in Nix-like environnements 2017-05-26 23:22:43 +02:00
vsonnier a0526f757e ReBuffer somewhat cleaner, safer code 2017-05-26 10:29:47 +02:00
vsonnier 44cdfa8521 Make ReBuffer also GC its own memory + cleanups:
- Use deque in ReBuffer instead of vector (as before) because it allows freeing its memory
- Random cleanup: remove mutable when not needed.
2017-05-25 16:39:01 +02:00
Vincent Sonnier 3192ee0e71 Merge pull request #547 from cjcliffe/vso_ReBuffer_with_shared_ptr
Rebuffer automatic refcount management
2017-05-25 12:32:11 +02:00
vsonnier 9b0ce69e8f Use the nuclear option to solve the hung problem:
Besides deadlocks, a thread can in theory get stuck in a blocking pop(),
not seeing the stopping flag in particular. So assure liveness by making all
pop() timed pop.
2017-05-25 09:32:27 +02:00
vsonnier 77a82e1617 Another fix for the neverending hung application bugs:
- Clear up DemodulatorInstance garbage collection, only do it in a single thread (AppFrame::OnIdle)
- Add a specific mutex lock for the list of deleted demodulators,
- Add a specific lock to control DemodulatorInstance thread lifetimes, protecting IsTerminated() of concurrent join and delete
2017-05-25 08:03:08 +02:00
vsonnier 4b323e9863 Make ReBuffer refcount management automatic, using std::shared_ptr:
- No longer need to call setRefCount() / decRefCount()
- Restore old ThreadBlockingQueue using std::deque, for std::shared_ptr correct behaviour.
2017-05-24 12:28:37 +02:00
vsonnier 8776908340 Fixes #546, when MTU > nb samples per-frame, overflow management was wrong. 2017-05-23 11:09:29 +02:00
vsonnier 5797548739 SoapySDRThread tweak: directly resize to the final size when building SDRThreadIQData 2017-05-23 11:09:28 +02:00
vsonnier af20f680a4 Clearer ThreadBlockingQueue impl by using a field to hold size... 2017-05-21 21:04:12 +02:00
Vincent Sonnier 313d66e1d6 Merge pull request #545 from cjcliffe/vso_circular_buffer_for_queue
TheadBlockingQueue implemented with circular buffer (zero runtime mem allocs)
==> Well, looks like it works.
2017-05-21 10:31:22 +02:00
vsonnier 41c7dd231b Fix tabs introduced in latest commits... 2017-05-21 10:03:21 +02:00
vsonnier e0af609224 Use a circular buffer for ThreadBlockingQueue (allocation-free) 2017-05-21 09:39:29 +02:00
vsonnier fc2716518d SoapySDRThread: more comments about the relation between MTU and sample rate 2017-05-21 09:20:41 +02:00
vsonnier c1fef72103 Use more a reliable time source in Windows for the Timer class 2017-05-20 13:31:55 +02:00
vsonnier a541e55ff6 SaopySDRThread simplified, (small) perf improvement: No longer use inpBuffer,
write to SDRThreadIQData->data directly.
2017-05-20 13:31:46 +02:00
273 changed files with 44133 additions and 32854 deletions

34
.circleci/config.yml Normal file
View File

@ -0,0 +1,34 @@
version: 2.1
jobs:
build:
docker:
- image: cimg/base:current-22.04
resource_class: medium
environment:
- CACHE_DIR: ~/build/wxWidgets/staticlib
steps:
- checkout
- restore_cache:
keys:
- cache-{{ checksum ".circleci/scripts/build_wxwidgets.sh" }}
- run:
name: Install Dependencies
command: |
sudo apt-get update
sudo apt-get install -y build-essential cmake libpulse-dev libgtk-3-dev freeglut3 freeglut3-dev libhamlib-dev
- run:
name: Build wxWidgets
command: bash .circleci/scripts/build_wxwidgets.sh
- run:
name: Build LiquidDSP
command: bash .circleci/scripts/build_liquiddsp.sh
- run:
name: Build SoapySDR
command: bash .circleci/scripts/build_soapysdr.sh
- run:
name: Build CubicSDR
command: bash .circleci/scripts/build_cubicsdr.sh
- save_cache:
key: cache-{{ checksum ".circleci/scripts/build_wxwidgets.sh" }}
paths:
- ~/build/wxWidgets/staticlib

View File

@ -0,0 +1,5 @@
# CubicSDR
mkdir -p $HOME/build/cjcliffe/CubicSDR-build
cd $HOME/build/cjcliffe/CubicSDR-build
cmake ~/project -DCMAKE_BUILD_TYPE=Release -DwxWidgets_CONFIG_EXECUTABLE=$HOME/build/wxWidgets/staticlib/bin/wx-config -DUSE_HAMLIB=1 -DENABLE_DIGITAL_LAB=1
make -j2

View File

@ -0,0 +1,14 @@
# Liquid-DSP
mkdir -p $HOME/build/jgaeddert
cd $HOME/build/jgaeddert
git clone https://github.com/jgaeddert/liquid-dsp.git
cd $HOME/build/jgaeddert/liquid-dsp
./bootstrap.sh
echo "Configuring liquid-dsp.."
./configure > /dev/null
echo "Building liquid-dsp.."
make -j2 > /dev/null
sudo make install

View File

@ -0,0 +1,13 @@
# Soapy SDR
mkdir -p $HOME/build/pothosware/SoapySDR-build
cd $HOME/build/pothosware
git clone https://github.com/pothosware/SoapySDR.git
cd $HOME/build/pothosware/SoapySDR-build
cmake $HOME/build/pothosware/SoapySDR -DCMAKE_BUILD_TYPE=Release
echo "Building SoapySDR.."
make -j2 > /dev/null
sudo make install

View File

@ -0,0 +1,29 @@
# wxWidgets
if [ -f "$HOME/build/wxWidgets/staticlib/bin/wx-config" ]; then
echo "wxWidgets cache found; skipping.."
exit 0
else
echo "wxWidgets cache not found; building.."
fi
echo "Fetch wxWidgets.."
mkdir -p $HOME/build/wxWidgets/staticlib
cd $HOME/build/wxWidgets
wget https://github.com/wxWidgets/wxWidgets/releases/download/v3.2.1/wxWidgets-3.2.1.tar.bz2 > /dev/null
echo "Unpacking wxWidgets.."
tar -xvjf wxWidgets-3.2.1.tar.bz2 > /dev/null
cd wxWidgets-3.2.1/
./autogen.sh
if [ "$(uname)" == "Linux" ]; then
./configure --with-opengl --disable-glcanvasegl --disable-shared --enable-monolithic --with-libjpeg --with-libtiff --with-libpng --with-zlib --disable-sdltest --enable-unicode --enable-display --enable-propgrid --disable-webview --disable-webviewwebkit --prefix=`echo $HOME/build/wxWidgets/staticlib` CXXFLAGS="-std=c++0x"
elif [ "$(uname)" == "Darwin" ]; then
./configure --with-opengl --disable-glcanvasegl --disable-shared --enable-monolithic --with-libjpeg --with-libtiff --with-libpng --with-zlib --with-mac --disable-sdltest --enable-unicode --enable-display --enable-propgrid --disable-webkit --disable-webview --disable-webviewwebkit --prefix=`echo $HOME/build/wxWidgets/staticlib` CXXFLAGS="-std=c++0x" --with-libiconv=/usr
fi
echo "Building wxWidgets.."
make V=1 -j2
make install

View File

@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 2.8)
cmake_minimum_required (VERSION 2.8.12)
project (CubicSDR)
@ -6,7 +6,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/")
SET(CUBICSDR_VERSION_MAJOR "0")
SET(CUBICSDR_VERSION_MINOR "2")
SET(CUBICSDR_VERSION_PATCH "2")
SET(CUBICSDR_VERSION_PATCH "8")
SET(CUBICSDR_VERSION_SUFFIX "")
SET(CUBICSDR_VERSION "${CUBICSDR_VERSION_MAJOR}.${CUBICSDR_VERSION_MINOR}.${CUBICSDR_VERSION_PATCH}${CUBICSDR_VERSION_SUFFIX}")
@ -14,6 +14,7 @@ SET(CPACK_PACKAGE_VERSION "${CUBICSDR_VERSION_MAJOR}.${CUBICSDR_VERSION_MINOR}.$
SET(CPACK_PACKAGE_VERSION_MAJOR ${CUBICSDR_VERSION_MAJOR})
SET(CPACK_PACKAGE_VERSION_MINOR ${CUBICSDR_VERSION_MINOR})
SET(CPACK_PACKAGE_VERSION_PATCH ${CUBICSDR_VERSION_PATCH})
set(CPACK_PACKAGE_VENDOR "cubicproductions")
SET (CUSTOM_BUILD OFF CACHE BOOL "Enable custom build options")
# Build options for custom deploys, optimization and debugging
@ -159,7 +160,7 @@ IF (MSVC)
SET(LIQUID_INCLUDES "${PROJECT_SOURCE_DIR}/external/liquid-dsp/include/" CACHE STRING "Liquid-DSP include directory")
SET(LIQUID_LIBRARIES "${PROJECT_SOURCE_DIR}/external/liquid-dsp/msvc/${EX_PLATFORM}/libliquid.lib" CACHE STRING "Liquid-DSP Library")
SET(LIQUID_DLL "${PROJECT_SOURCE_DIR}/external/liquid-dsp/msvc/${EX_PLATFORM}/libliquid.dll" CACHE STRING "Liquid-DSP DLL")
SET(HAMLIB_DLLS "${PROJECT_SOURCE_DIR}/external/hamlib/${EX_PLATFORM}/libhamlib-2.dll" CACHE STRING "HAMLIB DLLS")
SET(HAMLIB_DLLS "${PROJECT_SOURCE_DIR}/external/hamlib/${EX_PLATFORM}/libhamlib-4.dll" CACHE STRING "HAMLIB DLLS")
ELSE (MSVC)
ADD_DEFINITIONS(
-std=c++0x
@ -302,6 +303,9 @@ IF (APPLE)
SET(CMAKE_OSX_DEPLOYMENT_TARGET, "10.9")
SET(LIQUID_LIB liquid)
IF(CMAKE_INSTALL_PREFIX)
link_directories(${CMAKE_INSTALL_PREFIX}/lib)
ENDIF(CMAKE_INSTALL_PREFIX)
link_directories(/usr/local/lib)
link_directories(/opt/local/lib)
@ -326,6 +330,7 @@ SET (cubicsdr_sources
src/IOThread.cpp
src/ModemProperties.cpp
src/BookmarkMgr.cpp
src/SessionMgr.cpp
src/sdr/SDRDeviceInfo.cpp
src/sdr/SDRPostThread.cpp
src/sdr/SDREnumerator.cpp
@ -339,6 +344,7 @@ SET (cubicsdr_sources
src/modules/modem/ModemAnalog.cpp
src/modules/modem/ModemDigital.cpp
src/modules/modem/analog/ModemAM.cpp
src/modules/modem/analog/ModemCW.cpp
src/modules/modem/analog/ModemDSB.cpp
src/modules/modem/analog/ModemFM.cpp
src/modules/modem/analog/ModemNBFM.cpp
@ -347,6 +353,10 @@ SET (cubicsdr_sources
src/modules/modem/analog/ModemLSB.cpp
src/modules/modem/analog/ModemUSB.cpp
src/audio/AudioThread.cpp
src/audio/AudioSinkThread.cpp
src/audio/AudioSinkFileThread.cpp
src/audio/AudioFile.cpp
src/audio/AudioFileWAV.cpp
src/util/Gradient.cpp
src/util/Timer.cpp
src/util/MouseTracker.cpp
@ -429,6 +439,7 @@ SET (cubicsdr_headers
src/IOThread.h
src/ModemProperties.h
src/BookmarkMgr.h
src/SessionMgr.h
src/sdr/SDRDeviceInfo.h
src/sdr/SDRPostThread.h
src/sdr/SDREnumerator.h
@ -443,6 +454,7 @@ SET (cubicsdr_headers
src/modules/modem/ModemAnalog.h
src/modules/modem/ModemDigital.h
src/modules/modem/analog/ModemAM.h
src/modules/modem/analog/ModemCW.h
src/modules/modem/analog/ModemDSB.h
src/modules/modem/analog/ModemFM.h
src/modules/modem/analog/ModemNBFM.h
@ -451,6 +463,10 @@ SET (cubicsdr_headers
src/modules/modem/analog/ModemLSB.h
src/modules/modem/analog/ModemUSB.h
src/audio/AudioThread.h
src/audio/AudioSinkThread.h
src/audio/AudioSinkFileThread.h
src/audio/AudioFile.h
src/audio/AudioFileWAV.h
src/util/Gradient.h
src/util/Timer.h
src/util/ThreadBlockingQueue.h
@ -458,6 +474,7 @@ SET (cubicsdr_headers
src/util/GLExt.h
src/util/GLFont.h
src/util/DataTree.h
src/util/SpinMutex.h
src/panel/ScopePanel.h
src/panel/SpectrumPanel.h
src/panel/WaterfallPanel.h
@ -667,23 +684,27 @@ IF (NOT BUNDLE_APP)
configure_files(${PROJECT_SOURCE_DIR}/icon ${CMAKE_BINARY_DIR}/${EX_PLATFORM_NAME} CubicSDR.ico)
IF(MSVC)
configure_files(${PROJECT_SOURCE_DIR}/external/liquid-dsp/msvc/${EX_PLATFORM}/ ${CMAKE_BINARY_DIR}/${EX_PLATFORM_NAME} "*.dll")
configure_files(${PROJECT_SOURCE_DIR}/external/msvc/${EX_PLATFORM_NAME}/ ${CMAKE_BINARY_DIR}/${EX_PLATFORM_NAME} "*.dll")
IF(USE_HAMLIB)
configure_files(${PROJECT_SOURCE_DIR}/external/hamlib/${EX_PLATFORM}/ ${CMAKE_BINARY_DIR}/${EX_PLATFORM_NAME} "*.dll")
ENDIF(USE_HAMLIB)
ENDIF()
IF (CUBICSDR_HAS_HEADER_IMAGE)
configure_files(${CUBICSDR_HEADER_IMAGE_DIR} ${CMAKE_BINARY_DIR}/${EX_PLATFORM_NAME} ${CUBICSDR_HEADER_IMAGE_FILE})
ENDIF()
add_executable(CubicSDR ${cubicsdr_sources} ${cubicsdr_headers} ${RES_FILES})
target_link_libraries(CubicSDR ${LIQUID_LIB} ${wxWidgets_LIBRARIES} ${OPENGL_LIBRARIES} ${OTHER_LIBRARIES})
target_link_libraries(CubicSDR ${wxWidgets_LIBRARIES} ${OPENGL_LIBRARIES} ${OTHER_LIBRARIES})
ENDIF (NOT BUNDLE_APP)
IF (MSVC)
set_target_properties(CubicSDR PROPERTIES LINK_FLAGS_DEBUG "/SUBSYSTEM:WINDOWS")
set_target_properties(CubicSDR PROPERTIES COMPILE_DEFINITIONS_DEBUG "_WINDOWS")
set_target_properties(CubicSDR PROPERTIES COMPILE_DEFINITIONS_DEBUG "_WINDOWS;WIN32_LEAN_AND_MEAN")
set_target_properties(CubicSDR PROPERTIES LINK_FLAGS_RELWITHDEBINFO "/SUBSYSTEM:WINDOWS")
set_target_properties(CubicSDR PROPERTIES COMPILE_DEFINITIONS_RELWITHDEBINFO "_WINDOWS")
set_target_properties(CubicSDR PROPERTIES COMPILE_DEFINITIONS_RELWITHDEBINFO "_WINDOWS;WIN32_LEAN_AND_MEAN")
set_target_properties(CubicSDR PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS")
set_target_properties(CubicSDR PROPERTIES COMPILE_DEFINITIONS_RELEASE "_WINDOWS")
set_target_properties(CubicSDR PROPERTIES COMPILE_DEFINITIONS_RELEASE "_WINDOWS;WIN32_LEAN_AND_MEAN")
set_target_properties(CubicSDR PROPERTIES LINK_FLAGS_MINSIZEREL "/SUBSYSTEM:WINDOWS")
set_target_properties(CubicSDR PROPERTIES COMPILE_DEFINITIONS_MINSIZEREL "_WINDOWS")
set_target_properties(CubicSDR PROPERTIES COMPILE_DEFINITIONS_MINSIZEREL "_WINDOWS;WIN32_LEAN_AND_MEAN")
set(CMAKE_CREATE_WIN32_EXE "/SUBSYSTEM:WINDOWS /ENTRY:\"mainCRTStartup\"")
set_target_properties (CubicSDR PROPERTIES OUTPUT_NAME "${CUBICSDR_INSTALL_NAME}")
@ -766,8 +787,8 @@ IF (APPLE AND BUNDLE_APP)
# SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
IF (BUNDLE_SOAPY_MODS)
message(STATUS "SOAPY_ROOT: ${SOAPY_SDR_ROOT}")
SET(SOAPY_SDR_MOD_PATH "${SOAPY_SDR_ROOT}/lib/SoapySDR/modules${SOAPY_SDR_ABI_VERSION}")
message(STATUS "SOAPY_ROOT: ${CMAKE_INSTALL_PREFIX}")
SET(SOAPY_SDR_MOD_PATH "${CMAKE_INSTALL_PREFIX}/lib/SoapySDR/modules${SOAPY_SDR_ABI_VERSION}")
message(STATUS "SOAPY_SDR_MOD_PATH: ${SOAPY_SDR_MOD_PATH}")
file(GLOB SOAPY_MODS ${SOAPY_SDR_MOD_PATH}/*.so)
@ -895,7 +916,7 @@ IF (WIN32 AND NOT BUILD_INSTALLER)
IF(USE_HAMLIB)
FOREACH(HAMLIB_DLL ${HAMLIB_DLLS})
message(STATUS "Copying Hamlib DLL: ${HAMLIB_DLL}")
INSTALL( FILES "${HAMLIB_DLL}"
INSTALL( FILES ${HAMLIB_DLL}
DESTINATION bin
)
ENDFOREACH()
@ -939,7 +960,8 @@ IF (WIN32 AND BUILD_INSTALLER)
SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CUBICSDR_INSTALL_NAME} ${CPACK_PACKAGE_VERSION} (x86)")
set(CMAKE_CL_64 FALSE)
ENDIF(EX_PLATFORM EQUAL 64)
SET(BUNDLE_MSVC_REDIST "" CACHE STRING "Visual C++ Redistributable")
set(CPACK_NSIS_EXECUTABLES_DIRECTORY ".")
install(TARGETS CubicSDR RUNTIME DESTINATION .)
@ -986,16 +1008,21 @@ IF (WIN32 AND BUILD_INSTALLER)
install(FILES ${SOAPY_MODS} DESTINATION modules)
ENDIF(BUNDLE_SOAPY_MODS)
IF(MSVC AND EX_PLATFORM EQUAL 32)
file(GLOB MSVC32_DEPS ${PROJECT_SOURCE_DIR}/external/msvc/${EX_PLATFORM_NAME}/*.dll)
install(FILES ${MSVC32_DEPS} DESTINATION .)
ENDIF(MSVC AND EX_PLATFORM EQUAL 32)
IF(MSVC)
file(GLOB MSVC_DEPS ${PROJECT_SOURCE_DIR}/external/msvc/${EX_PLATFORM_NAME}/*.dll)
install(FILES ${MSVC_DEPS} DESTINATION .)
ENDIF(MSVC)
set(CPACK_PACKAGE_EXECUTABLES CubicSDR "CubicSDR")
IF (MSVC)
install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/external/msvc/${EX_PLATFORM_NAME}/vc_redist.${EX_PLATFORM_NAME}.exe DESTINATION vc_redist)
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "ExecWait '\\\"$INSTDIR\\\\vc_redist\\\\vc_redist.${EX_PLATFORM_NAME}.exe\\\" /q:a'")
IF (BUNDLE_MSVC_REDIST)
message(STATUS "BUNDLE_MSVC_REDIST: ${BUNDLE_MSVC_REDIST}")
cmake_path(GET BUNDLE_MSVC_REDIST FILENAME BUNDLE_MSVC_REDIST_FN)
message(STATUS "BUNDLE_MSVC_REDIST_FN: ${BUNDLE_MSVC_REDIST_FN}")
install(PROGRAMS ${BUNDLE_MSVC_REDIST} DESTINATION vc_redist)
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "ExecWait '\\\"$INSTDIR\\\\vc_redist\\\\${BUNDLE_MSVC_REDIST_FN}\\\" /passive /norestart'")
ENDIF()
ENDIF (MSVC)

View File

@ -1,11 +1,12 @@
CubicSDR
CubicSDR [![CircleCI](https://dl.circleci.com/status-badge/img/gh/cjcliffe/CubicSDR/tree/master.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/cjcliffe/CubicSDR/tree/master)
========
Cross-Platform Software-Defined Radio Application
- Please see the [CubicSDR GitHub Wiki](https://github.com/cjcliffe/CubicSDR/wiki) for build instructions.
- Manual is available (work-in-progress) at [cubicsdr.readthedocs.io](http://cubicsdr.readthedocs.io).
- See also the current [CubicSDR Releases](https://github.com/cjcliffe/CubicSDR/releases) page for available binaries.
- The latest releases are available on the [CubicSDR Releases](https://github.com/cjcliffe/CubicSDR/releases) page.
- Build instructions can be found at the [CubicSDR Wiki](https://github.com/cjcliffe/CubicSDR/wiki) page.
- Manual is available at [cubicsdr.readthedocs.io](http://cubicsdr.readthedocs.io).
- Manual contributions can be submitted to the [CubicSDR-Manual](https://github.com/cjcliffe/CubicSDR-Manual) repository.
Utilizes:
--------
@ -22,12 +23,7 @@ Utilizes:
Optional Libs:
--------
- FFTW3 (can be compiled into liquid-dsp if desired) (http://www.fftw.org/ -- https://github.com/FFTW/fftw3)
- hamlib (https://sourceforge.net/p/hamlib/wiki/Hamlib/ -- https://sourceforge.net/p/hamlib/code/ci/master/tree/)
Features and Status:
--------------------
- Please see the issues on GitHub or visit https://github.com/cjcliffe/CubicSDR/wiki/CubicSDR-Roadmap-and-Ideas for more information.
- A manual is in development at https://github.com/cjcliffe/CubicSDR/issues/248 if you would like to contribute.
- hamlib (https://github.com/Hamlib/Hamlib)
Recommended minimum requirements:
--------------------
@ -36,14 +32,12 @@ Recommended minimum requirements:
- OSX 10.9+ for Mac binary releases.
- Windows 7+ for 64 or 32-bit Windows binary releases.
- Linux and other embedded distribution support yet to be indexed, known to at least work on Debian 8+ and Ubuntu 14+.
- Raspberry Pi2 support is being experimented with; earlier versions of CubicSDR known to work with Banana Pi.
Target Platforms:
----------------
- [x] OSX
- [x] Windows
- [x] Linux
- [ ] HTML5
Platform build scripts and test builds:
--------------------------------------
- MacOS (https://github.com/cjcliffe/CubicSDR-macOSBuild)
- Windows (https://github.com/cjcliffe/CubicSDR-WinBuild)
- Linux (AppImage) (https://github.com/cjcliffe/CubicSDR-AppImageKit)
License:

View File

@ -1,7 +1,7 @@
[Desktop Entry]
Type=Application
Exec=CubicSDR %u
Icon=@CMAKE_INSTALL_PREFIX@/share/cubicsdr/CubicSDR.png
Icon=@CMAKE_INSTALL_PREFIX@/share/cubicsdr/CubicSDR
Terminal=false
Name=CubicSDR
GenericName=CubicSDR

View File

@ -1,5 +1,5 @@
#!/bin/bash
for f in ${APPS}/Contents/MacOS/*.dylib
for f in ${APPS}/Contents/**/*.dylib
do
/usr/bin/codesign --force --verify --verbose --sign "${CUBICSDR_CERT}" $f
done

View File

@ -14,7 +14,7 @@
namespace CubicVR {
enum aabb_enum { AABB_DISJOINT, AABB_A_INSIDE_B, AABB_B_INSIDE_A, AABB_INTERSECT };
enum class aabb_intersect { AABB_DISJOINT, AABB_A_INSIDE_B, AABB_B_INSIDE_A, AABB_INTERSECT };
struct aabb {
vec3 min, max;
@ -76,33 +76,33 @@ namespace CubicVR {
CubicVR.enums.aabb.B_INSIDE_A if boxB is inside boxA
CubicVR.enums.aabb.DISJOINT if AABBs are disjoint (do not intersect)
*/
aabb_enum intersects(aabb boxA, aabb boxB) {
aabb_intersect intersects(aabb boxA, aabb boxB) {
// Disjoint
if( boxA.min[0] > boxB.max[0] || boxA.max[0] < boxB.min[0] ){
return AABB_DISJOINT;
return aabb_intersect::AABB_DISJOINT;
}
if( boxA.min[1] > boxB.max[1] || boxA.max[1] < boxB.min[1] ){
return AABB_DISJOINT;
return aabb_intersect::AABB_DISJOINT;
}
if( boxA.min[2] > boxB.max[2] || boxA.max[2] < boxB.min[2] ){
return AABB_DISJOINT;
return aabb_intersect::AABB_DISJOINT;
}
// boxA is inside boxB.
if( boxA.min[0] >= boxB.min[0] && boxA.max[0] <= boxB.max[0] &&
boxA.min[1] >= boxB.min[1] && boxA.max[1] <= boxB.max[1] &&
boxA.min[2] >= boxB.min[2] && boxA.max[2] <= boxB.max[2]) {
return AABB_A_INSIDE_B;
return aabb_intersect::AABB_A_INSIDE_B;
}
// boxB is inside boxA.
if( boxB.min[0] >= boxA.min[0] && boxB.max[0] <= boxA.max[0] &&
boxB.min[1] >= boxA.min[1] && boxB.max[1] <= boxA.max[1] &&
boxB.min[2] >= boxA.min[2] && boxB.max[2] <= boxA.max[2]) {
return AABB_B_INSIDE_A;
return aabb_intersect::AABB_B_INSIDE_A;
}
// Otherwise AABB's intersect.
return AABB_INTERSECT;
return aabb_intersect::AABB_INTERSECT;
}
};
};

View File

@ -12,7 +12,7 @@
#include <iostream>
#include "vec3.h"
#include <cstring>
#include <stddef.h>
namespace CubicVR {
#define mat3SG(c,x,y) \
@ -20,14 +20,20 @@ namespace CubicVR {
c & COMBINE(set,x)(mat3 value) { y = value; return *this; }
struct mat3 {
__float a,b,c,d,e,f,g,h,i;
// __float operator [] (unsigned i) const { return ((__float *)this)[i]; }
#ifndef _WIN32
__float& operator [] (unsigned i) { return ((__float *)this)[i]; }
#endif
operator __float*() const { return (__float *)this; }
//access as-array:
inline __float& operator [] (size_t i) {
__float* as_array = (__float*)this;
return (as_array[i]);
}
inline const __float& operator [] (size_t i) const {
__float* as_array = (__float*)this;
return (as_array[i]);
}
mat3(__float ai,__float bi,__float ci,__float di,__float ei,__float fi,__float gi,__float hi,__float ii) {
a = ai; b = bi; c = ci; d = di; e = ei; f = fi; g = gi; h = hi; i = ii;
};

View File

@ -15,21 +15,35 @@
#include "vec4.h"
#include "mat3.h"
#include <cmath>
#include <stddef.h>
namespace CubicVR {
using namespace std;
#define mat4SG(c,x,y) \
mat4 COMBINE(get,x)() { return y; } \
c & COMBINE(set,x)(mat4 value) { y = value; return *this; }
struct mat4 {
__float a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p;
//16 elements
__float a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p;
//access as-array:
inline __float& operator [] (size_t i) {
__float* as_array = (__float*)this;
return (as_array[i]);
}
// __float operator [] (unsigned i) const { return ((__float *)this)[i]; }
#ifndef _WIN32
__float& operator [] (unsigned i) { return ((__float *)this)[i]; }
#endif
inline const __float& operator [] (size_t i) const {
__float* as_array = (__float*)this;
return (as_array[i]);
}
//To be accessed by GL API directly, accessed by pointer.
//operator* overloading is way too dangerous, especially in ptr != NULL
//tests.
inline __float* to_ptr() const { return (__float *)this; }
operator __float*() const { return (__float *)this; }
mat4(__float ai,__float bi,__float ci,__float di,__float ei,__float fi,__float gi,__float hi,__float ii,__float ji,__float ki,__float li,__float mi,__float ni,__float oi,__float pi) {
a = ai; b = bi; c = ci; d = di; e = ei; f = fi; g = gi; h = hi; i = ii; j = ji; k = ki; l = li; m = mi; n = ni; o = oi; p = pi;
}
@ -263,22 +277,19 @@ namespace CubicVR {
static mat4 transform(vec3 position, vec3 rotation, vec3 scale) {
mat4 m = mat4::identity();
if (position!=NULL) {
m *= mat4::translate(position[0],position[1],position[2]);
m *= mat4::translate(position[0],position[1],position[2]);
if (!(rotation[0] == 0 && rotation[1] == 0 && rotation[2] == 0)) {
m *= mat4::rotate(rotation[0], rotation[1], rotation[2]);
}
if (rotation!=NULL) {
if (!(rotation[0] == 0 && rotation[1] == 0 && rotation[2] == 0)) {
m *= mat4::rotate(rotation[0],rotation[1],rotation[2]);
}
}
if (scale!=NULL) {
if (!(scale[0] == 1 && scale[1] == 1 && scale[2] == 1)) {
m *= mat4::scale(scale[0],scale[1],scale[2]);
}
if (!(scale[0] == 1 && scale[1] == 1 && scale[2] == 1)) {
m *= mat4::scale(scale[0],scale[1],scale[2]);
}
return m;
};
static vec4 vec4_multiply(vec4 m1, mat4 m2) {
vec4 mOut;
@ -313,7 +324,7 @@ namespace CubicVR {
};
static vec3 unProject(mat4 pMatrix, mat4 mvMatrix, float width, float height, float winx, float winy, float /* winz */) {
vec4 p(((winx / width) * 2.0f) - 1.0, -(((winy / height) * 2.0f) - 1.0), 1.0, 1.0);
vec4 p(((winx / width) * 2.0f) - 1.0f, -(((winy / height) * 2.0f) - 1.0f), 1.0f, 1.0f);
vec4 invp = mat4::vec4_multiply(mat4::vec4_multiply(p, mat4::inverse(pMatrix)), mat4::inverse(mvMatrix));

View File

@ -73,7 +73,7 @@ namespace CubicVR {
void pushMatrix(mat4 m) {
c_stack++;
m_stack[c_stack] = (m ? m : getIdentity());
m_stack[c_stack] = m;
}
void popMatrix() {
@ -88,14 +88,10 @@ namespace CubicVR {
m_cache.clear();
c_stack = 0;
valid = 0;
delete result;
result = mat4::identity();
if (init_mat != NULL) {
m_stack[0] = init_mat;
} else {
setIdentity();
}
m_stack[0] = init_mat;
}
void translate(__float x, __float y, __float z) {

View File

@ -12,6 +12,7 @@
#include <iostream>
#include <cmath>
#include "cubic_types.h"
#include <stddef.h>
namespace CubicVR {
#define vec2SG(c,x,y) \
@ -20,20 +21,27 @@ namespace CubicVR {
struct vec2 {
__float x, y;
public:
__float& u() { return x; }
__float& v() { return y; }
// __float operator [] (unsigned i) const { return ((__float *)this)[i]; }
#ifndef _WIN32
__float& operator [] (unsigned i) { return ((__float *)this)[i]; }
#endif
//access as-array:
inline __float& operator [] (size_t i) {
__float* as_array = (__float*)this;
return (as_array[i]);
}
inline const __float& operator [] (size_t i) const {
__float* as_array = (__float*)this;
return (as_array[i]);
}
vec2 (__float xi,__float yi) { x = xi; y = yi; }
vec2 () { x = y = 0.0f; }
operator __float*() const { return (__float *)this; }
vec2 operator*(__float v) { return vec2( x*v, y*v ); }
// vec2 operator*(vec2 v) { return vec2::cross(*this,v); }
vec2 operator+(vec2 v) { return vec2::add(*this,v); }
vec2 operator-(vec2 v) { return vec2::subtract(*this,v); }

View File

@ -12,6 +12,7 @@
#include <iostream>
#include "cubic_types.h"
#include <cmath>
#include <stddef.h>
namespace CubicVR {
@ -23,19 +24,24 @@ namespace CubicVR {
struct vec3 {
__float x,y,z;
operator __float*() const { return (__float *)this; }
__float& r() { return x; }
__float& g() { return y; }
__float& b() { return z; }
#ifndef _WIN32
__float& operator [] (unsigned i) { return ((__float *)this)[i]; }
#endif
//access as-array:
inline __float& operator [] (size_t i) {
__float* as_array = (__float*)this;
return (as_array[i]);
}
inline const __float& operator [] (size_t i) const {
__float* as_array = (__float*)this;
return (as_array[i]);
}
vec3 (__float xi,__float yi,__float zi) { x = xi; y = yi; z = zi; }
vec3 () { x = y = z = 0.0f; }
vec3 operator*(__float v) { return vec3(x*v, y*v, z*v); }
vec3 operator*(vec3 v) { return vec3::cross(*this,v); }
vec3 operator+(vec3 v) { return vec3::add(*this,v); }

View File

@ -12,6 +12,7 @@
#include <iostream>
#include "cubic_types.h"
#include <cmath>
#include <stddef.h>
namespace CubicVR {
@ -20,23 +21,29 @@ namespace CubicVR {
c & COMBINE(set,x)(vec3 value) { y = value; return *this; }
struct vec4 {
__float x,y,z,w;
__float x, y, z, w;
public:
__float& r() { return x; }
__float& g() { return y; }
__float& b() { return z; }
__float& a() { return w; }
// __float operator [] (unsigned i) const { return ((__float *)this)[i]; }
#ifndef _WIN32
__float& operator [] (unsigned i) { return ((__float *)this)[i]; }
#endif
//access as-array:
inline __float& operator [] (size_t i) {
__float* as_array = (__float*)this;
return (as_array[i]);
}
inline const __float& operator [] (size_t i) const {
__float* as_array = (__float*)this;
return (as_array[i]);
}
vec4 (__float xi,__float yi,__float zi,__float wi) { x = xi; y = yi; z = zi; w = wi; }
vec4 () { x = y = z = w = 0.0f; }
operator __float*() const { return (__float *)this; }
vec4 operator*(__float v) { return vec4(x*v, y*v, z*v, w*v); }
// vec4 operator*(vec4 v) { return vec4::cross(*this,v); }
// vec4 operator+(vec4 v) { return vec4::add(*this,v); }

View File

@ -1,266 +0,0 @@
EXPORTS
azimuth_long_path @1
dec2dmmm @2
dec2dms @3
distance_long_path @4
dmmm2dec @5
dms2dec @6
from_bcd @7
from_bcd_be @8
hamlib_copyright @9 DATA
hamlib_copyright2 @10 DATA
hamlib_version @11 DATA
hamlib_version2 @12 DATA
initrigs3_adat @13
initrigs3_alinco @14
initrigs3_aor @15
initrigs3_drake @16
initrigs3_dummy @17
initrigs3_flexradio @18
initrigs3_icmarine @19
initrigs3_icom @20
initrigs3_jrc @21
initrigs3_kachina @22
initrigs3_kenwood @23
initrigs3_kit @24
initrigs3_lowe @25
initrigs3_pcr @26
initrigs3_prm80 @27
initrigs3_racal @28
initrigs3_rft @29
initrigs3_rs @30
initrigs3_skanti @31
initrigs3_tapr @32
initrigs3_tentec @33
initrigs3_tuner @34
initrigs3_uniden @35
initrigs3_winradio @36
initrigs3_wj @37
initrigs3_yaesu @38
initrots3_amsat @39
initrots3_ars @40
initrots3_celestron @41
initrots3_cnctrk @42
initrots3_dummy @43
initrots3_easycomm @44
initrots3_ether6 @45
initrots3_fodtrack @46
initrots3_gs232a @47
initrots3_heathkit @48
initrots3_kit @49
initrots3_m2 @50
initrots3_prosistel @51
initrots3_rotorez @52
initrots3_sartek @53
initrots3_spid @54
initrots3_ts7400 @55
locator2longlat @56
longlat2locator @57
par_lock @58
par_read_control @59
par_read_data @60
par_read_status @61
par_unlock @62
par_write_control @63
par_write_data @64
port_close @65
port_open @66
probeallrigs3_adat @67
probeallrigs3_drake @68
probeallrigs3_icom @69
probeallrigs3_kenwood @70
probeallrigs3_lowe @71
probeallrigs3_uniden @72
probeallrigs3_yaesu @73
qrb @74
read_block @75
read_string @76
rig_check_backend @77
rig_check_cache_timeout @78
rig_cleanup @79
rig_close @80
rig_confparam_lookup @81
rig_copyright @82
rig_debug @83
rig_ext_level_foreach @84
rig_ext_lookup @85
rig_ext_lookup_tok @86
rig_ext_parm_foreach @87
rig_ext_token_lookup @88
rig_force_cache_timeout @89
rig_get_ant @90
rig_get_caps @91
rig_get_chan_all @92
rig_get_chan_all_cb @93
rig_get_channel @94
rig_get_conf @95
rig_get_ctcss_sql @96
rig_get_ctcss_tone @97
rig_get_dcd @98
rig_get_dcs_code @99
rig_get_dcs_sql @100
rig_get_ext_level @101
rig_get_ext_parm @102
rig_get_freq @103
rig_get_func @104
rig_get_info @105
rig_get_level @106
rig_get_mem @107
rig_get_mem_all @108
rig_get_mem_all_cb @109
rig_get_mode @110
rig_get_parm @111
rig_get_powerstat @112
rig_get_ptt @113
rig_get_range @114
rig_get_resolution @115
rig_get_rit @116
rig_get_rptr_offs @117
rig_get_rptr_shift @118
rig_get_split_freq @119
rig_get_split_freq_mode @120
rig_get_split_mode @121
rig_get_split_vfo @122
rig_get_trn @123
rig_get_ts @124
rig_get_vfo @125
rig_get_xit @126
rig_has_get_func @127
rig_has_get_level @128
rig_has_get_parm @129
rig_has_scan @130
rig_has_set_func @131
rig_has_set_level @132
rig_has_set_parm @133
rig_has_vfo_op @134
rig_init @135
rig_license @136
rig_list_foreach @137
rig_load_all_backends @138
rig_load_backend @139
rig_lookup_mem_caps @140
rig_mW2power @141
rig_mem_count @142
rig_need_debug @143
rig_no_restore_ai @144
rig_open @145
rig_parse_func @146
rig_parse_level @147
rig_parse_mode @148
rig_parse_mtype @149
rig_parse_parm @150
rig_parse_rptr_shift @151
rig_parse_scan @152
rig_parse_vfo @153
rig_parse_vfo_op @154
rig_passband_narrow @155
rig_passband_normal @156
rig_passband_wide @157
rig_power2mW @158
rig_probe @159
rig_probe_all @160
rig_raw2val @161
rig_recv_dtmf @162
rig_register @163
rig_reset @164
rig_scan @165
rig_send_dtmf @166
rig_send_morse @167
rig_set_ant @168
rig_set_bank @169
rig_set_chan_all @170
rig_set_chan_all_cb @171
rig_set_channel @172
rig_set_conf @173
rig_set_ctcss_sql @174
rig_set_ctcss_tone @175
rig_set_dcd_callback @176
rig_set_dcs_code @177
rig_set_dcs_sql @178
rig_set_debug @179
rig_set_debug_callback @180
rig_set_debug_file @181
rig_set_ext_level @182
rig_set_ext_parm @183
rig_set_freq @184
rig_set_freq_callback @185
rig_set_func @186
rig_set_level @187
rig_set_mem @188
rig_set_mem_all @189
rig_set_mem_all_cb @190
rig_set_mode @191
rig_set_mode_callback @192
rig_set_parm @193
rig_set_pltune_callback @194
rig_set_powerstat @195
rig_set_ptt @196
rig_set_ptt_callback @197
rig_set_rit @198
rig_set_rptr_offs @199
rig_set_rptr_shift @200
rig_set_split_freq @201
rig_set_split_freq_mode @202
rig_set_split_mode @203
rig_set_split_vfo @204
rig_set_trn @205
rig_set_ts @206
rig_set_vfo @207
rig_set_vfo_callback @208
rig_set_xit @209
rig_setting2idx @210
rig_strfunc @211
rig_strlevel @212
rig_strmtype @213
rig_strparm @214
rig_strptrshift @215
rig_strrmode @216
rig_strscan @217
rig_strstatus @218
rig_strvfo @219
rig_strvfop @220
rig_token_foreach @221
rig_token_lookup @222
rig_unregister @223
rig_version @224
rig_vfo_op @225
rigerror @226
rot_check_backend @227
rot_cleanup @228
rot_close @229
rot_confparam_lookup @230
rot_get_caps @231
rot_get_conf @232
rot_get_info @233
rot_get_position @234
rot_init @235
rot_list_foreach @236
rot_load_all_backends @237
rot_load_backend @238
rot_move @239
rot_open @240
rot_park @241
rot_probe_all @242
rot_register @243
rot_reset @244
rot_set_conf @245
rot_set_position @246
rot_stop @247
rot_token_foreach @248
rot_token_lookup @249
rot_unregister @250
ser_get_car @251
ser_get_cts @252
ser_get_dsr @253
ser_get_dtr @254
ser_get_rts @255
ser_set_brk @256
ser_set_dtr @257
ser_set_rts @258
serial_flush @259
serial_open @260
serial_setup @261
sprintf_freq @262
to_bcd @263
to_bcd_be @264
write_block @265

Binary file not shown.

Binary file not shown.

Binary file not shown.

408
external/hamlib/32/libhamlib-4.def vendored Normal file
View File

@ -0,0 +1,408 @@
EXPORTS
CRC32_function @1
amp_check_backend @2
amp_cleanup @3
amp_close @4
amp_confparam_lookup @5
amp_ext_lookup @6
amp_get_caps @7
amp_get_conf @8
amp_get_ext_level @9
amp_get_freq @10
amp_get_info @11
amp_get_level @12
amp_get_powerstat @13
amp_has_get_level @14
amp_init @15
amp_list_foreach @16
amp_load_all_backends @17
amp_load_backend @18
amp_open @19
amp_parse_level @20
amp_probe_all @21
amp_register @22
amp_reset @23
amp_set_conf @24
amp_set_freq @25
amp_set_powerstat @26
amp_sprintf_level @27
amp_strlevel @28
amp_token_lookup @29
amp_unregister @30
azimuth_long_path @31
cookie_use @32 DATA
debugmsgsave @33 DATA
debugmsgsave2 @34 DATA
debugmsgsave3 @35 DATA
dec2dmmm @36
dec2dms @37
distance_long_path @38
dmmm2dec @39
dms2dec @40
dot10ths_to_millis @41
dump_hex @42
elapsed_ms @43
from_bcd @44
from_bcd_be @45
get_rig_conf_type @46
hamlib_copyright @47 DATA
hamlib_copyright2 @48 DATA
hamlib_version @49 DATA
hamlib_version2 @50 DATA
hl_usleep @51
initamps4_dummy @52
initamps4_kpa1500 @53
initrigs4_adat @54
initrigs4_alinco @55
initrigs4_aor @56
initrigs4_barrett @57
initrigs4_dorji @58
initrigs4_drake @59
initrigs4_dummy @60
initrigs4_elad @61
initrigs4_flexradio @62
initrigs4_icm710 @63
initrigs4_icmarine @64
initrigs4_icom @65
initrigs4_jrc @66
initrigs4_kachina @67
initrigs4_kenwood @68
initrigs4_kit @69
initrigs4_lowe @70
initrigs4_pcr @71
initrigs4_prm80 @72
initrigs4_racal @73
initrigs4_rft @74
initrigs4_rs @75
initrigs4_skanti @76
initrigs4_tapr @77
initrigs4_tentec @78
initrigs4_tuner @79
initrigs4_uniden @80
initrigs4_winradio @81
initrigs4_wj @82
initrigs4_yaesu @83
initrots4_amsat @84
initrots4_ars @85
initrots4_celestron @86
initrots4_cnctrk @87
initrots4_dummy @88
initrots4_easycomm @89
initrots4_ether6 @90
initrots4_fodtrack @91
initrots4_gs232a @92
initrots4_heathkit @93
initrots4_ioptron @94
initrots4_kit @95
initrots4_m2 @96
initrots4_meade @97
initrots4_prosistel @98
initrots4_radant @99
initrots4_rotorez @100
initrots4_sartek @101
initrots4_satel @102
initrots4_spid @103
initrots4_ts7400 @104
locator2longlat @105
longlat2locator @106
millis_to_dot10ths @107
morse_code_dot_to_millis @108
netrigctl_get_vfo_mode @109
network_multicast_server @110
par_lock @111
par_read_control @112
par_read_data @113
par_read_status @114
par_unlock @115
par_write_control @116
par_write_data @117
parse_hoststr @118
port_close @119
port_open @120
print_ext_param @121
probeallrigs4_adat @122
probeallrigs4_drake @123
probeallrigs4_elad @124
probeallrigs4_icom @125
probeallrigs4_kenwood @126
probeallrigs4_lowe @127
probeallrigs4_uniden @128
probeallrigs4_yaesu @129
qrb @130
read_block @131
read_string @132
rig_check_backend @133
rig_check_cache_timeout @134
rig_cleanup @135
rig_close @136
rig_confparam_lookup @137
rig_cookie @138
rig_copyright @139
rig_debug @140
rig_ext_func_foreach @141
rig_ext_level_foreach @142
rig_ext_lookup @143
rig_ext_lookup_tok @144
rig_ext_parm_foreach @145
rig_ext_token_lookup @146
rig_flush @147
rig_force_cache_timeout @148
rig_get_ant @149
rig_get_cache @150
rig_get_cache_timeout_ms @151
rig_get_caps @152
rig_get_caps_cptr @153
rig_get_caps_int @154
rig_get_chan_all @155
rig_get_chan_all_cb @156
rig_get_channel @157
rig_get_clock @158
rig_get_conf @159
rig_get_ctcss_sql @160
rig_get_ctcss_tone @161
rig_get_dcd @162
rig_get_dcs_code @163
rig_get_dcs_sql @164
rig_get_ext_func @165
rig_get_ext_level @166
rig_get_ext_parm @167
rig_get_freq @168
rig_get_func @169
rig_get_function_ptr @170
rig_get_info @171
rig_get_level @172
rig_get_mem @173
rig_get_mem_all @174
rig_get_mem_all_cb @175
rig_get_mode @176
rig_get_parm @177
rig_get_powerstat @178
rig_get_ptt @179
rig_get_range @180
rig_get_resolution @181
rig_get_rig_info @182
rig_get_rit @183
rig_get_rptr_offs @184
rig_get_rptr_shift @185
rig_get_split_freq @186
rig_get_split_freq_mode @187
rig_get_split_mode @188
rig_get_split_vfo @189
rig_get_trn @190
rig_get_ts @191
rig_get_twiddle @192
rig_get_vfo @193
rig_get_vfo_info @194
rig_get_vfo_list @195
rig_get_xit @196
rig_has_get_func @197
rig_has_get_level @198
rig_has_get_parm @199
rig_has_scan @200
rig_has_set_func @201
rig_has_set_level @202
rig_has_set_parm @203
rig_has_vfo_op @204
rig_idx2setting @205
rig_init @206
rig_license @207
rig_list_foreach @208
rig_list_foreach_model @209
rig_load_all_backends @210
rig_load_backend @211
rig_lookup_mem_caps @212
rig_mW2power @213
rig_mem_count @214
rig_need_debug @215
rig_no_restore_ai @216
rig_open @217
rig_parse_func @218
rig_parse_level @219
rig_parse_mode @220
rig_parse_mtype @221
rig_parse_parm @222
rig_parse_rptr_shift @223
rig_parse_scan @224
rig_parse_vfo @225
rig_parse_vfo_op @226
rig_passband_narrow @227
rig_passband_normal @228
rig_passband_wide @229
rig_power2mW @230
rig_probe @231
rig_probe_all @232
rig_raw2val @233
rig_raw2val_float @234
rig_recv_dtmf @235
rig_register @236
rig_reset @237
rig_scan @238
rig_send_dtmf @239
rig_send_morse @240
rig_send_voice_mem @241
rig_set_ant @242
rig_set_bank @243
rig_set_cache_timeout_ms @244
rig_set_chan_all @245
rig_set_chan_all_cb @246
rig_set_channel @247
rig_set_clock @248
rig_set_conf @249
rig_set_ctcss_sql @250
rig_set_ctcss_tone @251
rig_set_dcd_callback @252
rig_set_dcs_code @253
rig_set_dcs_sql @254
rig_set_debug @255
rig_set_debug_callback @256
rig_set_debug_file @257
rig_set_debug_time_stamp @258
rig_set_ext_func @259
rig_set_ext_level @260
rig_set_ext_parm @261
rig_set_freq @262
rig_set_freq_callback @263
rig_set_func @264
rig_set_level @265
rig_set_mem @266
rig_set_mem_all @267
rig_set_mem_all_cb @268
rig_set_mode @269
rig_set_mode_callback @270
rig_set_parm @271
rig_set_pltune_callback @272
rig_set_powerstat @273
rig_set_ptt @274
rig_set_ptt_callback @275
rig_set_rit @276
rig_set_rptr_offs @277
rig_set_rptr_shift @278
rig_set_spectrum_callback @279
rig_set_split_freq @280
rig_set_split_freq_mode @281
rig_set_split_mode @282
rig_set_split_vfo @283
rig_set_trn @284
rig_set_ts @285
rig_set_twiddle @286
rig_set_uplink @287
rig_set_vfo @288
rig_set_vfo_callback @289
rig_set_vfo_opt @290
rig_set_xit @291
rig_setting2idx @292
rig_sprintf_ant @293
rig_sprintf_func @294
rig_sprintf_level @295
rig_sprintf_level_gran @296
rig_sprintf_mode @297
rig_sprintf_parm @298
rig_sprintf_parm_gran @299
rig_sprintf_scan @300
rig_sprintf_spectrum_avg_modes @301
rig_sprintf_spectrum_modes @302
rig_sprintf_spectrum_spans @303
rig_sprintf_vfo @304
rig_sprintf_vfop @305
rig_stop_morse @306
rig_stragclevel @307
rig_strfunc @308
rig_strlevel @309
rig_strmtype @310
rig_strparm @311
rig_strptrshift @312
rig_strrmode @313
rig_strrmodes @314
rig_strscan @315
rig_strspectrummode @316
rig_strstatus @317
rig_strvfo @318
rig_strvfop @319
rig_token_foreach @320
rig_token_lookup @321
rig_unregister @322
rig_version @323
rig_vfo_op @324
rig_wait_morse @325
rigerror @326
rot_check_backend @327
rot_cleanup @328
rot_close @329
rot_confparam_lookup @330
rot_ext_func_foreach @331
rot_ext_level_foreach @332
rot_ext_lookup @333
rot_ext_lookup_tok @334
rot_ext_parm_foreach @335
rot_ext_token_lookup @336
rot_get_caps @337
rot_get_conf @338
rot_get_ext_func @339
rot_get_ext_level @340
rot_get_ext_parm @341
rot_get_func @342
rot_get_info @343
rot_get_level @344
rot_get_parm @345
rot_get_position @346
rot_get_status @347
rot_has_get_func @348
rot_has_get_level @349
rot_has_get_parm @350
rot_has_set_func @351
rot_has_set_level @352
rot_has_set_parm @353
rot_init @354
rot_list_foreach @355
rot_load_all_backends @356
rot_load_backend @357
rot_move @358
rot_open @359
rot_park @360
rot_parse_func @361
rot_parse_level @362
rot_parse_parm @363
rot_probe_all @364
rot_register @365
rot_reset @366
rot_set_conf @367
rot_set_ext_func @368
rot_set_ext_level @369
rot_set_ext_parm @370
rot_set_func @371
rot_set_level @372
rot_set_parm @373
rot_set_position @374
rot_sprintf_func @375
rot_sprintf_level @376
rot_sprintf_level_gran @377
rot_sprintf_parm @378
rot_sprintf_parm_gran @379
rot_sprintf_status @380
rot_stop @381
rot_strfunc @382
rot_strlevel @383
rot_strparm @384
rot_strstatus @385
rot_token_foreach @386
rot_token_lookup @387
rot_unregister @388
ser_get_car @389
ser_get_cts @390
ser_get_dsr @391
ser_get_dtr @392
ser_get_rts @393
ser_set_brk @394
ser_set_dtr @395
ser_set_rts @396
serial_flush @397
serial_open @398
serial_setup @399
sprintf_freq @400
sprintf_level_ext @401
sync_callback @402
to_bcd @403
to_bcd_be @404
vfo_fixup @405
vfo_fixup2a @406
write_block @407

BIN
external/hamlib/32/libhamlib-4.dll vendored Normal file

Binary file not shown.

BIN
external/hamlib/32/libhamlib-4.exp vendored Normal file

Binary file not shown.

BIN
external/hamlib/32/libhamlib-4.lib vendored Normal file

Binary file not shown.

View File

@ -1,266 +0,0 @@
EXPORTS
azimuth_long_path @1
dec2dmmm @2
dec2dms @3
distance_long_path @4
dmmm2dec @5
dms2dec @6
from_bcd @7
from_bcd_be @8
hamlib_copyright @9 DATA
hamlib_copyright2 @10 DATA
hamlib_version @11 DATA
hamlib_version2 @12 DATA
initrigs3_adat @13
initrigs3_alinco @14
initrigs3_aor @15
initrigs3_drake @16
initrigs3_dummy @17
initrigs3_flexradio @18
initrigs3_icmarine @19
initrigs3_icom @20
initrigs3_jrc @21
initrigs3_kachina @22
initrigs3_kenwood @23
initrigs3_kit @24
initrigs3_lowe @25
initrigs3_pcr @26
initrigs3_prm80 @27
initrigs3_racal @28
initrigs3_rft @29
initrigs3_rs @30
initrigs3_skanti @31
initrigs3_tapr @32
initrigs3_tentec @33
initrigs3_tuner @34
initrigs3_uniden @35
initrigs3_winradio @36
initrigs3_wj @37
initrigs3_yaesu @38
initrots3_amsat @39
initrots3_ars @40
initrots3_celestron @41
initrots3_cnctrk @42
initrots3_dummy @43
initrots3_easycomm @44
initrots3_ether6 @45
initrots3_fodtrack @46
initrots3_gs232a @47
initrots3_heathkit @48
initrots3_kit @49
initrots3_m2 @50
initrots3_prosistel @51
initrots3_rotorez @52
initrots3_sartek @53
initrots3_spid @54
initrots3_ts7400 @55
locator2longlat @56
longlat2locator @57
par_lock @58
par_read_control @59
par_read_data @60
par_read_status @61
par_unlock @62
par_write_control @63
par_write_data @64
port_close @65
port_open @66
probeallrigs3_adat @67
probeallrigs3_drake @68
probeallrigs3_icom @69
probeallrigs3_kenwood @70
probeallrigs3_lowe @71
probeallrigs3_uniden @72
probeallrigs3_yaesu @73
qrb @74
read_block @75
read_string @76
rig_check_backend @77
rig_check_cache_timeout @78
rig_cleanup @79
rig_close @80
rig_confparam_lookup @81
rig_copyright @82
rig_debug @83
rig_ext_level_foreach @84
rig_ext_lookup @85
rig_ext_lookup_tok @86
rig_ext_parm_foreach @87
rig_ext_token_lookup @88
rig_force_cache_timeout @89
rig_get_ant @90
rig_get_caps @91
rig_get_chan_all @92
rig_get_chan_all_cb @93
rig_get_channel @94
rig_get_conf @95
rig_get_ctcss_sql @96
rig_get_ctcss_tone @97
rig_get_dcd @98
rig_get_dcs_code @99
rig_get_dcs_sql @100
rig_get_ext_level @101
rig_get_ext_parm @102
rig_get_freq @103
rig_get_func @104
rig_get_info @105
rig_get_level @106
rig_get_mem @107
rig_get_mem_all @108
rig_get_mem_all_cb @109
rig_get_mode @110
rig_get_parm @111
rig_get_powerstat @112
rig_get_ptt @113
rig_get_range @114
rig_get_resolution @115
rig_get_rit @116
rig_get_rptr_offs @117
rig_get_rptr_shift @118
rig_get_split_freq @119
rig_get_split_freq_mode @120
rig_get_split_mode @121
rig_get_split_vfo @122
rig_get_trn @123
rig_get_ts @124
rig_get_vfo @125
rig_get_xit @126
rig_has_get_func @127
rig_has_get_level @128
rig_has_get_parm @129
rig_has_scan @130
rig_has_set_func @131
rig_has_set_level @132
rig_has_set_parm @133
rig_has_vfo_op @134
rig_init @135
rig_license @136
rig_list_foreach @137
rig_load_all_backends @138
rig_load_backend @139
rig_lookup_mem_caps @140
rig_mW2power @141
rig_mem_count @142
rig_need_debug @143
rig_no_restore_ai @144
rig_open @145
rig_parse_func @146
rig_parse_level @147
rig_parse_mode @148
rig_parse_mtype @149
rig_parse_parm @150
rig_parse_rptr_shift @151
rig_parse_scan @152
rig_parse_vfo @153
rig_parse_vfo_op @154
rig_passband_narrow @155
rig_passband_normal @156
rig_passband_wide @157
rig_power2mW @158
rig_probe @159
rig_probe_all @160
rig_raw2val @161
rig_recv_dtmf @162
rig_register @163
rig_reset @164
rig_scan @165
rig_send_dtmf @166
rig_send_morse @167
rig_set_ant @168
rig_set_bank @169
rig_set_chan_all @170
rig_set_chan_all_cb @171
rig_set_channel @172
rig_set_conf @173
rig_set_ctcss_sql @174
rig_set_ctcss_tone @175
rig_set_dcd_callback @176
rig_set_dcs_code @177
rig_set_dcs_sql @178
rig_set_debug @179
rig_set_debug_callback @180
rig_set_debug_file @181
rig_set_ext_level @182
rig_set_ext_parm @183
rig_set_freq @184
rig_set_freq_callback @185
rig_set_func @186
rig_set_level @187
rig_set_mem @188
rig_set_mem_all @189
rig_set_mem_all_cb @190
rig_set_mode @191
rig_set_mode_callback @192
rig_set_parm @193
rig_set_pltune_callback @194
rig_set_powerstat @195
rig_set_ptt @196
rig_set_ptt_callback @197
rig_set_rit @198
rig_set_rptr_offs @199
rig_set_rptr_shift @200
rig_set_split_freq @201
rig_set_split_freq_mode @202
rig_set_split_mode @203
rig_set_split_vfo @204
rig_set_trn @205
rig_set_ts @206
rig_set_vfo @207
rig_set_vfo_callback @208
rig_set_xit @209
rig_setting2idx @210
rig_strfunc @211
rig_strlevel @212
rig_strmtype @213
rig_strparm @214
rig_strptrshift @215
rig_strrmode @216
rig_strscan @217
rig_strstatus @218
rig_strvfo @219
rig_strvfop @220
rig_token_foreach @221
rig_token_lookup @222
rig_unregister @223
rig_version @224
rig_vfo_op @225
rigerror @226
rot_check_backend @227
rot_cleanup @228
rot_close @229
rot_confparam_lookup @230
rot_get_caps @231
rot_get_conf @232
rot_get_info @233
rot_get_position @234
rot_init @235
rot_list_foreach @236
rot_load_all_backends @237
rot_load_backend @238
rot_move @239
rot_open @240
rot_park @241
rot_probe_all @242
rot_register @243
rot_reset @244
rot_set_conf @245
rot_set_position @246
rot_stop @247
rot_token_foreach @248
rot_token_lookup @249
rot_unregister @250
ser_get_car @251
ser_get_cts @252
ser_get_dsr @253
ser_get_dtr @254
ser_get_rts @255
ser_set_brk @256
ser_set_dtr @257
ser_set_rts @258
serial_flush @259
serial_open @260
serial_setup @261
sprintf_freq @262
to_bcd @263
to_bcd_be @264
write_block @265

Binary file not shown.

Binary file not shown.

Binary file not shown.

408
external/hamlib/64/libhamlib-4.def vendored Normal file
View File

@ -0,0 +1,408 @@
EXPORTS
CRC32_function @1
amp_check_backend @2
amp_cleanup @3
amp_close @4
amp_confparam_lookup @5
amp_ext_lookup @6
amp_get_caps @7
amp_get_conf @8
amp_get_ext_level @9
amp_get_freq @10
amp_get_info @11
amp_get_level @12
amp_get_powerstat @13
amp_has_get_level @14
amp_init @15
amp_list_foreach @16
amp_load_all_backends @17
amp_load_backend @18
amp_open @19
amp_parse_level @20
amp_probe_all @21
amp_register @22
amp_reset @23
amp_set_conf @24
amp_set_freq @25
amp_set_powerstat @26
amp_sprintf_level @27
amp_strlevel @28
amp_token_lookup @29
amp_unregister @30
azimuth_long_path @31
cookie_use @32 DATA
debugmsgsave @33 DATA
debugmsgsave2 @34 DATA
debugmsgsave3 @35 DATA
dec2dmmm @36
dec2dms @37
distance_long_path @38
dmmm2dec @39
dms2dec @40
dot10ths_to_millis @41
dump_hex @42
elapsed_ms @43
from_bcd @44
from_bcd_be @45
get_rig_conf_type @46
hamlib_copyright @47 DATA
hamlib_copyright2 @48 DATA
hamlib_version @49 DATA
hamlib_version2 @50 DATA
hl_usleep @51
initamps4_dummy @52
initamps4_kpa1500 @53
initrigs4_adat @54
initrigs4_alinco @55
initrigs4_aor @56
initrigs4_barrett @57
initrigs4_dorji @58
initrigs4_drake @59
initrigs4_dummy @60
initrigs4_elad @61
initrigs4_flexradio @62
initrigs4_icm710 @63
initrigs4_icmarine @64
initrigs4_icom @65
initrigs4_jrc @66
initrigs4_kachina @67
initrigs4_kenwood @68
initrigs4_kit @69
initrigs4_lowe @70
initrigs4_pcr @71
initrigs4_prm80 @72
initrigs4_racal @73
initrigs4_rft @74
initrigs4_rs @75
initrigs4_skanti @76
initrigs4_tapr @77
initrigs4_tentec @78
initrigs4_tuner @79
initrigs4_uniden @80
initrigs4_winradio @81
initrigs4_wj @82
initrigs4_yaesu @83
initrots4_amsat @84
initrots4_ars @85
initrots4_celestron @86
initrots4_cnctrk @87
initrots4_dummy @88
initrots4_easycomm @89
initrots4_ether6 @90
initrots4_fodtrack @91
initrots4_gs232a @92
initrots4_heathkit @93
initrots4_ioptron @94
initrots4_kit @95
initrots4_m2 @96
initrots4_meade @97
initrots4_prosistel @98
initrots4_radant @99
initrots4_rotorez @100
initrots4_sartek @101
initrots4_satel @102
initrots4_spid @103
initrots4_ts7400 @104
locator2longlat @105
longlat2locator @106
millis_to_dot10ths @107
morse_code_dot_to_millis @108
netrigctl_get_vfo_mode @109
network_multicast_server @110
par_lock @111
par_read_control @112
par_read_data @113
par_read_status @114
par_unlock @115
par_write_control @116
par_write_data @117
parse_hoststr @118
port_close @119
port_open @120
print_ext_param @121
probeallrigs4_adat @122
probeallrigs4_drake @123
probeallrigs4_elad @124
probeallrigs4_icom @125
probeallrigs4_kenwood @126
probeallrigs4_lowe @127
probeallrigs4_uniden @128
probeallrigs4_yaesu @129
qrb @130
read_block @131
read_string @132
rig_check_backend @133
rig_check_cache_timeout @134
rig_cleanup @135
rig_close @136
rig_confparam_lookup @137
rig_cookie @138
rig_copyright @139
rig_debug @140
rig_ext_func_foreach @141
rig_ext_level_foreach @142
rig_ext_lookup @143
rig_ext_lookup_tok @144
rig_ext_parm_foreach @145
rig_ext_token_lookup @146
rig_flush @147
rig_force_cache_timeout @148
rig_get_ant @149
rig_get_cache @150
rig_get_cache_timeout_ms @151
rig_get_caps @152
rig_get_caps_cptr @153
rig_get_caps_int @154
rig_get_chan_all @155
rig_get_chan_all_cb @156
rig_get_channel @157
rig_get_clock @158
rig_get_conf @159
rig_get_ctcss_sql @160
rig_get_ctcss_tone @161
rig_get_dcd @162
rig_get_dcs_code @163
rig_get_dcs_sql @164
rig_get_ext_func @165
rig_get_ext_level @166
rig_get_ext_parm @167
rig_get_freq @168
rig_get_func @169
rig_get_function_ptr @170
rig_get_info @171
rig_get_level @172
rig_get_mem @173
rig_get_mem_all @174
rig_get_mem_all_cb @175
rig_get_mode @176
rig_get_parm @177
rig_get_powerstat @178
rig_get_ptt @179
rig_get_range @180
rig_get_resolution @181
rig_get_rig_info @182
rig_get_rit @183
rig_get_rptr_offs @184
rig_get_rptr_shift @185
rig_get_split_freq @186
rig_get_split_freq_mode @187
rig_get_split_mode @188
rig_get_split_vfo @189
rig_get_trn @190
rig_get_ts @191
rig_get_twiddle @192
rig_get_vfo @193
rig_get_vfo_info @194
rig_get_vfo_list @195
rig_get_xit @196
rig_has_get_func @197
rig_has_get_level @198
rig_has_get_parm @199
rig_has_scan @200
rig_has_set_func @201
rig_has_set_level @202
rig_has_set_parm @203
rig_has_vfo_op @204
rig_idx2setting @205
rig_init @206
rig_license @207
rig_list_foreach @208
rig_list_foreach_model @209
rig_load_all_backends @210
rig_load_backend @211
rig_lookup_mem_caps @212
rig_mW2power @213
rig_mem_count @214
rig_need_debug @215
rig_no_restore_ai @216
rig_open @217
rig_parse_func @218
rig_parse_level @219
rig_parse_mode @220
rig_parse_mtype @221
rig_parse_parm @222
rig_parse_rptr_shift @223
rig_parse_scan @224
rig_parse_vfo @225
rig_parse_vfo_op @226
rig_passband_narrow @227
rig_passband_normal @228
rig_passband_wide @229
rig_power2mW @230
rig_probe @231
rig_probe_all @232
rig_raw2val @233
rig_raw2val_float @234
rig_recv_dtmf @235
rig_register @236
rig_reset @237
rig_scan @238
rig_send_dtmf @239
rig_send_morse @240
rig_send_voice_mem @241
rig_set_ant @242
rig_set_bank @243
rig_set_cache_timeout_ms @244
rig_set_chan_all @245
rig_set_chan_all_cb @246
rig_set_channel @247
rig_set_clock @248
rig_set_conf @249
rig_set_ctcss_sql @250
rig_set_ctcss_tone @251
rig_set_dcd_callback @252
rig_set_dcs_code @253
rig_set_dcs_sql @254
rig_set_debug @255
rig_set_debug_callback @256
rig_set_debug_file @257
rig_set_debug_time_stamp @258
rig_set_ext_func @259
rig_set_ext_level @260
rig_set_ext_parm @261
rig_set_freq @262
rig_set_freq_callback @263
rig_set_func @264
rig_set_level @265
rig_set_mem @266
rig_set_mem_all @267
rig_set_mem_all_cb @268
rig_set_mode @269
rig_set_mode_callback @270
rig_set_parm @271
rig_set_pltune_callback @272
rig_set_powerstat @273
rig_set_ptt @274
rig_set_ptt_callback @275
rig_set_rit @276
rig_set_rptr_offs @277
rig_set_rptr_shift @278
rig_set_spectrum_callback @279
rig_set_split_freq @280
rig_set_split_freq_mode @281
rig_set_split_mode @282
rig_set_split_vfo @283
rig_set_trn @284
rig_set_ts @285
rig_set_twiddle @286
rig_set_uplink @287
rig_set_vfo @288
rig_set_vfo_callback @289
rig_set_vfo_opt @290
rig_set_xit @291
rig_setting2idx @292
rig_sprintf_ant @293
rig_sprintf_func @294
rig_sprintf_level @295
rig_sprintf_level_gran @296
rig_sprintf_mode @297
rig_sprintf_parm @298
rig_sprintf_parm_gran @299
rig_sprintf_scan @300
rig_sprintf_spectrum_avg_modes @301
rig_sprintf_spectrum_modes @302
rig_sprintf_spectrum_spans @303
rig_sprintf_vfo @304
rig_sprintf_vfop @305
rig_stop_morse @306
rig_stragclevel @307
rig_strfunc @308
rig_strlevel @309
rig_strmtype @310
rig_strparm @311
rig_strptrshift @312
rig_strrmode @313
rig_strrmodes @314
rig_strscan @315
rig_strspectrummode @316
rig_strstatus @317
rig_strvfo @318
rig_strvfop @319
rig_token_foreach @320
rig_token_lookup @321
rig_unregister @322
rig_version @323
rig_vfo_op @324
rig_wait_morse @325
rigerror @326
rot_check_backend @327
rot_cleanup @328
rot_close @329
rot_confparam_lookup @330
rot_ext_func_foreach @331
rot_ext_level_foreach @332
rot_ext_lookup @333
rot_ext_lookup_tok @334
rot_ext_parm_foreach @335
rot_ext_token_lookup @336
rot_get_caps @337
rot_get_conf @338
rot_get_ext_func @339
rot_get_ext_level @340
rot_get_ext_parm @341
rot_get_func @342
rot_get_info @343
rot_get_level @344
rot_get_parm @345
rot_get_position @346
rot_get_status @347
rot_has_get_func @348
rot_has_get_level @349
rot_has_get_parm @350
rot_has_set_func @351
rot_has_set_level @352
rot_has_set_parm @353
rot_init @354
rot_list_foreach @355
rot_load_all_backends @356
rot_load_backend @357
rot_move @358
rot_open @359
rot_park @360
rot_parse_func @361
rot_parse_level @362
rot_parse_parm @363
rot_probe_all @364
rot_register @365
rot_reset @366
rot_set_conf @367
rot_set_ext_func @368
rot_set_ext_level @369
rot_set_ext_parm @370
rot_set_func @371
rot_set_level @372
rot_set_parm @373
rot_set_position @374
rot_sprintf_func @375
rot_sprintf_level @376
rot_sprintf_level_gran @377
rot_sprintf_parm @378
rot_sprintf_parm_gran @379
rot_sprintf_status @380
rot_stop @381
rot_strfunc @382
rot_strlevel @383
rot_strparm @384
rot_strstatus @385
rot_token_foreach @386
rot_token_lookup @387
rot_unregister @388
ser_get_car @389
ser_get_cts @390
ser_get_dsr @391
ser_get_dtr @392
ser_get_rts @393
ser_set_brk @394
ser_set_dtr @395
ser_set_rts @396
serial_flush @397
serial_open @398
serial_setup @399
sprintf_freq @400
sprintf_level_ext @401
sync_callback @402
to_bcd @403
to_bcd_be @404
vfo_fixup @405
vfo_fixup2a @406
write_block @407

BIN
external/hamlib/64/libhamlib-4.dll vendored Normal file

Binary file not shown.

BIN
external/hamlib/64/libhamlib-4.exp vendored Normal file

Binary file not shown.

BIN
external/hamlib/64/libhamlib-4.lib vendored Normal file

Binary file not shown.

View File

@ -7,4 +7,9 @@ and also
Those dependencies are installed from external/msvc/[x86|x64] dirs.
In addition, Hamlib also uses libusb but since it is a common
dependency with SoapySDR, it is not included in the external dirs.
dependency with SoapySDR, it is not included in the external dirs.
For Hamlib v4.x releases, only the export file 'libhamlib-4.def' is provided, so we need to re-generate .lib to work on Visual Studio projects:
- Open the 'Developper Command Prompt for VS 2022'
- For Win32, go to hamlib/32 directory and run 'LIB /DEF:libhamlib-4.def /MACHINE:X86'
- For Win64, go to hamlib/64 directory and run 'LIB /DEF:libhamlib-4.def /MACHINE:X64'

446
external/hamlib/hamlib/amplifier.h vendored Normal file
View File

@ -0,0 +1,446 @@
/*
* Hamlib Interface - Amplifier API header
* Copyright (c) 2000-2005 by Stephane Fillod
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef _AMPLIFIER_H
#define _AMPLIFIER_H 1
#include <hamlib/rig.h>
#include <hamlib/amplist.h>
/**
* \addtogroup amplifier
* @{
*/
/**
* \brief Hamlib amplifier data structures.
*
* \file amplifier.h
*
* This file contains the data structures and declarations for the Hamlib
* amplifier Application Programming Interface (API).
*
* See the amplifier.c file for details on the amplifier API functions.
*/
__BEGIN_DECLS
/* Forward struct references */
struct amp;
struct amp_state;
/**
* \brief Main amplifier handle type definition.
*
* \typedef typedef struct amp AMP
*
* The #AMP handle is returned by amp_init() and is passed as a parameter to
* every amplifier specific API call.
*
* amp_cleanup() must be called when this handle is no longer needed.
*/
typedef struct amp AMP;
/**
* \brief Type definition for
* <a href="https://en.wikipedia.org/wiki/Standing_wave_ratio" >SWR (Standing Wave Ratio)</a>.
*
* \typedef typedef float swr_t
*
* The \a swr_t type is used as a parameter for the amp_get_swr() function.
*
* The unit of \a swr_t is 1.0 to the maximum value reported by the amplifier's
* internal antenna system tuner, i.e.
* <a href="http://www.arrl.org/transmatch-antenna-tuner" >transmatch</a>,
* representing the ratio of 1.0:1 to Maximum:1.
*/
typedef float swr_t;
/**
* \brief Type definition for the
* <a href="http://www.arrl.org/transmatch-antenna-tuner" >transmatch</a>
* tuning values of
* <a href="https://en.wikipedia.org/wiki/Capacitance" >capacitance</a>
* and
* <a href="https://en.wikipedia.org/wiki/Inductance" >inductance</a>.
*
* \typedef typedef float tune_value_t
*
* The \a tune_value_t type is used as a parameter for amp_get_level().
*
* The unit of \a tune_value_t is
* <a href="https://en.wikipedia.org/wiki/Farad" >picoFarads (pF)</a>
* or
* <a href="https://en.wikipedia.org/wiki/Henry_(unit)" >nanoHenrys (nH)</a>.
*/
typedef int tune_value_t;
/**
* \brief The token in the netampctl protocol for returning an error condition code.
*/
#define NETAMPCTL_RET "RPRT "
//! @cond Doxygen_Suppress
typedef enum
{
AMP_RESET_MEM, // erase tuner memory
AMP_RESET_FAULT, // reset any fault
AMP_RESET_AMP // for kpa1500
} amp_reset_t;
//! @endcond
/**
* \brief Amplifier type flags
*/
typedef enum
{
AMP_FLAG_1 = (1 << 1), /*!< TBD */
AMP_FLAG_2 = (1 << 2) /*!< TBD */
} amp_type_t;
//! @cond Doxygen_Suppress
// TBD AMP_TYPE
#define AMP_TYPE_MASK (AMP_FLAG_1|AMP_FLAG_2)
#define AMP_TYPE_OTHER 0
#define AMP_TYPE_1 AMP_FLAG_1
#define AMP_TYPE_2 AMP_FLAG_2
#define AMP_TYPE_ALL (AMP_FLAG_1|AMP_FLAG_2)
//! @endcond
//! @cond Doxygen_Suppress
enum amp_level_e
{
AMP_LEVEL_NONE = 0, /*!< '' -- No Level. */
AMP_LEVEL_SWR = (1 << 0), /*!< \c SWR 1.0 or greater. */
AMP_LEVEL_NH = (1 << 1), /*!< \c Tune setting in nanohenries. */
AMP_LEVEL_PF = (1 << 2), /*!< \c Tune setting in picofarads. */
AMP_LEVEL_PWR_INPUT = (1 << 3), /*!< \c Power reading from amplifier. */
AMP_LEVEL_PWR_FWD = (1 << 4), /*!< \c Power reading forward. */
AMP_LEVEL_PWR_REFLECTED = (1 << 5), /*!< \c Power reading reverse. */
AMP_LEVEL_PWR_PEAK = (1 << 6), /*!< \c Power reading peak. */
AMP_LEVEL_FAULT = (1 << 7) /*!< \c Fault code. */
};
//! @endcond
//! @cond Doxygen_Suppress
#define AMP_LEVEL_FLOAT_LIST (AMP_LEVEL_SWR)
#define AMP_LEVEL_STRING_LIST (AMP_LEVEL_FAULT)
#define AMP_LEVEL_IS_FLOAT(l) ((l)&AMP_LEVEL_FLOAT_LIST)
#define AMP_LEVEL_IS_STRING(l) ((l)&AMP_LEVEL_STRING_LIST)
//! @endcond
/* Basic amp type, can store some useful info about different amplifiers. Each
* lib must be able to populate this structure, so we can make useful
* enquiries about capabilities.
*/
//! @cond Doxygen_Suppress
#define AMP_MODEL(arg) .amp_model=arg,.macro_name=#arg
//! @endcond
/**
* \brief Amplifier capabilities.
*
* \struct amp_caps
*
* The main idea of this struct is that it will be defined by the backend
* amplifier driver and will remain read-only for the application. Fields
* that need to be modifiable by the application are copied into the
* amp_state structure, which is the private memory area of the #AMP instance.
*
* This way you can have several amplifiers running within the same
* application, sharing the amp_caps structure of the backend, while keeping
* their own customized data.
*
* \b Note: Don't move fields around and only add new fields at the end of the
* amp_caps structure. Shared libraries and DLLs depend on a constant
* structure to maintain compatibility.
*/
struct amp_caps
{
amp_model_t amp_model; /*!< Amplifier model as defined in amplist.h. */
const char *model_name; /*!< Model name, e.g. MM-5k. */
const char *mfg_name; /*!< Manufacturer, e.g. Moonbeam. */
const char *version; /*!< Driver version, typically in YYYYMMDD.x format. */
const char *copyright; /*!< Copyright info (should be LGPL). */
enum rig_status_e status; /*!< Driver status. */
int amp_type; /*!< Amplifier type. */
enum rig_port_e port_type; /*!< Type of communication port (serial, ethernet, etc.). */
int serial_rate_min; /*!< Minimal serial speed. */
int serial_rate_max; /*!< Maximal serial speed. */
int serial_data_bits; /*!< Number of data bits. */
int serial_stop_bits; /*!< Number of stop bits. */
enum serial_parity_e serial_parity; /*!< Parity. */
enum serial_handshake_e serial_handshake; /*!< Handshake. */
int write_delay; /*!< Write delay. */
int post_write_delay; /*!< Post-write delay. */
int timeout; /*!< Timeout. */
int retry; /*!< Number of retries if a command fails. */
const struct confparams *cfgparams; /*!< Configuration parameters. */
const rig_ptr_t priv; /*!< Private data. */
const char *amp_model_macro_name; /*!< Model macro name. */
setting_t has_get_level; /*!< List of get levels. */
setting_t has_set_level; /*!< List of set levels. */
gran_t level_gran[RIG_SETTING_MAX]; /*!< Level granularity. */
gran_t parm_gran[RIG_SETTING_MAX]; /*!< Parameter granularity. */
/*
* Amp Admin API
*
*/
int (*amp_init)(AMP *amp); /*!< Pointer to backend implementation of ::amp_init(). */
int (*amp_cleanup)(AMP *amp); /*!< Pointer to backend implementation of ::amp_cleanup(). */
int (*amp_open)(AMP *amp); /*!< Pointer to backend implementation of ::amp_open(). */
int (*amp_close)(AMP *amp); /*!< Pointer to backend implementation of ::amp_close(). */
int (*set_freq)(AMP *amp, freq_t val); /*!< Pointer to backend implementation of ::amp_set_freq(). */
int (*get_freq)(AMP *amp, freq_t *val); /*!< Pointer to backend implementation of ::amp_get_freq(). */
int (*set_conf)(AMP *amp, token_t token, const char *val); /*!< Pointer to backend implementation of ::amp_set_conf(). */
int (*get_conf)(AMP *amp, token_t token, char *val); /*!< Pointer to backend implementation of ::amp_get_conf(). */
/*
* General API commands, from most primitive to least.. :()
* List Set/Get functions pairs
*/
int (*reset)(AMP *amp, amp_reset_t reset); /*!< Pointer to backend implementation of ::amp_reset(). */
int (*get_level)(AMP *amp, setting_t level, value_t *val); /*!< Pointer to backend implementation of ::amp_get_level(). */
int (*get_ext_level)(AMP *amp, token_t level, value_t *val); /*!< Pointer to backend implementation of ::amp_get_ext_level(). */
int (*set_powerstat)(AMP *amp, powerstat_t status); /*!< Pointer to backend implementation of ::amp_set_powerstat(). */
int (*get_powerstat)(AMP *amp, powerstat_t *status); /*!< Pointer to backend implementation of ::amp_get_powerstat(). */
/* get firmware info, etc. */
const char *(*get_info)(AMP *amp); /*!< Pointer to backend implementation of ::amp_get_info(). */
//! @cond Doxygen_Suppress
setting_t levels;
unsigned ext_levels;
//! @endcond
const struct confparams *extlevels; /*!< Extension levels list. \sa extamp.c */
const struct confparams *extparms; /*!< Extension parameters list. \sa extamp.c */
const char *macro_name; /*!< Amplifier model macro name. */
};
/**
* \brief Amplifier state structure.
*
* \struct amp_state
*
* This structure contains live data, as well as a copy of capability fields
* that may be updated, i.e. customized while the #AMP handle is instantiated.
*
* It is fine to move fields around, as this kind of struct should not be
* initialized like amp_caps are.
*/
struct amp_state
{
/*
* overridable fields
*/
/*
* non overridable fields, internal use
*/
hamlib_port_t ampport; /*!< Amplifier port (internal use). */
int comm_state; /*!< Comm port state, opened/closed. */
rig_ptr_t priv; /*!< Pointer to private amplifier state data. */
rig_ptr_t obj; /*!< Internal use by hamlib++ for event handling. */
setting_t has_get_level; /*!< List of get levels. */
gran_t level_gran[RIG_SETTING_MAX]; /*!< Level granularity. */
gran_t parm_gran[RIG_SETTING_MAX]; /*!< Parameter granularity. */
};
/**
* \brief Master amplifier structure.
*
* \struct amp
*
* Master amplifier data structure acting as the #AMP handle for the
* controlled amplifier. A pointer to this structure is returned by the
* amp_init() API function and is passed as a parameter to every amplifier
* specific API call.
*
* \sa amp_init(), amp_caps, amp_state
*/
struct amp
{
struct amp_caps *caps; /*!< Amplifier caps. */
struct amp_state state; /*!< Amplifier state. */
};
//! @cond Doxygen_Suppress
/* --------------- API function prototypes -----------------*/
extern HAMLIB_EXPORT(AMP *)
amp_init HAMLIB_PARAMS((amp_model_t amp_model));
extern HAMLIB_EXPORT(int)
amp_open HAMLIB_PARAMS((AMP *amp));
extern HAMLIB_EXPORT(int)
amp_close HAMLIB_PARAMS((AMP *amp));
extern HAMLIB_EXPORT(int)
amp_cleanup HAMLIB_PARAMS((AMP *amp));
extern HAMLIB_EXPORT(int)
amp_set_conf HAMLIB_PARAMS((AMP *amp,
token_t token,
const char *val));
extern HAMLIB_EXPORT(int)
amp_get_conf HAMLIB_PARAMS((AMP *amp,
token_t token,
char *val));
extern HAMLIB_EXPORT(int)
amp_set_powerstat HAMLIB_PARAMS((AMP *amp,
powerstat_t status));
extern HAMLIB_EXPORT(int)
amp_get_powerstat HAMLIB_PARAMS((AMP *amp,
powerstat_t *status));
/*
* General API commands, from most primitive to least.. )
* List Set/Get functions pairs
*/
extern HAMLIB_EXPORT(int)
amp_get_freq HAMLIB_PARAMS((AMP *amp,
freq_t *freq));
extern HAMLIB_EXPORT(int)
amp_set_freq HAMLIB_PARAMS((AMP *amp,
freq_t freq));
extern HAMLIB_EXPORT(int)
amp_reset HAMLIB_PARAMS((AMP *amp,
amp_reset_t reset));
extern HAMLIB_EXPORT(const char *)
amp_get_info HAMLIB_PARAMS((AMP *amp));
extern HAMLIB_EXPORT(int)
amp_get_level HAMLIB_PARAMS((AMP *amp, setting_t level, value_t *val));
extern HAMLIB_EXPORT(int)
amp_register HAMLIB_PARAMS((const struct amp_caps *caps));
extern HAMLIB_EXPORT(int)
amp_unregister HAMLIB_PARAMS((amp_model_t amp_model));
extern HAMLIB_EXPORT(int)
amp_list_foreach HAMLIB_PARAMS((int (*cfunc)(const struct amp_caps *,
rig_ptr_t),
rig_ptr_t data));
extern HAMLIB_EXPORT(int)
amp_load_backend HAMLIB_PARAMS((const char *be_name));
extern HAMLIB_EXPORT(int)
amp_check_backend HAMLIB_PARAMS((amp_model_t amp_model));
extern HAMLIB_EXPORT(int)
amp_load_all_backends HAMLIB_PARAMS((void));
extern HAMLIB_EXPORT(amp_model_t)
amp_probe_all HAMLIB_PARAMS((hamlib_port_t *p));
extern HAMLIB_EXPORT(int)
amp_token_foreach HAMLIB_PARAMS((AMP *amp,
int (*cfunc)(const struct confparams *,
rig_ptr_t),
rig_ptr_t data));
extern HAMLIB_EXPORT(const struct confparams *)
amp_confparam_lookup HAMLIB_PARAMS((AMP *amp,
const char *name));
extern HAMLIB_EXPORT(token_t)
amp_token_lookup HAMLIB_PARAMS((AMP *amp,
const char *name));
extern HAMLIB_EXPORT(const struct amp_caps *)
amp_get_caps HAMLIB_PARAMS((amp_model_t amp_model));
extern HAMLIB_EXPORT(setting_t)
amp_has_get_level HAMLIB_PARAMS((AMP *amp,
setting_t level));
extern HAMLIB_EXPORT(const struct confparams *)
amp_ext_lookup HAMLIB_PARAMS((AMP *amp,
const char *name));
extern HAMLIB_EXPORT(int)
amp_get_ext_level HAMLIB_PARAMS((AMP *amp,
token_t token,
value_t *val));
extern HAMLIB_EXPORT(const char *) amp_strlevel(setting_t);
extern HAMLIB_EXPORT(const struct confparams *)
rig_ext_lookup HAMLIB_PARAMS((RIG *rig,
const char *name));
extern HAMLIB_EXPORT(setting_t) amp_parse_level(const char *s);
extern HAMLIB_EXPORT(const char *) amp_strlevel(setting_t);
//! @endcond
/**
* \brief Convenience macro for generating debugging messages.
*
* \def amp_debug
*
* This is an alias of the rig_debug() function call and is used in the same
* manner.
*/
#define amp_debug rig_debug
__END_DECLS
#endif /* _AMPLIFIER_H */
/** @} */

120
external/hamlib/hamlib/amplist.h vendored Normal file
View File

@ -0,0 +1,120 @@
/*
* Hamlib Interface - list of known amplifiers
* Copyright (c) 2000-2011 by Stephane Fillod
* Copyright (c) 2000-2002 by Frank Singleton
* Copyright (C) 2019 by Michael Black W9MDB. Derived from rotlist.h
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef _AMPLIST_H
#define _AMPLIST_H 1
//! @cond Doxygen_Suppress
#define AMP_MAKE_MODEL(a,b) ((a)*100+(b))
#define AMP_BACKEND_NUM(a) ((a)/100)
//! @endcond
/**
* \addtogroup amplifier
* @{
*/
/**
* \brief Hamlib amplifier model definitions.
*
* \file amplist.h
*
* This file contains amplifier model definitions for the Hamlib amplifier
* Application Programming Interface (API). Each distinct amplifier type has
* a unique model number (ID) and is used by Hamlib to identify and
* distinguish between the different hardware drivers. The exact model
* numbers can be acquired using the macros in this file. To obtain a list of
* supported amplifier branches, one can use the statically defined
* AMP_BACKEND_LIST macro (defined in configure.ac). To obtain a full list of
* supported amplifiers (including each model in every branch), the
* foreach_opened_amp() API function can be used.
*
* The model number, or ID, is used to tell Hamlib which amplifier the client
* wishes to use which is done with the amp_init() API call.
*/
/**
* \brief A macro that returns the model number for an unknown model.
*
* \def AMP_MODEL_NONE
*
* The none backend, as the name suggests, does nothing. It is mainly for
* internal use.
*/
#define AMP_MODEL_NONE 0
/**
* \brief A macro that returns the model number for the DUMMY backend.
*
* \def AMP_MODEL_DUMMY
*
* The DUMMY backend, as the name suggests, is a backend which performs no
* hardware operations and always behaves as one would expect. It can be
* thought of as a hardware simulator and is very useful for testing client
* applications.
*/
/**
* \brief A macro that returns the model number for the NETAMPCTL backend.
*
* \def AMP_MODEL_NETAMPCTL
*
* The NETAMPCTL backend allows use of the `ampctld` daemon through the normal
* Hamlib API.
*/
//! @cond Doxygen_Suppress
#define AMP_DUMMY 0
#define AMP_BACKEND_DUMMY "dummy"
//! @endcond
#define AMP_MODEL_DUMMY AMP_MAKE_MODEL(AMP_DUMMY, 1)
#define AMP_MODEL_NETAMPCTL AMP_MAKE_MODEL(AMP_DUMMY, 2)
/**
* \brief A macro that returns the model number of the KPA1500 backend.
*
* \def AMP_MODEL_ELECRAFT_KPA1500
*
* The KPA1500 backend can be used with amplifiers that support the Elecraft
* KPA-1500 protocol.
*/
//! @cond Doxygen_Suppress
#define AMP_ELECRAFT 2
#define AMP_BACKEND_ELECRAFT "elecraft"
//! @endcond
#define AMP_MODEL_ELECRAFT_KPA1500 AMP_MAKE_MODEL(AMP_ELECRAFT, 1)
//#define AMP_MODEL_ELECRAFT_KPA500 AMP_MAKE_MODEL(AMP_ELECRAFT, 2)
/**
* \brief Convenience type definition for an amplifier model.
*
* \typedef typedef int amp_model_t
*/
typedef int amp_model_t;
#endif /* _AMPLIST_H */
/** @} */

File diff suppressed because it is too large Load Diff

View File

@ -32,7 +32,7 @@
#if defined(_WIN32) && !defined(__CYGWIN__)
# undef HAMLIB_IMPEXP
# undef BACKEND_IMPEXP
# undef HAMLIB_CPP_IMPEXP
# undef HAMLIB_API
# undef HAMLIB_EXPORT
# undef HAMLIB_EXPORT_VAR
@ -42,26 +42,26 @@
# undef HAMLIB_DLL_EXPORT
# if defined (__BORLANDC__)
# define HAMLIB_DLL_IMPORT __import
# define HAMLIB_DLL_EXPORT __export
# define HAMLIB_DLL_IMPORT __import
# define HAMLIB_DLL_EXPORT __export
# else
# define HAMLIB_DLL_IMPORT __declspec(dllimport)
# define HAMLIB_DLL_EXPORT __declspec(dllexport)
# define HAMLIB_DLL_IMPORT __declspec(dllimport)
# define HAMLIB_DLL_EXPORT __declspec(dllexport)
# endif
# ifdef DLL_EXPORT
/* HAMLIB_API may be set to __stdcall for VB, .. */
/* HAMLIB_API may be set to __stdcall for VB, .. */
# define HAMLIB_API __cdecl
# ifdef IN_HAMLIB
# define BACKEND_IMPEXP HAMLIB_DLL_EXPORT
# define HAMLIB_CPP_IMPEXP HAMLIB_DLL_EXPORT
# define HAMLIB_IMPEXP HAMLIB_DLL_EXPORT
# else
# define BACKEND_IMPEXP HAMLIB_DLL_EXPORT
# define HAMLIB_CPP_IMPEXP HAMLIB_DLL_IMPORT
# define HAMLIB_IMPEXP HAMLIB_DLL_IMPORT
# endif
# else
/* static build, only export the backend entry points for lt_dlsym */
# define BACKEND_IMPEXP HAMLIB_DLL_EXPORT
/* static build, only export the backend entry points for lt_dlsym */
# define HAMLIB_CPP_IMPEXP HAMLIB_DLL_EXPORT
# endif
#endif
@ -70,8 +70,8 @@
#if !defined(HAMLIB_IMPEXP)
# define HAMLIB_IMPEXP
#endif
#if !defined(BACKEND_IMPEXP)
# define BACKEND_IMPEXP
#if !defined(HAMLIB_CPP_IMPEXP)
# define HAMLIB_CPP_IMPEXP
#endif
#if !defined(HAMLIB_API)
# define HAMLIB_API
@ -83,10 +83,8 @@
# define HAMLIB_EXPORT_VAR(type) HAMLIB_IMPEXP type
#endif
#if !defined(BACKEND_EXPORT)
# define BACKEND_EXPORT(type) BACKEND_IMPEXP type HAMLIB_API
# define BACKEND_EXPORT(type) HAMLIB_CPP_IMPEXP type HAMLIB_API
#endif
#if !defined(BACKEND_EXPORT_VAR)
# define BACKEND_EXPORT_VAR(type) BACKEND_IMPEXP type
# define BACKEND_EXPORT_VAR(type) HAMLIB_CPP_IMPEXP type
#endif

View File

@ -23,22 +23,30 @@
#ifndef _RIGLIST_H
#define _RIGLIST_H 1
#define RIG_MAKE_MODEL(a,b) ((a)*100+(b))
#define RIG_BACKEND_NUM(a) ((a)/100)
//! @cond Doxygen_Suppress
// The rig model number is designed to fit in a 32-bit int
// As of 2020-02-18 we have 33 backends defined
// With a max of 1000 models per backend we get total a model number range of 1001-33001
// This MAX was 100 prior to 2020-02-18 and Icom was close to running out of the 100 range
#define MAX_MODELS_PER_BACKEND 1000
#define RIG_MAKE_MODEL(a,b) ((a)*MAX_MODELS_PER_BACKEND+(b))
#define RIG_BACKEND_NUM(a) ((a)/MAX_MODELS_PER_BACKEND)
/*! \file riglist.h
* \brief Hamlib rig(radio) model definitions.
*
* This file contains rig model definitions for the Hamlib rig API.
* Each distinct rig type has a unique model number (ID) and is used
* by hamlib to identify and distinguish between the different hardware drivers.
* The exact model numbers can be acquired using the macros in this
* file. To obtain a list of supported rig branches, one can use the statically
* defined RIG_BACKEND_LIST macro. To obtain a full list of supported rig (including
* each model in every branch), the foreach_opened_rig() API function can be used.
* This file contains rig model definitions for the Hamlib rig API. Each
* distinct rig type has a unique model number (ID) and is used by hamlib to
* identify and distinguish between the different hardware drivers. The
* exact model numbers can be acquired using the macros in this file. To
* obtain a list of supported rig branches, one can use the statically
* defined RIG_BACKEND_LIST macro. To obtain a full list of supported rig
* (including each model in every branch), the foreach_opened_rig() API
* function can be used.
*
* The model number, or ID, is used to tell hamlib, which rig the client whishes to
* use. It is done with the rig_init() API call.
* The model number, or ID, is used to tell hamlib, which rig the client
* whishes to use. It is done with the rig_init() API call.
*/
#define RIG_MODEL_NONE 0
@ -46,20 +54,28 @@
/*! \def RIG_MODEL_DUMMY
* \brief A macro that returns the model number for the dummy backend.
*
* The dummy backend, as the name suggests, is a backend which performs
* no hardware operations and always behaves as one would expect. It can
* be thought of as a hardware simulator and is very usefull for testing
* client applications.
* The dummy backend, as the name suggests, is a backend which performs no
* hardware operations and always behaves as one would expect. It can be
* thought of as a hardware simulator and is very useful for testing client
* applications.
*
* It has also been expanded to provide support to "virtual" type of rigs
* such as the network rig control backend and W1HKJ's Flrig application.
*/
#define RIG_DUMMY 0
#define RIG_BACKEND_DUMMY "dummy"
#define RIG_MODEL_DUMMY RIG_MAKE_MODEL(RIG_DUMMY, 1)
#define RIG_MODEL_NETRIGCTL RIG_MAKE_MODEL(RIG_DUMMY, 2)
#define RIG_MODEL_ARMSTRONG RIG_MAKE_MODEL(RIG_DUMMY, 3)
#define RIG_MODEL_FLRIG RIG_MAKE_MODEL(RIG_DUMMY, 4)
#define RIG_MODEL_TRXMANAGER_RIG RIG_MAKE_MODEL(RIG_DUMMY, 5)
#define RIG_MODEL_DUMMY_NOVFO RIG_MAKE_MODEL(RIG_DUMMY, 6)
#define RIG_MODEL_TCI1X RIG_MAKE_MODEL(RIG_DUMMY, 7)
/*
* Yaesu
*/
/*
* Yaesu
*/
#define RIG_YAESU 1
#define RIG_BACKEND_YAESU "yaesu"
#define RIG_MODEL_FT847 RIG_MAKE_MODEL(RIG_YAESU, 1)
@ -95,12 +111,23 @@
#define RIG_MODEL_FT980 RIG_MAKE_MODEL(RIG_YAESU, 31)
#define RIG_MODEL_FTDX5000 RIG_MAKE_MODEL(RIG_YAESU, 32)
#define RIG_MODEL_VX1700 RIG_MAKE_MODEL(RIG_YAESU, 33)
#define RIG_MODEL_FT1200 RIG_MAKE_MODEL(RIG_YAESU, 34)
#define RIG_MODEL_FTDX1200 RIG_MAKE_MODEL(RIG_YAESU, 34)
#define RIG_MODEL_FT991 RIG_MAKE_MODEL(RIG_YAESU, 35)
#define RIG_MODEL_FT891 RIG_MAKE_MODEL(RIG_YAESU, 36)
#define RIG_MODEL_FTDX3000 RIG_MAKE_MODEL(RIG_YAESU, 37)
#define RIG_MODEL_FT847UNI RIG_MAKE_MODEL(RIG_YAESU, 38)
#define RIG_MODEL_FT600 RIG_MAKE_MODEL(RIG_YAESU, 39)
#define RIG_MODEL_FTDX101D RIG_MAKE_MODEL(RIG_YAESU, 40)
#define RIG_MODEL_FT818 RIG_MAKE_MODEL(RIG_YAESU, 41)
#define RIG_MODEL_FTDX10 RIG_MAKE_MODEL(RIG_YAESU, 42)
#define RIG_MODEL_FT897D RIG_MAKE_MODEL(RIG_YAESU, 43)
#define RIG_MODEL_FTDX101MP RIG_MAKE_MODEL(RIG_YAESU, 44)
#define RIG_MODEL_MCHFQRP RIG_MAKE_MODEL(RIG_YAESU, 45)
/*
* Kenwood
*/
/*
* Kenwood
*/
#define RIG_KENWOOD 2
#define RIG_BACKEND_KENWOOD "kenwood"
#define RIG_MODEL_TS50 RIG_MAKE_MODEL(RIG_KENWOOD, 1)
@ -114,7 +141,7 @@
#define RIG_MODEL_TS850 RIG_MAKE_MODEL(RIG_KENWOOD, 9)
#define RIG_MODEL_TS870S RIG_MAKE_MODEL(RIG_KENWOOD, 10)
#define RIG_MODEL_TS940 RIG_MAKE_MODEL(RIG_KENWOOD, 11)
#define RIG_MODEL_TS950 RIG_MAKE_MODEL(RIG_KENWOOD, 12)
#define RIG_MODEL_TS950S RIG_MAKE_MODEL(RIG_KENWOOD, 12)
#define RIG_MODEL_TS950SDX RIG_MAKE_MODEL(RIG_KENWOOD, 13)
#define RIG_MODEL_TS2000 RIG_MAKE_MODEL(RIG_KENWOOD, 14)
#define RIG_MODEL_R5000 RIG_MAKE_MODEL(RIG_KENWOOD, 15)
@ -138,14 +165,24 @@
#define RIG_MODEL_THD72A RIG_MAKE_MODEL(RIG_KENWOOD, 33)
#define RIG_MODEL_TMD710 RIG_MAKE_MODEL(RIG_KENWOOD, 34)
#define RIG_MODEL_TMV71 RIG_MAKE_MODEL(RIG_KENWOOD, 35)
#define RIG_MODEL_F6K RIG_MAKE_MODEL(RIG_KENWOOD, 36) /* Flex 6000 Series */
#define RIG_MODEL_F6K RIG_MAKE_MODEL(RIG_KENWOOD, 36) /* Flex 6000 Series */
#define RIG_MODEL_TS590SG RIG_MAKE_MODEL(RIG_KENWOOD, 37)
#define RIG_MODEL_XG3 RIG_MAKE_MODEL(RIG_KENWOOD, 38)
#define RIG_MODEL_XG3 RIG_MAKE_MODEL(RIG_KENWOOD, 38) /* Elecraft XG-3 signal generator */
#define RIG_MODEL_TS990S RIG_MAKE_MODEL(RIG_KENWOOD, 39)
#define RIG_MODEL_HPSDR RIG_MAKE_MODEL(RIG_KENWOOD, 40) /* OpenHPSDR, PiHPSDR */
#define RIG_MODEL_TS890S RIG_MAKE_MODEL(RIG_KENWOOD, 41)
#define RIG_MODEL_THD74 RIG_MAKE_MODEL(RIG_KENWOOD, 42)
#define RIG_MODEL_K3S RIG_MAKE_MODEL(RIG_KENWOOD, 43)
#define RIG_MODEL_KX2 RIG_MAKE_MODEL(RIG_KENWOOD, 44)
#define RIG_MODEL_KX3 RIG_MAKE_MODEL(RIG_KENWOOD, 45)
#define RIG_MODEL_PT8000A RIG_MAKE_MODEL(RIG_KENWOOD, 46)
#define RIG_MODEL_K4 RIG_MAKE_MODEL(RIG_KENWOOD, 47)
#define RIG_MODEL_POWERSDR RIG_MAKE_MODEL(RIG_KENWOOD, 48)
#define RIG_MODEL_MALACHITE RIG_MAKE_MODEL(RIG_KENWOOD, 49)
/*
* Icom
*/
/*
* Icom
*/
#define RIG_ICOM 3
#define RIG_BACKEND_ICOM "icom"
#define RIG_MODEL_IC1271 RIG_MAKE_MODEL(RIG_ICOM, 1)
@ -180,7 +217,7 @@
#define RIG_MODEL_IC775 RIG_MAKE_MODEL(RIG_ICOM, 30)
#define RIG_MODEL_IC781 RIG_MAKE_MODEL(RIG_ICOM, 31)
#define RIG_MODEL_IC820 RIG_MAKE_MODEL(RIG_ICOM, 32)
#define RIG_MODEL_IC821 RIG_MAKE_MODEL(RIG_ICOM, 33)
//#define RIG_MODEL_IC821 RIG_MAKE_MODEL(RIG_ICOM, 33) // not implemented and can be reused
#define RIG_MODEL_IC821H RIG_MAKE_MODEL(RIG_ICOM, 34)
#define RIG_MODEL_IC970 RIG_MAKE_MODEL(RIG_ICOM, 35)
#define RIG_MODEL_ICR10 RIG_MAKE_MODEL(RIG_ICOM, 36)
@ -194,16 +231,16 @@
#define RIG_MODEL_IC910 RIG_MAKE_MODEL(RIG_ICOM, 44)
#define RIG_MODEL_IC78 RIG_MAKE_MODEL(RIG_ICOM, 45)
#define RIG_MODEL_IC746PRO RIG_MAKE_MODEL(RIG_ICOM, 46)
#define RIG_MODEL_IC756PROII RIG_MAKE_MODEL(RIG_ICOM, 47)
#define RIG_MODEL_IC756PROII RIG_MAKE_MODEL(RIG_ICOM, 47) /* 48-53 defined below */
#define RIG_MODEL_ICID1 RIG_MAKE_MODEL(RIG_ICOM, 54)
#define RIG_MODEL_IC703 RIG_MAKE_MODEL(RIG_ICOM, 55)
#define RIG_MODEL_IC7800 RIG_MAKE_MODEL(RIG_ICOM, 56)
#define RIG_MODEL_IC756PROIII RIG_MAKE_MODEL(RIG_ICOM, 57)
#define RIG_MODEL_ICR20 RIG_MAKE_MODEL(RIG_ICOM, 58)
#define RIG_MODEL_ICR20 RIG_MAKE_MODEL(RIG_ICOM, 58) /* 59 defined below */
#define RIG_MODEL_IC7000 RIG_MAKE_MODEL(RIG_ICOM, 60)
#define RIG_MODEL_IC7200 RIG_MAKE_MODEL(RIG_ICOM, 61)
#define RIG_MODEL_IC7700 RIG_MAKE_MODEL(RIG_ICOM, 62)
#define RIG_MODEL_IC7600 RIG_MAKE_MODEL(RIG_ICOM, 63)
#define RIG_MODEL_IC7600 RIG_MAKE_MODEL(RIG_ICOM, 63) /* 64 defined below */
#define RIG_MODEL_IC92D RIG_MAKE_MODEL(RIG_ICOM, 65)
#define RIG_MODEL_ICR9500 RIG_MAKE_MODEL(RIG_ICOM, 66)
#define RIG_MODEL_IC7410 RIG_MAKE_MODEL(RIG_ICOM, 67)
@ -214,27 +251,41 @@
#define RIG_MODEL_IC2730 RIG_MAKE_MODEL(RIG_ICOM, 72)
#define RIG_MODEL_IC7300 RIG_MAKE_MODEL(RIG_ICOM, 73)
#define RIG_MODEL_PERSEUS RIG_MAKE_MODEL(RIG_ICOM, 74)
/* next one is 75 */
#define RIG_MODEL_IC785x RIG_MAKE_MODEL(RIG_ICOM, 75)
#define RIG_MODEL_X108G RIG_MAKE_MODEL(RIG_ICOM, 76) /* Xiegu X108 */
#define RIG_MODEL_ICR6 RIG_MAKE_MODEL(RIG_ICOM, 77)
#define RIG_MODEL_IC7610 RIG_MAKE_MODEL(RIG_ICOM, 78)
#define RIG_MODEL_ICR8600 RIG_MAKE_MODEL(RIG_ICOM, 79)
#define RIG_MODEL_ICR30 RIG_MAKE_MODEL(RIG_ICOM, 80)
#define RIG_MODEL_IC9700 RIG_MAKE_MODEL(RIG_ICOM, 81)
#define RIG_MODEL_ID4100 RIG_MAKE_MODEL(RIG_ICOM, 82)
#define RIG_MODEL_ID31 RIG_MAKE_MODEL(RIG_ICOM, 83)
#define RIG_MODEL_ID51 RIG_MAKE_MODEL(RIG_ICOM, 84)
#define RIG_MODEL_IC705 RIG_MAKE_MODEL(RIG_ICOM, 85)
/* next one is 86 */
/*
* Optoelectronics (CI-V)
*/
/*
* Optoelectronics (CI-V)
*/
#define RIG_MODEL_MINISCOUT RIG_MAKE_MODEL(RIG_ICOM, 48)
#define RIG_MODEL_XPLORER RIG_MAKE_MODEL(RIG_ICOM, 49)
#define RIG_MODEL_OS535 RIG_MAKE_MODEL(RIG_ICOM, 52)
#define RIG_MODEL_OS456 RIG_MAKE_MODEL(RIG_ICOM, 53)
/*
* TenTec (CI-V)
*/
/*
* TenTec (CI-V)
*/
#define RIG_MODEL_OMNIVI RIG_MAKE_MODEL(RIG_ICOM, 50)
#define RIG_MODEL_OMNIVIP RIG_MAKE_MODEL(RIG_ICOM, 51) /* OMNI-VI+ */
#define RIG_MODEL_PARAGON2 RIG_MAKE_MODEL(RIG_ICOM, 59)
#define RIG_MODEL_DELTAII RIG_MAKE_MODEL(RIG_ICOM, 64)
/*
* Icom PCR
*/
/*
* Icom PCR
*/
#define RIG_PCR 4
#define RIG_BACKEND_PCR "pcr"
#define RIG_MODEL_PCR1000 RIG_MAKE_MODEL(RIG_PCR, 1)
@ -242,9 +293,10 @@
#define RIG_MODEL_PCR1500 RIG_MAKE_MODEL(RIG_PCR, 3)
#define RIG_MODEL_PCR2500 RIG_MAKE_MODEL(RIG_PCR, 4)
/*
* AOR
*/
/*
* AOR
*/
#define RIG_AOR 5
#define RIG_BACKEND_AOR "aor"
#define RIG_MODEL_AR8200 RIG_MAKE_MODEL(RIG_AOR, 1)
@ -264,9 +316,10 @@
#define RIG_MODEL_AR7030P RIG_MAKE_MODEL(RIG_AOR, 15)
#define RIG_MODEL_SR2200 RIG_MAKE_MODEL(RIG_AOR, 16)
/*
* JRC
*/
/*
* JRC
*/
#define RIG_JRC 6
#define RIG_BACKEND_JRC "jrc"
#define RIG_MODEL_JST145 RIG_MAKE_MODEL(RIG_JRC, 1)
@ -277,28 +330,30 @@
#define RIG_MODEL_NRD535 RIG_MAKE_MODEL(RIG_JRC, 6)
#define RIG_MODEL_NRD545 RIG_MAKE_MODEL(RIG_JRC, 7)
/*
* Radio Shack
* Actualy, they might be either Icom or Uniden. TBC --SF
*/
/*
* Radio Shack
* Actually, they might be either Icom or Uniden. TBC --SF
*/
#define RIG_RADIOSHACK 7
#define RIG_BACKEND_RADIOSHACK "radioshack"
#define RIG_MODEL_RS64 RIG_MAKE_MODEL(RIG_RADIOSHACK, 1) /* PRO-64 */
#define RIG_MODEL_RS2005 RIG_MAKE_MODEL(RIG_RADIOSHACK, 2) /* w/ OptoElectronics OS456 Board */
#define RIG_MODEL_RS2006 RIG_MAKE_MODEL(RIG_RADIOSHACK, 3) /* w/ OptoElectronics OS456 Board */
#define RIG_MODEL_RS2035 RIG_MAKE_MODEL(RIG_RADIOSHACK, 4) /* w/ OptoElectronics OS435 Board */
#define RIG_MODEL_RS2042 RIG_MAKE_MODEL(RIG_RADIOSHACK, 5) /* w/ OptoElectronics OS435 Board */
#define RIG_MODEL_RS2041 RIG_MAKE_MODEL(RIG_RADIOSHACK, 6) /* PRO-2041 */
#define RIG_MODEL_RS64 RIG_MAKE_MODEL(RIG_RADIOSHACK, 1) /* PRO-64 */
#define RIG_MODEL_RS2005 RIG_MAKE_MODEL(RIG_RADIOSHACK, 2) /* w/ OptoElectronics OS456 Board */
#define RIG_MODEL_RS2006 RIG_MAKE_MODEL(RIG_RADIOSHACK, 3) /* w/ OptoElectronics OS456 Board */
#define RIG_MODEL_RS2035 RIG_MAKE_MODEL(RIG_RADIOSHACK, 4) /* w/ OptoElectronics OS435 Board */
#define RIG_MODEL_RS2042 RIG_MAKE_MODEL(RIG_RADIOSHACK, 5) /* w/ OptoElectronics OS435 Board */
#define RIG_MODEL_RS2041 RIG_MAKE_MODEL(RIG_RADIOSHACK, 6) /* PRO-2041 */
/*
* Uniden
*/
/*
* Uniden
*/
#define RIG_UNIDEN 8
#define RIG_BACKEND_UNIDEN "uniden"
#define RIG_MODEL_BC780 RIG_MAKE_MODEL(RIG_UNIDEN, 1) /* Uniden BC780 - Trunk Tracker "Desktop Radio" */
#define RIG_MODEL_BC780 RIG_MAKE_MODEL(RIG_UNIDEN, 1) /* Uniden BC780 - Trunk Tracker "Desktop Radio" */
#define RIG_MODEL_BC245 RIG_MAKE_MODEL(RIG_UNIDEN, 2)
#define RIG_MODEL_BC895 RIG_MAKE_MODEL(RIG_UNIDEN, 3)
#define RIG_MODEL_PRO2052 RIG_MAKE_MODEL(RIG_UNIDEN, 4) /* Radio Shack PRO-2052 */
#define RIG_MODEL_PRO2052 RIG_MAKE_MODEL(RIG_UNIDEN, 4) /* Radio Shack PRO-2052 */
#define RIG_MODEL_BC235 RIG_MAKE_MODEL(RIG_UNIDEN, 5)
#define RIG_MODEL_BC250 RIG_MAKE_MODEL(RIG_UNIDEN, 6)
#define RIG_MODEL_BC785 RIG_MAKE_MODEL(RIG_UNIDEN, 7)
@ -308,18 +363,20 @@
#define RIG_MODEL_BCD996T RIG_MAKE_MODEL(RIG_UNIDEN, 11)
#define RIG_MODEL_BC898 RIG_MAKE_MODEL(RIG_UNIDEN, 12)
/*
* Drake
*/
/*
* Drake
*/
#define RIG_DRAKE 9
#define RIG_BACKEND_DRAKE "drake"
#define RIG_MODEL_DKR8 RIG_MAKE_MODEL(RIG_DRAKE, 1)
#define RIG_MODEL_DKR8A RIG_MAKE_MODEL(RIG_DRAKE, 2)
#define RIG_MODEL_DKR8B RIG_MAKE_MODEL(RIG_DRAKE, 3)
/*
* Lowe
*/
/*
* Lowe
*/
#define RIG_LOWE 10
#define RIG_BACKEND_LOWE "lowe"
#define RIG_MODEL_HF150 RIG_MAKE_MODEL(RIG_LOWE, 1)
@ -327,9 +384,10 @@
#define RIG_MODEL_HF250 RIG_MAKE_MODEL(RIG_LOWE, 3)
#define RIG_MODEL_HF235 RIG_MAKE_MODEL(RIG_LOWE, 4)
/*
* Racal
*/
/*
* Racal
*/
#define RIG_RACAL 11
#define RIG_BACKEND_RACAL "racal"
#define RIG_MODEL_RA3790 RIG_MAKE_MODEL(RIG_RACAL, 1)
@ -338,9 +396,10 @@
#define RIG_MODEL_RA3710 RIG_MAKE_MODEL(RIG_RACAL, 4)
#define RIG_MODEL_RA3702 RIG_MAKE_MODEL(RIG_RACAL, 5)
/*
* Watkins-Johnson
*/
/*
* Watkins-Johnson
*/
#define RIG_WJ 12
#define RIG_BACKEND_WJ "wj"
#define RIG_MODEL_HF1000 RIG_MAKE_MODEL(RIG_WJ, 1)
@ -348,9 +407,10 @@
#define RIG_MODEL_WJ8711 RIG_MAKE_MODEL(RIG_WJ, 3)
#define RIG_MODEL_WJ8888 RIG_MAKE_MODEL(RIG_WJ, 4)
/*
* Rohde & Schwarz
*/
/*
* Rohde & Schwarz--ek
*/
#define RIG_EK 13
#define RIG_BACKEND_EK "ek"
#define RIG_MODEL_ESM500 RIG_MAKE_MODEL(RIG_EK, 1)
@ -359,9 +419,10 @@
#define RIG_MODEL_EK895 RIG_MAKE_MODEL(RIG_EK, 4)
#define RIG_MODEL_EK070 RIG_MAKE_MODEL(RIG_EK, 5)
/*
* Skanti
*/
/*
* Skanti
*/
#define RIG_SKANTI 14
#define RIG_BACKEND_SKANTI "skanti"
#define RIG_MODEL_TRP7000 RIG_MAKE_MODEL(RIG_SKANTI, 1)
@ -369,9 +430,10 @@
#define RIG_MODEL_TRP9000 RIG_MAKE_MODEL(RIG_SKANTI, 3)
#define RIG_MODEL_TRP8255 RIG_MAKE_MODEL(RIG_SKANTI, 4)
/*
* WiNRADiO/LinRADiO
*/
/*
* WiNRADiO/LinRADiO
*/
#define RIG_WINRADIO 15
#define RIG_BACKEND_WINRADIO "winradio"
#define RIG_MODEL_WR1000 RIG_MAKE_MODEL(RIG_WINRADIO, 1)
@ -386,69 +448,76 @@
#define RIG_MODEL_G305 RIG_MAKE_MODEL(RIG_WINRADIO, 10)
#define RIG_MODEL_G315 RIG_MAKE_MODEL(RIG_WINRADIO, 11)
/*
* Ten Tec
*/
/*
* Ten Tec
*/
#define RIG_TENTEC 16
#define RIG_BACKEND_TENTEC "tentec"
#define RIG_MODEL_TT550 RIG_MAKE_MODEL(RIG_TENTEC, 1) /* Pegasus */
#define RIG_MODEL_TT538 RIG_MAKE_MODEL(RIG_TENTEC, 2) /* Jupiter */
#define RIG_MODEL_TT550 RIG_MAKE_MODEL(RIG_TENTEC, 1) /* Pegasus */
#define RIG_MODEL_TT538 RIG_MAKE_MODEL(RIG_TENTEC, 2) /* Jupiter */
#define RIG_MODEL_RX320 RIG_MAKE_MODEL(RIG_TENTEC, 3)
#define RIG_MODEL_RX340 RIG_MAKE_MODEL(RIG_TENTEC, 4)
#define RIG_MODEL_RX350 RIG_MAKE_MODEL(RIG_TENTEC, 5)
#define RIG_MODEL_TT526 RIG_MAKE_MODEL(RIG_TENTEC, 6) /* 6N2 */
#define RIG_MODEL_TT516 RIG_MAKE_MODEL(RIG_TENTEC, 7) /* Argonaut V */
#define RIG_MODEL_TT565 RIG_MAKE_MODEL(RIG_TENTEC, 8) /* Orion */
#define RIG_MODEL_TT585 RIG_MAKE_MODEL(RIG_TENTEC, 9) /* Paragon */
#define RIG_MODEL_TT588 RIG_MAKE_MODEL(RIG_TENTEC, 11) /* Omni-VII */
#define RIG_MODEL_TT526 RIG_MAKE_MODEL(RIG_TENTEC, 6) /* 6N2 */
#define RIG_MODEL_TT516 RIG_MAKE_MODEL(RIG_TENTEC, 7) /* Argonaut V */
#define RIG_MODEL_TT565 RIG_MAKE_MODEL(RIG_TENTEC, 8) /* Orion */
#define RIG_MODEL_TT585 RIG_MAKE_MODEL(RIG_TENTEC, 9) /* Paragon */
#define RIG_MODEL_TT588 RIG_MAKE_MODEL(RIG_TENTEC, 11) /* Omni-VII */
#define RIG_MODEL_RX331 RIG_MAKE_MODEL(RIG_TENTEC, 12)
#define RIG_MODEL_TT599 RIG_MAKE_MODEL(RIG_TENTEC, 13) /* Eagle */
/*
* Alinco
*/
/*
* Alinco
*/
#define RIG_ALINCO 17
#define RIG_BACKEND_ALINCO "alinco"
#define RIG_MODEL_DX77 RIG_MAKE_MODEL(RIG_ALINCO, 1)
#define RIG_MODEL_DXSR8 RIG_MAKE_MODEL(RIG_ALINCO, 2)
/*
* Kachina
*/
/*
* Kachina
*/
#define RIG_KACHINA 18
#define RIG_BACKEND_KACHINA "kachina"
#define RIG_MODEL_505DSP RIG_MAKE_MODEL(RIG_KACHINA, 1)
/*
* Gnuradio backend
*/
/*
* Gnuradio backend
*/
#define RIG_GNURADIO 20
#define RIG_BACKEND_GNURADIO "gnuradio"
#define RIG_MODEL_GNURADIO RIG_MAKE_MODEL(RIG_GNURADIO, 1) /* dev model, Chirp source */
#define RIG_MODEL_MC4020 RIG_MAKE_MODEL(RIG_GNURADIO, 2) /* MC4020 */
#define RIG_MODEL_GRAUDIO RIG_MAKE_MODEL(RIG_GNURADIO, 3) /* Sound card source */
#define RIG_MODEL_GRAUDIOIQ RIG_MAKE_MODEL(RIG_GNURADIO, 4) /* I&Q stereo sound card source */
#define RIG_MODEL_USRP_G RIG_MAKE_MODEL(RIG_GNURADIO, 5) /* Universal Software Radio Peripheral */
#define RIG_MODEL_GNURADIO RIG_MAKE_MODEL(RIG_GNURADIO, 1) /* dev model, Chirp source */
#define RIG_MODEL_MC4020 RIG_MAKE_MODEL(RIG_GNURADIO, 2) /* MC4020 */
#define RIG_MODEL_GRAUDIO RIG_MAKE_MODEL(RIG_GNURADIO, 3) /* Sound card source */
#define RIG_MODEL_GRAUDIOIQ RIG_MAKE_MODEL(RIG_GNURADIO, 4) /* I&Q stereo sound card source */
#define RIG_MODEL_USRP_G RIG_MAKE_MODEL(RIG_GNURADIO, 5) /* Universal Software Radio Peripheral */
/*
* Microtune tuners
*/
/*
* Microtune tuners
*/
#define RIG_MICROTUNE 21
#define RIG_BACKEND_MICROTUNE "microtune"
#define RIG_MODEL_MICROTUNE_4937 RIG_MAKE_MODEL(RIG_MICROTUNE, 1) /* eval board */
#define RIG_MODEL_MICROTUNE_4702 RIG_MAKE_MODEL(RIG_MICROTUNE, 2) /* Alan's */
#define RIG_MODEL_MICROTUNE_4937 RIG_MAKE_MODEL(RIG_MICROTUNE, 1) /* eval board */
#define RIG_MODEL_MICROTUNE_4702 RIG_MAKE_MODEL(RIG_MICROTUNE, 2) /* Alan's */
#define RIG_MODEL_MICROTUNE_4707 RIG_MAKE_MODEL(RIG_MICROTUNE, 3)
/*
* TAPR
*/
/*
* TAPR
*/
#define RIG_TAPR 22
#define RIG_BACKEND_TAPR "tapr"
#define RIG_MODEL_DSP10 RIG_MAKE_MODEL(RIG_TAPR, 1)
/*
* Flex-radio
*/
/*
* Flex-radio
*/
#define RIG_FLEXRADIO 23
#define RIG_BACKEND_FLEXRADIO "flexradio"
#define RIG_MODEL_SDR1000 RIG_MAKE_MODEL(RIG_FLEXRADIO, 1)
@ -457,100 +526,137 @@
#define RIG_MODEL_DTTSP_UDP RIG_MAKE_MODEL(RIG_FLEXRADIO, 4)
/*
* VEB Funkwerk Köpenick RFT
*/
/*
* VEB Funkwerk Köpenick RFT
*/
#define RIG_RFT 24
#define RIG_BACKEND_RFT "rft"
#define RIG_MODEL_EKD500 RIG_MAKE_MODEL(RIG_RFT, 1)
/*
* Various kits
*/
/*
* Various kits
*/
#define RIG_KIT 25
#define RIG_BACKEND_KIT "kit"
#define RIG_MODEL_ELEKTOR304 RIG_MAKE_MODEL(RIG_KIT, 1)
#define RIG_MODEL_DRT1 RIG_MAKE_MODEL(RIG_KIT, 2)
#define RIG_MODEL_DWT RIG_MAKE_MODEL(RIG_KIT, 3)
#define RIG_MODEL_USRP0 RIG_MAKE_MODEL(RIG_KIT, 4) /* prototype */
#define RIG_MODEL_USRP0 RIG_MAKE_MODEL(RIG_KIT, 4) /* prototype */
#define RIG_MODEL_USRP RIG_MAKE_MODEL(RIG_KIT, 5)
#define RIG_MODEL_DDS60 RIG_MAKE_MODEL(RIG_KIT, 6)
#define RIG_MODEL_ELEKTOR507 RIG_MAKE_MODEL(RIG_KIT, 7) /* Elektor SDR USB */
#define RIG_MODEL_ELEKTOR507 RIG_MAKE_MODEL(RIG_KIT, 7) /* Elektor SDR USB */
#define RIG_MODEL_MINIVNA RIG_MAKE_MODEL(RIG_KIT, 8)
#define RIG_MODEL_SI570AVRUSB RIG_MAKE_MODEL(RIG_KIT, 9) /* SoftRock Si570 AVR */
#define RIG_MODEL_SI570AVRUSB RIG_MAKE_MODEL(RIG_KIT, 9) /* SoftRock Si570 AVR */
#define RIG_MODEL_PMSDR RIG_MAKE_MODEL(RIG_KIT, 10)
#define RIG_MODEL_SI570PICUSB RIG_MAKE_MODEL(RIG_KIT, 11) /* SoftRock Si570 PIC */
#define RIG_MODEL_FIFISDR RIG_MAKE_MODEL(RIG_KIT, 12) /* FiFi-SDR USB */
#define RIG_MODEL_FUNCUBEDONGLE RIG_MAKE_MODEL(RIG_KIT, 13) /* FunCUBE Dongle */
#define RIG_MODEL_HIQSDR RIG_MAKE_MODEL(RIG_KIT, 14) /* HiQSDR */
#define RIG_MODEL_FASDR RIG_MAKE_MODEL(RIG_KIT,15) /* Funkamateur Sdr */
#define RIG_MODEL_SI570PEABERRY1 RIG_MAKE_MODEL(RIG_KIT, 16) /* Peaberry V1 */
#define RIG_MODEL_SI570PEABERRY2 RIG_MAKE_MODEL(RIG_KIT, 17) /* Peaberry V2 */
#define RIG_MODEL_FUNCUBEDONGLEPLUS RIG_MAKE_MODEL(RIG_KIT, 18) /* FunCUBE Dongle Pro+ */
#define RIG_MODEL_SI570PICUSB RIG_MAKE_MODEL(RIG_KIT, 11) /* SoftRock Si570 PIC */
#define RIG_MODEL_FIFISDR RIG_MAKE_MODEL(RIG_KIT, 12) /* FiFi-SDR USB */
#define RIG_MODEL_FUNCUBEDONGLE RIG_MAKE_MODEL(RIG_KIT, 13) /* FunCUBE Dongle */
#define RIG_MODEL_HIQSDR RIG_MAKE_MODEL(RIG_KIT, 14) /* HiQSDR */
#define RIG_MODEL_FASDR RIG_MAKE_MODEL(RIG_KIT,15) /* Funkamateur Sdr */
#define RIG_MODEL_SI570PEABERRY1 RIG_MAKE_MODEL(RIG_KIT, 16) /* Peaberry V1 */
#define RIG_MODEL_SI570PEABERRY2 RIG_MAKE_MODEL(RIG_KIT, 17) /* Peaberry V2 */
#define RIG_MODEL_FUNCUBEDONGLEPLUS RIG_MAKE_MODEL(RIG_KIT, 18) /* FunCUBE Dongle Pro+ */
#define RIG_MODEL_RSHFIQ RIG_MAKE_MODEL(RIG_KIT, 19) /* RS-HFIQ */
/*
* SW/FM/TV tuner cards supported by Video4Linux,*BSD, ..
*/
/*
* SW/FM/TV tuner cards supported by Video4Linux,*BSD, ..
*/
#define RIG_TUNER 26
#define RIG_BACKEND_TUNER "tuner"
#define RIG_MODEL_V4L RIG_MAKE_MODEL(RIG_TUNER, 1)
#define RIG_MODEL_V4L2 RIG_MAKE_MODEL(RIG_TUNER, 2)
/*
* Rohde&Schwarz
*/
/*
* Rohde & Schwarz--rs
*/
#define RIG_RS 27
#define RIG_BACKEND_RS "rs"
#define RIG_MODEL_ESMC RIG_MAKE_MODEL(RIG_RS, 1)
#define RIG_MODEL_EB200 RIG_MAKE_MODEL(RIG_RS, 2)
#define RIG_MODEL_XK2100 RIG_MAKE_MODEL(RIG_RS, 3)
/*
* Phillips/Simoco PRM80
*/
/*
* Phillips/Simoco PRM80
*/
#define RIG_PRM80 28
#define RIG_BACKEND_PRM80 "prm80"
#define RIG_MODEL_PRM8060 RIG_MAKE_MODEL(RIG_PRM80, 1)
#define RIG_MODEL_PRM8070 RIG_MAKE_MODEL(RIG_PRM80, 2)
/*
* ADAT by HB9CBU
*
* ADDED: frgo (DG1SBG), 2012-01-01
*/
/*
* ADAT by HB9CBU
*
* ADDED: frgo (DG1SBG), 2012-01-01
*/
#define RIG_ADAT 29
#define RIG_BACKEND_ADAT "adat"
#define RIG_MODEL_ADT_200A RIG_MAKE_MODEL(RIG_ADAT, 1)
/*
* ICOM Marine
*/
/*
* ICOM Marine
*/
#define RIG_ICMARINE 30
#define RIG_BACKEND_ICMARINE "icmarine"
#define RIG_MODEL_IC_M700PRO RIG_MAKE_MODEL(RIG_ICMARINE, 1)
#define RIG_MODEL_IC_M802 RIG_MAKE_MODEL(RIG_ICMARINE, 2)
#define RIG_MODEL_IC_M710 RIG_MAKE_MODEL(RIG_ICMARINE, 3)
#define RIG_MODEL_IC_M803 RIG_MAKE_MODEL(RIG_ICMARINE, 4)
/*
* Dorji transceiver modules
*/
#define RIG_DORJI 31
#define RIG_BACKEND_DORJI "dorji"
#define RIG_MODEL_DORJI_DRA818V RIG_MAKE_MODEL(RIG_DORJI, 1)
#define RIG_MODEL_DORJI_DRA818U RIG_MAKE_MODEL(RIG_DORJI, 2)
/*
* Barrett
*/
#define RIG_BARRETT 32
#define RIG_BACKEND_BARRETT "barrett"
#define RIG_MODEL_BARRETT_2050 RIG_MAKE_MODEL(RIG_BARRETT, 1)
#define RIG_MODEL_BARRETT_950 RIG_MAKE_MODEL(RIG_BARRETT, 2)
/*
* Elad
*/
#define RIG_ELAD 33
#define RIG_BACKEND_ELAD "elad"
#define RIG_MODEL_ELAD_FDM_DUO RIG_MAKE_MODEL(RIG_ELAD, 1)
//! @endcond
/*
* TODO:
RIG_MODEL_KWZ30, KNEISNER +DOERING
RIG_MODEL_E1800, DASA-Telefunken
etc.
*/
/*
* TODO:
RIG_MODEL_KWZ30, KNEISNER +DOERING
RIG_MODEL_E1800, DASA-Telefunken
etc.
*/
/*! \typedef typedef int rig_model_t
\brief Convenience type definition for rig model.
*/
typedef int rig_model_t;
typedef uint32_t rig_model_t;
/*
* struct rig_backend_list {
* rig_model_t model;
* const char *backend;
* rig_model_t model;
* const char *backend;
* } rig_backend_list[] = RIG_LIST;
*
* TODO:
*
{ RIG_RADIOSHACK, RIG_BACKEND_RADIOSHACK }, \
{ RIG_RADIOSHACK, RIG_BACKEND_RADIOSHACK }, \
*/
#endif /* _RIGLIST_H */

File diff suppressed because it is too large Load Diff

View File

@ -23,288 +23,615 @@
#ifndef _ROTLIST_H
#define _ROTLIST_H 1
//! @cond Doxygen_Suppress
#define ROT_MAKE_MODEL(a,b) ((a)*100+(b))
#define ROT_BACKEND_NUM(a) ((a)/100)
//! @endcond
/**
* \addtogroup rotator
* @{
*/
/*! \file rotlist.h
* \brief Hamlib rotator model definitions.
/**
* \file rotlist.h
* \brief Hamlib rotator model definitions.
*
* This file contains rotator model definitions for the Hamlib rotator API.
* Each distinct rotator type has a unique model number (ID) and is used
* by hamlib to identify and distinguish between the different hardware drivers.
* The exact model numbers can be acquired using the macros in this
* file. To obtain a list of supported rotator branches, one can use the statically
* defined ROT_BACKEND_LIST macro. To obtain a full list of supported rotators (including
* each model in every branch), the foreach_opened_rot() API function can be used.
* This file contains rotator model definitions for the Hamlib rotator
* Application Programming Interface (API). Each distinct rotator type has a
* unique model number (ID) and is used by Hamlib to identify and distinguish
* between the different hardware drivers. The exact model numbers can be
* acquired using the macros in this file. To obtain a list of supported
* rotator branches, one can use the statically defined ROT_BACKEND_LIST macro
* (defined in configure.ac). To obtain a full list of supported rotators
* (including each model in every branch), the foreach_opened_rot() API
* function can be used.
*
* The model number, or ID, is used to tell hamlib, which rotator the client whishes to
* use. It is done with the rot_init() API call.
* The model number, or ID, is used to tell Hamlib which rotator the client
* wishes to use which is done with the rot_init() API call.
*/
/**
* \def ROT_MODEL_NONE
* \brief A macro that returns the model number for an unknown model.
*
* The none backend, as the name suggests, does nothing. It is mainly for
* internal use.
*/
#define ROT_MODEL_NONE 0
/*! \def ROT_MODEL_DUMMY
* \brief A macro that returns the model number for the dummy backend.
/**
* \brief A macro that returns the model number for the DUMMY backend.
*
* The dummy backend, as the name suggests, is a backend which performs
* no hardware operations and always behaves as one would expect. It can
* be thought of as a hardware simulator and is very usefull for testing
* client applications.
*/
/*! \def ROT_MODEL_NETROTCTL
* \brief A macro that returns the model number for the Network backend.
* \def ROT_MODEL_DUMMY
*
* This backend allows use of the rotctld daemon through the normal
* Hamlib API.
* The DUMMY backend, as the name suggests, is a backend which performs
* no hardware operations and always behaves as one would expect. It can
* be thought of as a hardware simulator and is very useful for testing
* client applications.
*/
/**
* \brief A macro that returns the model number for the NETROTCTL backend.
*
* \def ROT_MODEL_NETROTCTL
*
* The NETROTCTL backend allows use of the `rotctld` daemon through the normal
* Hamlib API.
*/
//! @cond Doxygen_Suppress
#define ROT_DUMMY 0
#define ROT_BACKEND_DUMMY "dummy"
//! @endcond
#define ROT_MODEL_DUMMY ROT_MAKE_MODEL(ROT_DUMMY, 1)
#define ROT_MODEL_NETROTCTL ROT_MAKE_MODEL(ROT_DUMMY, 2)
/*
* Easycomm
*/
/*! \def ROT_MODEL_EASYCOMM1
* \brief A macro that returns the model number of the EasyComm 1 backend.
/**
* \brief A macro that returns the model number of the EASYCOMM 1 backend.
*
* The EasyComm 1 backend can be used with rotators that support the
* EASYCOMM I Standard.
*/
/*! \def ROT_MODEL_EASYCOMM2
* \brief A macro that returns the model number of the EasyComm 2 backend.
* \def ROT_MODEL_EASYCOMM1
*
* The EasyComm 2 backend can be used with rotators that support the
* EASYCOMM II Standard.
* The EASYCOMM1 backend can be used with rotators that support the EASYCOMM
* I Standard.
*/
/**
* \brief A macro that returns the model number of the EASYCOMM 2 backend.
*
* \def ROT_MODEL_EASYCOMM2
*
* The EASYCOMM2 backend can be used with rotators that support the EASYCOMM
* II Standard.
*/
/**
* \brief A macro that returns the model number of the EASYCOMM 3 backend.
*
* \def ROT_MODEL_EASYCOMM3
*
* The EASYCOMM3 backend can be used with rotators that support the EASYCOMM
* III Standard.
*/
//! @cond Doxygen_Suppress
#define ROT_EASYCOMM 2
#define ROT_BACKEND_EASYCOMM "easycomm"
//! @endcond
#define ROT_MODEL_EASYCOMM1 ROT_MAKE_MODEL(ROT_EASYCOMM, 1)
#define ROT_MODEL_EASYCOMM2 ROT_MAKE_MODEL(ROT_EASYCOMM, 2)
#define ROT_MODEL_TRAKBOX ROT_MAKE_MODEL(ROT_EASYCOMM, 3)
#define ROT_MODEL_EASYCOMM3 ROT_MAKE_MODEL(ROT_EASYCOMM, 4)
/*! \def ROT_MODEL_FODTRACK
* \brief A macro that returns the model number of the Fodtrack backend.
/**
* \brief A macro that returns the model number of the FODTRACK backend.
*
* The Fodtrack backend can be used with rotators that support the
* FODTRACK Standard.
* \def ROT_MODEL_FODTRACK
*
* The FODTRACK backend can be used with rotators that support the FODTRACK
* Standard.
*/
//! @cond Doxygen_Suppress
#define ROT_FODTRACK 3
#define ROT_BACKEND_FODTRACK "fodtrack"
//! @endcond
#define ROT_MODEL_FODTRACK ROT_MAKE_MODEL(ROT_FODTRACK, 1)
/*! \def ROT_MODEL_ROTOREZ
* \brief A macro that returns the model number of the Rotor-EZ backend.
/**
* \brief A macro that returns the model number of the ROTOREZ backend.
*
* The Rotor-EZ backend can be used with Hy-Gain rotators that support
* the extended DCU command set by Idiom Press Rotor-EZ board.
*/
/*! \def ROT_MODEL_ROTORCARD
* \brief A macro that returns the model number of the Rotor Card backend.
* \def ROT_MODEL_ROTOREZ
*
* The Rotor-EZ backend can be used with Yaesu rotators that support the
* extended DCU command set by Idiom Press Rotor Card board.
* The ROTOREZ backend can be used with Hy-Gain rotators that support the
* extended DCU command set by the Idiom Press Rotor-EZ board.
*/
/*! \def ROT_MODEL_DCU
* \brief A macro that returns the model number of the DCU backend.
/**
* \brief A macro that returns the model number of the ROTORCARD backend.
*
* The Rotor-EZ backend can be used with rotators that support the
* DCU command set by Hy-Gain (currently the DCU-1).
*/
/*! \def ROT_MODEL_ERC
* \brief A macro that returns the model number of the ERC backend.
* \def ROT_MODEL_ROTORCARD
*
* The Rotor-EZ backend can be used with rotators that support the
* DCU command set by DF9GR (currently the ERC).
* The ROTORCARD backend can be used with Yaesu rotators that support the
* extended DCU command set by the Idiom Press Rotor Card board.
*/
/*! \def ROT_MODEL_RT21
* \brief A macro that returns the model number of the RT21 backend.
/**
* \brief A macro that returns the model number of the DCU backend.
*
* The Rotor-EZ backend can be used with rotators that support the
* DCU command set by Green Heron (currently the RT-21).
* \def ROT_MODEL_DCU
*
* The DCU backend can be used with rotators that support the DCU command set
* by Hy-Gain (currently the DCU-1).
*/
/**
* \brief A macro that returns the model number of the ERC backend.
*
* \def ROT_MODEL_ERC
*
* The ERC backend can be used with rotators that support the DCU command set
* by DF9GR (currently the ERC).
*/
/**
* \brief A macro that returns the model number of the RT21 backend.
*
* \def ROT_MODEL_RT21
*
* The RT21 backend can be used with rotators that support the DCU command set
* by Green Heron (currently the RT-21).
*/
//! @cond Doxygen_Suppress
#define ROT_ROTOREZ 4
#define ROT_BACKEND_ROTOREZ "rotorez"
//! @endcond
#define ROT_MODEL_ROTOREZ ROT_MAKE_MODEL(ROT_ROTOREZ, 1)
#define ROT_MODEL_ROTORCARD ROT_MAKE_MODEL(ROT_ROTOREZ, 2)
#define ROT_MODEL_DCU ROT_MAKE_MODEL(ROT_ROTOREZ, 3)
#define ROT_MODEL_ERC ROT_MAKE_MODEL(ROT_ROTOREZ, 4)
#define ROT_MODEL_RT21 ROT_MAKE_MODEL(ROT_ROTOREZ, 5)
/*! \def ROT_MODEL_SARTEK1
* \brief A macro that returns the model number of the SARtek-1 backend.
/**
* \brief A macro that returns the model number of the SARTEK1 backend.
*
* The sartek backend can be used with rotators that support the
* SARtek protocol.
* \def ROT_MODEL_SARTEK1
*
* The SARTEK1 backend can be used with rotators that support the SARtek
* protocol.
*/
//! @cond Doxygen_Suppress
#define ROT_SARTEK 5
#define ROT_BACKEND_SARTEK "sartek"
//! @endcond
#define ROT_MODEL_SARTEK1 ROT_MAKE_MODEL(ROT_SARTEK, 1)
/*! \def ROT_MODEL_GS232A
* \brief A macro that returns the model number of the GS-232A backend.
/**
* \brief A macro that returns the model number of the GS232A backend.
*
* The GS-232A backend can be used with rotators that support the
* GS-232A protocol.
*/
/*! \def ROT_MODEL_GS232
* \brief A macro that returns the model number of the GS-232 backend.
* \def ROT_MODEL_GS232A
*
* The GS-232 backend can be used with rotators that support the
* GS-232 protocol.
* The GS232A backend can be used with rotators that support the GS-232A
* protocol.
*/
/*! \def ROT_MODEL_GS232B
* \brief A macro that returns the model number of the GS-232B backend.
/**
* \brief A macro that returns the model number of the GS232 backend.
*
* The GS-232B backend can be used with rotators that support the
* GS-232B protocol.
*/
/*! \def ROT_MODEL_F1TETRACKER
* \brief A macro that returns the model number of the F1TETRACKER backend.
* \def ROT_MODEL_GS232_GENERIC
*
* The F1TETRACKER backend can be used with rotators that support the
* F1TETRACKER protocol.
* The GS232_GENERIC backend can be used with rotators that support the
* generic (even if not coded correctly) GS-232 protocol.
*/
/**
* \brief A macro that returns the model number of the GS232B backend.
*
* \def ROT_MODEL_GS232B
*
* The GS232B backend can be used with rotators that support the GS232B
* protocol.
*/
/**
* \brief A macro that returns the model number of the F1TETRACKER backend.
*
* \def ROT_MODEL_F1TETRACKER
*
* The F1TETRACKER backend can be used with rotators that support the F1TE
* Tracker protocol.
*/
/**
* \brief A macro that returns the model number of the GS23 backend.
*
* \def ROT_MODEL_GS23
*
* The GS23 backend can be used with rotators that support the GS-23 protocol.
*/
/**
* \brief A macro that returns the model number of the GS232 backend.
*
* \def ROT_MODEL_GS232
*
* The GS232 backend can be used with rotators that support the GS-232
* protocol.
*/
/**
* \brief A macro that returns the model number of the LVB backend.
*
* \def ROT_MODEL_LVB
*
* The LVB backend can be used with rotators that support the G6LVB AMSAT LVB
* Tracker GS-232 based protocol.
*/
/**
* \brief A macro that returns the model number of the ST2 backend.
*
* \def ROT_MODEL_ST2
*
* The ST2 backend can be used with rotators that support the Fox Delta ST2
* GS-232 based protocol.
*/
/**
* \brief A macro that returns the model number of the GS232A_AZ Azimuth backend.
*
* \def ROT_MODEL_GS232A_AZ
*
* The GS232A_AZ backend can be used with azimuth rotators that support the
* GS-232A protocol.
*/
/**
* \brief A macro that returns the model number of the GS232A_EL Elevation backend.
*
* \def ROT_MODEL_GS232A_EL
*
* The GS232A_EL backend can be used with elevation rotators that support the
* GS-232A protocol.
*/
/**
* \brief A macro that returns the model number of the GS232B_AZ Azimuth backend.
*
* \def ROT_MODEL_GS232B_AZ
*
* The GS232B_AZ backend can be used with azimuth rotators that support the
* GS-232B protocol.
*/
/**
* \brief A macro that returns the model number of the GS232B_EL Elevation backend.
*
* \def ROT_MODEL_GS232B_EL
*
* The GS232B_EL backend can be used with elevation rotators that support the
* GS-232B protocol.
*/
//! @cond Doxygen_Suppress
#define ROT_GS232A 6
#define ROT_BACKEND_GS232A "gs232a"
//! @endcond
#define ROT_MODEL_GS232A ROT_MAKE_MODEL(ROT_GS232A, 1)
#define ROT_MODEL_GS232 ROT_MAKE_MODEL(ROT_GS232A, 2) /* Not A or B */
#define ROT_MODEL_GS232_GENERIC ROT_MAKE_MODEL(ROT_GS232A, 2) /* GENERIC */
#define ROT_MODEL_GS232B ROT_MAKE_MODEL(ROT_GS232A, 3)
#define ROT_MODEL_F1TETRACKER ROT_MAKE_MODEL(ROT_GS232A, 4)
#define ROT_MODEL_GS23 ROT_MAKE_MODEL(ROT_GS232A, 5)
#define ROT_MODEL_GS232 ROT_MAKE_MODEL(ROT_GS232A, 6) /* Not A or B */
#define ROT_MODEL_LVB ROT_MAKE_MODEL(ROT_GS232A, 7)
#define ROT_MODEL_ST2 ROT_MAKE_MODEL(ROT_GS232A, 8)
#define ROT_MODEL_GS232A_AZ ROT_MAKE_MODEL(ROT_GS232A, 9)
#define ROT_MODEL_GS232A_EL ROT_MAKE_MODEL(ROT_GS232A, 10)
#define ROT_MODEL_GS232B_AZ ROT_MAKE_MODEL(ROT_GS232A, 11)
#define ROT_MODEL_GS232B_EL ROT_MAKE_MODEL(ROT_GS232A, 12)
/*! \def ROT_MODEL_PCROTOR
* \brief A macro that returns the model number of the PcRotor/WA6UFQ backend.
/**
* \brief A macro that returns the model number of the PCROTOR backend.
*
* The kit backend can be used with home brewed rotators.
* \def ROT_MODEL_PCROTOR
*
* The PCROTOR backend is a member of the kit backend group that can be used
* with home brewed rotators.
*/
//! @cond Doxygen_Suppress
#define ROT_KIT 7
#define ROT_BACKEND_KIT "kit"
//! @endcond
#define ROT_MODEL_PCROTOR ROT_MAKE_MODEL(ROT_KIT, 1)
/*! \def ROT_MODEL_HD1780
* \brief A macro that returns the model number of the HD 1780 backend.
/**
* \brief A macro that returns the model number of the HD1780 backend.
*
* \def ROT_MODEL_HD1780
*
* The HD1780 backend can be used with rotators that support the Heathkit
* HD-1780 protocol.
*/
//! @cond Doxygen_Suppress
#define ROT_HEATHKIT 8
#define ROT_BACKEND_HEATHKIT "heathkit"
//! @endcond
#define ROT_MODEL_HD1780 ROT_MAKE_MODEL(ROT_HEATHKIT, 1)
/*! \def ROT_MODEL_SPID_ROT2PROG
* \brief A macro that returns the model number of the ROT2PROG backend.
/**
* \brief A macro that returns the model number of the ROT2PROG backend.
*
* The SPID backend can be used with rotators that support the SPID
* protocol.
*/
/*! \def ROT_MODEL_SPID_ROT1PROG
* \brief A macro that returns the model number of the ROT1PROG backend.
* \def ROT_MODEL_SPID_ROT2PROG
*
* The SPID backend can be used with rotators that support the SPID
* protocol.
* The SPID_ROT2PROG backend can be used with rotators that support the SPID
* azimuth and elevation protocol.
*/
/**
* \brief A macro that returns the model number of the ROT1PROG backend.
*
* \def ROT_MODEL_SPID_ROT1PROG
*
* The SPID_ROT1PROG backend can be used with rotators that support the SPID
* azimuth protocol.
*/
/**
* \brief A macro that returns the model number of the SPID_MD01_ROT2PROG backend.
*
* \def ROT_MODEL_SPID_MD01_ROT2PROG
*
* The SPID_MD01_ROT2PROG backend can be used with rotators that support the
* extended SPID ROT2PROG azimuth and elevation protocol.
*/
//! @cond Doxygen_Suppress
#define ROT_SPID 9
#define ROT_BACKEND_SPID "spid"
//! @endcond
#define ROT_MODEL_SPID_ROT2PROG ROT_MAKE_MODEL(ROT_SPID, 1)
#define ROT_MODEL_SPID_ROT1PROG ROT_MAKE_MODEL(ROT_SPID, 2)
#define ROT_MODEL_SPID_MD01_ROT2PROG ROT_MAKE_MODEL(ROT_SPID, 3)
/*! \def ROT_MODEL_RC2800
* \brief A macro that returns the model number of the RC2800 backend.
/**
* \brief A macro that returns the model number of the RC2800 backend.
*
* The M2 backend can be used with rotators that support the RC2800
* protocol and alike.
* \def ROT_MODEL_RC2800
*
* The RC2800 backend can be used with rotators that support the M2 (M
* Squared) RC2800 protocol.
*/
/**
* \brief A macro that returns the model number of the RC2800_EARLY_AZ
* backend.
*
* \def ROT_MODEL_RC2800_EARLY_AZ
*
* The RC2800_EARLY_AZ backend can be used with rotators that support the M2
* (M Squared) RC2800 early azimuth protocol.
*/
/**
* \brief A macro that returns the model number of the RC2800_EARLY_AZEL
* backend.
*
* \def ROT_MODEL_RC2800_EARLY_AZEL
*
* The RC2800_EARLY_AZEL backend can be used with rotators that support the M2
* (M Squared) RC2800 early azimuth and elevation protocol.
*/
//! @cond Doxygen_Suppress
#define ROT_M2 10
#define ROT_BACKEND_M2 "m2"
//! @endcond
#define ROT_MODEL_RC2800 ROT_MAKE_MODEL(ROT_M2, 1)
#define ROT_MODEL_RC2800_EARLY_AZ ROT_MAKE_MODEL(ROT_M2, 2)
#define ROT_MODEL_RC2800_EARLY_AZEL ROT_MAKE_MODEL(ROT_M2, 3)
/*! \def ROT_MODEL_RCI_AZEL
* \brief A macro that returns the model number of the RCI_AZEL backend.
/**
* \brief A macro that returns the model number of the RCI_AZEL backend.
*
* The ARS backend can be used with rotators that support the ARS
* protocol.
*/
/*! \def ROT_MODEL_RCI_AZ
* \brief A macro that returns the model number of the RCI_AZ backend.
* \def ROT_MODEL_RCI_AZEL
*
* The ARS backend can be used with rotators that support the ARS
* protocol.
* The RCI_AZEL backend can be used with rotators that support the ARS azimuth
* and elevation protocol.
*/
/**
* \brief A macro that returns the model number of the RCI_AZ backend.
*
* \def ROT_MODEL_RCI_AZ
*
* The RCI_AZ backend can be used with rotators that support the ARS azimuth
* protocol.
*/
//! @cond Doxygen_Suppress
#define ROT_ARS 11
#define ROT_BACKEND_ARS "ars"
//! @endcond
#define ROT_MODEL_RCI_AZEL ROT_MAKE_MODEL(ROT_ARS, 1)
#define ROT_MODEL_RCI_AZ ROT_MAKE_MODEL(ROT_ARS, 2)
/*! \def ROT_MODEL_IF100
* \brief A macro that returns the model number of the IF-100 backend.
/**
* \brief A macro that returns the model number of the IF100 backend.
*
* The AMSAT backend can be used with rotators that support,
* among other, the IF-100 interface.
* \def ROT_MODEL_IF100
*
* The IF100 backend can be used with rotators that support the AMSAT IF-100
* interface.
*/
//! @cond Doxygen_Suppress
#define ROT_AMSAT 12
#define ROT_BACKEND_AMSAT "amsat"
//! @endcond
#define ROT_MODEL_IF100 ROT_MAKE_MODEL(ROT_AMSAT, 1)
/*! \def ROT_MODEL_TS7400
* \brief A macro that returns the model number of the TS7400 backend.
/**
* \brief A macro that returns the model number of the TS7400 backend.
*
* The TS-7400 backend supports and embedded ARM board using the TS-7400
* Linux board. More information is at http://www.embeddedarm.com
* \def ROT_MODEL_TS7400
*
* The TS7400 backend supports an embedded ARM board using the TS-7400 Linux
* board. More information is at https://www.embeddedarm.com
*/
//! @cond Doxygen_Suppress
#define ROT_TS7400 13
#define ROT_BACKEND_TS7400 "ts7400"
//! @endcond
#define ROT_MODEL_TS7400 ROT_MAKE_MODEL(ROT_TS7400, 1)
/*! \def ROT_MODEL_NEXSTAR
* \brief A macro that returns the model number of the NEXSTAR backend.
/**
* \brief A macro that returns the model number of the NEXSTAR backend.
*
* The CELESTRON backend can be used with rotators that support the Celestron
* protocol and alike.
* \def ROT_MODEL_NEXSTAR
*
* The NEXSTAR backend can be used with rotators that support the Celestron
* NexStar protocol and alike.
*/
//! @cond Doxygen_Suppress
#define ROT_CELESTRON 14
#define ROT_BACKEND_CELESTRON "celestron"
//! @endcond
#define ROT_MODEL_NEXSTAR ROT_MAKE_MODEL(ROT_CELESTRON, 1)
/*! \def ROT_MODEL_ETHER6
* \brief A macro that returns the model number of the Ether6 backend.
/**
* \brief A macro that returns the model number of the ETHER6 backend.
*
* The Ether6 backend can be used with rotators that support the Ether6
* protocol and alike.
* \def ROT_MODEL_ETHER6
*
* The ETHER6 backend can be used with rotators that support the Ether6
* protocol.
*/
//! @cond Doxygen_Suppress
#define ROT_ETHER6 15
#define ROT_BACKEND_ETHER6 "ether6"
//! @endcond
#define ROT_MODEL_ETHER6 ROT_MAKE_MODEL(ROT_ETHER6, 1)
/*! \def ROT_MODEL_CNCTRK
* \brief A macro that returns the model number of the CNCTRK backend.
/**
* \brief A macro that returns the model number of the CNCTRK backend.
*
* The CNCTRK backend can be used with rotators that support,
* the LinuxCNC running Axis GUI interface.
* \def ROT_MODEL_CNCTRK
*
* The CNCTRK backend can be used with rotators that support the LinuxCNC
* running Axis GUI interface.
*/
//! @cond Doxygen_Suppress
#define ROT_CNCTRK 16
#define ROT_BACKEND_CNCTRK "cnctrk"
//! @endcond
#define ROT_MODEL_CNCTRK ROT_MAKE_MODEL(ROT_CNCTRK, 1)
/*! \def ROT_MODEL_PROSISTEL
* \brief A macro that returns the model number of the PROSISTEL backend.
/**
* \brief A macro that returns the model number of the PROSISTEL_D_AZ backend.
*
* \def ROT_MODEL_PROSISTEL_D_AZ
*
* The PROSISTEL_D_AZ backend can be used with rotators that support the Prosistel
* azimuth protocol.
*/
/**
* \brief A macro that returns the model number of the PROSISTEL_D_EL backend.
*
* \def ROT_MODEL_PROSISTEL_D_EL
*
* The PROSISTEL_D_EL backend can be used with rotators that support the Prosistel
* elevation protocol.
*/
/**
* \brief A macro that returns the model number of the
* PROSISTEL_COMBI_TRACK_AZEL backend.
*
* \def ROT_MODEL_PROSISTEL_COMBI_TRACK_AZEL
*
* The PROSISTEL_AZEL_COMBI_TRACK_AZEL backend can be used with rotators that
* support the Prosistel combination azimuth and elevation protocol.
*/
//! @cond Doxygen_Suppress
#define ROT_PROSISTEL 17
#define ROT_BACKEND_PROSISTEL "prosistel"
#define ROT_MODEL_PROSISTEL ROT_MAKE_MODEL(ROT_PROSISTEL, 1)
//! @endcond
#define ROT_MODEL_PROSISTEL_D_AZ ROT_MAKE_MODEL(ROT_PROSISTEL, 1)
#define ROT_MODEL_PROSISTEL_D_EL ROT_MAKE_MODEL(ROT_PROSISTEL, 2)
#define ROT_MODEL_PROSISTEL_COMBI_TRACK_AZEL ROT_MAKE_MODEL(ROT_PROSISTEL, 3)
/*! \typedef typedef int rot_model_t
\brief Convenience type definition for rotator model.
/**
* \brief A macro that returns the model number of the MEADE backend.
*
* \def ROT_MODEL_MEADE
*
* The MEADE backend can be used with Meade telescope rotators like the
* DS-2000.
*/
//! @cond Doxygen_Suppress
#define ROT_MEADE 18
#define ROT_BACKEND_MEADE "meade"
//! @endcond
#define ROT_MODEL_MEADE ROT_MAKE_MODEL(ROT_MEADE, 1)
/**
* \brief A macro that returns the model number of the IOPTRON backend.
*
* \def ROT_MODEL_IOPTRON
*
* The IOPTRON backend can be used with IOPTRON telescope mounts.
*/
//! @cond Doxygen_Suppress
#define ROT_IOPTRON 19
#define ROT_BACKEND_IOPTRON "ioptron"
//! @endcond
#define ROT_MODEL_IOPTRON ROT_MAKE_MODEL(ROT_IOPTRON, 1)
/**
* \brief A macro that returns the model number of the INDI backend.
*
* \def ROT_MODEL_INDI
*
* The INDI backend can be used with rotators that support the INDI interface.
*/
//! @cond Doxygen_Suppress
#define ROT_INDI 20
#define ROT_BACKEND_INDI "indi"
//! @endcond
#define ROT_MODEL_INDI ROT_MAKE_MODEL(ROT_INDI, 1)
/**
* \brief A macro that returns the model number of the SATEL backend.
*
* \def ROT_MODEL_SATEL
*
* The SATEL backend can be used with rotators that support the VE5FP
* interface.
*/
//! @cond Doxygen_Suppress
#define ROT_SATEL 21
#define ROT_BACKEND_SATEL "satel"
//! @endcond
#define ROT_MODEL_SATEL ROT_MAKE_MODEL(ROT_SATEL, 1)
/**
* \brief A macro that returns the model number of the RADANT backend.
*
* \def ROT_MODEL_RADANT
*
* The RADANT backend can be used with rotators that support the MS232
* interface.
*/
//! @cond Doxygen_Suppress
#define ROT_RADANT 22
#define ROT_BACKEND_RADANT "radant"
//! @endcond
#define ROT_MODEL_RADANT ROT_MAKE_MODEL(ROT_RADANT, 1)
#define ROT_ANDROIDSENSOR 23
#define ROT_BACKEND_ANDROIDSENSOR "androidsensor"
#define ROT_MODEL_ANDROIDSENSOR ROT_MAKE_MODEL(ROT_ANDROIDSENSOR, 1)
/**
* \brief Convenience type definition for a rotator model.
*
* \typedef typedef int rot_model_t
*/
typedef int rot_model_t;
#endif /* _ROTLIST_H */
/** @} */

View File

@ -3,11 +3,8 @@
- Install the Msys2 distribution as described on their site (https://msys2.github.io/)
- Add mingw32 and mingw64 compiler to the Msys2 installation.
- Copy config.h, makefile.mingw32, makefile.mingw64 in the liquid-dsp root directory.
- Run a Msys2 Win32 shell (mingw32.exe) and execute 'make -f makefile.mingw32 -j8' to compile a libliquid.dll 32bit Windows Dll.
- Run a Msys2 Win64 shell (mingw64.exe) and execute 'make -f makefile.mingw64 -j8' to compile a libliquid.dll 64bit Windows Dll.
Note that the Win32 dll needs libgcc_s_dw2-1.dll and libwinpthread-1.dll (as a libgcc_s_dw2-1.dll dependency) as dependencies.
On the other hand, Win64 dll has no external dependencies.
- Run a Msys2 Win32 shell (mingw32.exe) and execute 'make -f makefile.mingw32 -j clean' then 'make -f makefile.mingw32 -j' to compile a libliquid.dll 32bit Windows Dll.
- Run a Msys2 Win64 shell (mingw64.exe) and execute 'make -f makefile.mingw64 -j clean' then 'make -f makefile.mingw64 -j' to compile a libliquid.dll 64bit Windows Dll.
This process generates a .dll, .a together with libliquid.def the listing exported functions, and libliquid.lib the import lib matching the dll.

View File

@ -5,9 +5,80 @@
#ifndef __LIQUID_CONFIG_H__
#define __LIQUID_CONFIG_H__
/* Define to 1 to support Advanced Bit Manipulation */
#define HAVE_ABM 1
/* Define to 1 to support Multi-Precision Add-Carry Instruction Extensions */
#define HAVE_ADX 1
/* Define to 1 to support Advanced Encryption Standard New Instruction Set
(AES-NI) */
/* #define HAVE_AES 1 */
/* Support Altivec instructions */
/* #undef HAVE_ALTIVEC */
/* Define to 1 to support Advanced Vector Extensions */
/* #define HAVE_AVX 1 */
/* Define to 1 to support Advanced Vector Extensions 2 */
/* #define HAVE_AVX2 1 */
/* Define to 1 to support AVX-512 Byte and Word Instructions */
/* #undef HAVE_AVX512_BW */
/* Define to 1 to support AVX-512 Conflict Detection Instructions */
/* #undef HAVE_AVX512_CD */
/* Define to 1 to support AVX-512 Doubleword and Quadword Instructions */
/* #undef HAVE_AVX512_DQ */
/* Define to 1 to support AVX-512 Exponential & Reciprocal Instructions */
/* #undef HAVE_AVX512_ER */
/* Define to 1 to support AVX-512 Foundation Extensions */
/* #undef HAVE_AVX512_F */
/* Define to 1 to support AVX-512 Integer Fused Multiply Add Instructions */
/* #undef HAVE_AVX512_IFMA */
/* Define to 1 to support AVX-512 Conflict Prefetch Instructions */
/* #undef HAVE_AVX512_PF */
/* Define to 1 to support AVX-512 Vector Byte Manipulation Instructions */
/* #undef HAVE_AVX512_VBMI */
/* Define to 1 to support AVX-512 Vector Length Extensions */
/* #undef HAVE_AVX512_VL */
/* Define to 1 to support Bit Manipulation Instruction Set 1 */
#define HAVE_BMI1 1
/* Define to 1 to support Bit Manipulation Instruction Set 2 */
#define HAVE_BMI2 1
/* Define to 1 if you have the `cargf' function. */
#define HAVE_CARGF 1
/* Define to 1 if you have the `cexpf' function. */
#define HAVE_CEXPF 1
/* Define to 1 if you have the `cimagf' function. */
#define HAVE_CIMAGF 1
/* Define to 1 if you have the <complex.h> header file. */
#define HAVE_COMPLEX_H 1
/* Define to 1 if you have the `cosf' function. */
#define HAVE_COSF 1
/* Define to 1 if you have the `crealf' function. */
#define HAVE_CREALF 1
/* Define to 1 if you have the `expf' function. */
#define HAVE_EXPF 1
/* Define to 1 if you have the <fec.h> header file. */
/* #undef HAVE_FEC_H */
@ -17,6 +88,15 @@
/* Define to 1 if you have the <float.h> header file. */
#define HAVE_FLOAT_H 1
/* Define to 1 to support Fused Multiply-Add Extensions 3 */
#define HAVE_FMA3 1
/* Define to 1 to support Fused Multiply-Add Extensions 4 */
/* #undef HAVE_FMA4 */
/* Define to 1 if you have the `free' function. */
#define HAVE_FREE 1
/* Define to 1 if you have the <getopt.h> header file. */
#define HAVE_GETOPT_H 1
@ -38,64 +118,59 @@
/* Define to 1 if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1
/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
to 0 otherwise. */
/* Define to 1 if you have the `malloc' function. */
#define HAVE_MALLOC 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the `memmove' function. */
#define HAVE_MEMMOVE 1
/* Define to 1 if you have the <mmintrin.h> header file. */ //MMX
#define HAVE_MMINTRIN_H 1
/* Define to 1 if you have the `memset' function. */
#define HAVE_MEMSET 1
/* Define to 1 if you have the <xmmintrin.h> header file. */ //SSE
#define HAVE_XMMINTRIN_H 1
/* Define to 1 to support Multimedia Extensions */
#define HAVE_MMX 1
/* Define to 1 if you have the <emmintrin.h> header file. */ //SSE2
#define HAVE_EMMINTRIN_H 1
/* Define to 1 to support Memory Protection Extensions */
/* #undef HAVE_MPX */
/* Define to 1 if you have the <pmmintrin.h> header file. */ //SSE3
#define HAVE_PMMINTRIN_H 1
/* Define to 1 to support Prefetch Vector Data Into Caches WT1 */
/* #undef HAVE_PREFETCHWT1 */
/* Define to 1 if you have the <smmintrin.h> header file. */ //SSE4.1
//#define HAVE_SMMINTRIN_H 1
/* Define to 1 to support Digital Random Number Generator */
#define HAVE_RDRND 1
/* Define to 1 if you have the <immintrin.h> header file. */ //AVX
//#define HAVE_IMMINTRIN_H 1
/* The size of `int', as computed by sizeof. */
#define SIZEOF_INT 4
/* The size of `unsigned int', as computed by sizeof. */
#define SIZEOF_UNSIGNED_INT 4
/* Define to 1 if your system has a GNU libc compatible `realloc' function,
and to 0 otherwise. */
/* Define to 1 if you have the `realloc' function. */
#define HAVE_REALLOC 1
/* Support MMX instructions */
#define HAVE_MMX /**/
/* Define to 1 to support Secure Hash Algorithm Extension */
/* #undef HAVE_SHA */
/* Support SSE (Streaming SIMD Extensions) instructions */
#define HAVE_SSE /**/
/* Define to 1 if you have the `sinf' function. */
#define HAVE_SINF 1
/* Support SSE2 (Streaming SIMD Extensions 2) instructions */
#define HAVE_SSE2 /**/
/* Define to 1 if you have the `sqrtf' function. */
#define HAVE_SQRTF 1
/* Support SSE3 (Streaming SIMD Extensions 3) instructions */
#define HAVE_SSE3 /**/
/* Define to 1 to support Streaming SIMD Extensions */
#define HAVE_SSE 1
/* Support SSE4.1 (Streaming SIMD Extensions 4.1) instructions */
#define HAVE_SSE41 /**/
/* Define to 1 to support Streaming SIMD Extensions */
#define HAVE_SSE2 1
/* Support SSE4.2 (Streaming SIMD Extensions 4.2) instructions */
#define HAVE_SSE42 1
/* Define to 1 to support Streaming SIMD Extensions 3 */
#define HAVE_SSE3 1
/* Support SSSE3 (Supplemental Streaming SIMD Extensions 3) instructions */
#define HAVE_SSSE3 /**/
/* Define to 1 to support Streaming SIMD Extensions 4.1 */
#define HAVE_SSE4_1 1
/* Support AVX (Advanced Vector Extensions) instructions */
#define HAVE_AVX /**/
/* Define to 1 to support Streaming SIMD Extensions 4.2 */
#define HAVE_SSE4_2 1
/* Define to 1 to support AMD Streaming SIMD Extensions 4a */
/* #undef HAVE_SSE4a */
/* Define to 1 to support Supplemental Streaming SIMD Extensions 3 */
#define HAVE_SSSE3 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
@ -121,26 +196,35 @@
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <tmmintrin.h> header file. */
#define HAVE_TMMINTRIN_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Support VSX instructions */
/* #undef HAVE_VSX */
/* Define to 1 to support eXtended Operations Extensions */
/* #undef HAVE_XOP */
/* Force internal FFT even if libfftw is available */
/* #undef LIQUID_FFTOVERRIDE */
#undef LIQUID_FFTOVERRIDE
/* Force overriding of SIMD (use portable C code) */
/* #undef LIQUID_SIMDOVERRIDE */
/* Enable strict program exit on error */
/* #undef LIQUID_STRICT_EXIT */
/* Suppress printing errors to stderr */
/* #undef LIQUID_SUPPRESS_ERROR_OUTPUT */
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "support@liquidsdr.org"
#define PACKAGE_BUGREPORT "joseph@liquidsdr.org"
/* Define to the full name of this package. */
#define PACKAGE_NAME "liquid-dsp"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "liquid-dsp 1.3.0"
#define PACKAGE_STRING "liquid-dsp 1.5"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "liquid-dsp"
@ -149,9 +233,23 @@
#define PACKAGE_URL ""
/* Define to the version of this package. */
#define PACKAGE_VERSION "1.3.0"
#define PACKAGE_VERSION "1.5"
/* Define to 1 if you have the ANSI C header files. */
/* The size of `int', as computed by sizeof. */
#define SIZEOF_INT 4
/* The size of `long int', as computed by sizeof. */
#define SIZEOF_LONG_INT 8
/* The size of `long long int', as computed by sizeof. */
#define SIZEOF_LONG_LONG_INT 8
/* The size of `short int', as computed by sizeof. */
#define SIZEOF_SHORT_INT 2
/* Define to 1 if all of the C90 standard headers exist (not just the ones
required in a freestanding environment). This macro is provided for
backward compatibility; new code need not use it. */
#define STDC_HEADERS 1
/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
/*
LodePNG version 20161127
LodePNG version 20180819
Copyright (c) 2005-2016 Lode Vandevenne
Copyright (c) 2005-2018 Lode Vandevenne
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@ -255,6 +255,7 @@ const char* lodepng_error_text(unsigned code);
typedef struct LodePNGDecompressSettings LodePNGDecompressSettings;
struct LodePNGDecompressSettings
{
/* Check LodePNGDecoderSettings for more ignorable errors such as ignore_crc */
unsigned ignore_adler32; /*if 1, continue and don't give an error message if the Adler32 checksum is corrupted*/
/*use custom zlib decoder instead of built in one (default: null)*/
@ -409,23 +410,35 @@ typedef struct LodePNGInfo
/*header (IHDR), palette (PLTE) and transparency (tRNS) chunks*/
unsigned compression_method;/*compression method of the original file. Always 0.*/
unsigned filter_method; /*filter method of the original file*/
unsigned interlace_method; /*interlace method of the original file*/
unsigned interlace_method; /*interlace method of the original file: 0=none, 1=Adam7*/
LodePNGColorMode color; /*color type and bits, palette and transparency of the PNG file*/
#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS
/*
suggested background color chunk (bKGD)
This color uses the same color mode as the PNG (except alpha channel), which can be 1-bit to 16-bit.
Suggested background color chunk (bKGD)
For greyscale PNGs, r, g and b will all 3 be set to the same. When encoding
the encoder writes the red one. For palette PNGs: When decoding, the RGB value
will be stored, not a palette index. But when encoding, specify the index of
the palette in background_r, the other two are then ignored.
This uses the same color mode and bit depth as the PNG (except no alpha channel),
with values truncated to the bit depth in the unsigned integer.
The decoder does not use this background color to edit the color of pixels.
For greyscale and palette PNGs, the value is stored in background_r. The values
in background_g and background_b are then unused.
So when decoding, you may get these in a different color mode than the one you requested
for the raw pixels.
When encoding with auto_convert, you must use the color model defined in info_png.color for
these values. The encoder normally ignores info_png.color when auto_convert is on, but will
use it to interpret these values (and convert copies of them to its chosen color model).
When encoding, avoid setting this to an expensive color, such as a non-grey value
when the image is grey, or the compression will be worse since it will be forced to
write the PNG with a more expensive color mode (when auto_convert is on).
The decoder does not use this background color to edit the color of pixels. This is a
completely optional metadata feature.
*/
unsigned background_defined; /*is a suggested background color given?*/
unsigned background_r; /*red component of suggested background color*/
unsigned background_r; /*red/grey/palette component of suggested background color*/
unsigned background_g; /*green component of suggested background color*/
unsigned background_b; /*blue component of suggested background color*/
@ -436,6 +449,10 @@ typedef struct LodePNGInfo
text_strings, while text_keys are keywords that give a short description what
the actual text represents, e.g. Title, Author, Description, or anything else.
All the string fields below including keys, names and language tags are null terminated.
The PNG specification uses null characters for the keys, names and tags, and forbids null
characters to appear in the main text which is why we can use null termination everywhere here.
A keyword is minimum 1 character and maximum 79 characters long. It's
discouraged to use a single line length longer than 79 characters for texts.
@ -468,11 +485,86 @@ typedef struct LodePNGInfo
unsigned phys_unit; /*may be 0 (unknown unit) or 1 (metre)*/
/*
unknown chunks
There are 3 buffers, one for each position in the PNG where unknown chunks can appear
each buffer contains all unknown chunks for that position consecutively
The 3 buffers are the unknown chunks between certain critical chunks:
0: IHDR-PLTE, 1: PLTE-IDAT, 2: IDAT-IEND
Color profile related chunks: gAMA, cHRM, sRGB, iCPP
LodePNG does not apply any color conversions on pixels in the encoder or decoder and does not interpret these color
profile values. It merely passes on the information. If you wish to use color profiles and convert colors, please
use these values with a color management library.
See the PNG, ICC and sRGB specifications for more information about the meaning of these values.
*/
/* gAMA chunk: optional, overridden by sRGB or iCCP if those are present. */
unsigned gama_defined; /* Whether a gAMA chunk is present (0 = not present, 1 = present). */
unsigned gama_gamma; /* Gamma exponent times 100000 */
/* cHRM chunk: optional, overridden by sRGB or iCCP if those are present. */
unsigned chrm_defined; /* Whether a cHRM chunk is present (0 = not present, 1 = present). */
unsigned chrm_white_x; /* White Point x times 100000 */
unsigned chrm_white_y; /* White Point y times 100000 */
unsigned chrm_red_x; /* Red x times 100000 */
unsigned chrm_red_y; /* Red y times 100000 */
unsigned chrm_green_x; /* Green x times 100000 */
unsigned chrm_green_y; /* Green y times 100000 */
unsigned chrm_blue_x; /* Blue x times 100000 */
unsigned chrm_blue_y; /* Blue y times 100000 */
/*
sRGB chunk: optional. May not appear at the same time as iCCP.
If gAMA is also present gAMA must contain value 45455.
If cHRM is also present cHRM must contain respectively 31270,32900,64000,33000,30000,60000,15000,6000.
*/
unsigned srgb_defined; /* Whether an sRGB chunk is present (0 = not present, 1 = present). */
unsigned srgb_intent; /* Rendering intent: 0=perceptual, 1=rel. colorimetric, 2=saturation, 3=abs. colorimetric */
/*
iCCP chunk: optional. May not appear at the same time as sRGB.
LodePNG does not parse or use the ICC profile (except its color space header field for an edge case), a
separate library to handle the ICC data (not included in LodePNG) format is needed to use it for color
management and conversions.
For encoding, if iCCP is present, gAMA and cHRM are recommended to be added as well with values that match the ICC
profile as closely as possible, if you wish to do this you should provide the correct values for gAMA and cHRM and
enable their '_defined' flags since LodePNG will not automatically compute them from the ICC profile.
For encoding, the ICC profile is required by the PNG specification to be an "RGB" profile for non-grey
PNG color types and a "GRAY" profile for grey PNG color types. If you disable auto_convert, you must ensure
the ICC profile type matches your requested color type, else the encoder gives an error. If auto_convert is
enabled (the default), and the ICC profile is not a good match for the pixel data, this will result in an encoder
error if the pixel data has non-grey pixels for a GRAY profile, or a silent less-optimal compression of the pixel
data if the pixels could be encoded as greyscale but the ICC profile is RGB.
To avoid this do not set an ICC profile in the image unless there is a good reason for it, and when doing so
make sure you compute it carefully to avoid the above problems.
*/
unsigned iccp_defined; /* Whether an iCCP chunk is present (0 = not present, 1 = present). */
char* iccp_name; /* Null terminated string with profile name, 1-79 bytes */
/*
The ICC profile in iccp_profile_size bytes.
Don't allocate this buffer yourself. Use the init/cleanup functions
correctly and use lodepng_set_icc and lodepng_clear_icc.
*/
unsigned char* iccp_profile;
unsigned iccp_profile_size; /* The size of iccp_profile in bytes */
/* End of color profile related chunks */
/*
unknown chunks: chunks not known by LodePNG, passed on byte for byte.
There are 3 buffers, one for each position in the PNG where unknown chunks can appear.
Each buffer contains all unknown chunks for that position consecutively.
The 3 positions are:
0: between IHDR and PLTE, 1: between PLTE and IDAT, 2: between IDAT and IEND.
For encoding, do not store critical chunks or known chunks that are enabled with a "_defined" flag
above in here, since the encoder will blindly follow this and could then encode an invalid PNG file
(such as one with two IHDR chunks or the disallowed combination of sRGB with iCCP). But do use
this if you wish to store an ancillary chunk that is not supported by LodePNG (such as sPLT or hIST),
or any non-standard PNG chunk.
Do not allocate or traverse this data yourself. Use the chunk traversing functions declared
later, such as lodepng_chunk_next and lodepng_chunk_append, to read/write this struct.
*/
@ -488,12 +580,16 @@ void lodepng_info_cleanup(LodePNGInfo* info);
unsigned lodepng_info_copy(LodePNGInfo* dest, const LodePNGInfo* source);
#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS
void lodepng_clear_text(LodePNGInfo* info); /*use this to clear the texts again after you filled them in*/
unsigned lodepng_add_text(LodePNGInfo* info, const char* key, const char* str); /*push back both texts at once*/
void lodepng_clear_text(LodePNGInfo* info); /*use this to clear the texts again after you filled them in*/
void lodepng_clear_itext(LodePNGInfo* info); /*use this to clear the itexts again after you filled them in*/
unsigned lodepng_add_itext(LodePNGInfo* info, const char* key, const char* langtag,
const char* transkey, const char* str); /*push back the 4 texts of 1 chunk at once*/
void lodepng_clear_itext(LodePNGInfo* info); /*use this to clear the itexts again after you filled them in*/
/*replaces if exists*/
unsigned lodepng_set_icc(LodePNGInfo* info, const char* name, const unsigned char* profile, unsigned profile_size);
void lodepng_clear_icc(LodePNGInfo* info); /*use this to clear the texts again after you filled them in*/
#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/
/*
@ -520,7 +616,14 @@ typedef struct LodePNGDecoderSettings
{
LodePNGDecompressSettings zlibsettings; /*in here is the setting to ignore Adler32 checksums*/
/* Check LodePNGDecompressSettings for more ignorable errors such as ignore_adler32 */
unsigned ignore_crc; /*ignore CRC checksums*/
unsigned ignore_critical; /*ignore unknown critical chunks*/
unsigned ignore_end; /*ignore issues at end of file if possible (missing IEND chunk, too large chunk, ...)*/
/* TODO: make a system involving warnings with levels and a strict mode instead. Other potentially recoverable
errors: srgb rendering intent value, size of content of ancillary chunks, more than 79 characters for some
strings, placement/combination rules for ancillary chunks, crc of unknown chunks, allowed characters
in string keys, etc... */
unsigned color_convert; /*whether to convert the PNG to the color type you want. Default: yes*/
@ -554,8 +657,11 @@ typedef enum LodePNGFilterStrategy
LFS_PREDEFINED
} LodePNGFilterStrategy;
/*Gives characteristics about the colors of the image, which helps decide which color model to use for encoding.
Used internally by default if "auto_convert" is enabled. Public because it's useful for custom algorithms.*/
/*Gives characteristics about the integer RGBA colors of the image (count, alpha channel usage, bit depth, ...),
which helps decide which color model to use for encoding.
Used internally by default if "auto_convert" is enabled. Public because it's useful for custom algorithms.
NOTE: This is not related to the ICC color profile, search "iccp_profile" instead to find the ICC/chromacity/...
fields in this header file.*/
typedef struct LodePNGColorProfile
{
unsigned colored; /*not greyscale*/
@ -567,11 +673,14 @@ typedef struct LodePNGColorProfile
unsigned numcolors; /*amount of colors, up to 257. Not valid if bits == 16.*/
unsigned char palette[1024]; /*Remembers up to the first 256 RGBA colors, in no particular order*/
unsigned bits; /*bits per channel (not for palette). 1,2 or 4 for greyscale only. 16 if 16-bit per channel required.*/
size_t numpixels;
} LodePNGColorProfile;
void lodepng_color_profile_init(LodePNGColorProfile* profile);
/*Get a LodePNGColorProfile of the image.*/
/*Get a LodePNGColorProfile of the image. The profile must already have been inited.
NOTE: This is not related to the ICC color profile, search "iccp_profile" instead to find the ICC/chromacity/...
fields in this header file.*/
unsigned lodepng_get_color_profile(LodePNGColorProfile* profile,
const unsigned char* image, unsigned w, unsigned h,
const LodePNGColorMode* mode_in);
@ -653,7 +762,7 @@ unsigned lodepng_decode(unsigned char** out, unsigned* w, unsigned* h,
/*
Read the PNG header, but not the actual data. This returns only the information
that is in the header chunk of the PNG, such as width, height and color type. The
that is in the IHDR chunk of the PNG, such as width, height and color type. The
information is placed in the info_png field of the LodePNGState.
*/
unsigned lodepng_inspect(unsigned* w, unsigned* h,
@ -674,11 +783,23 @@ The lodepng_chunk functions are normally not needed, except to traverse the
unknown chunks stored in the LodePNGInfo struct, or add new ones to it.
It also allows traversing the chunks of an encoded PNG file yourself.
PNG standard chunk naming conventions:
First byte: uppercase = critical, lowercase = ancillary
Second byte: uppercase = public, lowercase = private
Third byte: must be uppercase
Fourth byte: uppercase = unsafe to copy, lowercase = safe to copy
The chunk pointer always points to the beginning of the chunk itself, that is
the first byte of the 4 length bytes.
In the PNG file format, chunks have the following format:
-4 bytes length: length of the data of the chunk in bytes (chunk itself is 12 bytes longer)
-4 bytes chunk name (ASCII a-z,A-Z only, see below)
-length bytes of data (may be 0 bytes if length was 0)
-4 bytes of CRC, computed on chunk name + data
The first chunk starts at the 8th byte of the PNG file, the entire rest of the file
exists out of concatenated chunks with the above format.
PNG standard chunk ASCII naming conventions:
-First byte: uppercase = critical, lowercase = ancillary
-Second byte: uppercase = public, lowercase = private
-Third byte: must be uppercase
-Fourth byte: uppercase = unsafe to copy, lowercase = safe to copy
*/
/*
@ -713,7 +834,12 @@ unsigned lodepng_chunk_check_crc(const unsigned char* chunk);
/*generates the correct CRC from the data and puts it in the last 4 bytes of the chunk*/
void lodepng_chunk_generate_crc(unsigned char* chunk);
/*iterate to next chunks. don't use on IEND chunk, as there is no next chunk then*/
/*
Iterate to next chunks, allows iterating through all chunks of the PNG file. Expects at least 4 readable
bytes of memory in the input pointer. Will output pointer to the start of the next chunk or the end of the
file if there is no more chunk after this. Start this process at the 8th byte of the PNG file. In a non-corrupt
PNG file, the last chunk should have name "IEND".
*/
unsigned char* lodepng_chunk_next(unsigned char* chunk);
const unsigned char* lodepng_chunk_next_const(const unsigned char* chunk);
@ -890,13 +1016,15 @@ TODO:
[.] test if there are no memory leaks or security exploits - done a lot but needs to be checked often
[.] check compatibility with various compilers - done but needs to be redone for every newer version
[X] converting color to 16-bit per channel types
[ ] read all public PNG chunk types (but never let the color profile and gamma ones touch RGB values)
[X] support color profile chunk types (but never let them touch RGB values by default)
[ ] support all public PNG chunk types
[ ] make sure encoder generates no chunks with size > (2^31)-1
[ ] partial decoding (stream processing)
[X] let the "isFullyOpaque" function check color keys and transparent palettes too
[X] better name for the variables "codes", "codesD", "codelengthcodes", "clcl" and "lldl"
[ ] don't stop decoding on errors like 69, 57, 58 (make warnings)
[ ] make warnings like: oob palette, checksum fail, data after iend, wrong/unknown crit chunk, no null terminator in text, ...
[ ] errors with line numbers (and version)
[ ] let the C++ wrapper catch exceptions coming from the standard library and return LodePNG error codes
[ ] allow user to provide custom color conversion functions, e.g. for premultiplied alpha, padding bits or not, ...
[ ] allow user to give data (void*) to custom allocator
@ -1567,6 +1695,8 @@ For decoding:
state.decoder.zlibsettings.ignore_adler32: ignore ADLER32 checksums
state.decoder.zlibsettings.custom_...: use custom inflate function
state.decoder.ignore_crc: ignore CRC checksums
state.decoder.ignore_critical: ignore unknown critical chunks
state.decoder.ignore_end: ignore missing IEND chunk. May fail if this corruption causes other errors
state.decoder.color_convert: convert internal PNG color to chosen one
state.decoder.read_text_chunks: whether to read in text metadata chunks
state.decoder.remember_unknown_chunks: whether to read in unknown chunks
@ -1608,6 +1738,13 @@ yyyymmdd.
Some changes aren't backwards compatible. Those are indicated with a (!)
symbol.
*) 19 aug 2018 (!): fixed color mode bKGD is encoded with and made it use palette
index in case of palette.
*) 10 aug 2018 (!): added support for gAMA, cHRM, sRGB and iCCP chunks. This
change is backwards compatible unless you relied on unknown_chunks for those.
*) 11 jun 2018: less restrictive check for pixel size integer overflow
*) 14 jan 2018: allow optionally ignoring a few more recoverable errors
*) 17 sep 2017: fix memory leak for some encoder input error cases
*) 27 nov 2016: grey+alpha auto color model detection bugfix
*) 18 apr 2016: Changed qsort to custom stable sort (for platforms w/o qsort).
*) 09 apr 2016: Fixed colorkey usage detection, and better file loading (within
@ -1757,5 +1894,5 @@ Domain: gmail dot com.
Account: lode dot vandevenne.
Copyright (c) 2005-2016 Lode Vandevenne
Copyright (c) 2005-2018 Lode Vandevenne
*/

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,212 +0,0 @@
#pragma once
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
Module Name:
devpkey.h
Abstract:
Defines property keys for the Plug and Play Device Property API.
Author:
Jim Cavalaris (jamesca) 10-14-2003
Environment:
User-mode only.
Revision History:
14-October-2003 jamesca
Creation and initial implementation.
20-June-2006 dougb
Copied Jim's version replaced "DEFINE_DEVPROPKEY(DEVPKEY_" with "DEFINE_PROPERTYKEY(PKEY_"
--*/
//#include <devpropdef.h>
//
// _NAME
//
DEFINE_PROPERTYKEY(PKEY_NAME, 0xb725f130, 0x47ef, 0x101a, 0xa5, 0xf1, 0x02, 0x60, 0x8c, 0x9e, 0xeb, 0xac, 10); // DEVPROP_TYPE_STRING
//
// Device properties
// These PKEYs correspond to the old setupapi SPDRP_XXX properties
//
DEFINE_PROPERTYKEY(PKEY_Device_DeviceDesc, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 2); // DEVPROP_TYPE_STRING
DEFINE_PROPERTYKEY(PKEY_Device_HardwareIds, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 3); // DEVPROP_TYPE_STRING_LIST
DEFINE_PROPERTYKEY(PKEY_Device_CompatibleIds, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 4); // DEVPROP_TYPE_STRING_LIST
DEFINE_PROPERTYKEY(PKEY_Device_Service, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 6); // DEVPROP_TYPE_STRING
DEFINE_PROPERTYKEY(PKEY_Device_Class, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 9); // DEVPROP_TYPE_STRING
DEFINE_PROPERTYKEY(PKEY_Device_ClassGuid, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 10); // DEVPROP_TYPE_GUID
DEFINE_PROPERTYKEY(PKEY_Device_Driver, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 11); // DEVPROP_TYPE_STRING
DEFINE_PROPERTYKEY(PKEY_Device_ConfigFlags, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 12); // DEVPROP_TYPE_UINT32
DEFINE_PROPERTYKEY(PKEY_Device_Manufacturer, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 13); // DEVPROP_TYPE_STRING
DEFINE_PROPERTYKEY(PKEY_Device_FriendlyName, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 14); // DEVPROP_TYPE_STRING
DEFINE_PROPERTYKEY(PKEY_Device_LocationInfo, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 15); // DEVPROP_TYPE_STRING
DEFINE_PROPERTYKEY(PKEY_Device_PDOName, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 16); // DEVPROP_TYPE_STRING
DEFINE_PROPERTYKEY(PKEY_Device_Capabilities, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 17); // DEVPROP_TYPE_UNINT32
DEFINE_PROPERTYKEY(PKEY_Device_UINumber, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 18); // DEVPROP_TYPE_STRING
DEFINE_PROPERTYKEY(PKEY_Device_UpperFilters, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 19); // DEVPROP_TYPE_STRING_LIST
DEFINE_PROPERTYKEY(PKEY_Device_LowerFilters, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 20); // DEVPROP_TYPE_STRING_LIST
DEFINE_PROPERTYKEY(PKEY_Device_BusTypeGuid, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 21); // DEVPROP_TYPE_GUID
DEFINE_PROPERTYKEY(PKEY_Device_LegacyBusType, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 22); // DEVPROP_TYPE_UINT32
DEFINE_PROPERTYKEY(PKEY_Device_BusNumber, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 23); // DEVPROP_TYPE_UINT32
DEFINE_PROPERTYKEY(PKEY_Device_EnumeratorName, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 24); // DEVPROP_TYPE_STRING
DEFINE_PROPERTYKEY(PKEY_Device_Security, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 25); // DEVPROP_TYPE_SECURITY_DESCRIPTOR
DEFINE_PROPERTYKEY(PKEY_Device_SecuritySDS, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 26); // DEVPROP_TYPE_SECURITY_DESCRIPTOR_STRING
DEFINE_PROPERTYKEY(PKEY_Device_DevType, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 27); // DEVPROP_TYPE_UINT32
DEFINE_PROPERTYKEY(PKEY_Device_Exclusive, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 28); // DEVPROP_TYPE_UINT32
DEFINE_PROPERTYKEY(PKEY_Device_Characteristics, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 29); // DEVPROP_TYPE_UINT32
DEFINE_PROPERTYKEY(PKEY_Device_Address, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 30); // DEVPROP_TYPE_UINT32
DEFINE_PROPERTYKEY(PKEY_Device_UINumberDescFormat, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 31); // DEVPROP_TYPE_STRING
DEFINE_PROPERTYKEY(PKEY_Device_PowerData, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 32); // DEVPROP_TYPE_BINARY
DEFINE_PROPERTYKEY(PKEY_Device_RemovalPolicy, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 33); // DEVPROP_TYPE_UINT32
DEFINE_PROPERTYKEY(PKEY_Device_RemovalPolicyDefault, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 34); // DEVPROP_TYPE_UINT32
DEFINE_PROPERTYKEY(PKEY_Device_RemovalPolicyOverride, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 35); // DEVPROP_TYPE_UINT32
DEFINE_PROPERTYKEY(PKEY_Device_InstallState, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 36); // DEVPROP_TYPE_UINT32
DEFINE_PROPERTYKEY(PKEY_Device_LocationPaths, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 37); // DEVPROP_TYPE_STRING_LIST
DEFINE_PROPERTYKEY(PKEY_Device_BaseContainerId, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 38); // DEVPROP_TYPE_GUID
//
// Device properties
// These PKEYs correspond to a device's status and problem code
//
DEFINE_PROPERTYKEY(PKEY_Device_DevNodeStatus, 0x4340a6c5, 0x93fa, 0x4706, 0x97, 0x2c, 0x7b, 0x64, 0x80, 0x08, 0xa5, 0xa7, 2); // DEVPROP_TYPE_UINT32
DEFINE_PROPERTYKEY(PKEY_Device_ProblemCode, 0x4340a6c5, 0x93fa, 0x4706, 0x97, 0x2c, 0x7b, 0x64, 0x80, 0x08, 0xa5, 0xa7, 3); // DEVPROP_TYPE_UINT32
//
// Device properties
// These PKEYs correspond to device relations
//
DEFINE_PROPERTYKEY(PKEY_Device_EjectionRelations, 0x4340a6c5, 0x93fa, 0x4706, 0x97, 0x2c, 0x7b, 0x64, 0x80, 0x08, 0xa5, 0xa7, 4); // DEVPROP_TYPE_STRING_LIST
DEFINE_PROPERTYKEY(PKEY_Device_RemovalRelations, 0x4340a6c5, 0x93fa, 0x4706, 0x97, 0x2c, 0x7b, 0x64, 0x80, 0x08, 0xa5, 0xa7, 5); // DEVPROP_TYPE_STRING_LIST
DEFINE_PROPERTYKEY(PKEY_Device_PowerRelations, 0x4340a6c5, 0x93fa, 0x4706, 0x97, 0x2c, 0x7b, 0x64, 0x80, 0x08, 0xa5, 0xa7, 6); // DEVPROP_TYPE_STRING_LIST
DEFINE_PROPERTYKEY(PKEY_Device_BusRelations, 0x4340a6c5, 0x93fa, 0x4706, 0x97, 0x2c, 0x7b, 0x64, 0x80, 0x08, 0xa5, 0xa7, 7); // DEVPROP_TYPE_STRING_LIST
DEFINE_PROPERTYKEY(PKEY_Device_Parent, 0x4340a6c5, 0x93fa, 0x4706, 0x97, 0x2c, 0x7b, 0x64, 0x80, 0x08, 0xa5, 0xa7, 8); // DEVPROP_TYPE_STRING
DEFINE_PROPERTYKEY(PKEY_Device_Children, 0x4340a6c5, 0x93fa, 0x4706, 0x97, 0x2c, 0x7b, 0x64, 0x80, 0x08, 0xa5, 0xa7, 9); // DEVPROP_TYPE_STRING_LIST
DEFINE_PROPERTYKEY(PKEY_Device_Siblings, 0x4340a6c5, 0x93fa, 0x4706, 0x97, 0x2c, 0x7b, 0x64, 0x80, 0x08, 0xa5, 0xa7, 10); // DEVPROP_TYPE_STRING_LIST
DEFINE_PROPERTYKEY(PKEY_Device_TransportRelations, 0x4340a6c5, 0x93fa, 0x4706, 0x97, 0x2c, 0x7b, 0x64, 0x80, 0x08, 0xa5, 0xa7, 11); // DEVPROP_TYPE_STRING_LIST
//
// Other Device properties
//
DEFINE_PROPERTYKEY(PKEY_Device_Reported, 0x80497100, 0x8c73, 0x48b9, 0xaa, 0xd9, 0xce, 0x38, 0x7e, 0x19, 0xc5, 0x6e, 2); // DEVPROP_TYPE_BOOLEAN
DEFINE_PROPERTYKEY(PKEY_Device_Legacy, 0x80497100, 0x8c73, 0x48b9, 0xaa, 0xd9, 0xce, 0x38, 0x7e, 0x19, 0xc5, 0x6e, 3); // DEVPROP_TYPE_BOOLEAN
DEFINE_PROPERTYKEY(PKEY_Device_InstanceId, 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 256); // DEVPROP_TYPE_STRING
DEFINE_PROPERTYKEY(PKEY_Device_ContainerId, 0x8c7ed206, 0x3f8a, 0x4827, 0xb3, 0xab, 0xae, 0x9e, 0x1f, 0xae, 0xfc, 0x6c, 2); // DEVPROP_TYPE_GUID
DEFINE_PROPERTYKEY(PKEY_Device_ModelId, 0x80d81ea6, 0x7473, 0x4b0c, 0x82, 0x16, 0xef, 0xc1, 0x1a, 0x2c, 0x4c, 0x8b, 2); // DEVPROP_TYPE_GUID
DEFINE_PROPERTYKEY(PKEY_Device_FriendlyNameAttributes, 0x80d81ea6, 0x7473, 0x4b0c, 0x82, 0x16, 0xef, 0xc1, 0x1a, 0x2c, 0x4c, 0x8b, 3); // DEVPROP_TYPE_UINT32
DEFINE_PROPERTYKEY(PKEY_Device_ManufacturerAttributes, 0x80d81ea6, 0x7473, 0x4b0c, 0x82, 0x16, 0xef, 0xc1, 0x1a, 0x2c, 0x4c, 0x8b, 4); // DEVPROP_TYPE_UINT32
DEFINE_PROPERTYKEY(PKEY_Device_PresenceNotForDevice, 0x80d81ea6, 0x7473, 0x4b0c, 0x82, 0x16, 0xef, 0xc1, 0x1a, 0x2c, 0x4c, 0x8b, 5); // DEVPROP_TYPE_BOOLEAN
DEFINE_PROPERTYKEY(PKEY_Numa_Proximity_Domain, 0x540b947e, 0x8b40, 0x45bc, 0xa8, 0xa2, 0x6a, 0x0b, 0x89, 0x4c, 0xbd, 0xa2, 1); // DEVPROP_TYPE_UINT32
DEFINE_PROPERTYKEY(PKEY_Device_DHP_Rebalance_Policy, 0x540b947e, 0x8b40, 0x45bc, 0xa8, 0xa2, 0x6a, 0x0b, 0x89, 0x4c, 0xbd, 0xa2, 2); // DEVPROP_TYPE_UINT32
DEFINE_PROPERTYKEY(PKEY_Device_Numa_Node, 0x540b947e, 0x8b40, 0x45bc, 0xa8, 0xa2, 0x6a, 0x0b, 0x89, 0x4c, 0xbd, 0xa2, 3); // DEVPROP_TYPE_UINT32
DEFINE_PROPERTYKEY(PKEY_Device_BusReportedDeviceDesc, 0x540b947e, 0x8b40, 0x45bc, 0xa8, 0xa2, 0x6a, 0x0b, 0x89, 0x4c, 0xbd, 0xa2, 4); // DEVPROP_TYPE_STRING
DEFINE_PROPERTYKEY(PKEY_Device_InstallInProgress, 0x83da6326, 0x97a6, 0x4088, 0x94, 0x53, 0xa1, 0x92, 0x3f, 0x57, 0x3b, 0x29, 9); // DEVPROP_TYPE_BOOLEAN
//
// Device driver properties
//
DEFINE_PROPERTYKEY(PKEY_Device_DriverDate, 0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 2); // DEVPROP_TYPE_FILETIME
DEFINE_PROPERTYKEY(PKEY_Device_DriverVersion, 0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 3); // DEVPROP_TYPE_STRING
DEFINE_PROPERTYKEY(PKEY_Device_DriverDesc, 0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 4); // DEVPROP_TYPE_STRING
DEFINE_PROPERTYKEY(PKEY_Device_DriverInfPath, 0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 5); // DEVPROP_TYPE_STRING
DEFINE_PROPERTYKEY(PKEY_Device_DriverInfSection, 0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 6); // DEVPROP_TYPE_STRING
DEFINE_PROPERTYKEY(PKEY_Device_DriverInfSectionExt, 0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 7); // DEVPROP_TYPE_STRING
DEFINE_PROPERTYKEY(PKEY_Device_MatchingDeviceId, 0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 8); // DEVPROP_TYPE_STRING
DEFINE_PROPERTYKEY(PKEY_Device_DriverProvider, 0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 9); // DEVPROP_TYPE_STRING
DEFINE_PROPERTYKEY(PKEY_Device_DriverPropPageProvider, 0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 10); // DEVPROP_TYPE_STRING
DEFINE_PROPERTYKEY(PKEY_Device_DriverCoInstallers, 0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 11); // DEVPROP_TYPE_STRING_LIST
DEFINE_PROPERTYKEY(PKEY_Device_ResourcePickerTags, 0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 12); // DEVPROP_TYPE_STRING
DEFINE_PROPERTYKEY(PKEY_Device_ResourcePickerExceptions, 0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 13); // DEVPROP_TYPE_STRING
DEFINE_PROPERTYKEY(PKEY_Device_DriverRank, 0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 14); // DEVPROP_TYPE_UINT32
DEFINE_PROPERTYKEY(PKEY_Device_DriverLogoLevel, 0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 15); // DEVPROP_TYPE_UINT32
DEFINE_PROPERTYKEY(PKEY_Device_NoConnectSound, 0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 17); // DEVPROP_TYPE_BOOLEAN
DEFINE_PROPERTYKEY(PKEY_Device_GenericDriverInstalled, 0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 18); // DEVPROP_TYPE_BOOLEAN
DEFINE_PROPERTYKEY(PKEY_Device_AdditionalSoftwareRequested, 0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 19);// DEVPROP_TYPE_BOOLEAN
//
// Device safe-removal properties
//
DEFINE_PROPERTYKEY(PKEY_Device_SafeRemovalRequired, 0xafd97640, 0x86a3, 0x4210, 0xb6, 0x7c, 0x28, 0x9c, 0x41, 0xaa, 0xbe, 0x55, 2); // DEVPROP_TYPE_BOOLEAN
DEFINE_PROPERTYKEY(PKEY_Device_SafeRemovalRequiredOverride, 0xafd97640, 0x86a3, 0x4210, 0xb6, 0x7c, 0x28, 0x9c, 0x41, 0xaa, 0xbe, 0x55, 3);// DEVPROP_TYPE_BOOLEAN
//
// Device properties that were set by the driver package that was installed
// on the device.
//
DEFINE_PROPERTYKEY(PKEY_DrvPkg_Model, 0xcf73bb51, 0x3abf, 0x44a2, 0x85, 0xe0, 0x9a, 0x3d, 0xc7, 0xa1, 0x21, 0x32, 2); // DEVPROP_TYPE_STRING
DEFINE_PROPERTYKEY(PKEY_DrvPkg_VendorWebSite, 0xcf73bb51, 0x3abf, 0x44a2, 0x85, 0xe0, 0x9a, 0x3d, 0xc7, 0xa1, 0x21, 0x32, 3); // DEVPROP_TYPE_STRING
DEFINE_PROPERTYKEY(PKEY_DrvPkg_DetailedDescription, 0xcf73bb51, 0x3abf, 0x44a2, 0x85, 0xe0, 0x9a, 0x3d, 0xc7, 0xa1, 0x21, 0x32, 4); // DEVPROP_TYPE_STRING
DEFINE_PROPERTYKEY(PKEY_DrvPkg_DocumentationLink, 0xcf73bb51, 0x3abf, 0x44a2, 0x85, 0xe0, 0x9a, 0x3d, 0xc7, 0xa1, 0x21, 0x32, 5); // DEVPROP_TYPE_STRING
DEFINE_PROPERTYKEY(PKEY_DrvPkg_Icon, 0xcf73bb51, 0x3abf, 0x44a2, 0x85, 0xe0, 0x9a, 0x3d, 0xc7, 0xa1, 0x21, 0x32, 6); // DEVPROP_TYPE_STRING_LIST
DEFINE_PROPERTYKEY(PKEY_DrvPkg_BrandingIcon, 0xcf73bb51, 0x3abf, 0x44a2, 0x85, 0xe0, 0x9a, 0x3d, 0xc7, 0xa1, 0x21, 0x32, 7); // DEVPROP_TYPE_STRING_LIST
//
// Device setup class properties
// These PKEYs correspond to the old setupapi SPCRP_XXX properties
//
DEFINE_PROPERTYKEY(PKEY_DeviceClass_UpperFilters, 0x4321918b, 0xf69e, 0x470d, 0xa5, 0xde, 0x4d, 0x88, 0xc7, 0x5a, 0xd2, 0x4b, 19); // DEVPROP_TYPE_STRING_LIST
DEFINE_PROPERTYKEY(PKEY_DeviceClass_LowerFilters, 0x4321918b, 0xf69e, 0x470d, 0xa5, 0xde, 0x4d, 0x88, 0xc7, 0x5a, 0xd2, 0x4b, 20); // DEVPROP_TYPE_STRING_LIST
DEFINE_PROPERTYKEY(PKEY_DeviceClass_Security, 0x4321918b, 0xf69e, 0x470d, 0xa5, 0xde, 0x4d, 0x88, 0xc7, 0x5a, 0xd2, 0x4b, 25); // DEVPROP_TYPE_SECURITY_DESCRIPTOR
DEFINE_PROPERTYKEY(PKEY_DeviceClass_SecuritySDS, 0x4321918b, 0xf69e, 0x470d, 0xa5, 0xde, 0x4d, 0x88, 0xc7, 0x5a, 0xd2, 0x4b, 26); // DEVPROP_TYPE_SECURITY_DESCRIPTOR_STRING
DEFINE_PROPERTYKEY(PKEY_DeviceClass_DevType, 0x4321918b, 0xf69e, 0x470d, 0xa5, 0xde, 0x4d, 0x88, 0xc7, 0x5a, 0xd2, 0x4b, 27); // DEVPROP_TYPE_UINT32
DEFINE_PROPERTYKEY(PKEY_DeviceClass_Exclusive, 0x4321918b, 0xf69e, 0x470d, 0xa5, 0xde, 0x4d, 0x88, 0xc7, 0x5a, 0xd2, 0x4b, 28); // DEVPROP_TYPE_UINT32
DEFINE_PROPERTYKEY(PKEY_DeviceClass_Characteristics, 0x4321918b, 0xf69e, 0x470d, 0xa5, 0xde, 0x4d, 0x88, 0xc7, 0x5a, 0xd2, 0x4b, 29); // DEVPROP_TYPE_UINT32
//
// Device setup class properties
// These PKEYs correspond to registry values under the device class GUID key
//
DEFINE_PROPERTYKEY(PKEY_DeviceClass_Name, 0x259abffc, 0x50a7, 0x47ce, 0xaf, 0x8, 0x68, 0xc9, 0xa7, 0xd7, 0x33, 0x66, 2); // DEVPROP_TYPE_STRING
DEFINE_PROPERTYKEY(PKEY_DeviceClass_ClassName, 0x259abffc, 0x50a7, 0x47ce, 0xaf, 0x8, 0x68, 0xc9, 0xa7, 0xd7, 0x33, 0x66, 3); // DEVPROP_TYPE_STRING
DEFINE_PROPERTYKEY(PKEY_DeviceClass_Icon, 0x259abffc, 0x50a7, 0x47ce, 0xaf, 0x8, 0x68, 0xc9, 0xa7, 0xd7, 0x33, 0x66, 4); // DEVPROP_TYPE_STRING
DEFINE_PROPERTYKEY(PKEY_DeviceClass_ClassInstaller, 0x259abffc, 0x50a7, 0x47ce, 0xaf, 0x8, 0x68, 0xc9, 0xa7, 0xd7, 0x33, 0x66, 5); // DEVPROP_TYPE_STRING
DEFINE_PROPERTYKEY(PKEY_DeviceClass_PropPageProvider, 0x259abffc, 0x50a7, 0x47ce, 0xaf, 0x8, 0x68, 0xc9, 0xa7, 0xd7, 0x33, 0x66, 6); // DEVPROP_TYPE_STRING
DEFINE_PROPERTYKEY(PKEY_DeviceClass_NoInstallClass, 0x259abffc, 0x50a7, 0x47ce, 0xaf, 0x8, 0x68, 0xc9, 0xa7, 0xd7, 0x33, 0x66, 7); // DEVPROP_TYPE_BOOLEAN
DEFINE_PROPERTYKEY(PKEY_DeviceClass_NoDisplayClass, 0x259abffc, 0x50a7, 0x47ce, 0xaf, 0x8, 0x68, 0xc9, 0xa7, 0xd7, 0x33, 0x66, 8); // DEVPROP_TYPE_BOOLEAN
DEFINE_PROPERTYKEY(PKEY_DeviceClass_SilentInstall, 0x259abffc, 0x50a7, 0x47ce, 0xaf, 0x8, 0x68, 0xc9, 0xa7, 0xd7, 0x33, 0x66, 9); // DEVPROP_TYPE_BOOLEAN
DEFINE_PROPERTYKEY(PKEY_DeviceClass_NoUseClass, 0x259abffc, 0x50a7, 0x47ce, 0xaf, 0x8, 0x68, 0xc9, 0xa7, 0xd7, 0x33, 0x66, 10); // DEVPROP_TYPE_BOOLEAN
DEFINE_PROPERTYKEY(PKEY_DeviceClass_DefaultService, 0x259abffc, 0x50a7, 0x47ce, 0xaf, 0x8, 0x68, 0xc9, 0xa7, 0xd7, 0x33, 0x66, 11); // DEVPROP_TYPE_STRING
DEFINE_PROPERTYKEY(PKEY_DeviceClass_IconPath, 0x259abffc, 0x50a7, 0x47ce, 0xaf, 0x8, 0x68, 0xc9, 0xa7, 0xd7, 0x33, 0x66, 12); // DEVPROP_TYPE_STRING_LIST
//
// Other Device setup class properties
//
DEFINE_PROPERTYKEY(PKEY_DeviceClass_ClassCoInstallers, 0x713d1703, 0xa2e2, 0x49f5, 0x92, 0x14, 0x56, 0x47, 0x2e, 0xf3, 0xda, 0x5c, 2); // DEVPROP_TYPE_STRING_LIST
//
// Device interface properties
//
DEFINE_PROPERTYKEY(PKEY_DeviceInterface_FriendlyName, 0x026e516e, 0xb814, 0x414b, 0x83, 0xcd, 0x85, 0x6d, 0x6f, 0xef, 0x48, 0x22, 2); // DEVPROP_TYPE_STRING
DEFINE_PROPERTYKEY(PKEY_DeviceInterface_Enabled, 0x026e516e, 0xb814, 0x414b, 0x83, 0xcd, 0x85, 0x6d, 0x6f, 0xef, 0x48, 0x22, 3); // DEVPROP_TYPE_BOOLEAN
DEFINE_PROPERTYKEY(PKEY_DeviceInterface_ClassGuid, 0x026e516e, 0xb814, 0x414b, 0x83, 0xcd, 0x85, 0x6d, 0x6f, 0xef, 0x48, 0x22, 4); // DEVPROP_TYPE_GUID
//
// Device interface class properties
//
DEFINE_PROPERTYKEY(PKEY_DeviceInterfaceClass_DefaultInterface, 0x14c83a99, 0x0b3f, 0x44b7, 0xbe, 0x4c, 0xa1, 0x78, 0xd3, 0x99, 0x05, 0x64, 2); // DEVPROP_TYPE_STRING

62
external/rtaudio/README.md vendored Normal file
View File

@ -0,0 +1,62 @@
# RtAudio
![Build Status](https://github.com/thestk/rtaudio/actions/workflows/ci.yml/badge.svg)
A set of C++ classes that provide a common API for realtime audio input/output across Linux (native ALSA, JACK, PulseAudio and OSS), Macintosh OS X (CoreAudio and JACK), and Windows (DirectSound, ASIO and WASAPI) operating systems.
By Gary P. Scavone, 2001-2021 (and many other developers!)
This distribution of RtAudio contains the following:
- doc: RtAudio documentation (see doc/html/index.html)
- tests: example RtAudio programs
- include: header and source files necessary for ASIO, DS & OSS compilation
- tests/Windows: Visual C++ .net test program workspace and projects
## Overview
RtAudio is a set of C++ classes that provides a common API (Application Programming Interface) for realtime audio input/output across Linux (native ALSA, JACK, PulseAudio and OSS), Macintosh OS X and Windows (DirectSound, ASIO and WASAPI) operating systems. RtAudio significantly simplifies the process of interacting with computer audio hardware. It was designed with the following objectives:
- object-oriented C++ design
- simple, common API across all supported platforms
- only one source and one header file for easy inclusion in programming projects
- allow simultaneous multi-api support
- support dynamic connection of devices
- provide extensive audio device parameter control
- allow audio device capability probing
- automatic internal conversion for data format, channel number compensation, (de)interleaving, and byte-swapping
RtAudio incorporates the concept of audio streams, which represent audio output (playback) and/or input (recording). Available audio devices and their capabilities can be enumerated and then specified when opening a stream. Where applicable, multiple API support can be compiled and a particular API specified when creating an RtAudio instance. See the \ref apinotes section for information specific to each of the supported audio APIs.
## Building
Several build systems are available. These are:
- autotools (`./autogen.sh; make` from git, or `./configure; make` from tarball release)
- CMake (`mkdir build; cd build; ../cmake; make`)
- meson (`meson build; cd build; ninja`)
See `install.txt` for more instructions about how to select the audio backend API. By
default all detected APIs will be enabled.
We recommend using the autotools-based build for packaging purposes. Please note that
RtAudio is designed as a single `.cpp` and `.h` file so that it is easy to copy directly
into a project. In that case you need to define the appropriate flags for the desired
backend APIs.
## FAQ
### Why does audio only come to one ear when I choose 1-channel output?
RtAudio doesn't automatically turn 1-channel output into stereo output with copied values
to each channel, it really only opens one channel. So, if this is the behaviour you want,
you have to do this copying in your audio stream callback.
## Further Reading
For complete documentation on RtAudio, see the doc directory of the distribution or surf to http://www.music.mcgill.ca/~gary/rtaudio/.
## Legal and ethical:
The RtAudio license is similar to the MIT License. Please see [LICENSE](LICENSE).

File diff suppressed because it is too large Load Diff

View File

@ -7,10 +7,11 @@
and OSS), Macintosh OS X (CoreAudio and Jack), and Windows
(DirectSound, ASIO and WASAPI) operating systems.
RtAudio GitHub site: https://github.com/thestk/rtaudio
RtAudio WWW site: http://www.music.mcgill.ca/~gary/rtaudio/
RtAudio: realtime audio i/o C++ classes
Copyright (c) 2001-2016 Gary P. Scavone
Copyright (c) 2001-2021 Gary P. Scavone
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation files
@ -45,11 +46,25 @@
#ifndef __RTAUDIO_H
#define __RTAUDIO_H
#define RTAUDIO_VERSION "4.1.2"
#define RTAUDIO_VERSION "5.2.0"
#if defined _WIN32 || defined __CYGWIN__
#if defined(RTAUDIO_EXPORT)
#define RTAUDIO_DLL_PUBLIC __declspec(dllexport)
#else
#define RTAUDIO_DLL_PUBLIC
#endif
#else
#if __GNUC__ >= 4
#define RTAUDIO_DLL_PUBLIC __attribute__( (visibility( "default" )) )
#else
#define RTAUDIO_DLL_PUBLIC
#endif
#endif
#include <string>
#include <vector>
#include <exception>
#include <stdexcept>
#include <iostream>
/*! \typedef typedef unsigned long RtAudioFormat;
@ -86,6 +101,7 @@ static const RtAudioFormat RTAUDIO_FLOAT64 = 0x20; // Normalized between plus/mi
- \e RTAUDIO_MINIMIZE_LATENCY: Attempt to set stream parameters for lowest possible latency.
- \e RTAUDIO_HOG_DEVICE: Attempt grab device for exclusive use.
- \e RTAUDIO_ALSA_USE_DEFAULT: Use the "default" PCM device (ALSA only).
- \e RTAUDIO_JACK_DONT_CONNECT: Do not automatically connect ports (JACK only).
By default, RtAudio streams pass and receive audio data from the
client in an interleaved format. By passing the
@ -101,7 +117,7 @@ static const RtAudioFormat RTAUDIO_FLOAT64 = 0x20; // Normalized between plus/mi
Certain audio APIs offer a number of parameters that influence the
I/O latency of a stream. By default, RtAudio will attempt to set
these parameters internally for robust (glitch-free) performance
(though some APIs, like Windows Direct Sound, make this difficult).
(though some APIs, like Windows DirectSound, make this difficult).
By passing the RTAUDIO_MINIMIZE_LATENCY flag to the openStream()
function, internal stream settings will be influenced in an attempt
to minimize stream latency, though possibly at the expense of stream
@ -117,6 +133,9 @@ static const RtAudioFormat RTAUDIO_FLOAT64 = 0x20; // Normalized between plus/mi
If the RTAUDIO_ALSA_USE_DEFAULT flag is set, RtAudio will attempt to
open the "default" PCM device when using the ALSA API. Note that this
will override any specified input or output device id.
If the RTAUDIO_JACK_DONT_CONNECT flag is set, RtAudio will not attempt
to automatically connect the ports of the client to the audio device.
*/
typedef unsigned int RtAudioStreamFlags;
static const RtAudioStreamFlags RTAUDIO_NONINTERLEAVED = 0x1; // Use non-interleaved buffers (default = interleaved).
@ -124,6 +143,7 @@ static const RtAudioStreamFlags RTAUDIO_MINIMIZE_LATENCY = 0x2; // Attempt to s
static const RtAudioStreamFlags RTAUDIO_HOG_DEVICE = 0x4; // Attempt grab device and prevent use by others.
static const RtAudioStreamFlags RTAUDIO_SCHEDULE_REALTIME = 0x8; // Try to select realtime scheduling for callback thread.
static const RtAudioStreamFlags RTAUDIO_ALSA_USE_DEFAULT = 0x10; // Use the "default" PCM device (ALSA only).
static const RtAudioStreamFlags RTAUDIO_JACK_DONT_CONNECT = 0x20; // Do not automatically connect ports (JACK only).
/*! \typedef typedef unsigned long RtAudioStreamStatus;
\brief RtAudio stream status (over- or underflow) flags.
@ -174,6 +194,7 @@ static const RtAudioStreamStatus RTAUDIO_OUTPUT_UNDERFLOW = 0x2; // The output
\param userData A pointer to optional data provided by the client
when opening the stream (default = NULL).
\return
To continue normal stream operation, the RtAudioCallback function
should return a value of zero. To stop the stream and drain the
output buffer, the function should return a value of one. To abort
@ -195,7 +216,7 @@ typedef int (*RtAudioCallback)( void *outputBuffer, void *inputBuffer,
*/
/************************************************************************/
class RtAudioError : public std::exception
class RTAUDIO_DLL_PUBLIC RtAudioError : public std::runtime_error
{
public:
//! Defined RtAudioError types.
@ -205,34 +226,31 @@ class RtAudioError : public std::exception
UNSPECIFIED, /*!< The default, unspecified error type. */
NO_DEVICES_FOUND, /*!< No devices found on system. */
INVALID_DEVICE, /*!< An invalid device ID was specified. */
MEMORY_ERROR, /*!< An error occured during memory allocation. */
MEMORY_ERROR, /*!< An error occurred during memory allocation. */
INVALID_PARAMETER, /*!< An invalid parameter was specified to a function. */
INVALID_USE, /*!< The function was called incorrectly. */
DRIVER_ERROR, /*!< A system driver error occured. */
SYSTEM_ERROR, /*!< A system error occured. */
THREAD_ERROR /*!< A thread error occured. */
DRIVER_ERROR, /*!< A system driver error occurred. */
SYSTEM_ERROR, /*!< A system error occurred. */
THREAD_ERROR /*!< A thread error occurred. */
};
//! The constructor.
RtAudioError( const std::string& message, Type type = RtAudioError::UNSPECIFIED ) throw() : message_(message), type_(type) {}
//! The destructor.
virtual ~RtAudioError( void ) throw() {}
RtAudioError( const std::string& message,
Type type = RtAudioError::UNSPECIFIED )
: std::runtime_error(message), type_(type) {}
//! Prints thrown error message to stderr.
virtual void printMessage( void ) const throw() { std::cerr << '\n' << message_ << "\n\n"; }
virtual void printMessage( void ) const
{ std::cerr << '\n' << what() << "\n\n"; }
//! Returns the thrown error message type.
virtual const Type& getType(void) const throw() { return type_; }
virtual const Type& getType(void) const { return type_; }
//! Returns the thrown error message string.
virtual const std::string& getMessage(void) const throw() { return message_; }
//! Returns the thrown error message as a c-style string.
virtual const char* what( void ) const throw() { return message_.c_str(); }
virtual const std::string getMessage(void) const
{ return std::string(what()); }
protected:
std::string message_;
Type type_;
};
@ -258,7 +276,7 @@ typedef void (*RtAudioErrorCallback)( RtAudioError::Type type, const std::string
class RtApi;
class RtAudio
class RTAUDIO_DLL_PUBLIC RtAudio
{
public:
@ -272,38 +290,30 @@ class RtAudio
MACOSX_CORE, /*!< Macintosh OS-X Core Audio API. */
WINDOWS_WASAPI, /*!< The Microsoft WASAPI API. */
WINDOWS_ASIO, /*!< The Steinberg Audio Stream I/O API. */
WINDOWS_DS, /*!< The Microsoft Direct Sound API. */
RTAUDIO_DUMMY /*!< A compilable but non-functional API. */
WINDOWS_DS, /*!< The Microsoft DirectSound API. */
RTAUDIO_DUMMY, /*!< A compilable but non-functional API. */
NUM_APIS /*!< Number of values in this enum. */
};
//! The public device information structure for returning queried values.
struct DeviceInfo {
bool probed; /*!< true if the device capabilities were successfully probed. */
std::string name; /*!< Character string device identifier. */
unsigned int outputChannels; /*!< Maximum output channels supported by device. */
unsigned int inputChannels; /*!< Maximum input channels supported by device. */
unsigned int duplexChannels; /*!< Maximum simultaneous input/output channels supported by device. */
bool isDefaultOutput; /*!< true if this is the default output device. */
bool isDefaultInput; /*!< true if this is the default input device. */
unsigned int outputChannels{}; /*!< Maximum output channels supported by device. */
unsigned int inputChannels{}; /*!< Maximum input channels supported by device. */
unsigned int duplexChannels{}; /*!< Maximum simultaneous input/output channels supported by device. */
bool isDefaultOutput{false}; /*!< true if this is the default output device. */
bool isDefaultInput{false}; /*!< true if this is the default input device. */
std::vector<unsigned int> sampleRates; /*!< Supported sample rates (queried from list of standard rates). */
unsigned int preferredSampleRate; /*!< Preferred sample rate, eg. for WASAPI the system sample rate. */
RtAudioFormat nativeFormats; /*!< Bit mask of supported data formats. */
// Default constructor.
DeviceInfo()
:probed(false), outputChannels(0), inputChannels(0), duplexChannels(0),
isDefaultOutput(false), isDefaultInput(false), preferredSampleRate(0), nativeFormats(0) {}
unsigned int preferredSampleRate{}; /*!< Preferred sample rate, e.g. for WASAPI the system sample rate. */
RtAudioFormat nativeFormats{}; /*!< Bit mask of supported data formats. */
};
//! The structure for specifying input or ouput stream parameters.
//! The structure for specifying input or output stream parameters.
struct StreamParameters {
unsigned int deviceId; /*!< Device index (0 to getDeviceCount() - 1). */
unsigned int nChannels; /*!< Number of channels. */
unsigned int firstChannel; /*!< First channel index on device (default = 0). */
// Default constructor.
StreamParameters()
: deviceId(0), nChannels(0), firstChannel(0) {}
unsigned int deviceId{}; /*!< Device index (0 to getDeviceCount() - 1). */
unsigned int nChannels{}; /*!< Number of channels. */
unsigned int firstChannel{}; /*!< First channel index on device (default = 0). */
};
//! The structure for specifying stream options.
@ -331,7 +341,7 @@ class RtAudio
Certain audio APIs offer a number of parameters that influence the
I/O latency of a stream. By default, RtAudio will attempt to set
these parameters internally for robust (glitch-free) performance
(though some APIs, like Windows Direct Sound, make this difficult).
(though some APIs, like Windows DirectSound, make this difficult).
By passing the RTAUDIO_MINIMIZE_LATENCY flag to the openStream()
function, internal stream settings will be influenced in an attempt
to minimize stream latency, though possibly at the expense of stream
@ -364,18 +374,14 @@ class RtAudio
RtAudio with Jack, each instance must have a unique client name.
*/
struct StreamOptions {
RtAudioStreamFlags flags; /*!< A bit-mask of stream flags (RTAUDIO_NONINTERLEAVED, RTAUDIO_MINIMIZE_LATENCY, RTAUDIO_HOG_DEVICE, RTAUDIO_ALSA_USE_DEFAULT). */
unsigned int numberOfBuffers; /*!< Number of stream buffers. */
RtAudioStreamFlags flags{}; /*!< A bit-mask of stream flags (RTAUDIO_NONINTERLEAVED, RTAUDIO_MINIMIZE_LATENCY, RTAUDIO_HOG_DEVICE, RTAUDIO_ALSA_USE_DEFAULT). */
unsigned int numberOfBuffers{}; /*!< Number of stream buffers. */
std::string streamName; /*!< A stream name (currently used only in Jack). */
int priority; /*!< Scheduling priority of callback thread (only used with flag RTAUDIO_SCHEDULE_REALTIME). */
// Default constructor.
StreamOptions()
: flags(0), numberOfBuffers(0), priority(0) {}
int priority{}; /*!< Scheduling priority of callback thread (only used with flag RTAUDIO_SCHEDULE_REALTIME). */
};
//! A static function to determine the current RtAudio version.
static std::string getVersion( void ) throw();
static std::string getVersion( void );
//! A static function to determine the available compiled audio APIs.
/*!
@ -383,7 +389,30 @@ class RtAudio
the enumerated list values. Note that there can be more than one
API compiled for certain operating systems.
*/
static void getCompiledApi( std::vector<RtAudio::Api> &apis ) throw();
static void getCompiledApi( std::vector<RtAudio::Api> &apis );
//! Return the name of a specified compiled audio API.
/*!
This obtains a short lower-case name used for identification purposes.
This value is guaranteed to remain identical across library versions.
If the API is unknown, this function will return the empty string.
*/
static std::string getApiName( RtAudio::Api api );
//! Return the display name of a specified compiled audio API.
/*!
This obtains a long name used for display purposes.
If the API is unknown, this function will return the empty string.
*/
static std::string getApiDisplayName( RtAudio::Api api );
//! Return the compiled audio API having the given name.
/*!
A case insensitive comparison will check the specified name
against the list of compiled APIs, and return the one which
matches. On failure, the function returns UNSPECIFIED.
*/
static RtAudio::Api getCompiledApiByName( const std::string &name );
//! The class constructor.
/*!
@ -401,10 +430,10 @@ class RtAudio
If a stream is running or open, it will be stopped and closed
automatically.
*/
~RtAudio() throw();
~RtAudio();
//! Returns the audio API specifier for the current instance of RtAudio.
RtAudio::Api getCurrentApi( void ) throw();
RtAudio::Api getCurrentApi( void );
//! A public function that queries for the number of audio devices available.
/*!
@ -412,7 +441,7 @@ class RtAudio
is called, thus supporting devices connected \e after instantiation. If
a system error occurs during processing, a warning will be issued.
*/
unsigned int getDeviceCount( void ) throw();
unsigned int getDeviceCount( void );
//! Return an RtAudio::DeviceInfo structure for a specified device number.
/*!
@ -435,7 +464,7 @@ class RtAudio
client's responsibility to verify that a device is available
before attempting to open a stream.
*/
unsigned int getDefaultOutputDevice( void ) throw();
unsigned int getDefaultOutputDevice( void );
//! A function that returns the index of the default input device.
/*!
@ -445,7 +474,7 @@ class RtAudio
client's responsibility to verify that a device is available
before attempting to open a stream.
*/
unsigned int getDefaultInputDevice( void ) throw();
unsigned int getDefaultInputDevice( void );
//! A public function for opening a stream with the specified parameters.
/*!
@ -485,7 +514,7 @@ class RtAudio
lowest allowable value is used. The actual value used is
returned via the structure argument. The parameter is API dependent.
\param errorCallback A client-defined function that will be invoked
when an error has occured.
when an error has occurred.
*/
void openStream( RtAudio::StreamParameters *outputParameters,
RtAudio::StreamParameters *inputParameters,
@ -498,7 +527,7 @@ class RtAudio
If a stream is not open, this function issues a warning and
returns (no exception is thrown).
*/
void closeStream( void ) throw();
void closeStream( void );
//! A function that starts a stream.
/*!
@ -528,10 +557,10 @@ class RtAudio
void abortStream( void );
//! Returns true if a stream is open and false if not.
bool isStreamOpen( void ) const throw();
bool isStreamOpen( void ) const;
//! Returns true if the stream is running and false if it is stopped or not open.
bool isStreamRunning( void ) const throw();
bool isStreamRunning( void ) const;
//! Returns the number of elapsed seconds since the stream was started.
/*!
@ -565,7 +594,7 @@ class RtAudio
unsigned int getStreamSampleRate( void );
//! Specify whether warning messages should be printed to stderr.
void showWarnings( bool value = true ) throw();
void showWarnings( bool value = true );
protected:
@ -574,29 +603,34 @@ class RtAudio
};
// Operating system dependent thread functionality.
#if defined(__WINDOWS_DS__) || defined(__WINDOWS_ASIO__) || defined(__WINDOWS_WASAPI__)
#if defined(_WIN32) || defined(__CYGWIN__)
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include <windows.h>
#include <process.h>
#include <stdint.h>
typedef uintptr_t ThreadHandle;
typedef CRITICAL_SECTION StreamMutex;
#elif defined(__LINUX_ALSA__) || defined(__LINUX_PULSE__) || defined(__UNIX_JACK__) || defined(__LINUX_OSS__) || defined(__MACOSX_CORE__)
#else
// Using pthread library for various flavors of unix.
#include <pthread.h>
typedef pthread_t ThreadHandle;
typedef pthread_mutex_t StreamMutex;
#else // Setup for "dummy" behavior
#endif
// Setup for "dummy" behavior if no apis specified.
#if !(defined(__WINDOWS_DS__) || defined(__WINDOWS_ASIO__) || defined(__WINDOWS_WASAPI__) \
|| defined(__LINUX_ALSA__) || defined(__LINUX_PULSE__) || defined(__UNIX_JACK__) \
|| defined(__LINUX_OSS__) || defined(__MACOSX_CORE__))
#define __RTAUDIO_DUMMY__
typedef int ThreadHandle;
typedef int StreamMutex;
#endif
@ -604,19 +638,15 @@ class RtAudio
// between the private RtAudio stream structure and global callback
// handling functions.
struct CallbackInfo {
void *object; // Used as a "this" pointer.
ThreadHandle thread;
void *callback;
void *userData;
void *errorCallback;
void *apiInfo; // void pointer for API specific callback information
bool isRunning;
bool doRealtime;
int priority;
// Default constructor.
CallbackInfo()
:object(0), callback(0), userData(0), errorCallback(0), apiInfo(0), isRunning(false), doRealtime(false) {}
void *object{}; // Used as a "this" pointer.
ThreadHandle thread{};
void *callback{};
void *userData{};
void *errorCallback{};
void *apiInfo{}; // void pointer for API specific callback information
bool isRunning{false};
bool doRealtime{false};
int priority{};
};
// **************************************************************** //
@ -643,13 +673,12 @@ class S24 {
S24() {}
S24& operator = ( const int& i ) {
c3[0] = (i & 0x000000ff);
c3[1] = (i & 0x0000ff00) >> 8;
c3[2] = (i & 0x00ff0000) >> 16;
c3[0] = (unsigned char)(i & 0x000000ff);
c3[1] = (unsigned char)((i & 0x0000ff00) >> 8);
c3[2] = (unsigned char)((i & 0x00ff0000) >> 16);
return *this;
}
S24( const S24& v ) { *this = v; }
S24( const double& d ) { *this = (int) d; }
S24( const float& f ) { *this = (int) f; }
S24( const signed short& s ) { *this = (int) s; }
@ -669,7 +698,7 @@ class S24 {
#include <sstream>
class RtApi
class RTAUDIO_DLL_PUBLIC RtApi
{
public:
@ -824,22 +853,22 @@ protected:
//
// **************************************************************** //
inline RtAudio::Api RtAudio :: getCurrentApi( void ) throw() { return rtapi_->getCurrentApi(); }
inline unsigned int RtAudio :: getDeviceCount( void ) throw() { return rtapi_->getDeviceCount(); }
inline RtAudio::Api RtAudio :: getCurrentApi( void ) { return rtapi_->getCurrentApi(); }
inline unsigned int RtAudio :: getDeviceCount( void ) { return rtapi_->getDeviceCount(); }
inline RtAudio::DeviceInfo RtAudio :: getDeviceInfo( unsigned int device ) { return rtapi_->getDeviceInfo( device ); }
inline unsigned int RtAudio :: getDefaultInputDevice( void ) throw() { return rtapi_->getDefaultInputDevice(); }
inline unsigned int RtAudio :: getDefaultOutputDevice( void ) throw() { return rtapi_->getDefaultOutputDevice(); }
inline void RtAudio :: closeStream( void ) throw() { return rtapi_->closeStream(); }
inline unsigned int RtAudio :: getDefaultInputDevice( void ) { return rtapi_->getDefaultInputDevice(); }
inline unsigned int RtAudio :: getDefaultOutputDevice( void ) { return rtapi_->getDefaultOutputDevice(); }
inline void RtAudio :: closeStream( void ) { return rtapi_->closeStream(); }
inline void RtAudio :: startStream( void ) { return rtapi_->startStream(); }
inline void RtAudio :: stopStream( void ) { return rtapi_->stopStream(); }
inline void RtAudio :: abortStream( void ) { return rtapi_->abortStream(); }
inline bool RtAudio :: isStreamOpen( void ) const throw() { return rtapi_->isStreamOpen(); }
inline bool RtAudio :: isStreamRunning( void ) const throw() { return rtapi_->isStreamRunning(); }
inline bool RtAudio :: isStreamOpen( void ) const { return rtapi_->isStreamOpen(); }
inline bool RtAudio :: isStreamRunning( void ) const { return rtapi_->isStreamRunning(); }
inline long RtAudio :: getStreamLatency( void ) { return rtapi_->getStreamLatency(); }
inline unsigned int RtAudio :: getStreamSampleRate( void ) { return rtapi_->getStreamSampleRate(); }
inline double RtAudio :: getStreamTime( void ) { return rtapi_->getStreamTime(); }
inline void RtAudio :: setStreamTime( double time ) { return rtapi_->setStreamTime( time ); }
inline void RtAudio :: showWarnings( bool value ) throw() { rtapi_->showWarnings( value ); }
inline void RtAudio :: showWarnings( bool value ) { rtapi_->showWarnings( value ); }
// RtApi Subclass prototypes.
@ -853,21 +882,20 @@ public:
RtApiCore();
~RtApiCore();
RtAudio::Api getCurrentApi( void ) { return RtAudio::MACOSX_CORE; }
unsigned int getDeviceCount( void );
RtAudio::DeviceInfo getDeviceInfo( unsigned int device );
unsigned int getDefaultOutputDevice( void );
unsigned int getDefaultInputDevice( void );
void closeStream( void );
void startStream( void );
void stopStream( void );
void abortStream( void );
long getStreamLatency( void );
RtAudio::Api getCurrentApi( void ) override { return RtAudio::MACOSX_CORE; }
unsigned int getDeviceCount( void ) override;
RtAudio::DeviceInfo getDeviceInfo( unsigned int device ) override;
unsigned int getDefaultOutputDevice( void ) override;
unsigned int getDefaultInputDevice( void ) override;
void closeStream( void ) override;
void startStream( void ) override;
void stopStream( void ) override;
void abortStream( void ) override;
// This function is intended for internal use only. It must be
// public because it is called by the internal callback handler,
// which is not a member of RtAudio. External use of this function
// will most likely produce highly undesireable results!
// will most likely produce highly undesirable results!
bool callbackEvent( AudioDeviceID deviceId,
const AudioBufferList *inBufferList,
const AudioBufferList *outBufferList );
@ -877,7 +905,7 @@ public:
bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels,
unsigned int firstChannel, unsigned int sampleRate,
RtAudioFormat format, unsigned int *bufferSize,
RtAudio::StreamOptions *options );
RtAudio::StreamOptions *options ) override;
static const char* getErrorCode( OSStatus code );
};
@ -891,19 +919,18 @@ public:
RtApiJack();
~RtApiJack();
RtAudio::Api getCurrentApi( void ) { return RtAudio::UNIX_JACK; }
unsigned int getDeviceCount( void );
RtAudio::DeviceInfo getDeviceInfo( unsigned int device );
void closeStream( void );
void startStream( void );
void stopStream( void );
void abortStream( void );
long getStreamLatency( void );
RtAudio::Api getCurrentApi( void ) override { return RtAudio::UNIX_JACK; }
unsigned int getDeviceCount( void ) override;
RtAudio::DeviceInfo getDeviceInfo( unsigned int device ) override;
void closeStream( void ) override;
void startStream( void ) override;
void stopStream( void ) override;
void abortStream( void ) override;
// This function is intended for internal use only. It must be
// public because it is called by the internal callback handler,
// which is not a member of RtAudio. External use of this function
// will most likely produce highly undesireable results!
// will most likely produce highly undesirable results!
bool callbackEvent( unsigned long nframes );
private:
@ -911,7 +938,9 @@ public:
bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels,
unsigned int firstChannel, unsigned int sampleRate,
RtAudioFormat format, unsigned int *bufferSize,
RtAudio::StreamOptions *options );
RtAudio::StreamOptions *options ) override;
bool shouldAutoconnect_;
};
#endif
@ -924,19 +953,20 @@ public:
RtApiAsio();
~RtApiAsio();
RtAudio::Api getCurrentApi( void ) { return RtAudio::WINDOWS_ASIO; }
unsigned int getDeviceCount( void );
RtAudio::DeviceInfo getDeviceInfo( unsigned int device );
void closeStream( void );
void startStream( void );
void stopStream( void );
void abortStream( void );
long getStreamLatency( void );
RtAudio::Api getCurrentApi( void ) override { return RtAudio::WINDOWS_ASIO; }
unsigned int getDeviceCount( void ) override;
unsigned int getDefaultOutputDevice( void ) override;
unsigned int getDefaultInputDevice( void ) override;
RtAudio::DeviceInfo getDeviceInfo( unsigned int device ) override;
void closeStream( void ) override;
void startStream( void ) override;
void stopStream( void ) override;
void abortStream( void ) override;
// This function is intended for internal use only. It must be
// public because it is called by the internal callback handler,
// which is not a member of RtAudio. External use of this function
// will most likely produce highly undesireable results!
// will most likely produce highly undesirable results!
bool callbackEvent( long bufferIndex );
private:
@ -947,7 +977,7 @@ public:
bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels,
unsigned int firstChannel, unsigned int sampleRate,
RtAudioFormat format, unsigned int *bufferSize,
RtAudio::StreamOptions *options );
RtAudio::StreamOptions *options ) override;
};
#endif
@ -960,21 +990,20 @@ public:
RtApiDs();
~RtApiDs();
RtAudio::Api getCurrentApi( void ) { return RtAudio::WINDOWS_DS; }
unsigned int getDeviceCount( void );
unsigned int getDefaultOutputDevice( void );
unsigned int getDefaultInputDevice( void );
RtAudio::DeviceInfo getDeviceInfo( unsigned int device );
void closeStream( void );
void startStream( void );
void stopStream( void );
void abortStream( void );
long getStreamLatency( void );
RtAudio::Api getCurrentApi( void ) override { return RtAudio::WINDOWS_DS; }
unsigned int getDeviceCount( void ) override;
unsigned int getDefaultOutputDevice( void ) override;
unsigned int getDefaultInputDevice( void ) override;
RtAudio::DeviceInfo getDeviceInfo( unsigned int device ) override;
void closeStream( void ) override;
void startStream( void ) override;
void stopStream( void ) override;
void abortStream( void ) override;
// This function is intended for internal use only. It must be
// public because it is called by the internal callback handler,
// which is not a member of RtAudio. External use of this function
// will most likely produce highly undesireable results!
// will most likely produce highly undesirable results!
void callbackEvent( void );
private:
@ -986,7 +1015,7 @@ public:
bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels,
unsigned int firstChannel, unsigned int sampleRate,
RtAudioFormat format, unsigned int *bufferSize,
RtAudio::StreamOptions *options );
RtAudio::StreamOptions *options ) override;
};
#endif
@ -999,17 +1028,15 @@ class RtApiWasapi : public RtApi
{
public:
RtApiWasapi();
~RtApiWasapi();
virtual ~RtApiWasapi();
RtAudio::Api getCurrentApi( void ) { return RtAudio::WINDOWS_WASAPI; }
unsigned int getDeviceCount( void );
RtAudio::DeviceInfo getDeviceInfo( unsigned int device );
unsigned int getDefaultOutputDevice( void );
unsigned int getDefaultInputDevice( void );
void closeStream( void );
void startStream( void );
void stopStream( void );
void abortStream( void );
RtAudio::Api getCurrentApi( void ) override { return RtAudio::WINDOWS_WASAPI; }
unsigned int getDeviceCount( void ) override;
RtAudio::DeviceInfo getDeviceInfo( unsigned int device ) override;
void closeStream( void ) override;
void startStream( void ) override;
void stopStream( void ) override;
void abortStream( void ) override;
private:
bool coInitialized_;
@ -1018,7 +1045,7 @@ private:
bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels,
unsigned int firstChannel, unsigned int sampleRate,
RtAudioFormat format, unsigned int* bufferSize,
RtAudio::StreamOptions* options );
RtAudio::StreamOptions* options ) override;
static DWORD WINAPI runWasapiThread( void* wasapiPtr );
static DWORD WINAPI stopWasapiThread( void* wasapiPtr );
@ -1036,18 +1063,18 @@ public:
RtApiAlsa();
~RtApiAlsa();
RtAudio::Api getCurrentApi() { return RtAudio::LINUX_ALSA; }
unsigned int getDeviceCount( void );
RtAudio::DeviceInfo getDeviceInfo( unsigned int device );
void closeStream( void );
void startStream( void );
void stopStream( void );
void abortStream( void );
RtAudio::Api getCurrentApi() override { return RtAudio::LINUX_ALSA; }
unsigned int getDeviceCount( void ) override;
RtAudio::DeviceInfo getDeviceInfo( unsigned int device ) override;
void closeStream( void ) override;
void startStream( void ) override;
void stopStream( void ) override;
void abortStream( void ) override;
// This function is intended for internal use only. It must be
// public because it is called by the internal callback handler,
// which is not a member of RtAudio. External use of this function
// will most likely produce highly undesireable results!
// will most likely produce highly undesirable results!
void callbackEvent( void );
private:
@ -1057,7 +1084,7 @@ public:
bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels,
unsigned int firstChannel, unsigned int sampleRate,
RtAudioFormat format, unsigned int *bufferSize,
RtAudio::StreamOptions *options );
RtAudio::StreamOptions *options ) override;
};
#endif
@ -1068,28 +1095,27 @@ class RtApiPulse: public RtApi
{
public:
~RtApiPulse();
RtAudio::Api getCurrentApi() { return RtAudio::LINUX_PULSE; }
unsigned int getDeviceCount( void );
RtAudio::DeviceInfo getDeviceInfo( unsigned int device );
void closeStream( void );
void startStream( void );
void stopStream( void );
void abortStream( void );
RtAudio::Api getCurrentApi() override { return RtAudio::LINUX_PULSE; }
unsigned int getDeviceCount( void ) override;
RtAudio::DeviceInfo getDeviceInfo( unsigned int device ) override;
void closeStream( void ) override;
void startStream( void ) override;
void stopStream( void ) override;
void abortStream( void ) override;
// This function is intended for internal use only. It must be
// public because it is called by the internal callback handler,
// which is not a member of RtAudio. External use of this function
// will most likely produce highly undesireable results!
// will most likely produce highly undesirable results!
void callbackEvent( void );
private:
std::vector<RtAudio::DeviceInfo> devices_;
void saveDeviceInfo( void );
void collectDeviceInfo( void );
bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels,
unsigned int firstChannel, unsigned int sampleRate,
RtAudioFormat format, unsigned int *bufferSize,
RtAudio::StreamOptions *options );
RtAudio::StreamOptions *options ) override;
};
#endif
@ -1102,18 +1128,18 @@ public:
RtApiOss();
~RtApiOss();
RtAudio::Api getCurrentApi() { return RtAudio::LINUX_OSS; }
unsigned int getDeviceCount( void );
RtAudio::DeviceInfo getDeviceInfo( unsigned int device );
void closeStream( void );
void startStream( void );
void stopStream( void );
void abortStream( void );
RtAudio::Api getCurrentApi() override { return RtAudio::LINUX_OSS; }
unsigned int getDeviceCount( void ) override;
RtAudio::DeviceInfo getDeviceInfo( unsigned int device ) override;
void closeStream( void ) override;
void startStream( void ) override;
void stopStream( void ) override;
void abortStream( void ) override;
// This function is intended for internal use only. It must be
// public because it is called by the internal callback handler,
// which is not a member of RtAudio. External use of this function
// will most likely produce highly undesireable results!
// will most likely produce highly undesirable results!
void callbackEvent( void );
private:
@ -1121,7 +1147,7 @@ public:
bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels,
unsigned int firstChannel, unsigned int sampleRate,
RtAudioFormat format, unsigned int *bufferSize,
RtAudio::StreamOptions *options );
RtAudio::StreamOptions *options ) override;
};
#endif
@ -1133,20 +1159,20 @@ class RtApiDummy: public RtApi
public:
RtApiDummy() { errorText_ = "RtApiDummy: This class provides no functionality."; error( RtAudioError::WARNING ); }
RtAudio::Api getCurrentApi( void ) { return RtAudio::RTAUDIO_DUMMY; }
unsigned int getDeviceCount( void ) { return 0; }
RtAudio::DeviceInfo getDeviceInfo( unsigned int /*device*/ ) { RtAudio::DeviceInfo info; return info; }
void closeStream( void ) {}
void startStream( void ) {}
void stopStream( void ) {}
void abortStream( void ) {}
RtAudio::Api getCurrentApi( void ) override { return RtAudio::RTAUDIO_DUMMY; }
unsigned int getDeviceCount( void ) override { return 0; }
RtAudio::DeviceInfo getDeviceInfo( unsigned int /*device*/ ) override { RtAudio::DeviceInfo info; return info; }
void closeStream( void ) override {}
void startStream( void ) override {}
void stopStream( void ) override {}
void abortStream( void ) override {}
private:
bool probeDeviceOpen( unsigned int /*device*/, StreamMode /*mode*/, unsigned int /*channels*/,
unsigned int /*firstChannel*/, unsigned int /*sampleRate*/,
RtAudioFormat /*format*/, unsigned int * /*bufferSize*/,
RtAudio::StreamOptions * /*options*/ ) { return false; }
RtAudio::StreamOptions * /*options*/ ) override { return false; }
};
#endif

View File

@ -1,61 +0,0 @@
RtAudio - a set of C++ classes that provide a common API for realtime audio input/output across Linux (native ALSA, JACK, PulseAudio and OSS), Macintosh OS X (CoreAudio and JACK), and Windows (DirectSound, ASIO and WASAPI) operating systems.
By Gary P. Scavone, 2001-2016.
This distribution of RtAudio contains the following:
doc: RtAudio documentation (see doc/html/index.html)
tests: example RtAudio programs
include: header and source files necessary for ASIO, DS & OSS compilation
tests/Windows: Visual C++ .net test program workspace and projects
OVERVIEW:
RtAudio is a set of C++ classes that provides a common API (Application Programming Interface) for realtime audio input/output across Linux (native ALSA, JACK, PulseAudio and OSS), Macintosh OS X and Windows (DirectSound, ASIO and WASAPI) operating systems. RtAudio significantly simplifies the process of interacting with computer audio hardware. It was designed with the following objectives:
- object-oriented C++ design
- simple, common API across all supported platforms
- only one source and one header file for easy inclusion in programming projects
- allow simultaneous multi-api support
- support dynamic connection of devices
- provide extensive audio device parameter control
- allow audio device capability probing
- automatic internal conversion for data format, channel number compensation, (de)interleaving, and byte-swapping
RtAudio incorporates the concept of audio streams, which represent audio output (playback) and/or input (recording). Available audio devices and their capabilities can be enumerated and then specified when opening a stream. Where applicable, multiple API support can be compiled and a particular API specified when creating an RtAudio instance. See the \ref apinotes section for information specific to each of the supported audio APIs.
FURTHER READING:
For complete documentation on RtAudio, see the doc directory of the distribution or surf to http://www.music.mcgill.ca/~gary/rtaudio/.
LEGAL AND ETHICAL:
The RtAudio license is similar to the MIT License.
RtAudio: a set of realtime audio i/o C++ classes
Copyright (c) 2001-2016 Gary P. Scavone
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation files
(the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
Any person wishing to distribute modifications to the Software is
asked to send the modifications to the original developer so that
they can be incorporated into the canonical version. This is,
however, not a binding provision of this license.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -4,43 +4,53 @@
#include "AppConfig.h"
#include "CubicSDR.h"
DeviceConfig::DeviceConfig() : deviceId("") {
#include <wx/msgdlg.h>
DeviceConfig::DeviceConfig() {
ppm.store(0);
offset.store(0);
agcMode.store(true);
sampleRate.store(0);
}
DeviceConfig::DeviceConfig(std::string deviceId) : DeviceConfig() {
this->deviceId = deviceId;
DeviceConfig::DeviceConfig(std::string deviceId_in) : DeviceConfig() {
deviceId = deviceId_in;
}
void DeviceConfig::setPPM(int ppm) {
this->ppm.store(ppm);
void DeviceConfig::setPPM(int ppm_in) {
ppm.store(ppm_in);
}
int DeviceConfig::getPPM() {
return ppm.load();
}
void DeviceConfig::setOffset(long long offset) {
this->offset.store(offset);
void DeviceConfig::setOffset(long long offset_in) {
offset.store(offset_in);
}
long long DeviceConfig::getOffset() {
return offset.load();
}
void DeviceConfig::setSampleRate(long srate) {
sampleRate.store(srate);
void DeviceConfig::setSampleRate(long sampleRate_in) {
sampleRate.store(sampleRate_in);
}
long DeviceConfig::getSampleRate() {
return sampleRate.load();
}
void DeviceConfig::setAGCMode(bool agcMode) {
this->agcMode.store(agcMode);
void DeviceConfig::setAntennaName(const std::string& name) {
antennaName = name;
}
const std::string& DeviceConfig::getAntennaName() {
return antennaName;
}
void DeviceConfig::setAGCMode(bool agcMode_in) {
agcMode.store(agcMode_in);
}
bool DeviceConfig::getAGCMode() {
@ -48,9 +58,9 @@ bool DeviceConfig::getAGCMode() {
}
void DeviceConfig::setDeviceId(std::string deviceId) {
void DeviceConfig::setDeviceId(std::string deviceId_in) {
std::lock_guard < std::mutex > lock(busy_lock);
this->deviceId = deviceId;
deviceId = deviceId_in;
}
@ -64,24 +74,24 @@ std::string DeviceConfig::getDeviceId() {
return tmp;
}
void DeviceConfig::setDeviceName(std::string deviceName) {
void DeviceConfig::setDeviceName(std::string deviceName_in) {
std::lock_guard < std::mutex > lock(busy_lock);
this->deviceName = deviceName;
deviceName = deviceName_in;
}
std::string DeviceConfig::getDeviceName() {
std::string tmp;
std::lock_guard < std::mutex > lock(busy_lock);
tmp = (deviceName=="")?deviceId:deviceName;
tmp = deviceName.empty()?deviceId:deviceName;
return tmp;
}
void DeviceConfig::save(DataNode *node) {
std::lock_guard < std::mutex > lock(busy_lock);
*node->newChild("id") = deviceId;
*node->newChild("name") = deviceName;
*node->newChild("ppm") = ppm.load();
@ -89,19 +99,23 @@ void DeviceConfig::save(DataNode *node) {
*node->newChild("sample_rate") = sampleRate.load();
*node->newChild("agc_mode") = agcMode.load()?1:0;
if (streamOpts.size()) {
if (!antennaName.empty()) {
*node->newChild("antenna") = antennaName;
}
if (!streamOpts.empty()) {
DataNode *streamOptsNode = node->newChild("streamOpts");
for (ConfigSettings::const_iterator opt_i = streamOpts.begin(); opt_i != streamOpts.end(); opt_i++) {
*streamOptsNode->newChild(opt_i->first.c_str()) = opt_i->second;
}
}
if (settings.size()) {
if (!settings.empty()) {
DataNode *settingsNode = node->newChild("settings");
for (ConfigSettings::const_iterator set_i = settings.begin(); set_i != settings.end(); set_i++) {
*settingsNode->newChild(set_i->first.c_str()) = set_i->second;
}
}
if (rigIF.size()) {
if (!rigIF.empty()) {
DataNode *rigIFs = node->newChild("rig_ifs");
for (std::map<int, long long>::const_iterator rigIF_i = rigIF.begin(); rigIF_i != rigIF.end(); rigIF_i++) {
DataNode *ifNode = rigIFs->newChild("rig_if");
@ -109,7 +123,7 @@ void DeviceConfig::save(DataNode *node) {
*ifNode->newChild("sdr_if") = rigIF_i->second;
}
}
if (gains.size()) {
if (!gains.empty()) {
DataNode *gainsNode = node->newChild("gains");
for (ConfigGains::const_iterator gain_i = gains.begin(); gain_i != gains.end(); gain_i++) {
DataNode *gainNode = gainsNode->newChild("gain");
@ -141,7 +155,7 @@ void DeviceConfig::load(DataNode *node) {
DataNode *agc_node = node->getNext("agc_mode");
int agcModeValue = 0;
agc_node->element()->get(agcModeValue);
setAGCMode(agcModeValue?true:false);
setAGCMode(agcModeValue != 0);
}
if (node->hasAnother("sample_rate")) {
DataNode *sample_rate_node = node->getNext("sample_rate");
@ -149,6 +163,12 @@ void DeviceConfig::load(DataNode *node) {
sample_rate_node->element()->get(sampleRateValue);
setSampleRate(sampleRateValue);
}
if (node->hasAnother("antenna")) {
DataNode *antenna_node = node->getNext("antenna");
std::string antennaNameValue;
antenna_node->element()->get(antennaNameValue);
setAntennaName(antennaNameValue);
}
if (node->hasAnother("streamOpts")) {
DataNode *streamOptsNode = node->getNext("streamOpts");
for (int i = 0, iMax = streamOptsNode->numChildren(); i<iMax; i++) {
@ -156,7 +176,7 @@ void DeviceConfig::load(DataNode *node) {
std::string keyName = streamOptNode->getName();
std::string strSettingValue = streamOptNode->element()->toString();
if (keyName != "") {
if (!keyName.empty()) {
setStreamOpt(keyName, strSettingValue);
}
}
@ -168,7 +188,7 @@ void DeviceConfig::load(DataNode *node) {
std::string keyName = settingNode->getName();
std::string strSettingValue = settingNode->element()->toString();
if (keyName != "") {
if (!keyName.empty()) {
setSetting(keyName, strSettingValue);
}
}
@ -179,7 +199,7 @@ void DeviceConfig::load(DataNode *node) {
DataNode *rigIFNode = rigIFNodes->getNext("rig_if");
if (rigIFNode->hasAnother("model") && rigIFNode->hasAnother("sdr_if")) {
int load_model;
long long load_freq;
long long load_freq = 0;
rigIFNode->getNext("model")->element()->get(load_model);
rigIFNode->getNext("sdr_if")->element()->get(load_freq);
@ -193,12 +213,12 @@ void DeviceConfig::load(DataNode *node) {
while (gainsNode->hasAnother("gain")) {
DataNode *gainNode = gainsNode->getNext("gain");
std::string keyName;
float fltSettingValue;
float fltSettingValue = 0;
gainNode->getNext("id")->element()->get(keyName);
gainNode->getNext("value")->element()->get(fltSettingValue);
if (keyName != "" && !(fltSettingValue!=fltSettingValue)) {
if (!keyName.empty() && !(fltSettingValue!=fltSettingValue)) {
setGain(keyName, fltSettingValue);
}
}
@ -214,11 +234,11 @@ ConfigSettings DeviceConfig::getStreamOpts() {
return streamOpts;
}
void DeviceConfig::setStreamOpt(std::string key, std::string value) {
void DeviceConfig::setStreamOpt(const std::string& key, std::string value) {
streamOpts[key] = value;
}
std::string DeviceConfig::getStreamOpt(std::string key, std::string defaultValue) {
std::string DeviceConfig::getStreamOpt(const std::string& key, std::string defaultValue) {
if (streamOpts.find(key) == streamOpts.end()) {
return defaultValue;
}
@ -226,15 +246,15 @@ std::string DeviceConfig::getStreamOpt(std::string key, std::string defaultValue
return streamOpts[key];
}
void DeviceConfig::setSettings(ConfigSettings settings) {
this->settings = settings;
void DeviceConfig::setSettings(ConfigSettings settings_in) {
settings = settings_in;
}
void DeviceConfig::setSetting(std::string key, std::string value) {
this->settings[key] = value;
void DeviceConfig::setSetting(const std::string& key, std::string value) {
settings[key] = value;
}
std::string DeviceConfig::getSetting(std::string key, std::string defaultValue) {
std::string DeviceConfig::getSetting(const std::string& key, std::string defaultValue) {
if (settings.find(key) == settings.end()) {
return defaultValue;
}
@ -246,19 +266,19 @@ ConfigSettings DeviceConfig::getSettings() {
}
void DeviceConfig::setGains(ConfigGains gains) {
this->gains = gains;
void DeviceConfig::setGains(ConfigGains gains_in) {
gains = gains_in;
}
ConfigGains DeviceConfig::getGains() {
return gains;
}
void DeviceConfig::setGain(std::string key, float value) {
void DeviceConfig::setGain(const std::string& key, float value) {
gains[key] = value;
}
float DeviceConfig::getGain(std::string key, float defaultValue) {
float DeviceConfig::getGain(const std::string& key, float defaultValue) {
if (gains.find(key) != gains.end()) {
return gains[key];
}
@ -277,14 +297,14 @@ long long DeviceConfig::getRigIF(int rigType) {
return 0;
}
AppConfig::AppConfig() : configName("") {
AppConfig::AppConfig() {
winX.store(0);
winY.store(0);
winW.store(0);
winH.store(0);
winMax.store(false);
showTips.store(true);
lowPerfMode.store(false);
perfMode.store(PERF_NORMAL);
themeId.store(0);
fontScale.store(0);
snap.store(1);
@ -312,7 +332,7 @@ AppConfig::AppConfig() : configName("") {
#endif
}
DeviceConfig *AppConfig::getDevice(std::string deviceId) {
DeviceConfig *AppConfig::getDevice(const std::string& deviceId) {
if (deviceConfig.find(deviceId) == deviceConfig.end()) {
deviceConfig[deviceId] = new DeviceConfig();
}
@ -371,32 +391,32 @@ bool AppConfig::getShowTips() {
return showTips.load();
}
void AppConfig::setLowPerfMode(bool show) {
lowPerfMode.store(show);
void AppConfig::setPerfMode(PerfModeEnum show) {
perfMode.store(show);
}
bool AppConfig::getLowPerfMode() {
return lowPerfMode.load();
AppConfig::PerfModeEnum AppConfig::getPerfMode() {
return perfMode.load();
}
wxRect *AppConfig::getWindow() {
wxRect *r = NULL;
wxRect *r = nullptr;
if (winH.load() && winW.load()) {
r = new wxRect(winX.load(),winY.load(),winW.load(),winH.load());
}
return r;
}
void AppConfig::setTheme(int themeId) {
this->themeId.store(themeId);
void AppConfig::setTheme(int themeId_in) {
themeId.store(themeId_in);
}
int AppConfig::getTheme() {
return themeId.load();
}
void AppConfig::setFontScale(int fontScale) {
this->fontScale.store(fontScale);
void AppConfig::setFontScale(int fontScale_in) {
fontScale.store(fontScale_in);
}
int AppConfig::getFontScale() {
@ -485,9 +505,54 @@ bool AppConfig::getBookmarksVisible() {
return bookmarksVisible.load();
}
void AppConfig::setRecordingPath(std::string recPath) {
recordingPath = recPath;
}
void AppConfig::setConfigName(std::string configName) {
this->configName = configName;
std::string AppConfig::getRecordingPath() {
return recordingPath;
}
bool AppConfig::verifyRecordingPath() {
string recPathStr = wxGetApp().getConfig()->getRecordingPath();
if (recPathStr.empty()) {
wxMessageBox( wxT("Recording path is not set. Please use 'Set Recording Path' from the 'Recording' Menu."), wxT("Recording Path Error"), wxICON_INFORMATION);
return false;
}
wxFileName recPath(recPathStr);
if (!recPath.Exists() || !recPath.IsDirWritable()) {
wxMessageBox( wxT("Recording path does not exist or is not writable. Please use 'Set Recording Path' from the 'Recording' Menu."), wxT("Recording Path Error"), wxICON_INFORMATION);
return false;
}
return true;
}
void AppConfig::setRecordingSquelchOption(int enumChoice) {
recordingSquelchOption = enumChoice;
}
int AppConfig::getRecordingSquelchOption() const {
return recordingSquelchOption;
}
void AppConfig::setRecordingFileTimeLimit(int nbSeconds) {
recordingFileTimeLimitSeconds = nbSeconds;
}
int AppConfig::getRecordingFileTimeLimit() const {
return recordingFileTimeLimitSeconds;
}
void AppConfig::setConfigName(std::string configName_in) {
configName = configName_in;
}
std::string AppConfig::getConfigFileName(bool ignoreName) {
@ -523,14 +588,14 @@ bool AppConfig::save() {
*window_node->newChild("max") = winMax.load();
*window_node->newChild("tips") = showTips.load();
*window_node->newChild("low_perf_mode") = lowPerfMode.load();
*window_node->newChild("perf_mode") = (int)perfMode.load();
*window_node->newChild("theme") = themeId.load();
*window_node->newChild("font_scale") = fontScale.load();
*window_node->newChild("snap") = snap.load();
*window_node->newChild("center_freq") = centerFreq.load();
*window_node->newChild("waterfall_lps") = waterfallLinesPerSec.load();
*window_node->newChild("spectrum_avg") = spectrumAvgSpeed.load();
*window_node->newChild("modemprops_collapsed") = modemPropsCollapsed.load();;
*window_node->newChild("modemprops_collapsed") = modemPropsCollapsed.load();
*window_node->newChild("db_offset") = dbOffset.load();
*window_node->newChild("main_split") = mainSplit.load();
@ -539,6 +604,12 @@ bool AppConfig::save() {
*window_node->newChild("bookmark_visible") = bookmarksVisible.load();
}
//Recording settings:
DataNode *rec_node = cfg.rootNode()->newChild("recording");
*rec_node->newChild("path") = recordingPath;
*rec_node->newChild("squelch") = recordingSquelchOption;
*rec_node->newChild("file_time_limit") = recordingFileTimeLimitSeconds;
DataNode *devices_node = cfg.rootNode()->newChild("devices");
std::map<std::string, DeviceConfig *>::iterator device_config_i;
@ -547,12 +618,12 @@ bool AppConfig::save() {
device_config_i->second->save(device_node);
}
if (manualDevices.size()) {
if (!manualDevices.empty()) {
DataNode *manual_node = cfg.rootNode()->newChild("manual_devices");
for (std::vector<SDRManualDef>::const_iterator i = manualDevices.begin(); i != manualDevices.end(); i++) {
for (const auto & manualDevice : manualDevices) {
DataNode *rig_node = manual_node->newChild("device");
*rig_node->newChild("factory") = i->factory;
*rig_node->newChild("params") = i->params;
*rig_node->newChild("factory") = manualDevice.factory;
*rig_node->newChild("params") = manualDevice.params;
}
}
@ -616,7 +687,7 @@ bool AppConfig::load() {
if (cfg.rootNode()->hasAnother("window")) {
int x = 0 ,y = 0 ,w = 0 ,h = 0;
int max = 0 ,tips = 0 ,lpm = 0 ,mpc = 0;
int max = 0 ,tips = 0 ,perf_mode = 0 ,mpc = 0;
DataNode *win_node = cfg.rootNode()->getNext("window");
@ -635,45 +706,53 @@ bool AppConfig::load() {
if (win_node->hasAnother("max")) {
win_node->getNext("max")->element()->get(max);
winMax.store(max?true:false);
winMax.store(max != 0);
}
if (win_node->hasAnother("tips")) {
win_node->getNext("tips")->element()->get(tips);
showTips.store(tips?true:false);
showTips.store(tips != 0);
}
if (win_node->hasAnother("low_perf_mode")) {
win_node->getNext("low_perf_mode")->element()->get(lpm);
lowPerfMode.store(lpm?true:false);
}
// default:
perfMode.store(PERF_NORMAL);
if (win_node->hasAnother("perf_mode")) {
win_node->getNext("perf_mode")->element()->get(perf_mode);
if (perf_mode == (int)PERF_LOW) {
perfMode.store(PERF_LOW);
} else if (perf_mode == (int)PERF_HIGH) {
perfMode.store(PERF_HIGH);
}
}
if (win_node->hasAnother("theme")) {
int theme;
int theme = 0;
win_node->getNext("theme")->element()->get(theme);
themeId.store(theme);
}
if (win_node->hasAnother("font_scale")) {
int fscale;
int fscale = 0;
win_node->getNext("font_scale")->element()->get(fscale);
fontScale.store(fscale);
}
if (win_node->hasAnother("snap")) {
long long snapVal;
long long snapVal = 0;
win_node->getNext("snap")->element()->get(snapVal);
snap.store(snapVal);
}
if (win_node->hasAnother("center_freq")) {
long long freqVal;
long long freqVal = 0;
win_node->getNext("center_freq")->element()->get(freqVal);
centerFreq.store(freqVal);
}
if (win_node->hasAnother("waterfall_lps")) {
int lpsVal;
int lpsVal = 30;
win_node->getNext("waterfall_lps")->element()->get(lpsVal);
waterfallLinesPerSec.store(lpsVal);
}
@ -686,7 +765,7 @@ bool AppConfig::load() {
if (win_node->hasAnother("modemprops_collapsed")) {
win_node->getNext("modemprops_collapsed")->element()->get(mpc);
modemPropsCollapsed.store(mpc?true:false);
modemPropsCollapsed.store(mpc != 0);
}
if (win_node->hasAnother("db_offset")) {
@ -721,6 +800,26 @@ bool AppConfig::load() {
}
}
//Recording settings:
if (cfg.rootNode()->hasAnother("recording")) {
DataNode *rec_node = cfg.rootNode()->getNext("recording");
if (rec_node->hasAnother("path")) {
DataNode *rec_path = rec_node->getNext("path");
recordingPath = rec_path->element()->toString();
}
if (rec_node->hasAnother("squelch")) {
DataNode *rec_squelch = rec_node->getNext("squelch");
rec_squelch->element()->get(recordingSquelchOption);
}
if (rec_node->hasAnother("file_time_limit")) {
DataNode *rec_file_time_limit = rec_node->getNext("file_time_limit");
rec_file_time_limit->element()->get(recordingFileTimeLimitSeconds);
}
}
if (cfg.rootNode()->hasAnother("devices")) {
DataNode *devices_node = cfg.rootNode()->getNext("devices");
@ -757,7 +856,7 @@ bool AppConfig::load() {
if (rig_node->hasAnother("enabled")) {
int loadEnabled;
rig_node->getNext("enabled")->element()->get(loadEnabled);
rigEnabled.store(loadEnabled?true:false);
rigEnabled.store(loadEnabled != 0);
}
if (rig_node->hasAnother("model")) {
int loadModel;
@ -775,22 +874,22 @@ bool AppConfig::load() {
if (rig_node->hasAnother("control")) {
int loadControl;
rig_node->getNext("control")->element()->get(loadControl);
rigControlMode.store(loadControl?true:false);
rigControlMode.store(loadControl != 0);
}
if (rig_node->hasAnother("follow")) {
int loadFollow;
rig_node->getNext("follow")->element()->get(loadFollow);
rigFollowMode.store(loadFollow?true:false);
rigFollowMode.store(loadFollow != 0);
}
if (rig_node->hasAnother("center_lock")) {
int loadCenterLock;
rig_node->getNext("center_lock")->element()->get(loadCenterLock);
rigCenterLock.store(loadCenterLock?true:false);
rigCenterLock.store(loadCenterLock != 0);
}
if (rig_node->hasAnother("follow_modem")) {
int loadFollow;
rig_node->getNext("follow_modem")->element()->get(loadFollow);
rigFollowModem.store(loadFollow?true:false);
rigFollowModem.store(loadFollow != 0);
}
}
#endif
@ -811,24 +910,24 @@ int AppConfig::getRigModel() {
return rigModel.load();
}
void AppConfig::setRigModel(int rigModel) {
this->rigModel.store(rigModel);
void AppConfig::setRigModel(int rigModel_in) {
rigModel.store(rigModel_in);
}
int AppConfig::getRigRate() {
return rigRate.load();
}
void AppConfig::setRigRate(int rigRate) {
this->rigRate.store(rigRate);
void AppConfig::setRigRate(int rigRate_in) {
rigRate.store(rigRate_in);
}
std::string AppConfig::getRigPort() {
return rigPort;
}
void AppConfig::setRigPort(std::string rigPort) {
this->rigPort = rigPort;
void AppConfig::setRigPort(std::string rigPort_in) {
rigPort = rigPort_in;
}
void AppConfig::setRigControlMode(bool cMode) {

View File

@ -20,40 +20,43 @@ typedef std::map<std::string, float> ConfigGains;
class DeviceConfig {
public:
DeviceConfig();
DeviceConfig(std::string deviceId);
explicit DeviceConfig(std::string deviceId_in);
void setPPM(int ppm);
void setPPM(int ppm_in);
int getPPM();
void setOffset(long long offset);
void setOffset(long long offset_in);
long long getOffset();
void setSampleRate(long srate);
void setSampleRate(long sampleRate_in);
long getSampleRate();
void setAGCMode(bool agcMode);
void setAntennaName(const std::string& name);
const std::string& getAntennaName();
void setAGCMode(bool agcMode_in);
bool getAGCMode();
void setDeviceId(std::string deviceId);
void setDeviceId(std::string deviceId_in);
std::string getDeviceId();
void setDeviceName(std::string deviceName);
void setDeviceName(std::string deviceName_in);
std::string getDeviceName();
void setStreamOpts(ConfigSettings opts);
ConfigSettings getStreamOpts();
void setStreamOpt(std::string key, std::string value);
std::string getStreamOpt(std::string key, std::string defaultValue);
void setStreamOpt(const std::string& key, std::string value);
std::string getStreamOpt(const std::string& key, std::string defaultValue);
void setSettings(ConfigSettings settings);
void setSettings(ConfigSettings settings_in);
ConfigSettings getSettings();
void setSetting(std::string key, std::string value);
std::string getSetting(std::string key, std::string defaultValue);
void setSetting(const std::string& key, std::string value);
std::string getSetting(const std::string& key, std::string defaultValue);
void setGains(ConfigGains gains);
void setGains(ConfigGains gains_in);
ConfigGains getGains();
void setGain(std::string key, float value);
float getGain(std::string key, float defaultValue);
void setGain(const std::string& key, float value);
float getGain(const std::string& key, float defaultValue);
void setRigIF(int rigType, long long freq);
long long getRigIF(int rigType);
@ -64,12 +67,14 @@ public:
private:
std::string deviceId;
std::string deviceName;
std::mutex busy_lock;
std::atomic_int ppm;
std::atomic_llong offset;
std::atomic_bool agcMode;
std::atomic_long sampleRate;
std::atomic_int ppm{};
std::atomic_llong offset{};
std::atomic_bool agcMode{};
std::atomic_long sampleRate{};
std::string antennaName;
ConfigSettings streamOpts;
ConfigGains gains;
std::map<std::string, std::string> settings;
@ -78,9 +83,17 @@ private:
class AppConfig {
public:
enum PerfModeEnum {
PERF_LOW = 0,
PERF_NORMAL = 1,
PERF_HIGH = 2
};
AppConfig();
std::string getConfigDir();
DeviceConfig *getDevice(std::string deviceId);
DeviceConfig *getDevice(const std::string& deviceId);
void setWindow(wxPoint winXY, wxSize winWH);
wxRect *getWindow();
@ -94,13 +107,13 @@ public:
void setShowTips(bool show);
bool getShowTips();
void setLowPerfMode(bool lpm);
bool getLowPerfMode();
void setPerfMode(PerfModeEnum mode);
PerfModeEnum getPerfMode();
void setTheme(int themeId);
void setTheme(int themeId_in);
int getTheme();
void setFontScale(int scaleValue);
void setFontScale(int fontScale_in);
int getFontScale();
void setSnap(long long snapVal);
@ -133,16 +146,26 @@ public:
void setBookmarksVisible(bool state);
bool getBookmarksVisible();
//Recording settings:
void setRecordingPath(std::string recPath);
std::string getRecordingPath();
bool verifyRecordingPath();
void setRecordingSquelchOption(int enumChoice);
int getRecordingSquelchOption() const;
void setRecordingFileTimeLimit(int nbSeconds);
int getRecordingFileTimeLimit() const;
#if USE_HAMLIB
int getRigModel();
void setRigModel(int rigModel);
void setRigModel(int rigModel_in);
int getRigRate();
void setRigRate(int rigRate);
void setRigRate(int rigRate_in);
std::string getRigPort();
void setRigPort(std::string rigPort);
void setRigPort(std::string rigPort_in);
void setRigControlMode(bool cMode);
bool getRigControlMode();
@ -160,7 +183,7 @@ public:
bool getRigEnabled();
#endif
void setConfigName(std::string configName);
void setConfigName(std::string configName_in);
std::string getConfigFileName(bool ignoreName=false);
bool save();
bool load();
@ -169,20 +192,26 @@ public:
private:
std::string configName;
std::map<std::string, DeviceConfig *> deviceConfig;
std::atomic_int winX,winY,winW,winH;
std::atomic_bool winMax, showTips, lowPerfMode, modemPropsCollapsed;
std::atomic_int themeId;
std::atomic_int fontScale;
std::atomic_llong snap;
std::atomic_llong centerFreq;
std::atomic_int waterfallLinesPerSec;
std::atomic<float> spectrumAvgSpeed, mainSplit, visSplit, bookmarkSplit;
std::atomic_int dbOffset;
std::atomic_int winX{},winY{},winW{},winH{};
std::atomic_bool winMax{}, showTips{}, modemPropsCollapsed{};
std::atomic_int themeId{};
std::atomic_int fontScale{};
std::atomic_llong snap{};
std::atomic_llong centerFreq{};
std::atomic_int waterfallLinesPerSec{};
std::atomic<float> spectrumAvgSpeed{}, mainSplit{}, visSplit{}, bookmarkSplit{};
std::atomic_int dbOffset{};
std::vector<SDRManualDef> manualDevices;
std::atomic_bool bookmarksVisible;
std::atomic_bool bookmarksVisible{};
std::atomic<PerfModeEnum> perfMode{};
std::string recordingPath;
int recordingSquelchOption = 0;
int recordingFileTimeLimitSeconds = 0;
#if USE_HAMLIB
std::atomic_int rigModel, rigRate;
std::atomic_int rigModel{}, rigRate{};
std::string rigPort;
std::atomic_bool rigEnabled, rigFollowMode, rigControlMode, rigCenterLock, rigFollowModem;
std::atomic_bool rigEnabled{}, rigFollowMode{}, rigControlMode{}, rigCenterLock{}, rigFollowModem{};
#endif
};

File diff suppressed because it is too large Load Diff

View File

@ -9,6 +9,7 @@
#include <wx/sizer.h>
#include <wx/bitmap.h>
#include <wx/statbmp.h>
#include <wx/tooltip.h>
#include "PrimaryGLContext.h"
@ -26,60 +27,10 @@
#include "FrequencyDialog.h"
#include "BookmarkView.h"
#include "AboutDialog.h"
#include "DemodulatorInstance.h"
#include "DemodulatorThread.h"
#include <map>
#define wxID_RT_AUDIO_DEVICE 1000
#define wxID_SET_FREQ_OFFSET 2001
#define wxID_RESET 2002
#define wxID_SET_PPM 2003
#define wxID_SET_TIPS 2004
#define wxID_SET_IQSWAP 2005
#define wxID_SDR_DEVICES 2008
#define wxID_AGC_CONTROL 2009
#define wxID_SDR_START_STOP 2010
#define wxID_LOW_PERF 2011
#define wxID_SET_DB_OFFSET 2012
#define wxID_ABOUT_CUBICSDR 2013
#define wxID_MAIN_SPLITTER 2050
#define wxID_VIS_SPLITTER 2051
#define wxID_BM_SPLITTER 2052
#define wxID_THEME_DEFAULT 2100
#define wxID_THEME_SHARP 2101
#define wxID_THEME_BW 2102
#define wxID_THEME_RAD 2103
#define wxID_THEME_TOUCH 2104
#define wxID_THEME_HD 2105
#define wxID_THEME_RADAR 2106
#define wxID_DISPLAY_BOOKMARKS 2107
#define wxID_BANDWIDTH_BASE 2150
#define wxID_BANDWIDTH_MANUAL_DIALOG 2199
#define wxID_BANDWIDTH_MANUAL 2200
#define wxID_DISPLAY_BASE 2250
#define wxID_SETTINGS_BASE 2300
#define wxID_DEVICE_ID 3500
#define wxID_AUDIO_BANDWIDTH_BASE 9000
#define wxID_AUDIO_DEVICE_MULTIPLIER 50
#ifdef USE_HAMLIB
#define wxID_RIG_TOGGLE 11900
#define wxID_RIG_PORT 11901
#define wxID_RIG_SDR_IF 11902
#define wxID_RIG_CONTROL 11903
#define wxID_RIG_FOLLOW 11904
#define wxID_RIG_CENTERLOCK 11905
#define wxID_RIG_FOLLOW_MODEM 11906
#define wxID_RIG_SERIAL_BASE 11950
#define wxID_RIG_MODEL_BASE 12000
#endif
#ifdef USE_HAMLIB
class PortSelectorDialog;
@ -89,33 +40,28 @@ class PortSelectorDialog;
class AppFrame: public wxFrame {
public:
AppFrame();
~AppFrame();
~AppFrame() override;
void initDeviceParams(SDRDeviceInfo *devInfo);
void updateDeviceParams();
void saveSession(std::string fileName);
bool loadSession(std::string fileName);
void initDeviceParams(SDRDeviceInfo *devInfo_in);
FFTVisualDataThread *getWaterfallDataThread();
WaterfallCanvas *getWaterfallCanvas();
SpectrumCanvas *getSpectrumCanvas();
void notifyUpdateModemProperties();
void setMainWaterfallFFTSize(int fftSize);
void setScopeDeviceName(std::string deviceName);
void gkNudgeLeft(DemodulatorInstance *demod, int snap);
void gkNudgeRight(DemodulatorInstance *demod, int snap);
int OnGlobalKeyDown(wxKeyEvent &event);
int OnGlobalKeyUp(wxKeyEvent &event);
void setWaterfallLinesPerSecond(int lps);
void setSpectrumAvgSpeed(double avg);
FrequencyDialog::FrequencyDialogTarget getFrequencyDialogTarget();
void refreshGainUI();
void setViewState(long long center_freq, int bandwidth);
void setViewState(long long center_freq);
void setViewState();
long long getViewCenterFreq();
int getViewBandwidth();
@ -134,115 +80,223 @@ public:
bool canFocus();
#endif
//set tooltip to window
void setStatusText(wxWindow* window, std::string statusText);
void setStatusText(std::string statusText, int value);
void setStatusText(wxWindow* window, const std::string& statusText);
void setStatusText(const std::string& statusText, int value);
#ifdef USE_HAMLIB
void setRigControlPort(std::string portName);
void dismissRigControlPortDialog();
void setRigControlPort(const std::string& portName);
void dismissRigControlPortDialog();
#endif
private:
/***
* UI Elements
*/
ScopeCanvas *scopeCanvas;
SpectrumCanvas *spectrumCanvas, *demodSpectrumCanvas;
WaterfallCanvas *waterfallCanvas, *demodWaterfallCanvas;
TuningCanvas *demodTuner;
MeterCanvas *demodSignalMeter, *demodGainMeter, *spectrumAvgMeter, *waterfallSpeedMeter;
ModeSelectorCanvas *demodModeSelector, *demodMuteButton, *peakHoldButton, *soloModeButton, *deltaLockButton;
GainCanvas *gainCanvas;
BookmarkView *bookmarkView;
wxSizerItem *gainSizerItem, *gainSpacerItem;
wxSplitterWindow *mainVisSplitter, *mainSplitter, *bookmarkSplitter;
wxBoxSizer *demodTray;
//Use a raw pointer here to prevent a dangling reference
DemodulatorInstance* activeDemodulator;
/***
* Menus
*/
wxMenuBar *menuBar = nullptr;
wxMenu *fileMenu = nullptr;
wxMenu *settingsMenu = nullptr;
wxMenuItem *showTipMenuItem;
wxMenuItem *iqSwapMenuItem = nullptr;
wxMenuItem *agcMenuItem = nullptr;
wxMenu *sampleRateMenu = nullptr;
wxMenu *displayMenu = nullptr;
wxMenuItem *hideBookmarksItem;
wxMenu *recordingMenu = nullptr;
//depending on context, maps the item id to wxMenuItem*,
//OR the submenu item id to its parent wxMenuItem*.
std::map<int, wxMenuItem *> sampleRateMenuItems;
std::map<int, wxMenuItem *> antennaMenuItems;
std::map<int, wxMenuItem *> settingsMenuItems;
std::map<int, wxMenuItem *> performanceMenuItems;
std::map<int, wxMenuItem *> audioSampleRateMenuItems;
std::map<int, wxMenuItem *> recordingMenuItems;
/***
* Waterfall Data Thread
*/
FFTVisualDataThread *waterfallDataThread;
std::thread *t_FFTData;
/***
* Active Settings
*/
bool saveDisabled = false;
std::string currentSessionFile;
std::string currentBookmarkFile;
SoapySDR::ArgInfoList settingArgs;
int settingsIdMax;
std::vector<long> sampleRates;
long manualSampleRate = -1;
SDRDeviceInfo *devInfo = nullptr;
std::atomic_bool deviceChanged;
ModemProperties *modemProps;
std::atomic_bool modemPropertiesUpdated;
std::vector<std::string> antennaNames;
std::string currentTXantennaName;
AboutDialog *aboutDlg = nullptr;
std::string lastToolTip;
#ifdef ENABLE_DIGITAL_LAB
ModeSelectorCanvas *demodModeSelectorAdv;
#endif
/***
* wx Events
*/
void OnMenu(wxCommandEvent& event);
void OnClose(wxCloseEvent& event);
void OnNewWindow(wxCommandEvent& event);
void OnIdle(wxIdleEvent& event);
void OnDoubleClickSash(wxSplitterEvent& event);
void OnUnSplit(wxSplitterEvent& event);
void OnAboutDialogClose(wxCommandEvent& event);
//actionXXXX manage menu actions, return true if the event has been
//treated.
bool actionOnMenuAbout(wxCommandEvent& event);
bool actionOnMenuReset(wxCommandEvent& event);
bool actionOnMenuSettings(wxCommandEvent& event);
bool actionOnMenuAGC(wxCommandEvent& event);
bool actionOnMenuSampleRate(wxCommandEvent& event);
bool actionOnMenuAudioSampleRate(wxCommandEvent& event);
bool actionOnMenuDisplay(wxCommandEvent& event);
bool actionOnMenuLoadSave(wxCommandEvent& event);
bool actionOnMenuRig(wxCommandEvent& event);
void OnNewWindow(wxCommandEvent& event);
ScopeCanvas *scopeCanvas;
SpectrumCanvas *spectrumCanvas;
WaterfallCanvas *waterfallCanvas;
ModeSelectorCanvas *demodModeSelector;
#ifdef ENABLE_DIGITAL_LAB
ModeSelectorCanvas *demodModeSelectorAdv;
#endif
SpectrumCanvas *demodSpectrumCanvas;
WaterfallCanvas *demodWaterfallCanvas;
MeterCanvas *demodSignalMeter;
MeterCanvas *demodGainMeter;
TuningCanvas *demodTuner;
// UITestCanvas *testCanvas;
MeterCanvas *spectrumAvgMeter;
MeterCanvas *waterfallSpeedMeter;
ModeSelectorCanvas *demodMuteButton, *peakHoldButton, *soloModeButton, *deltaLockButton;
GainCanvas *gainCanvas;
wxSizerItem *gainSizerItem, *gainSpacerItem;
wxSplitterWindow *mainVisSplitter, *mainSplitter, *bookmarkSplitter;
wxBoxSizer *demodTray;
BookmarkView *bookmarkView;
DemodulatorInstance *activeDemodulator;
/**
* Session Management
*/
void saveSession(const std::string& fileName);
bool loadSession(const std::string& fileName);
std::vector<RtAudio::DeviceInfo> devices;
std::map<int,RtAudio::DeviceInfo> inputDevices;
std::map<int,RtAudio::DeviceInfo> outputDevices;
std::map<int, wxMenuItem *> outputDeviceMenuItems;
std::map<int, wxMenuItem *> sampleRateMenuItems;
std::map<int, wxMenuItem *> audioSampleRateMenuItems;
std::map<int, wxMenuItem *> directSamplingMenuItems;
wxMenuBar *menuBar;
wxMenu *sampleRateMenu = nullptr;
wxMenu *displayMenu = nullptr;
wxMenuItem *agcMenuItem = nullptr;
wxMenuItem *iqSwapMenuItem = nullptr;
wxMenuItem *lowPerfMenuItem = nullptr;
wxMenu *settingsMenu = nullptr;
SoapySDR::ArgInfoList settingArgs;
int settingsIdMax;
std::vector<long> sampleRates;
long manualSampleRate = -1;
std::string currentSessionFile;
FFTVisualDataThread *waterfallDataThread;
std::thread *t_FFTData;
SDRDeviceInfo *devInfo;
std::atomic_bool deviceChanged;
ModemProperties *modemProps;
std::atomic_bool modemPropertiesUpdated;
wxMenuItem *showTipMenuItem;
/**
* Keyboard handlers
*/
void gkNudge(const DemodulatorInstancePtr& demod, int snap);
bool lowPerfMode;
void toggleActiveDemodRecording();
void toggleAllActiveDemodRecording();
wxMenuItem *hideBookmarksItem;
bool saveDisabled;
AboutDialog *aboutDlg;
/**
* UI init functions
*/
ModeSelectorCanvas *makeModemSelectorPanel(wxWindow *parent, const wxGLAttributes &attribList);
WaterfallCanvas *makeWaterfallCanvas(wxWindow *parent, const wxGLAttributes &attribList);
SpectrumCanvas *makeDemodSpectrumCanvas(wxWindow *parent, const wxGLAttributes &attribList);
MeterCanvas *makeSignalMeter(wxWindow *parent, const wxGLAttributes &attribList);
ModeSelectorCanvas *makeDeltaLockButton(wxWindow *parent, const wxGLAttributes &attribList);
TuningCanvas *makeModemTuner(wxWindow *parent, const wxGLAttributes &attribList);
MeterCanvas *makeModemGainMeter(wxWindow *parent, const wxGLAttributes &attribList);
ModeSelectorCanvas *makeSoloModeButton(wxWindow *parent, const wxGLAttributes &attribList);
ModeSelectorCanvas *makeModemMuteButton(wxWindow *parent, const wxGLAttributes &attribList);
ModeSelectorCanvas *makePeakHoldButton(wxWindow *parent, const wxGLAttributes &attribList);
SpectrumCanvas *makeSpectrumCanvas(wxWindow *parent, const wxGLAttributes &attribList);
MeterCanvas *makeSpectrumAvgMeter(wxWindow *parent, const wxGLAttributes &attribList);
WaterfallCanvas *makeWaterfall(wxWindow *parent, const wxGLAttributes &attribList);
MeterCanvas *makeWaterfallSpeedMeter(wxWindow *parent, const wxGLAttributes &attribList);
ScopeCanvas *makeScopeCanvas(wxPanel *parent, const wxGLAttributes &attribList);
ModeSelectorCanvas *makeModemAdvSelectorPanel(wxPanel *parent, const wxGLAttributes &attribList);
ModemProperties *makeModemProperties(wxPanel *parent);
std::string lastToolTip;
void initConfigurationSettings();
void initMenuBar();
void initIcon();
wxMenu *makeFileMenu();
wxMenu *makeAudioSampleRateMenu();
wxMenu *makeDisplayMenu();
wxMenu *makeRecordingMenu();
void updateRecordingMenu();
wxString getSettingsLabel(const std::string& settingsName,
const std::string& settingsValue,
const std::string& settingsSuffix = "");
/**
* Menu Action Handlers
*/
//actionXXXX manage menu actions, return true if the event has been
//treated.
bool actionOnMenuAbout(wxCommandEvent& event);
bool actionOnMenuReset(wxCommandEvent& event);
bool actionOnMenuSettings(wxCommandEvent& event);
bool actionOnMenuAGC(wxCommandEvent& event);
bool actionOnMenuSampleRate(wxCommandEvent& event);
bool actionOnMenuAudioSampleRate(wxCommandEvent& event);
bool actionOnMenuDisplay(wxCommandEvent& event);
bool actionOnMenuLoadSave(wxCommandEvent& event);
bool actionOnMenuRecording(wxCommandEvent& event);
bool actionOnMenuRig(wxCommandEvent& event);
bool actionOnMenuSDRStartStop(wxCommandEvent &event);
bool actionOnMenuPerformance(wxCommandEvent &event);
bool actionOnMenuTips(wxCommandEvent &event);
bool actionOnMenuIQSwap(wxCommandEvent &event);
bool actionOnMenuFreqOffset(wxCommandEvent &event);
bool actionOnMenuDBOffset(wxCommandEvent &event);
bool actionOnMenuSDRDevices(wxCommandEvent &event);
bool actionOnMenuSetPPM(wxCommandEvent &event);
bool actionOnMenuClose(wxCommandEvent &event);
/**
* UI Activity Handlers
*/
void handleUpdateDeviceParams();
void handleTXAntennaChange();
void handleCurrentModem();
void handleModeSelector();
void handleGainMeter();
void handleDemodWaterfallSpectrum();
void handleSpectrumWaterfall();
void handleMuteButton();
void handleScopeProcessor();
void handleScopeSpectrumProcessors();
void handleModemProperties();
void handlePeakHold();
/**
* Hamlib/Rig specific
*/
#ifdef USE_HAMLIB
void enableRig();
void disableRig();
wxMenu *rigMenu;
wxMenu *rigMenu;
wxMenuItem *rigEnableMenuItem;
wxMenuItem *rigPortMenuItem;
wxMenuItem *rigControlMenuItem;
wxMenuItem *rigFollowMenuItem;
wxMenuItem *rigCenterLockMenuItem;
wxMenuItem *rigFollowModemMenuItem;
std::map<int, wxMenuItem *> rigSerialMenuItems;
std::map<int, wxMenuItem *> rigModelMenuItems;
wxMenu *rigModelMenu;
int rigModel;
int rigSerialRate;
long long rigSDRIF;
@ -250,7 +304,86 @@ private:
std::string rigPort;
int numRigs;
PortSelectorDialog *rigPortDialog;
void enableRig();
void disableRig();
wxMenu *makeRigMenu();
void handleRigMenu();
#endif
wxDECLARE_EVENT_TABLE();
};
#define wxID_RT_AUDIO_DEVICE 1000
#define wxID_SET_FREQ_OFFSET 2001
#define wxID_RESET 2002
#define wxID_SET_PPM 2003
#define wxID_SET_TIPS 2004
#define wxID_SET_IQSWAP 2005
#define wxID_SDR_DEVICES 2008
#define wxID_AGC_CONTROL 2009
#define wxID_SDR_START_STOP 2010
#define wxID_SET_DB_OFFSET 2012
#define wxID_ABOUT_CUBICSDR 2013
#define wxID_OPEN_BOOKMARKS 2020
#define wxID_SAVE_BOOKMARKS 2021
#define wxID_SAVEAS_BOOKMARKS 2022
#define wxID_RESET_BOOKMARKS 2023
#define wxID_MAIN_SPLITTER 2050
#define wxID_VIS_SPLITTER 2051
#define wxID_BM_SPLITTER 2052
#define wxID_THEME_DEFAULT 2070
#define wxID_THEME_DEFAULT_JET 2071
#define wxID_THEME_SHARP 2072
#define wxID_THEME_BW 2073
#define wxID_THEME_RAD 2074
#define wxID_THEME_TOUCH 2075
#define wxID_THEME_HD 2076
#define wxID_THEME_RADAR 2077
#define wxID_DISPLAY_BOOKMARKS 2100
#define wxID_BANDWIDTH_BASE 2150
#define wxID_BANDWIDTH_MANUAL_DIALOG 2199
#define wxID_BANDWIDTH_MANUAL 2200
#define wxID_DISPLAY_BASE 2250
#define wxID_SETTINGS_BASE 2300
#define wxID_ANTENNA_CURRENT 2350
#define wxID_ANTENNA_CURRENT_TX 2501
#define wxID_ANTENNAS_BASE 2352
#define wxID_PERF_CURRENT 2400
#define wxID_PERF_BASE 2401
#define wxID_DEVICE_ID 3500
#define wxID_RECORDING_PATH 8500
#define wxID_RECORDING_SQUELCH_BASE 8501
#define wxID_RECORDING_SQUELCH_SILENCE 8502
#define wxID_RECORDING_SQUELCH_SKIP 8503
#define wxID_RECORDING_SQUELCH_ALWAYS 8504
#define wxID_RECORDING_FILE_TIME_LIMIT 8505
#define wxID_AUDIO_BANDWIDTH_BASE 9000
#define wxID_AUDIO_DEVICE_MULTIPLIER 50
#ifdef USE_HAMLIB
#define wxID_RIG_TOGGLE 11900
#define wxID_RIG_PORT 11901
#define wxID_RIG_SDR_IF 11902
#define wxID_RIG_CONTROL 11903
#define wxID_RIG_FOLLOW 11904
#define wxID_RIG_CENTERLOCK 11905
#define wxID_RIG_FOLLOW_MODEM 11906
#define wxID_RIG_SERIAL_BASE 11950
#define wxID_RIG_MODEL_BASE 12000
#endif

View File

@ -14,11 +14,11 @@ BookmarkEntry::~BookmarkEntry() {
BookmarkMgr::BookmarkMgr() {
rangesSorted = false;
}
//
void BookmarkMgr::saveToFile(const std::string& bookmarkFn, bool backup, bool useFullpath) {
//represents an empty BookMarkList that is returned by reference by some functions.
const BookmarkList BookmarkMgr::emptyResults;
std::lock_guard < std::recursive_mutex > lock(busy_lock);
void BookmarkMgr::saveToFile(std::string bookmarkFn, bool backup) {
DataTree s("cubicsdr_bookmarks");
DataNode *header = s.rootNode()->newChild("header");
header->newChild("version")->element()->set(wxString(CUBICSDR_VERSION).ToStdWstring());
@ -32,7 +32,7 @@ void BookmarkMgr::saveToFile(std::string bookmarkFn, bool backup) {
DataNode *view_ranges = s.rootNode()->newChild("ranges");
for (auto re_i : ranges) {
for (const auto& re_i : ranges) {
DataNode *range = view_ranges->newChild("range");
*range->newChild("label") = re_i->label;
*range->newChild("freq") = re_i->freq;
@ -48,13 +48,27 @@ void BookmarkMgr::saveToFile(std::string bookmarkFn, bool backup) {
*group->newChild("@expanded") = (getExpandState(bmd_i.first)?std::string("true"):std::string("false"));
for (auto &bm_i : bmd_i.second ) {
group->newChildCloneFrom("modem", bm_i->node);
//if a matching demodulator exists, use its data instead to be be saved, because output_device could have been
//modified by the user. So, save that "live" version instead.
auto matchingDemod = wxGetApp().getDemodMgr().getLastDemodulatorWith(bm_i->type,
bm_i->label,
bm_i->frequency,
bm_i->bandwidth);
if (matchingDemod != nullptr) {
wxGetApp().getDemodMgr().saveInstance(group->newChild("modem"), matchingDemod);
}
else {
group->newChildCloneFrom("modem", bm_i->node);
}
}
}
DataNode *recent_modems = s.rootNode()->newChild("recent_modems");
for (auto demod : wxGetApp().getDemodMgr().getDemodulators()) {
for (const auto& demod : wxGetApp().getDemodMgr().getDemodulators()) {
wxGetApp().getDemodMgr().saveInstance(recent_modems->newChild("modem"),demod);
}
@ -62,9 +76,18 @@ void BookmarkMgr::saveToFile(std::string bookmarkFn, bool backup) {
recent_modems->newChildCloneFrom("modem", r_i->node);
}
wxFileName saveFile(wxGetApp().getConfig()->getConfigDir(), bookmarkFn);
wxFileName saveFileBackup(wxGetApp().getConfig()->getConfigDir(), bookmarkFn + ".backup");
wxFileName saveFile;
wxFileName saveFileBackup;
if (useFullpath) {
saveFile.Assign(bookmarkFn);
saveFileBackup.Assign(bookmarkFn + ".backup");
}
else {
saveFile.Assign(wxGetApp().getConfig()->getConfigDir(), bookmarkFn);
saveFileBackup.Assign(wxGetApp().getConfig()->getConfigDir(), bookmarkFn + ".backup");
}
if (saveFile.IsDirWritable()) {
// Hopefully leave at least a readable backup in case of failure..
if (backup && saveFile.FileExists() && (!saveFileBackup.FileExists() || saveFileBackup.IsFileWritable())) {
@ -74,20 +97,30 @@ void BookmarkMgr::saveToFile(std::string bookmarkFn, bool backup) {
}
}
bool BookmarkMgr::loadFromFile(std::string bookmarkFn, bool backup) {
wxFileName loadFile(wxGetApp().getConfig()->getConfigDir(), bookmarkFn);
wxFileName failFile(wxGetApp().getConfig()->getConfigDir(), bookmarkFn + ".failedload");
wxFileName lastLoaded(wxGetApp().getConfig()->getConfigDir(), bookmarkFn + ".lastloaded");
wxFileName backupFile(wxGetApp().getConfig()->getConfigDir(), bookmarkFn + ".backup");
bool BookmarkMgr::loadFromFile(const std::string& bookmarkFn, bool backup, bool useFullpath) {
std::lock_guard < std::recursive_mutex > lock(busy_lock);
wxFileName loadFile;
wxFileName failFile;
wxFileName lastLoaded;
wxFileName backupFile;
if (useFullpath) {
loadFile.Assign(bookmarkFn);
failFile.Assign(bookmarkFn + ".failedload");
lastLoaded.Assign(bookmarkFn + ".lastloaded");
backupFile.Assign(bookmarkFn + ".backup");
}
else {
loadFile.Assign(wxGetApp().getConfig()->getConfigDir(), bookmarkFn);
failFile.Assign(wxGetApp().getConfig()->getConfigDir(), bookmarkFn + ".failedload");
lastLoaded.Assign(wxGetApp().getConfig()->getConfigDir(), bookmarkFn + ".lastloaded");
backupFile.Assign(wxGetApp().getConfig()->getConfigDir(), bookmarkFn + ".backup");
}
DataTree s;
bool loadStatusOk = true;
// Clear any active data
bmData.clear();
clearRecents();
clearRanges();
bmDataSorted.clear();
// File exists but is not readable
if (loadFile.FileExists() && !loadFile.IsFileReadable()) {
@ -96,7 +129,7 @@ bool BookmarkMgr::loadFromFile(std::string bookmarkFn, bool backup) {
// New instance of bookmark savefiles
if (backup && !loadFile.FileExists() && !lastLoaded.FileExists() && !backupFile.FileExists()) {
wxGetApp().getAppFrame()->getBookmarkView()->loadDefaultRanges();
loadDefaultRanges();
return true;
}
@ -104,6 +137,17 @@ bool BookmarkMgr::loadFromFile(std::string bookmarkFn, bool backup) {
if (!s.LoadFromFileXML(loadFile.GetFullPath(wxPATH_NATIVE).ToStdString())) {
return false;
}
//Check if it is a bookmark file, read the root node.
if (s.rootNode()->getName() != "cubicsdr_bookmarks") {
return false;
}
// Clear any active data
bmData.clear();
recents.clear();
ranges.clear();
bmDataSorted.clear();
if (s.rootNode()->hasAnother("branches")) {
DataNode *branches = s.rootNode()->getNext("branches");
@ -112,10 +156,10 @@ bool BookmarkMgr::loadFromFile(std::string bookmarkFn, bool backup) {
if (branches->hasAnother("range")) branches->getNext("range")->element()->get(bRange);
if (branches->hasAnother("bookmark")) branches->getNext("bookmark")->element()->get(bBookmark);
if (branches->hasAnother("recent")) branches->getNext("recent")->element()->get(bRecent);
wxGetApp().getAppFrame()->getBookmarkView()->setExpandState("active", bActive?true:false);
wxGetApp().getAppFrame()->getBookmarkView()->setExpandState("range", bRange?true:false);
wxGetApp().getAppFrame()->getBookmarkView()->setExpandState("bookmark", bBookmark?true:false);
wxGetApp().getAppFrame()->getBookmarkView()->setExpandState("recent", bRecent?true:false);
wxGetApp().getAppFrame()->getBookmarkView()->setExpandState("active", bActive != 0);
wxGetApp().getAppFrame()->getBookmarkView()->setExpandState("range", bRange != 0);
wxGetApp().getAppFrame()->getBookmarkView()->setExpandState("bookmark", bBookmark != 0);
wxGetApp().getAppFrame()->getBookmarkView()->setExpandState("recent", bRecent != 0);
}
if (s.rootNode()->hasAnother("ranges")) {
@ -138,20 +182,20 @@ bool BookmarkMgr::loadFromFile(std::string bookmarkFn, bool backup) {
DataNode *modems = s.rootNode()->getNext("modems");
while (modems->hasAnother("group")) {
DataNode *group = modems->getNext("group");
std::string expandState = "true";
std::string groupExpandState = "true";
std::string groupName = "Unnamed";
if (group->hasAnother("@name")) {
groupName = group->getNext("@name")->element()->toString();
}
if (group->hasAnother("@expanded")) {
expandState = group->getNext("@expanded")->element()->toString();
groupExpandState = group->getNext("@expanded")->element()->toString();
}
setExpandState(groupName, (expandState == "true"));
setExpandState(groupName, (groupExpandState == "true"));
while (group->hasAnother("modem")) {
DataNode *modem = group->getNext("modem");
BookmarkEntryPtr be = nodeToBookmark("modem", modem);
BookmarkEntryPtr be = nodeToBookmark(modem);
if (be) {
addBookmark(groupName.c_str(), be);
addBookmark(groupName, be);
} else {
std::cout << "error loading bookmarked modem.." << std::endl;
loadStatusOk = false;
@ -165,7 +209,7 @@ bool BookmarkMgr::loadFromFile(std::string bookmarkFn, bool backup) {
while (recent_modems->hasAnother("modem")) {
DataNode *modem = recent_modems->getNext("modem");
BookmarkEntryPtr be = nodeToBookmark("modem", modem);
BookmarkEntryPtr be = nodeToBookmark(modem);
if (be) {
addRecent(be);
} else {
@ -182,7 +226,7 @@ bool BookmarkMgr::loadFromFile(std::string bookmarkFn, bool backup) {
wxCopyFile(loadFile.GetFullPath(wxPATH_NATIVE).ToStdString(), lastLoaded.GetFullPath(wxPATH_NATIVE).ToStdString());
}
}
} else if (!loadStatusOk) {
} else {
if (loadFile.IsDirWritable()) { // Load failed; keep a copy of the failed bookmark file for analysis?
if (loadFile.FileExists() && (!failFile.FileExists() || failFile.IsFileWritable())) {
wxCopyFile(loadFile.GetFullPath(wxPATH_NATIVE).ToStdString(), failFile.GetFullPath(wxPATH_NATIVE).ToStdString());
@ -194,18 +238,56 @@ bool BookmarkMgr::loadFromFile(std::string bookmarkFn, bool backup) {
return loadStatusOk;
}
void BookmarkMgr::loadDefaultRanges() {
bool BookmarkMgr::hasLastLoad(std::string bookmarkFn) {
addRange(std::make_shared<BookmarkRangeEntry>(L"2200 Meters (135.7-137.8 kHz)", 136750, 135700, 137800));
addRange(std::make_shared<BookmarkRangeEntry>(L"630 Meters (472-479 kHz)", 475500, 472000, 479000));
addRange(std::make_shared<BookmarkRangeEntry>(L"160 Meters (1.8-2 MHz)", 1900000, 1800000, 2000000));
addRange(std::make_shared<BookmarkRangeEntry>(L"80 Meters (3.5-4.0 MHz)", 3750000, 3500000, 4000000));
addRange(std::make_shared<BookmarkRangeEntry>(L"60 Meters (5.332-5.405Mhz)", 5368500, 5332000, 5405000));
addRange(std::make_shared<BookmarkRangeEntry>(L"40 Meters (7.0-7.3 MHz)", 7150000, 7000000, 7300000));
addRange(std::make_shared<BookmarkRangeEntry>(L"30 Meters (10.1-10.15 MHz)", 10125000, 10100000, 10150000));
addRange(std::make_shared<BookmarkRangeEntry>(L"20 Meters (14.0-14.35 MHz)", 14175000, 14000000, 14350000));
addRange(std::make_shared<BookmarkRangeEntry>(L"17 Meters (17.044-19.092 MHz)", 18068180, 17044180, 19092180));
addRange(std::make_shared<BookmarkRangeEntry>(L"15 Meters (21-21.45 MHz)", 21225000, 21000000, 21450000));
addRange(std::make_shared<BookmarkRangeEntry>(L"12 Meters (24.89-24.99 MHz)", 24940000, 24890000, 24990000));
addRange(std::make_shared<BookmarkRangeEntry>(L"10 Meters (28-29.7 MHz)", 28850000, 28000000, 29700000));
addRange(std::make_shared<BookmarkRangeEntry>(L"6 Meters (50-54 MHz)", 52000000, 50000000, 54000000));
addRange(std::make_shared<BookmarkRangeEntry>(L"4 Meters (70-70.5 MHz)", 70250000, 70000000, 70500000));
addRange(std::make_shared<BookmarkRangeEntry>(L"2 Meters (144-148 MHz)", 146000000, 144000000, 148000000));
addRange(std::make_shared<BookmarkRangeEntry>(L"1.25 Meters (219-225 MHz)", 222000000, 219000000, 225000000));
addRange(std::make_shared<BookmarkRangeEntry>(L"70 cm (420-450 MHz)", 435000000, 420000000, 450000000));
addRange(std::make_shared<BookmarkRangeEntry>(L"33 cm (902-928 MHz)", 915000000, 902000000, 928000000));
addRange(std::make_shared<BookmarkRangeEntry>(L"23 cm (1240-1300 MHz)", 1270000000, 1240000000, 1300000000));
addRange(std::make_shared<BookmarkRangeEntry>(L"13 cm lower (2300-2310 MHz)", 2305000000, 2300000000, 2310000000));
addRange(std::make_shared<BookmarkRangeEntry>(L"13 cm upper (2390-2450 MHz)", 2420000000, 2390000000, 2450000000));
}
void BookmarkMgr::resetBookmarks() {
std::lock_guard < std::recursive_mutex > lock(busy_lock);
// Clear any active data
bmData.clear();
recents.clear();
ranges.clear();
bmDataSorted.clear();
loadDefaultRanges();
}
bool BookmarkMgr::hasLastLoad(const std::string& bookmarkFn) {
wxFileName lastLoaded(wxGetApp().getConfig()->getConfigDir(), bookmarkFn + ".lastloaded");
return lastLoaded.FileExists() && lastLoaded.IsFileReadable();
}
bool BookmarkMgr::hasBackup(std::string bookmarkFn) {
bool BookmarkMgr::hasBackup(const std::string& bookmarkFn) {
wxFileName backupFile(wxGetApp().getConfig()->getConfigDir(), bookmarkFn + ".backup");
return backupFile.FileExists() && backupFile.IsFileReadable();
}
void BookmarkMgr::addBookmark(std::string group, DemodulatorInstance *demod) {
void BookmarkMgr::addBookmark(const std::string& group, const DemodulatorInstancePtr& demod) {
std::lock_guard < std::recursive_mutex > lock(busy_lock);
//Create a BookmarkEntry from demod data, saving its
@ -216,7 +298,7 @@ void BookmarkMgr::addBookmark(std::string group, DemodulatorInstance *demod) {
bmDataSorted[group] = false;
}
void BookmarkMgr::addBookmark(std::string group, BookmarkEntryPtr be) {
void BookmarkMgr::addBookmark(const std::string& group, const BookmarkEntryPtr& be) {
std::lock_guard < std::recursive_mutex > lock(busy_lock);
bmData[group].push_back(be);
@ -224,15 +306,14 @@ void BookmarkMgr::addBookmark(std::string group, BookmarkEntryPtr be) {
}
void BookmarkMgr::removeBookmark(std::string group, BookmarkEntryPtr be) {
std::lock_guard < std::recursive_mutex > lockData(busy_lock);
std::lock_guard < std::mutex > lockEnt(be->busy_lock);
void BookmarkMgr::removeBookmark(const std::string& group, const BookmarkEntryPtr& be) {
std::lock_guard < std::recursive_mutex > lock(busy_lock);
if (bmData.find(group) == bmData.end()) {
return;
}
BookmarkList::iterator i = std::find(bmData[group].begin(), bmData[group].end(), be);
auto i = std::find(bmData[group].begin(), bmData[group].end(), be);
if (i != bmData[group].end()) {
@ -240,24 +321,22 @@ void BookmarkMgr::removeBookmark(std::string group, BookmarkEntryPtr be) {
}
}
void BookmarkMgr::removeBookmark(BookmarkEntryPtr be) {
std::lock_guard < std::recursive_mutex > lockData(busy_lock);
std::lock_guard < std::mutex > lockEnt(be->busy_lock);
void BookmarkMgr::removeBookmark(const BookmarkEntryPtr& be) {
std::lock_guard < std::recursive_mutex > lock(busy_lock);
for (auto &bmd_i : bmData) {
BookmarkList::iterator i = std::find(bmd_i.second.begin(), bmd_i.second.end(), be);
auto i = std::find(bmd_i.second.begin(), bmd_i.second.end(), be);
if (i != bmd_i.second.end()) {
bmd_i.second.erase(i);
}
}
}
void BookmarkMgr::moveBookmark(BookmarkEntryPtr be, std::string group) {
std::lock_guard < std::recursive_mutex > lockData(busy_lock);
std::lock_guard < std::mutex > lockEnt(be->busy_lock);
void BookmarkMgr::moveBookmark(const BookmarkEntryPtr& be, const std::string& group) {
std::lock_guard < std::recursive_mutex > lock(busy_lock);
for (auto &bmd_i : bmData) {
BookmarkList::iterator i = std::find(bmd_i.second.begin(), bmd_i.second.end(), be);
auto i = std::find(bmd_i.second.begin(), bmd_i.second.end(), be);
if (i != bmd_i.second.end()) {
if (bmd_i.first == group) {
return;
@ -272,7 +351,7 @@ void BookmarkMgr::moveBookmark(BookmarkEntryPtr be, std::string group) {
}
void BookmarkMgr::addGroup(std::string group) {
void BookmarkMgr::addGroup(const std::string& group) {
std::lock_guard < std::recursive_mutex > lock(busy_lock);
if (bmData.find(group) == bmData.end()) {
@ -280,10 +359,10 @@ void BookmarkMgr::addGroup(std::string group) {
}
}
void BookmarkMgr::removeGroup(std::string group) {
void BookmarkMgr::removeGroup(const std::string& group) {
std::lock_guard < std::recursive_mutex > lock(busy_lock);
BookmarkMap::iterator i = bmData.find(group);
auto i = bmData.find(group);
if (i != bmData.end()) {
@ -291,18 +370,18 @@ void BookmarkMgr::removeGroup(std::string group) {
}
}
void BookmarkMgr::renameGroup(std::string group, std::string ngroup) {
void BookmarkMgr::renameGroup(const std::string& group, const std::string& ngroup) {
if (group == ngroup) {
return;
}
std::lock_guard < std::recursive_mutex > lock(busy_lock);
BookmarkMap::iterator i = bmData.find(group);
BookmarkMap::iterator it = bmData.find(ngroup);
auto i = bmData.find(group);
auto it = bmData.find(ngroup);
if (i != bmData.end() && it != bmData.end()) {
for (auto ii : bmData[group]) {
for (const auto& ii : bmData[group]) {
bmData[ngroup].push_back(ii);
}
bmData.erase(group);
@ -312,15 +391,15 @@ void BookmarkMgr::renameGroup(std::string group, std::string ngroup) {
}
}
const BookmarkList& BookmarkMgr::getBookmarks(std::string group) {
BookmarkList BookmarkMgr::getBookmarks(const std::string& group) {
std::lock_guard < std::recursive_mutex > lock(busy_lock);
if (bmData.find(group) == bmData.end()) {
return emptyResults;
return BookmarkList();
}
if (!bmDataSorted[group]) {
std::sort(bmData[group].begin(), bmData[group].end(), BookmarkEntryCompare());
std::sort(bmData[group].begin(), bmData[group].end(), [](const BookmarkEntryPtr a, const BookmarkEntryPtr b) -> bool { return a->frequency < b->frequency;});
bmDataSorted[group] = true;
}
@ -329,28 +408,33 @@ const BookmarkList& BookmarkMgr::getBookmarks(std::string group) {
void BookmarkMgr::getGroups(BookmarkNames &arr) {
std::lock_guard < std::recursive_mutex > lockData(busy_lock);
std::lock_guard < std::recursive_mutex > lock(busy_lock);
for (BookmarkMap::iterator i = bmData.begin(); i!= bmData.end(); ++i) {
arr.push_back(i->first);
for (auto & i : bmData) {
arr.push_back(i.first);
}
}
void BookmarkMgr::getGroups(wxArrayString &arr) {
std::lock_guard < std::recursive_mutex > lockData(busy_lock);
std::lock_guard < std::recursive_mutex > lock(busy_lock);
for (BookmarkMap::iterator i = bmData.begin(); i!= bmData.end(); ++i) {
arr.push_back(i->first);
for (auto & i : bmData) {
arr.push_back(i.first);
}
}
void BookmarkMgr::setExpandState(std::string groupName, bool state) {
void BookmarkMgr::setExpandState(const std::string& groupName, bool state) {
std::lock_guard < std::recursive_mutex > lock(busy_lock);
expandState[groupName] = state;
}
bool BookmarkMgr::getExpandState(std::string groupName) {
bool BookmarkMgr::getExpandState(const std::string& groupName) {
std::lock_guard < std::recursive_mutex > lock(busy_lock);
if (expandState.find(groupName) == expandState.end()) {
return true;
}
@ -360,7 +444,9 @@ bool BookmarkMgr::getExpandState(std::string groupName) {
void BookmarkMgr::updateActiveList() {
std::lock_guard < std::recursive_mutex > lockData(busy_lock);
if (wxGetApp().isShuttingDown()) {
return;
}
BookmarkView *bmv = wxGetApp().getAppFrame()->getBookmarkView();
@ -371,8 +457,6 @@ void BookmarkMgr::updateActiveList() {
void BookmarkMgr::updateBookmarks() {
std::lock_guard < std::recursive_mutex > lockData(busy_lock);
BookmarkView *bmv = wxGetApp().getAppFrame()->getBookmarkView();
if (bmv) {
@ -380,9 +464,7 @@ void BookmarkMgr::updateBookmarks() {
}
}
void BookmarkMgr::updateBookmarks(std::string group) {
std::lock_guard < std::recursive_mutex > lockData(busy_lock);
void BookmarkMgr::updateBookmarks(const std::string& group) {
BookmarkView *bmv = wxGetApp().getAppFrame()->getBookmarkView();
@ -392,7 +474,7 @@ void BookmarkMgr::updateBookmarks(std::string group) {
}
void BookmarkMgr::addRecent(DemodulatorInstance *demod) {
void BookmarkMgr::addRecent(const DemodulatorInstancePtr& demod) {
std::lock_guard < std::recursive_mutex > lock(busy_lock);
recents.push_back(demodToBookmarkEntry(demod));
@ -400,7 +482,7 @@ void BookmarkMgr::addRecent(DemodulatorInstance *demod) {
trimRecents();
}
void BookmarkMgr::addRecent(BookmarkEntryPtr be) {
void BookmarkMgr::addRecent(const BookmarkEntryPtr& be) {
std::lock_guard < std::recursive_mutex > lock(busy_lock);
recents.push_back(be);
@ -410,10 +492,10 @@ void BookmarkMgr::addRecent(BookmarkEntryPtr be) {
void BookmarkMgr::removeRecent(BookmarkEntryPtr be) {
void BookmarkMgr::removeRecent(const BookmarkEntryPtr& be) {
std::lock_guard < std::recursive_mutex > lock(busy_lock);
BookmarkList::iterator bm_i = std::find(recents.begin(),recents.end(), be);
auto bm_i = std::find(recents.begin(),recents.end(), be);
if (bm_i != recents.end()) {
recents.erase(bm_i);
@ -421,9 +503,10 @@ void BookmarkMgr::removeRecent(BookmarkEntryPtr be) {
}
const BookmarkList& BookmarkMgr::getRecents() {
std::lock_guard < std::recursive_mutex > lockData(busy_lock);
return recents;
BookmarkList BookmarkMgr::getRecents() {
std::lock_guard < std::recursive_mutex > lock(busy_lock);
//return a copy
return recents;
}
@ -442,19 +525,17 @@ void BookmarkMgr::trimRecents() {
}
void BookmarkMgr::addRange(BookmarkRangeEntryPtr re) {
void BookmarkMgr::addRange(const BookmarkRangeEntryPtr& re) {
std::lock_guard < std::recursive_mutex > lock(busy_lock);
ranges.push_back(re);
rangesSorted = false;
}
void BookmarkMgr::removeRange(BookmarkRangeEntryPtr re) {
void BookmarkMgr::removeRange(const BookmarkRangeEntryPtr& re) {
std::lock_guard < std::recursive_mutex > lock(busy_lock);
BookmarkRangeList::iterator re_i = std::find(ranges.begin(), ranges.end(), re);
auto re_i = std::find(ranges.begin(), ranges.end(), re);
if (re_i != ranges.end()) {
@ -463,11 +544,11 @@ void BookmarkMgr::removeRange(BookmarkRangeEntryPtr re) {
}
const BookmarkRangeList& BookmarkMgr::getRanges() {
BookmarkRangeList BookmarkMgr::getRanges() {
std::lock_guard < std::recursive_mutex > lock(busy_lock);
if (!rangesSorted) {
std::sort(ranges.begin(), ranges.end(), BookmarkRangeEntryCompare());
std::sort(ranges.begin(), ranges.end(), [](const BookmarkRangeEntryPtr a, const BookmarkRangeEntryPtr b) -> bool { return a->freq < b->freq;});
rangesSorted = true;
}
@ -482,7 +563,7 @@ void BookmarkMgr::clearRanges() {
}
BookmarkEntryPtr BookmarkMgr::demodToBookmarkEntry(DemodulatorInstance *demod) {
BookmarkEntryPtr BookmarkMgr::demodToBookmarkEntry(const DemodulatorInstancePtr& demod) {
BookmarkEntryPtr be(new BookmarkEntry);
@ -499,7 +580,39 @@ BookmarkEntryPtr BookmarkMgr::demodToBookmarkEntry(DemodulatorInstance *demod) {
return be;
}
BookmarkEntryPtr BookmarkMgr::nodeToBookmark(const char *name_in, DataNode *node) {
std::wstring BookmarkMgr::getSafeWstringValue(DataNode* node, const std::string& childNodeName) {
std::wstring decodedWString;
if (node != nullptr) {
DataNode* childNode = node->getNext(childNodeName.c_str());
//1) decode as encoded wstring:
try {
childNode->element()->get(decodedWString);
} catch (const DataTypeMismatchException &) {
//2) wstring decode fail, try simple std::string
std::string decodedStdString;
try {
childNode->element()->get(decodedStdString);
//use wxString for a clean conversion to a wstring:
decodedWString = wxString(decodedStdString).ToStdWstring();
} catch (const DataTypeMismatchException &) {
//nothing works, return an empty string.
decodedWString = L"";
}
}
}
return decodedWString;
}
BookmarkEntryPtr BookmarkMgr::nodeToBookmark(DataNode *node) {
if (!node->hasAnother("frequency") || !node->hasAnother("type") || !node->hasAnother("bandwidth")) {
return nullptr;
}
@ -511,7 +624,7 @@ BookmarkEntryPtr BookmarkMgr::nodeToBookmark(const char *name_in, DataNode *node
node->getNext("bandwidth")->element()->get(be->bandwidth);
if (node->hasAnother("user_label")) {
node->getNext("user_label")->element()->get(be->label);
be->label = BookmarkMgr::getSafeWstringValue( node, "user_label");
}
node->rewindAll();
@ -525,32 +638,32 @@ BookmarkEntryPtr BookmarkMgr::nodeToBookmark(const char *name_in, DataNode *node
}
std::wstring BookmarkMgr::getBookmarkEntryDisplayName(BookmarkEntryPtr bmEnt) {
std::wstring BookmarkMgr::getBookmarkEntryDisplayName(const BookmarkEntryPtr& bmEnt) {
std::wstring dispName = bmEnt->label;
if (dispName == "") {
if (dispName.empty()) {
std::string freqStr = frequencyToStr(bmEnt->frequency) + " " + bmEnt->type;
dispName = wstring(freqStr.begin(),freqStr.end());
dispName = wxString(freqStr).ToStdWstring();
}
return dispName;
}
std::wstring BookmarkMgr::getActiveDisplayName(DemodulatorInstance *demod) {
std::wstring BookmarkMgr::getActiveDisplayName(const DemodulatorInstancePtr& demod) {
std::wstring activeName = demod->getDemodulatorUserLabel();
if (activeName == "") {
if (activeName.empty()) {
std::string wstr = frequencyToStr(demod->getFrequency()) + " " + demod->getDemodulatorType();
activeName = std::wstring(wstr.begin(),wstr.end());
activeName = wxString(wstr).ToStdWstring();
}
return activeName;
}
void BookmarkMgr::removeActive(DemodulatorInstance *demod) {
void BookmarkMgr::removeActive(const DemodulatorInstancePtr& demod) {
std::lock_guard < std::recursive_mutex > lock(busy_lock);
if (demod == nullptr) {
return;
}

View File

@ -16,8 +16,7 @@ class DataNode;
class BookmarkEntry {
public:
std::mutex busy_lock;
std::string type;
//maps on the Demod user label.
std::wstring label;
@ -33,14 +32,12 @@ public:
class BookmarkRangeEntry {
public:
BookmarkRangeEntry() : label(L""), freq(0), startFreq(0), endFreq(0) {
BookmarkRangeEntry() : freq(0), startFreq(0), endFreq(0) {
}
BookmarkRangeEntry(std::wstring label, long long freq, long long startFreq, long long endFreq) : label(label), freq(freq), startFreq(startFreq), endFreq(endFreq) {
}
std::mutex busy_lock;
std::wstring label;
long long freq;
@ -51,23 +48,6 @@ public:
typedef std::shared_ptr<BookmarkEntry> BookmarkEntryPtr;
typedef std::shared_ptr<BookmarkRangeEntry> BookmarkRangeEntryPtr;
struct BookmarkEntryCompare : public std::binary_function<BookmarkEntryPtr,BookmarkEntryPtr,bool>
{
bool operator()(const BookmarkEntryPtr a, BookmarkEntryPtr b) const
{
return a->frequency < b->frequency;
}
};
struct BookmarkRangeEntryCompare : public std::binary_function<BookmarkRangeEntryPtr ,BookmarkRangeEntryPtr ,bool>
{
bool operator()(const BookmarkRangeEntryPtr a, BookmarkRangeEntryPtr b) const
{
return a->freq < b->freq;
}
};
typedef std::vector<BookmarkEntryPtr> BookmarkList;
typedef std::vector<BookmarkRangeEntryPtr> BookmarkRangeList;
typedef std::map<std::string, BookmarkList > BookmarkMap;
@ -78,65 +58,80 @@ typedef std::map<std::string, bool> BookmarkExpandState;
class BookmarkMgr {
public:
BookmarkMgr();
void saveToFile(std::string bookmarkFn, bool backup = true);
bool loadFromFile(std::string bookmarkFn, bool backup = true);
//if useFullpath = false, use the application config dir.
//else assume bookmarkFn is a full path and use it for location.
void saveToFile(const std::string& bookmarkFn, bool backup = true, bool useFullpath = false);
bool loadFromFile(const std::string& bookmarkFn, bool backup = true, bool useFullpath = false);
bool hasLastLoad(std::string bookmarkFn);
bool hasBackup(std::string bookmarkFn);
void resetBookmarks();
void addBookmark(std::string group, DemodulatorInstance *demod);
void addBookmark(std::string group, BookmarkEntryPtr be);
void removeBookmark(std::string group, BookmarkEntryPtr be);
void removeBookmark(BookmarkEntryPtr be);
void moveBookmark(BookmarkEntryPtr be, std::string group);
bool hasLastLoad(const std::string& bookmarkFn);
bool hasBackup(const std::string& bookmarkFn);
void addBookmark(const std::string& group, const DemodulatorInstancePtr& demod);
void addBookmark(const std::string& group, const BookmarkEntryPtr& be);
void removeBookmark(const std::string& group, const BookmarkEntryPtr& be);
void removeBookmark(const BookmarkEntryPtr& be);
void moveBookmark(const BookmarkEntryPtr& be, const std::string& group);
void addGroup(std::string group);
void removeGroup(std::string group);
void renameGroup(std::string group, std::string ngroup);
const BookmarkList& getBookmarks(std::string group);
void addGroup(const std::string& group);
void removeGroup(const std::string& group);
void renameGroup(const std::string& group, const std::string& ngroup);
//return an independent copy on purpose
BookmarkList getBookmarks(const std::string& group);
void getGroups(BookmarkNames &arr);
void getGroups(wxArrayString &arr);
void setExpandState(std::string groupName, bool state);
bool getExpandState(std::string groupName);
void setExpandState(const std::string& groupName, bool state);
bool getExpandState(const std::string& groupName);
void updateActiveList();
void updateBookmarks();
void updateBookmarks(std::string group);
void updateBookmarks(const std::string& group);
void addRecent(const DemodulatorInstancePtr& demod);
void addRecent(const BookmarkEntryPtr& be);
void removeRecent(const BookmarkEntryPtr& be);
//return an independent copy on purpose
BookmarkList getRecents();
void addRecent(DemodulatorInstance *demod);
void addRecent(BookmarkEntryPtr be);
void removeRecent(BookmarkEntryPtr be);
const BookmarkList& getRecents();
void clearRecents();
void removeActive(DemodulatorInstance *demod);
void removeActive(const DemodulatorInstancePtr& demod);
void addRange(BookmarkRangeEntryPtr re);
void removeRange(BookmarkRangeEntryPtr re);
const BookmarkRangeList& getRanges();
void clearRanges();
static std::wstring getBookmarkEntryDisplayName(BookmarkEntryPtr bmEnt);
static std::wstring getActiveDisplayName(DemodulatorInstance *demod);
void addRange(const BookmarkRangeEntryPtr& re);
void removeRange(const BookmarkRangeEntryPtr& re);
//return an independent copy on purpose
BookmarkRangeList getRanges();
void clearRanges();
static std::wstring getBookmarkEntryDisplayName(const BookmarkEntryPtr& bmEnt);
static std::wstring getActiveDisplayName(const DemodulatorInstancePtr& demod);
protected:
void trimRecents();
void loadDefaultRanges();
//utility method that attempts to decode the childNodeName as std::wstring, else as std::string, else
//return an empty string.
static std::wstring getSafeWstringValue(DataNode* node, const std::string& childNodeName);
BookmarkEntryPtr demodToBookmarkEntry(DemodulatorInstance *demod);
BookmarkEntryPtr nodeToBookmark(const char *name_in, DataNode *node);
BookmarkEntryPtr demodToBookmarkEntry(const DemodulatorInstancePtr& demod);
BookmarkEntryPtr nodeToBookmark(DataNode *node);
BookmarkMap bmData;
BookmarkMapSorted bmDataSorted;
BookmarkList recents;
BookmarkRangeList ranges;
bool rangesSorted;
std::recursive_mutex busy_lock;
BookmarkExpandState expandState;
//represents an empty BookMarkList that is returned by reference by some functions.
static const BookmarkList emptyResults;
};

View File

@ -32,6 +32,8 @@ IMPLEMENT_APP(CubicSDR)
#include "ActionDialog.h"
#include <memory>
//#ifdef ENABLE_DIGITAL_LAB
//// console output buffer for windows
@ -79,7 +81,7 @@ std::string frequencyToStr(long long freq) {
long double freqTemp;
freqTemp = freq;
std::string suffix("");
std::string suffix;
std::stringstream freqStr;
if (freqTemp >= 1.0e9) {
@ -131,7 +133,7 @@ long long strToFrequency(std::string freqStr) {
} else if (suffixStr.find_first_of("Hh") != std::string::npos) {
// ...
}
} else if (numPartStr.find_first_of(".") != std::string::npos || freqTemp <= 3000) {
} else if (numPartStr.find_first_of('.') != std::string::npos || freqTemp <= 3000) {
freqTemp *= 1.0e6;
}
@ -146,7 +148,7 @@ public:
m_questionText->SetLabelText(wxT("All attempts to recover bookmarks have failed. \nWould you like to exit without touching any more save files?\nClick OK to exit without saving; or Cancel to continue anyways."));
}
void doClickOK() {
void doClickOK() override {
wxGetApp().getAppFrame()->disableSave(true);
wxGetApp().getAppFrame()->Close(false);
}
@ -160,7 +162,7 @@ public:
m_questionText->SetLabelText(wxT("Sorry; unable to load your bookmarks backup file. \nWould you like to attempt to load the last succssfully loaded bookmarks file?"));
}
void doClickOK() {
void doClickOK() override {
if (wxGetApp().getBookmarkMgr().hasLastLoad("bookmarks.xml")) {
if (wxGetApp().getBookmarkMgr().loadFromFile("bookmarks.xml.lastloaded",false)) {
wxGetApp().getBookmarkMgr().updateBookmarks();
@ -179,7 +181,7 @@ public:
m_questionText->SetLabelText(wxT("Sorry; unable to load your bookmarks file. \nWould you like to attempt to load the backup file?"));
}
void doClickOK() {
void doClickOK() override {
bool loadOk = false;
if (wxGetApp().getBookmarkMgr().hasBackup("bookmarks.xml")) {
loadOk = wxGetApp().getBookmarkMgr().loadFromFile("bookmarks.xml.backup",false);
@ -196,13 +198,57 @@ public:
};
class ActionDialogRigError : public ActionDialog {
public:
explicit ActionDialogRigError(const std::string& message) : ActionDialog(wxGetApp().getAppFrame(), wxID_ANY, wxT("Rig Control Error")) {
m_questionText->SetLabelText(message);
}
void doClickOK() override {
}
};
CubicSDR::CubicSDR() : frequency(0), offset(0), ppm(0), snap(1), sampleRate(DEFAULT_SAMPLE_RATE), agcMode(false)
{
config.load();
sampleRateInitialized.store(false);
agcMode.store(true);
soloMode.store(false);
shuttingDown.store(false);
fdlgTarget = FrequencyDialog::FDIALOG_TARGET_DEFAULT;
stoppedDev = nullptr;
//set OpenGL configuration:
m_glContextAttributes = new wxGLContextAttrs();
wxGLContextAttrs glSettings;
glSettings.CompatibilityProfile().EndList();
*m_glContextAttributes = glSettings;
}
void CubicSDR::initAudioDevices() const {
std::vector<RtAudio::DeviceInfo> devices;
std::map<int, RtAudio::DeviceInfo> inputDevices, outputDevices;
AudioThread::enumerateDevices(devices);
int i = 0;
for (auto & device : devices) {
if (device.inputChannels) {
inputDevices[i] = device;
}
if (device.outputChannels) {
outputDevices[i] = device;
}
i++;
}
wxGetApp().getDemodMgr().setOutputDevices(outputDevices);
}
bool CubicSDR::OnInit() {
@ -229,7 +275,7 @@ bool CubicSDR::OnInit() {
}
//Deactivated code to allocate an explicit Console on Windows.
//This tends to hang the apllication on heavy demod (re)creation.
//This tends to hang the application on heavy demod (re)creation.
//To continue to debug with std::cout traces, simply run CubicSDR in a MINSYS2 compatble shell on Windows:
//ex: Cygwin shell, Git For Windows Bash shell....
#if (0)
@ -260,6 +306,7 @@ bool CubicSDR::OnInit() {
Modem::addModemFactory(ModemNBFM::factory, "NBFM", 12500);
Modem::addModemFactory(ModemFMStereo::factory, "FMS", 200000);
Modem::addModemFactory(ModemAM::factory, "AM", 6000);
Modem::addModemFactory(ModemCW::factory, "CW", 500);
Modem::addModemFactory(ModemLSB::factory, "LSB", 5400);
Modem::addModemFactory(ModemUSB::factory, "USB", 5400);
Modem::addModemFactory(ModemDSB::factory, "DSB", 5400);
@ -287,20 +334,22 @@ bool CubicSDR::OnInit() {
devicesFailed.store(false);
deviceSelectorOpen.store(false);
initAudioDevices();
// Visual Data
spectrumVisualThread = new SpectrumVisualDataThread();
pipeIQVisualData = new DemodulatorThreadInputQueue();
pipeIQVisualData = std::make_shared<DemodulatorThreadInputQueue>();
pipeIQVisualData->set_max_num_items(1);
pipeWaterfallIQVisualData = new DemodulatorThreadInputQueue();
pipeWaterfallIQVisualData = std::make_shared<DemodulatorThreadInputQueue>();
pipeWaterfallIQVisualData->set_max_num_items(128);
getSpectrumProcessor()->setInput(pipeIQVisualData);
getSpectrumProcessor()->setHideDC(true);
// I/Q Data
pipeSDRIQData = new SDRThreadIQDataQueue();
pipeSDRIQData = std::make_shared<SDRThreadIQDataQueue>();
pipeSDRIQData->set_max_num_items(100);
sdrThread = new SDRThread();
@ -313,7 +362,7 @@ bool CubicSDR::OnInit() {
sdrPostThread->setOutputQueue("IQDataOutput", pipeWaterfallIQVisualData);
#if CUBICSDR_ENABLE_VIEW_SCOPE
pipeAudioVisualData = new DemodulatorThreadOutputQueue();
pipeAudioVisualData = std::make_shared<DemodulatorThreadOutputQueue>();
pipeAudioVisualData->set_max_num_items(1);
scopeProcessor.setInput(pipeAudioVisualData);
@ -323,7 +372,7 @@ bool CubicSDR::OnInit() {
#if CUBICSDR_ENABLE_VIEW_DEMOD
demodVisualThread = new SpectrumVisualDataThread();
pipeDemodIQVisualData = new DemodulatorThreadInputQueue();
pipeDemodIQVisualData = std::make_shared<DemodulatorThreadInputQueue>();
pipeDemodIQVisualData->set_max_num_items(1);
if (getDemodSpectrumProcessor()) {
@ -382,49 +431,81 @@ bool CubicSDR::OnInit() {
}
int CubicSDR::OnExit() {
shuttingDown.store(true);
#if USE_HAMLIB
if (rigIsActive()) {
std::cout << "Terminating Rig thread.." << std::endl;
std::cout << "Terminating Rig thread.." << std::endl << std::flush;
stopRig();
}
#endif
bool terminationSequenceOK = true;
//The thread feeding them all should be terminated first, so:
std::cout << "Terminating SDR thread.." << std::endl;
std::cout << "Terminating SDR thread.." << std::endl << std::flush ;
sdrThread->terminate();
sdrThread->isTerminated(3000);
if (t_SDR) {
t_SDR->join();
delete t_SDR;
t_SDR = nullptr;
terminationSequenceOK = terminationSequenceOK && sdrThread->isTerminated(3000);
//in case termination sequence goes wrong, kill App brutally now because it can get stuck.
if (!terminationSequenceOK) {
//no trace here because it could occur if the device is not started.
::exit(11);
}
std::cout << "Terminating SDR post-processing thread.." << std::endl;
std::cout << "Terminating SDR post-processing thread.." << std::endl << std::flush;
sdrPostThread->terminate();
std::cout << "Terminating All Demodulators.." << std::endl;
//Wait for termination for sdrPostThread second:: since it is doing
//mostly blocking push() to the other threads, they must stay alive
//so that sdrPostThread can complete a processing loop and die.
terminationSequenceOK = terminationSequenceOK && sdrPostThread->isTerminated(3000);
//in case termination sequence goes wrong, kill App brutally now because it can get stuck.
if (!terminationSequenceOK) {
std::cout << "Cannot terminate application properly, calling exit() now." << std::endl << std::flush;
::exit(12);
}
std::cout << "Terminating All Demodulators.." << std::endl << std::flush;
demodMgr.terminateAll();
std::cout << "Terminating Visual Processor threads.." << std::endl;
std::cout << "Terminating Visual Processor threads.." << std::endl << std::flush;
spectrumVisualThread->terminate();
if (demodVisualThread) {
demodVisualThread->terminate();
}
//Wait nicely
sdrPostThread->isTerminated(1000);
spectrumVisualThread->isTerminated(1000);
terminationSequenceOK = terminationSequenceOK && spectrumVisualThread->isTerminated(1000);
if (demodVisualThread) {
demodVisualThread->isTerminated(1000);
terminationSequenceOK = terminationSequenceOK && demodVisualThread->isTerminated(1000);
}
//in case termination sequence goes wrong, kill App brutally because it can get stuck.
if (!terminationSequenceOK) {
std::cout << "Cannot terminate application properly, calling exit() now." << std::endl << std::flush;
::exit(13);
}
//Then join the thread themselves:
if (t_SDR) {
t_SDR->join();
}
//Then join the thread themselves
t_PostSDR->join();
if (t_DemodVisual) t_DemodVisual->join();
if (t_DemodVisual) {
t_DemodVisual->join();
}
t_SpectrumVisual->join();
//Now only we can delete
//Now only we can delete:
delete t_SDR;
t_SDR = nullptr;
delete sdrThread;
sdrThread = nullptr;
@ -445,22 +526,14 @@ int CubicSDR::OnExit() {
delete demodVisualThread;
demodVisualThread = nullptr;
delete pipeIQVisualData;
pipeIQVisualData = nullptr;
delete pipeAudioVisualData;
pipeAudioVisualData = nullptr;
delete pipeSDRIQData;
pipeSDRIQData = nullptr;
delete m_glContext;
m_glContext = nullptr;
#ifdef __APPLE__
//
AudioThread::deviceCleanup();
#endif
std::cout << "Application termination complete." << std::endl << std::flush;
return wxApp::OnExit();
}
@ -468,27 +541,30 @@ int CubicSDR::OnExit() {
PrimaryGLContext& CubicSDR::GetContext(wxGLCanvas *canvas) {
PrimaryGLContext *glContext;
if (!m_glContext) {
m_glContext = new PrimaryGLContext(canvas, NULL);
m_glContext = new PrimaryGLContext(canvas, nullptr, GetContextAttributes());
}
glContext = m_glContext;
return *glContext;
}
wxGLContextAttrs* CubicSDR::GetContextAttributes() {
return m_glContextAttributes;
}
void CubicSDR::OnInitCmdLine(wxCmdLineParser& parser) {
parser.SetDesc (commandLineInfo);
parser.SetSwitchChars (wxT("-"));
}
bool CubicSDR::OnCmdLineParsed(wxCmdLineParser& parser) {
wxString *confName = new wxString;
auto *confName = new wxString;
if (parser.Found("c",confName)) {
if (confName) {
if (!confName->empty()) {
config.setConfigName(confName->ToStdString());
}
}
config.load();
#ifdef BUNDLE_SOAPY_MODS
if (parser.Found("b")) {
@ -500,10 +576,10 @@ bool CubicSDR::OnCmdLineParsed(wxCmdLineParser& parser) {
useLocalMod.store(true);
#endif
wxString *modPath = new wxString;
auto *modPath = new wxString;
if (parser.Found("m",modPath)) {
if (modPath) {
if (!modPath->empty()) {
modulePath = modPath->ToStdString();
} else {
modulePath = "";
@ -526,21 +602,26 @@ void CubicSDR::deviceSelector() {
return;
}
deviceSelectorOpen.store(true);
deviceSelectorDialog = new SDRDevicesDialog(appframe);
wxRect *winRect = getConfig()->getWindow();
wxPoint pos(wxDefaultPosition);
if (winRect != nullptr) {
pos = wxPoint(winRect->x, winRect->y);
}
deviceSelectorDialog = new SDRDevicesDialog(appframe, pos);
deviceSelectorDialog->Show();
}
void CubicSDR::addRemote(std::string remoteAddr) {
void CubicSDR::addRemote(const std::string& remoteAddr) {
SDREnumerator::addRemote(remoteAddr);
devicesReady.store(false);
t_SDREnum = new std::thread(&SDREnumerator::threadMain, sdrEnum);
}
void CubicSDR::removeRemote(std::string remoteAddr) {
void CubicSDR::removeRemote(const std::string& remoteAddr) {
SDREnumerator::removeRemote(remoteAddr);
}
void CubicSDR::sdrThreadNotify(SDRThread::SDRThreadState state, std::string message) {
void CubicSDR::sdrThreadNotify(SDRThread::SDRThreadState state, const std::string& message) {
std::lock_guard < std::mutex > lock(notify_busy);
@ -601,9 +682,37 @@ long long CubicSDR::getOffset() {
void CubicSDR::setOffset(long long ofs) {
offset = ofs;
sdrThread->setOffset(offset);
SDRDeviceInfo *dev = getDevice();
config.getDevice(dev->getDeviceId())->setOffset(ofs);
if (sdrThread && !sdrThread->isTerminated()) {
sdrThread->setOffset(offset);
}
}
void CubicSDR::setAntennaName(const std::string& name) {
antennaName = name;
if (sdrThread && !sdrThread->isTerminated()) {
sdrThread->setAntenna(antennaName);
}
}
const std::string& CubicSDR::getAntennaName() {
return antennaName;
}
void CubicSDR::setChannelizerType(SDRPostThreadChannelizerType chType) {
if (sdrPostThread && !sdrPostThread->isTerminated()) {
sdrPostThread->setChannelizerType(chType);
}
}
SDRPostThreadChannelizerType CubicSDR::getChannelizerType() {
if (sdrPostThread && !sdrPostThread->isTerminated()) {
return sdrPostThread->getChannelizerType();
}
return SDRPostThreadChannelizerType::SDRPostPFBCH;
}
long long CubicSDR::getFrequency() {
@ -626,12 +735,18 @@ bool CubicSDR::isFrequencyLocked() {
void CubicSDR::unlockFrequency() {
frequency_locked.store(false);
sdrThread->unlockFrequency();
if (sdrThread && !sdrThread->isTerminated()) {
sdrThread->unlockFrequency();
}
}
void CubicSDR::setSampleRate(long long rate_in) {
sampleRate = rate_in;
sdrThread->setSampleRate(sampleRate);
if (sdrThread && !sdrThread->isTerminated()) {
sdrThread->setSampleRate(sampleRate);
}
setFrequency(frequency);
if (rate_in <= CHANNELIZER_RATE_MAX / 8) {
@ -651,7 +766,7 @@ void CubicSDR::setSampleRate(long long rate_in) {
void CubicSDR::stopDevice(bool store, int waitMsForTermination) {
//Firt we must stop the threads
//First we must stop the threads
sdrThread->terminate();
sdrThread->isTerminated(waitMsForTermination);
@ -722,13 +837,8 @@ void CubicSDR::setDevice(SDRDeviceInfo *dev, int waitMsForTermination) {
setPPM(devConfig->getPPM());
setOffset(devConfig->getOffset());
if (devConfig->getAGCMode()) {
setAGCMode(true);
} else {
setAGCMode(false);
}
setAGCMode(devConfig->getAGCMode());
setAntennaName(devConfig->getAntennaName());
t_SDR = new std::thread(&SDRThread::threadMain, sdrThread);
}
@ -760,24 +870,28 @@ SpectrumVisualProcessor *CubicSDR::getDemodSpectrumProcessor() {
}
}
DemodulatorThreadOutputQueue* CubicSDR::getAudioVisualQueue() {
DemodulatorThreadOutputQueuePtr CubicSDR::getAudioVisualQueue() {
return pipeAudioVisualData;
}
DemodulatorThreadInputQueue* CubicSDR::getIQVisualQueue() {
DemodulatorThreadInputQueuePtr CubicSDR::getIQVisualQueue() {
return pipeIQVisualData;
}
DemodulatorThreadInputQueue* CubicSDR::getWaterfallVisualQueue() {
DemodulatorThreadInputQueuePtr CubicSDR::getWaterfallVisualQueue() {
return pipeWaterfallIQVisualData;
}
BookmarkMgr &CubicSDR::getBookmarkMgr() {
return bookmarkMgr;
}
DemodulatorMgr &CubicSDR::getDemodMgr() {
return demodMgr;
}
BookmarkMgr &CubicSDR::getBookmarkMgr() {
return bookmarkMgr;
SessionMgr &CubicSDR::getSessionMgr() {
return sessionMgr;
}
SDRPostThread *CubicSDR::getSDRPostThread() {
@ -789,30 +903,21 @@ SDRThread *CubicSDR::getSDRThread() {
}
void CubicSDR::bindDemodulator(DemodulatorInstance *demod) {
if (!demod) {
return;
}
sdrPostThread->bindDemodulator(demod);
}
void CubicSDR::bindDemodulators(std::vector<DemodulatorInstance *> *demods) {
if (!demods) {
return;
}
sdrPostThread->bindDemodulators(demods);
void CubicSDR::notifyDemodulatorsChanged() {
sdrPostThread->notifyDemodulatorsChanged();
}
long long CubicSDR::getSampleRate() {
return sampleRate;
}
void CubicSDR::removeDemodulator(DemodulatorInstance *demod) {
void CubicSDR::removeDemodulator(const DemodulatorInstancePtr& demod) {
if (!demod) {
return;
}
demod->setActive(false);
sdrPostThread->removeDemodulator(demod);
sdrPostThread->notifyDemodulatorsChanged();
wxGetApp().getAppFrame()->notifyUpdateModemProperties();
}
@ -831,11 +936,8 @@ void CubicSDR::saveConfig() {
void CubicSDR::setPPM(int ppm_in) {
ppm = ppm_in;
sdrThread->setPPM(ppm);
SDRDeviceInfo *dev = getDevice();
if (dev) {
config.getDevice(dev->getDeviceId())->setPPM(ppm_in);
if (sdrThread && !sdrThread->isTerminated()) {
sdrThread->setPPM(ppm);
}
}
@ -847,7 +949,7 @@ int CubicSDR::getPPM() {
return ppm;
}
void CubicSDR::showFrequencyInput(FrequencyDialog::FrequencyDialogTarget targetMode, wxString initString) {
void CubicSDR::showFrequencyInput(FrequencyDialog::FrequencyDialogTarget targetMode, const wxString& initString) {
const wxString demodTitle("Set Demodulator Frequency");
const wxString freqTitle("Set Center Frequency");
const wxString bwTitle("Modem Bandwidth (150Hz - 500KHz)");
@ -856,11 +958,12 @@ void CubicSDR::showFrequencyInput(FrequencyDialog::FrequencyDialogTarget targetM
const wxString gainTitle("Gain Entry: "+wxGetApp().getActiveGainEntry());
wxString title;
auto activeModem = demodMgr.getActiveContextModem();
switch (targetMode) {
case FrequencyDialog::FDIALOG_TARGET_DEFAULT:
case FrequencyDialog::FDIALOG_TARGET_FREQ:
title = demodMgr.getActiveDemodulator()?demodTitle:freqTitle;
title = activeModem ?demodTitle:freqTitle;
break;
case FrequencyDialog::FDIALOG_TARGET_BANDWIDTH:
title = bwTitle;
@ -873,21 +976,21 @@ void CubicSDR::showFrequencyInput(FrequencyDialog::FrequencyDialogTarget targetM
break;
case FrequencyDialog::FDIALOG_TARGET_GAIN:
title = gainTitle;
if (wxGetApp().getActiveGainEntry() == "") {
if (wxGetApp().getActiveGainEntry().empty()) {
return;
}
break;
default:
break;
}
FrequencyDialog fdialog(appframe, -1, title, demodMgr.getActiveDemodulator(), wxPoint(-100,-100), wxSize(350, 75), wxDEFAULT_DIALOG_STYLE, targetMode, initString);
FrequencyDialog fdialog(appframe, -1, title, activeModem, wxPoint(-100,-100), wxSize(350, 75), wxDEFAULT_DIALOG_STYLE, targetMode, initString);
fdialog.ShowModal();
}
void CubicSDR::showLabelInput() {
DemodulatorInstance *activeDemod = wxGetApp().getDemodMgr().getActiveDemodulator();
DemodulatorInstancePtr activeDemod = wxGetApp().getDemodMgr().getActiveContextModem();
if (activeDemod != nullptr) {
@ -902,11 +1005,11 @@ AppFrame *CubicSDR::getAppFrame() {
return appframe;
}
void CubicSDR::setFrequencySnap(int snap) {
if (snap > 1000000) {
snap = 1000000;
void CubicSDR::setFrequencySnap(int snap_in) {
if (snap_in > 1000000) {
snap_in = 1000000;
}
this->snap = snap;
this->snap = snap_in;
}
int CubicSDR::getFrequencySnap() {
@ -917,8 +1020,12 @@ bool CubicSDR::areDevicesReady() {
return devicesReady.load();
}
void CubicSDR::notifyMainUIOfDeviceChange() {
void CubicSDR::notifyMainUIOfDeviceChange(bool forceRefreshOfGains) {
appframe->notifyDeviceChanged();
if (forceRefreshOfGains) {
appframe->refreshGainUI();
}
}
bool CubicSDR::areDevicesEnumerating() {
@ -947,7 +1054,10 @@ bool CubicSDR::isDeviceSelectorOpen() {
void CubicSDR::setAGCMode(bool mode) {
agcMode.store(mode);
sdrThread->setAGCMode(mode);
if (sdrThread && !sdrThread->isTerminated()) {
sdrThread->setAGCMode(mode);
}
}
bool CubicSDR::getAGCMode() {
@ -955,11 +1065,11 @@ bool CubicSDR::getAGCMode() {
}
void CubicSDR::setGain(std::string name, float gain_in) {
void CubicSDR::setGain(const std::string& name, float gain_in) {
sdrThread->setGain(name,gain_in);
}
float CubicSDR::getGain(std::string name) {
float CubicSDR::getGain(const std::string& name) {
return sdrThread->getGain(name);
}
@ -995,6 +1105,11 @@ bool CubicSDR::getSoloMode() {
return soloMode.load();
}
bool CubicSDR::isShuttingDown()
{
return shuttingDown.load();
}
int CubicSDR::FilterEvent(wxEvent& event) {
if (!appframe) {
return -1;
@ -1055,9 +1170,12 @@ void CubicSDR::stopRig() {
}
if (rigThread) {
rigThread->terminate();
rigThread->isTerminated(1000);
if (rigThread->getErrorState()) {
ActionDialog::showDialog(new ActionDialogRigError(rigThread->getErrorMessage()));
}
}
if (t_Rig && t_Rig->joinable()) {

View File

@ -23,6 +23,7 @@
#include "FrequencyDialog.h"
#include "DemodLabelDialog.h"
#include "BookmarkMgr.h"
#include "SessionMgr.h"
#include "ScopeVisualProcessor.h"
#include "SpectrumVisualProcessor.h"
@ -33,6 +34,7 @@
#include "ModemFM.h"
#include "ModemNBFM.h"
#include "ModemFMStereo.h"
#include "ModemCW.h"
#include "ModemAM.h"
#include "ModemUSB.h"
#include "ModemLSB.h"
@ -71,15 +73,16 @@ public:
CubicSDR();
PrimaryGLContext &GetContext(wxGLCanvas *canvas);
wxGLContextAttrs* GetContextAttributes();
virtual bool OnInit();
virtual int OnExit();
bool OnInit() override;
int OnExit() override;
virtual void OnInitCmdLine(wxCmdLineParser& parser);
virtual bool OnCmdLineParsed(wxCmdLineParser& parser);
void OnInitCmdLine(wxCmdLineParser& parser) override;
bool OnCmdLineParsed(wxCmdLineParser& parser) override;
void deviceSelector();
void sdrThreadNotify(SDRThread::SDRThreadState state, std::string message);
void sdrThreadNotify(SDRThread::SDRThreadState state, const std::string& message);
void sdrEnumThreadNotify(SDREnumerator::SDREnumState state, std::string message);
void setFrequency(long long freq);
@ -91,13 +94,18 @@ public:
void setOffset(long long ofs);
long long getOffset();
void setDBOffset(int ofs);
int getDBOffset();
void setAntennaName(const std::string& name);
const std::string& getAntennaName();
void setChannelizerType(SDRPostThreadChannelizerType chType);
SDRPostThreadChannelizerType getChannelizerType();
void setSampleRate(long long rate_in);
long long getSampleRate();
std::vector<SDRDeviceInfo *> *getDevices();
void setDevice(SDRDeviceInfo *dev, int waitMsForTermination);
void stopDevice(bool store, int waitMsForTermination);
@ -107,21 +115,22 @@ public:
SpectrumVisualProcessor *getSpectrumProcessor();
SpectrumVisualProcessor *getDemodSpectrumProcessor();
DemodulatorThreadOutputQueue* getAudioVisualQueue();
DemodulatorThreadInputQueue* getIQVisualQueue();
DemodulatorThreadInputQueue* getWaterfallVisualQueue();
DemodulatorThreadInputQueue* getActiveDemodVisualQueue();
DemodulatorThreadOutputQueuePtr getAudioVisualQueue();
DemodulatorThreadInputQueuePtr getIQVisualQueue();
DemodulatorThreadInputQueuePtr getWaterfallVisualQueue();
DemodulatorMgr &getDemodMgr();
BookmarkMgr &getBookmarkMgr();
SessionMgr &getSessionMgr();
SDRPostThread *getSDRPostThread();
SDRThread *getSDRThread();
void bindDemodulator(DemodulatorInstance *demod);
void bindDemodulators(std::vector<DemodulatorInstance *> *demods);
void removeDemodulator(DemodulatorInstance *demod);
void notifyDemodulatorsChanged();
void removeDemodulator(const DemodulatorInstancePtr& demod);
void setFrequencySnap(int snap);
void setFrequencySnap(int snap_in);
int getFrequencySnap();
AppConfig *getConfig();
@ -130,7 +139,7 @@ public:
void setPPM(int ppm_in);
int getPPM();
void showFrequencyInput(FrequencyDialog::FrequencyDialogTarget targetMode = FrequencyDialog::FDIALOG_TARGET_DEFAULT, wxString initString = "");
void showFrequencyInput(FrequencyDialog::FrequencyDialogTarget targetMode = FrequencyDialog::FDIALOG_TARGET_DEFAULT, const wxString& initString = "");
void showLabelInput();
AppFrame *getAppFrame();
@ -139,10 +148,10 @@ public:
bool areModulesMissing();
std::string getNotification();
void notifyMainUIOfDeviceChange();
void notifyMainUIOfDeviceChange(bool forceRefreshOfGains = false);
void addRemote(std::string remoteAddr);
void removeRemote(std::string remoteAddr);
void addRemote(const std::string& remoteAddr);
void removeRemote(const std::string& remoteAddr);
void setDeviceSelectorClosed();
void reEnumerateDevices();
@ -152,8 +161,8 @@ public:
void setAGCMode(bool mode);
bool getAGCMode();
void setGain(std::string name, float gain_in);
float getGain(std::string name);
void setGain(const std::string& name, float gain_in);
float getGain(const std::string& name);
void setStreamArgs(SoapySDR::Kwargs streamArgs_in);
void setDeviceArgs(SoapySDR::Kwargs settingArgs_in);
@ -166,6 +175,8 @@ public:
void setSoloMode(bool solo);
bool getSoloMode();
bool isShuttingDown();
#ifdef USE_HAMLIB
RigThread *getRigThread();
@ -175,21 +186,26 @@ public:
#endif
private:
int FilterEvent(wxEvent& event);
int FilterEvent(wxEvent& event) override;
AppFrame *appframe = nullptr;
AppConfig config;
PrimaryGLContext *m_glContext = nullptr;
wxGLContextAttrs *m_glContextAttributes = nullptr;
std::vector<SDRDeviceInfo *> *devs = nullptr;
DemodulatorMgr demodMgr;
BookmarkMgr bookmarkMgr;
SessionMgr sessionMgr;
std::atomic_llong frequency;
std::atomic_llong offset;
std::atomic_int ppm, snap;
std::atomic_llong sampleRate;
std::string antennaName;
std::atomic_bool agcMode;
std::atomic_bool shuttingDown;
SDRThread *sdrThread = nullptr;
SDREnumerator *sdrEnum = nullptr;
@ -197,12 +213,12 @@ private:
SpectrumVisualDataThread *spectrumVisualThread = nullptr;
SpectrumVisualDataThread *demodVisualThread = nullptr;
SDRThreadIQDataQueue* pipeSDRIQData = nullptr;
DemodulatorThreadInputQueue* pipeIQVisualData = nullptr;
DemodulatorThreadOutputQueue* pipeAudioVisualData = nullptr;
DemodulatorThreadInputQueue* pipeDemodIQVisualData = nullptr;
DemodulatorThreadInputQueue* pipeWaterfallIQVisualData = nullptr;
DemodulatorThreadInputQueue* pipeActiveDemodIQVisualData = nullptr;
SDRThreadIQDataQueuePtr pipeSDRIQData;
DemodulatorThreadInputQueuePtr pipeIQVisualData;
DemodulatorThreadOutputQueuePtr pipeAudioVisualData;
DemodulatorThreadInputQueuePtr pipeDemodIQVisualData;
DemodulatorThreadInputQueuePtr pipeWaterfallIQVisualData;
DemodulatorThreadInputQueuePtr pipeActiveDemodIQVisualData;
ScopeVisualProcessor scopeProcessor;
@ -236,13 +252,15 @@ private:
RigThread* rigThread = nullptr;
std::thread *t_Rig = nullptr;
#endif
void initAudioDevices() const;
};
static const wxCmdLineEntryDesc commandLineInfo [] =
{
{ wxCMD_LINE_SWITCH, "h", "help", "Command line parameter help", wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP },
{ wxCMD_LINE_OPTION, "c", "config", "Specify a named configuration to use, i.e. '-c ham'", wxCMD_LINE_VAL_STRING, 0 },
{ wxCMD_LINE_OPTION, "m", "modpath", "Load modules from suppplied path, i.e. '-m ~/SoapyMods/'", wxCMD_LINE_VAL_STRING, 0 },
{ wxCMD_LINE_OPTION, "m", "modpath", "Load modules from supplied path, i.e. '-m ~/SoapyMods/'", wxCMD_LINE_VAL_STRING, 0 },
#ifdef BUNDLE_SOAPY_MODS
{ wxCMD_LINE_SWITCH, "b", "bundled", "Use bundled SoapySDR modules first instead of local.", wxCMD_LINE_VAL_NONE, 0 },
#endif

View File

@ -3,6 +3,10 @@
#pragma once
#if defined(__linux__) || defined(__FreeBSD__)
#include <sys/param.h>
#endif
#define CUBICSDR_TITLE "" CUBICSDR_BUILD_TITLE
#ifndef __BYTE_ORDER
@ -16,7 +20,11 @@
#ifdef __APPLE__
#include <machine/endian.h>
#else
#include <endian.h>
#ifdef __FreeBSD__
#include <sys/endian.h>
#else
#include <endian.h>
#endif
#endif
#endif
#endif
@ -59,3 +67,7 @@ const char filePathSeparator =
//Represents the amount of time to process in the FFT distributor.
#define FFT_DISTRIBUTOR_BUFFER_IN_SECONDS 0.250
//The maximum number of listed sample rates for a device, to be able to handle
//devices returning an insane amount because they have quasi-continuous ranges (UHD...)
#define DEVICE_SAMPLE_RATES_MAX_NB 25

View File

@ -13,13 +13,13 @@ EVT_SHOW(DemodLabelDialog::OnShow)
wxEND_EVENT_TABLE()
DemodLabelDialog::DemodLabelDialog(wxWindow * parent, wxWindowID id, const wxString & title,
DemodulatorInstance *demod, const wxPoint & position,
DemodulatorInstancePtr demod, const wxPoint & position,
const wxSize & size, long style) :
wxDialog(parent, id, title, position, size, style) {
wxString labelStr;
//by construction, is allways != nullptr
//by construction, is always != nullptr
activeDemod = demod;
labelStr = activeDemod->getDemodulatorUserLabel();
@ -30,13 +30,20 @@ DemodLabelDialog::DemodLabelDialog(wxWindow * parent, wxWindowID id, const wxStr
}
dialogText = new wxTextCtrl(this, wxID_LABEL_INPUT, labelStr, wxPoint(6, 1), wxSize(size.GetWidth() - 20, size.GetHeight() - 70),
wxTE_PROCESS_ENTER);
dialogText = new wxTextCtrl(this, wxID_LABEL_INPUT, labelStr, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER);
dialogText->SetFont(wxFont(15, wxFONTFAMILY_TELETYPE, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD));
// Set the textControl width to the [title + 100%] or the [content +100%],
// whichever's the greater.
int textCtrlX = dialogText->GetTextExtent(labelStr).GetWidth();
int titleX = this->GetTextExtent(title).GetWidth();
dialogText->SetMinSize(wxSize(max(int(2.0 * titleX), int(2.0 * textCtrlX)), -1));
auto* dialogsizer = new wxBoxSizer(wxALL);
dialogsizer->Add(dialogText, wxSizerFlags(1).Expand().Border(wxALL, 5));
SetSizerAndFit(dialogsizer);
Centre();
dialogText->SetValue(labelStr);
dialogText->SetSelection(-1, -1);
}
@ -83,7 +90,7 @@ void DemodLabelDialog::OnChar(wxKeyEvent& event) {
}
else {
#ifdef __linux__
#if defined(__linux__) || defined(__FreeBSD__)
dialogText->OnChar(event);
event.Skip();
#else

View File

@ -16,7 +16,7 @@ class DemodLabelDialog : public wxDialog
public:
DemodLabelDialog( wxWindow * parent, wxWindowID id, const wxString & title,
DemodulatorInstance *demod = NULL,
DemodulatorInstancePtr demod = nullptr,
const wxPoint & pos = wxDefaultPosition,
const wxSize & size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE);
@ -24,8 +24,7 @@ public:
wxTextCtrl * dialogText;
private:
DemodulatorInstance *activeDemod = nullptr;
void OnEnter ( wxCommandEvent &event );
DemodulatorInstancePtr activeDemod = nullptr;
void OnChar ( wxKeyEvent &event );
void OnShow(wxShowEvent &event);
DECLARE_EVENT_TABLE()

View File

@ -5,6 +5,7 @@
#include "wx/clipbrd.h"
#include <sstream>
#include <algorithm>
#include "CubicSDR.h"
wxBEGIN_EVENT_TABLE(FrequencyDialog, wxDialog)
@ -12,13 +13,15 @@ EVT_CHAR_HOOK(FrequencyDialog::OnChar)
EVT_SHOW(FrequencyDialog::OnShow)
wxEND_EVENT_TABLE()
FrequencyDialog::FrequencyDialog(wxWindow * parent, wxWindowID id, const wxString & title, DemodulatorInstance *demod, const wxPoint & position,
const wxSize & size, long style, FrequencyDialogTarget targetMode, wxString initString) :
wxDialog(parent, id, title, position, size, style) {
FrequencyDialog::FrequencyDialog(wxWindow * parent, wxWindowID id, const wxString & title, DemodulatorInstancePtr demod, const wxPoint & /*position*/,
const wxSize & /*size*/, long style, FrequencyDialogTarget targetMode, wxString initString) :
wxDialog(parent, id, title, wxDefaultPosition, wxDefaultSize, style) {
wxString freqStr;
activeDemod = demod;
this->targetMode = targetMode;
this->initialString = initString;
this->initialString = initString;
if (targetMode == FDIALOG_TARGET_DEFAULT) {
if (activeDemod) {
@ -27,7 +30,7 @@ FrequencyDialog::FrequencyDialog(wxWindow * parent, wxWindowID id, const wxStrin
freqStr = frequencyToStr(wxGetApp().getFrequency());
}
}
if (targetMode == FDIALOG_TARGET_BANDWIDTH) {
std::string lastDemodType = activeDemod?activeDemod->getDemodulatorType():wxGetApp().getDemodMgr().getLastDemodulatorType();
if (lastDemodType == "USB" || lastDemodType == "LSB") {
@ -36,7 +39,7 @@ FrequencyDialog::FrequencyDialog(wxWindow * parent, wxWindowID id, const wxStrin
freqStr = frequencyToStr(wxGetApp().getDemodMgr().getLastBandwidth());
}
}
if (targetMode == FDIALOG_TARGET_WATERFALL_LPS) {
freqStr = std::to_string(wxGetApp().getAppFrame()->getWaterfallDataThread()->getLinesPerSecond());
}
@ -46,23 +49,31 @@ FrequencyDialog::FrequencyDialog(wxWindow * parent, wxWindowID id, const wxStrin
}
if (targetMode == FDIALOG_TARGET_GAIN) {
if (wxGetApp().getActiveGainEntry() != "") {
if (!wxGetApp().getActiveGainEntry().empty()) {
freqStr = std::to_string((int)wxGetApp().getGain(wxGetApp().getActiveGainEntry()));
}
}
dialogText = new wxTextCtrl(this, wxID_FREQ_INPUT, freqStr, wxPoint(6, 1), wxSize(size.GetWidth() - 20, size.GetHeight() - 70),
wxTE_PROCESS_ENTER);
dialogText->SetFont(wxFont(20, wxFONTFAMILY_TELETYPE, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD));
dialogText = new wxTextCtrl(this, wxID_FREQ_INPUT, freqStr, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER);
dialogText->SetFont(wxFont(15, wxFONTFAMILY_TELETYPE, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD));
// Set the textControl width to the [title + 100%] or the [content +100%],
// whichever's the greater.
int textCtrlX = dialogText->GetTextExtent(freqStr).GetWidth();
int initTextCtrlX = dialogText->GetTextExtent(initString).GetWidth();
int titleX = this->GetTextExtent(title).GetWidth();
dialogText->SetMinSize(wxSize(max(int(2.0 * titleX), int(2.0 * std::max(textCtrlX, initTextCtrlX))), -1));
auto* dialogsizer = new wxBoxSizer(wxALL);
dialogsizer->Add(dialogText, wxSizerFlags(1).Expand().Border(wxALL, 5));
SetSizerAndFit(dialogsizer);
Centre();
if (initString != "" && initString.length() == 1) {
if (!initString.empty() && initString.length() == 1) {
dialogText->SetValue(initString);
dialogText->SetSelection(2, 2);
dialogText->SetFocus();
} else {
if (initString != "") {
if (!initString.empty()) {
dialogText->SetValue(initString);
}
dialogText->SetSelection(-1, -1);
@ -76,11 +87,11 @@ void FrequencyDialog::OnChar(wxKeyEvent& event) {
double dblval;
std::string lastDemodType = activeDemod?activeDemod->getDemodulatorType():wxGetApp().getDemodMgr().getLastDemodulatorType();
std::string strValue = dialogText->GetValue().ToStdString();
bool ranged = false;
bool ranged;
std::string strValue2;
size_t range_pos;
switch (c) {
case WXK_RETURN:
case WXK_NUMPAD_ENTER:
@ -95,7 +106,7 @@ void FrequencyDialog::OnChar(wxKeyEvent& event) {
}
}
if (targetMode == FDIALOG_TARGET_DEFAULT) {
if (targetMode == FDIALOG_TARGET_DEFAULT || targetMode == FDIALOG_TARGET_FREQ) {
if (ranged) {
freq = strToFrequency(strValue);
freq2 = strToFrequency(strValue2);
@ -103,10 +114,16 @@ void FrequencyDialog::OnChar(wxKeyEvent& event) {
freq = strToFrequency(strValue);
}
if (activeDemod) {
activeDemod->setTracking(true);
activeDemod->setFollow(true);
activeDemod->setFrequency(freq);
activeDemod->updateLabel(freq);
freq_ctr = wxGetApp().getFrequency();
range_bw = wxGetApp().getSampleRate();
if (freq_ctr - (range_bw / 2) > freq || freq_ctr + (range_bw / 2) < freq) {
wxGetApp().setFrequency(freq);
}
} else {
if (ranged && (freq || freq2)) {
if (freq > freq2) {
@ -122,7 +139,7 @@ void FrequencyDialog::OnChar(wxKeyEvent& event) {
}
if (freq == freq2) {
wxGetApp().setFrequency(freq_ctr);
wxGetApp().getAppFrame()->setViewState(freq_ctr);
wxGetApp().getAppFrame()->setViewState();
} else {
if (wxGetApp().getSampleRate()/4 > range_bw) {
wxGetApp().setFrequency(freq_ctr + wxGetApp().getSampleRate()/4);
@ -141,6 +158,9 @@ void FrequencyDialog::OnChar(wxKeyEvent& event) {
if (lastDemodType == "USB" || lastDemodType == "LSB") {
freq *= 2;
}
if (freq > CHANNELIZER_RATE_MAX) {
freq = CHANNELIZER_RATE_MAX;
}
if (activeDemod) {
activeDemod->setBandwidth(freq);
} else {
@ -150,7 +170,7 @@ void FrequencyDialog::OnChar(wxKeyEvent& event) {
if (targetMode == FDIALOG_TARGET_WATERFALL_LPS) {
try {
freq = std::stoi(strValue);
} catch (exception e) {
} catch (const exception &) {
Close();
break;
}
@ -165,7 +185,7 @@ void FrequencyDialog::OnChar(wxKeyEvent& event) {
if (targetMode == FDIALOG_TARGET_SPECTRUM_AVG) {
try {
dblval = std::stod(strValue);
} catch (exception e) {
} catch (const exception &) {
Close();
break;
}
@ -177,16 +197,16 @@ void FrequencyDialog::OnChar(wxKeyEvent& event) {
}
wxGetApp().getAppFrame()->setSpectrumAvgSpeed(dblval);
}
if (targetMode == FDIALOG_TARGET_GAIN) {
try {
freq = std::stoi(strValue);
} catch (exception e) {
} catch (const exception &) {
break;
}
SDRDeviceInfo *devInfo = wxGetApp().getDevice();
std::string gainName = wxGetApp().getActiveGainEntry();
if (gainName == "") {
if (gainName.empty()) {
break;
}
SDRRangeMap gains = devInfo->getGains(SOAPY_SDR_RX, 0);
@ -216,7 +236,7 @@ void FrequencyDialog::OnChar(wxKeyEvent& event) {
if (allowed.find_first_of(c) != std::string::npos || c == WXK_DELETE || c == WXK_BACK || c == WXK_NUMPAD_DECIMAL
|| (c >= WXK_NUMPAD0 && c <= WXK_NUMPAD9)) {
#ifdef __linux__
#if defined(__linux__) || defined(__FreeBSD__)
dialogText->OnChar(event);
event.Skip();
#else
@ -238,7 +258,7 @@ void FrequencyDialog::OnChar(wxKeyEvent& event) {
}
void FrequencyDialog::OnShow(wxShowEvent &event) {
if (initialString.length() == 1) {
if (initialString.length() == 1) {
dialogText->SetFocus();
dialogText->SetSelection(2, 2);
}

View File

@ -24,7 +24,7 @@ public:
FDIALOG_TARGET_GAIN
} FrequencyDialogTarget;
FrequencyDialog ( wxWindow * parent, wxWindowID id, const wxString & title,
DemodulatorInstance *demod = NULL,
DemodulatorInstancePtr demod = nullptr,
const wxPoint & pos = wxDefaultPosition,
const wxSize & size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE,
@ -34,8 +34,7 @@ public:
wxTextCtrl * dialogText;
private:
DemodulatorInstance *activeDemod;
void OnEnter ( wxCommandEvent &event );
DemodulatorInstancePtr activeDemod;
void OnChar ( wxKeyEvent &event );
void OnShow(wxShowEvent &event);
FrequencyDialogTarget targetMode;

View File

@ -2,10 +2,7 @@
// SPDX-License-Identifier: GPL-2.0+
#include "IOThread.h"
#include <typeinfo>
std::mutex ReBufferGC::g_mutex;
std::set<ReferenceCounter *> ReBufferGC::garbage;
#include <memory>
#define SPIN_WAIT_SLEEP_MS 5
@ -55,51 +52,51 @@ void IOThread::threadMain() {
terminated.store(true);
stopping.store(true);
};
}
#endif
void IOThread::setup() {
//redefined in subclasses
};
}
void IOThread::run() {
//redefined in subclasses
};
}
void IOThread::terminate() {
stopping.store(true);
};
}
void IOThread::onBindOutput(std::string /* name */, ThreadQueueBase* /* threadQueue */) {
void IOThread::onBindOutput(std::string /* name */, ThreadQueueBasePtr /* threadQueue */) {
};
}
void IOThread::onBindInput(std::string /* name */, ThreadQueueBase* /* threadQueue */) {
void IOThread::onBindInput(std::string /* name */, ThreadQueueBasePtr /* threadQueue */) {
};
}
void IOThread::setInputQueue(std::string qname, ThreadQueueBase *threadQueue) {
void IOThread::setInputQueue(const std::string& qname, const ThreadQueueBasePtr& threadQueue) {
std::lock_guard < std::mutex > lock(m_queue_bindings_mutex);
input_queues[qname] = threadQueue;
this->onBindInput(qname, threadQueue);
};
}
ThreadQueueBase *IOThread::getInputQueue(std::string qname) {
ThreadQueueBasePtr IOThread::getInputQueue(const std::string& qname) {
std::lock_guard < std::mutex > lock(m_queue_bindings_mutex);
return input_queues[qname];
};
}
void IOThread::setOutputQueue(std::string qname, ThreadQueueBase *threadQueue) {
void IOThread::setOutputQueue(const std::string& qname, const ThreadQueueBasePtr& threadQueue) {
std::lock_guard < std::mutex > lock(m_queue_bindings_mutex);
output_queues[qname] = threadQueue;
this->onBindOutput(qname, threadQueue);
};
}
ThreadQueueBase *IOThread::getOutputQueue(std::string qname) {
ThreadQueueBasePtr IOThread::getOutputQueue(const std::string& qname) {
std::lock_guard < std::mutex > lock(m_queue_bindings_mutex);
return output_queues[qname];
};
}
bool IOThread::isTerminated(int waitMs) {
@ -111,13 +108,12 @@ bool IOThread::isTerminated(int waitMs) {
}
//this is a stupid busy plus sleep loop
int nbCyclesToWait = 0;
int nbCyclesToWait;
if (waitMs < 0) {
nbCyclesToWait = std::numeric_limits<int>::max();
}
else {
nbCyclesToWait = (waitMs / SPIN_WAIT_SLEEP_MS) + 1;
}
@ -130,7 +126,7 @@ bool IOThread::isTerminated(int waitMs) {
}
}
std::cout << "ERROR: thread '" << typeid(*this).name() << "' has not terminated in time ! (> " << waitMs << " ms)" << std::endl;
std::cout << "ERROR: thread '" << typeid(*this).name() << "' has not terminated in time ! (> " << waitMs << " ms)" << std::endl << std::flush;
return terminated.load();
}

View File

@ -11,11 +11,13 @@
#include <string>
#include <iostream>
#include <thread>
#include <memory>
#include <climits>
#include "ThreadBlockingQueue.h"
#include "Timer.h"
#include "SpinMutex.h"
struct map_string_less : public std::binary_function<std::string,std::string,bool>
struct map_string_less
{
bool operator()(const std::string& a,const std::string& b) const
{
@ -23,163 +25,133 @@ struct map_string_less : public std::binary_function<std::string,std::string,boo
}
};
class ReferenceCounter {
template <typename PtrType>
class ReBufferAge {
public:
//default constructor, initialized with refcont 1, sounds very natural
ReferenceCounter() {
refCount = 1;
}
// void setIndex(int idx) {
// std::lock_guard < std::recursive_mutex > lock(m_mutex);
// index = idx;
// }
// int getIndex() {
// std::lock_guard < std::recursive_mutex > lock(m_mutex);
// return index;
// }
void setRefCount(int rc) {
std::lock_guard < std::recursive_mutex > lock(m_mutex);
refCount = rc;
}
void decRefCount() {
std::lock_guard < std::recursive_mutex > lock(m_mutex);
refCount--;
}
int getRefCount() {
std::lock_guard < std::recursive_mutex > lock(m_mutex);
return refCount;
ReBufferAge(PtrType p, int a) {
ptr = p;
age = a;
}
// Access to the own mutex protecting the ReferenceCounter, i.e the monitor of the class
std::recursive_mutex& getMonitor() const {
return m_mutex;
}
PtrType ptr;
int age;
protected:
//this is a basic mutex for all ReferenceCounter derivatives operations INCLUDING the counter itself for consistency !
mutable std::recursive_mutex m_mutex;
private:
int refCount;
// int index;
virtual ~ReBufferAge() = default;;
};
#define REBUFFER_GC_LIMIT 100
#define REBUFFER_WARNING_THRESHOLD 2000
class ReBufferGC {
public:
static void garbageCollect() {
std::lock_guard < std::mutex > lock(g_mutex);
std::deque<ReferenceCounter *> garbageRemoval;
for (typename std::set<ReferenceCounter *>::iterator i = garbage.begin(); i != garbage.end(); i++) {
if ((*i)->getRefCount() <= 0) {
garbageRemoval.push_back(*i);
}
else {
// std::cout << "Garbage in queue buffer idx #" << (*i)->getIndex() << ", " << (*i)->getRefCount() << " usage(s)" << std::endl;
std::cout << "Garbage in queue buffer with " << (*i)->getRefCount() << " usage(s)" << std::endl;
}
}
if ( garbageRemoval.size() ) {
std::cout << "Garbage collecting " << garbageRemoval.size() << " ReBuffer(s)" << std::endl;
while (!garbageRemoval.empty()) {
ReferenceCounter *ref = garbageRemoval.back();
garbageRemoval.pop_back();
garbage.erase(ref);
delete ref;
}
}
}
static void addGarbage(ReferenceCounter *ref) {
std::lock_guard < std::mutex > lock(g_mutex);
garbage.insert(ref);
}
private:
static std::mutex g_mutex;
static std::set<ReferenceCounter *> garbage;
};
template<class BufferType = ReferenceCounter>
template<typename BufferType>
class ReBuffer {
typedef typename std::shared_ptr<BufferType> ReBufferPtr;
public:
ReBuffer(std::string bufferId) : bufferId(bufferId) {
// indexCounter.store(0);
//Virtual destructor to assure correct freeing of all descendants.
virtual ~ReBuffer() = default;
//constructor
explicit ReBuffer(std::string bufferId) : bufferId(bufferId) {
//nothing
}
BufferType *getBuffer() {
std::lock_guard < std::mutex > lock(m_mutex);
/// Return a new ReBuffer_ptr usable by the application.
ReBufferPtr getBuffer() {
BufferType* buf = nullptr;
for (outputBuffersI = outputBuffers.begin(); outputBuffersI != outputBuffers.end(); outputBuffersI++) {
if (buf == nullptr && (*outputBuffersI)->getRefCount() <= 0) {
buf = (*outputBuffersI);
buf->setRefCount(1);
} else if ((*outputBuffersI)->getRefCount() <= 0) {
(*outputBuffersI)->decRefCount();
std::lock_guard < SpinMutex > lock(m_mutex);
// iterate the ReBufferAge list: if the std::shared_ptr count == 1, it means
//it is only referenced in outputBuffers itself, so available for re-use.
//else if the std::shared_ptr count <= 1, make it age.
//else the ReBufferPtr is in use, don't use it.
ReBufferPtr buf = nullptr;
outputBuffersI it = outputBuffers.begin();
while (it != outputBuffers.end()) {
//careful here: take care of reading the use_count directly
//through the iterator, else it's value is wrong if a temp variable
//is used.
long use = it->ptr.use_count();
//1. If we encounter a ReBufferPtr with a use count of 0, this
//is a bug since it is supposed to be at least 1, because it is referenced here.
//in this case, purge it from here and trace.
if (use == 0) {
std::cout << "Warning: in ReBuffer '" << bufferId << "' count '" << outputBuffers.size() << "', found 1 dangling buffer !" << std::endl << std::flush;
it = outputBuffers.erase(it);
}
else if (use == 1) {
if (buf == nullptr) {
it->age = 1; //select this one.
buf = it->ptr;
// std::cout << "**" << std::flush;
it++;
}
else {
//make the other unused buffers age
it->age--;
it++;
}
}
}
if (buf != nullptr) {
if (outputBuffers.back()->getRefCount() < -REBUFFER_GC_LIMIT) {
BufferType *ref = outputBuffers.back();
else {
it++;
}
} //end while
//2.1 Garbage collect the oldest (last element) if it aged too much, and return the buffer
if (buf != nullptr) {
if (outputBuffers.back().age < -REBUFFER_GC_LIMIT) {
//by the nature of the shared_ptr, memory will ne deallocated automatically.
outputBuffers.pop_back();
delete ref;
//std::cout << "--" << std::flush;
}
// buf->setIndex(indexCounter++);
return buf;
}
#define REBUFFER_WARNING_THRESHOLD 100
if (outputBuffers.size() > REBUFFER_WARNING_THRESHOLD) {
std::cout << "Warning: ReBuffer '" << bufferId << "' count '" << outputBuffers.size() << "' exceeds threshold of '" << REBUFFER_WARNING_THRESHOLD << "'" << std::endl;
}
//by default created with refcount = 1
buf = new BufferType();
// buf->setIndex(indexCounter++);
outputBuffers.push_back(buf);
if (outputBuffers.size() > REBUFFER_WARNING_THRESHOLD) {
std::cout << "Warning: ReBuffer '" << bufferId << "' count '" << outputBuffers.size() << "' exceeds threshold of '" << REBUFFER_WARNING_THRESHOLD << "'" << std::endl << std::flush;
}
return buf;
//3.We need to allocate a new buffer.
ReBufferAge < ReBufferPtr > newBuffer(std::make_shared<BufferType>(), 1);
outputBuffers.push_back(newBuffer);
// std::cout << "++" << std::flush;
return newBuffer.ptr;
}
/// Purge the cache.
void purge() {
std::lock_guard < std::mutex > lock(m_mutex);
// if (bufferId == "DemodulatorThreadBuffers") {
// std::cout << "'" << bufferId << "' purging.. total indexes: " << indexCounter.load() << std::endl;
// }
while (!outputBuffers.empty()) {
BufferType *ref = outputBuffers.front();
outputBuffers.pop_front();
if (ref->getRefCount() <= 0) {
delete ref;
} else {
// Something isn't done with it yet; throw it on the pile.. keep this as a bug indicator for now..
std::cout << "'" << bufferId << "' pushed garbage.." << std::endl;
ReBufferGC::addGarbage(ref);
}
}
std::lock_guard < SpinMutex > lock(m_mutex);
// since outputBuffers are full std::shared_ptr,
//purging if will effectively loose the local reference,
// so the std::shared_ptr will naturally be deallocated
//when their time comes.
outputBuffers.clear();
}
private:
private:
//name of the buffer cache kind
std::string bufferId;
std::deque<BufferType*> outputBuffers;
typename std::deque<BufferType*>::iterator outputBuffersI;
mutable std::mutex m_mutex;
// std::atomic_int indexCounter;
//the ReBuffer cache: use a std:deque to also release
//memory when ReBufferPtr are GCed.
std::deque< ReBufferAge < ReBufferPtr > > outputBuffers;
typedef typename std::deque< ReBufferAge < ReBufferPtr > >::iterator outputBuffersI;
//mutex protecting access to outputBuffers.
SpinMutex m_mutex;
};
@ -210,20 +182,20 @@ public:
//If wait < 0, the wait in infinite until the thread dies.
bool isTerminated(int waitMs = 0);
virtual void onBindOutput(std::string name, ThreadQueueBase* threadQueue);
virtual void onBindInput(std::string name, ThreadQueueBase* threadQueue);
virtual void onBindOutput(std::string name, ThreadQueueBasePtr threadQueue);
virtual void onBindInput(std::string name, ThreadQueueBasePtr threadQueue);
void setInputQueue(std::string qname, ThreadQueueBase *threadQueue);
ThreadQueueBase *getInputQueue(std::string qname);
void setOutputQueue(std::string qname, ThreadQueueBase *threadQueue);
ThreadQueueBase *getOutputQueue(std::string qname);
void setInputQueue(const std::string& qname, const ThreadQueueBasePtr& threadQueue);
ThreadQueueBasePtr getInputQueue(const std::string& qname);
void setOutputQueue(const std::string& qname, const ThreadQueueBasePtr& threadQueue);
ThreadQueueBasePtr getOutputQueue(const std::string& qname);
protected:
std::map<std::string, ThreadQueueBase *, map_string_less> input_queues;
std::map<std::string, ThreadQueueBase *, map_string_less> output_queues;
std::map<std::string, ThreadQueueBasePtr, map_string_less> input_queues;
std::map<std::string, ThreadQueueBasePtr, map_string_less> output_queues;
//this protects against concurrent changes in input/output bindings: get/set/Input/OutPutQueue
mutable std::mutex m_queue_bindings_mutex;
std::mutex m_queue_bindings_mutex;
//true when a termination is ordered
std::atomic_bool stopping;

View File

@ -15,13 +15,13 @@ ModemProperties::ModemProperties(wxWindow *parent, wxWindowID winid,
this->SetSizer(bSizer);
m_propertyGrid->Connect( wxEVT_PG_ITEM_COLLAPSED, wxPropertyGridEventHandler( ModemProperties::OnCollapse ), NULL, this );
m_propertyGrid->Connect( wxEVT_PG_ITEM_EXPANDED, wxPropertyGridEventHandler( ModemProperties::OnExpand ), NULL, this );
m_propertyGrid->Connect( wxEVT_PG_CHANGED, wxPropertyGridEventHandler( ModemProperties::OnChange ), NULL, this );
this->Connect( wxEVT_SHOW, wxShowEventHandler( ModemProperties::OnShow ), NULL, this );
m_propertyGrid->Connect( wxEVT_PG_ITEM_COLLAPSED, wxPropertyGridEventHandler( ModemProperties::OnCollapse ), nullptr, this );
m_propertyGrid->Connect( wxEVT_PG_ITEM_EXPANDED, wxPropertyGridEventHandler( ModemProperties::OnExpand ), nullptr, this );
m_propertyGrid->Connect( wxEVT_PG_CHANGED, wxPropertyGridEventHandler( ModemProperties::OnChange ), nullptr, this );
this->Connect( wxEVT_SHOW, wxShowEventHandler( ModemProperties::OnShow ), nullptr, this );
this->Connect( wxEVT_ENTER_WINDOW, wxMouseEventHandler( ModemProperties::OnMouseEnter ), NULL, this);
this->Connect( wxEVT_LEAVE_WINDOW, wxMouseEventHandler( ModemProperties::OnMouseLeave ), NULL, this);
this->Connect( wxEVT_ENTER_WINDOW, wxMouseEventHandler( ModemProperties::OnMouseEnter ), nullptr, this);
this->Connect( wxEVT_LEAVE_WINDOW, wxMouseEventHandler( ModemProperties::OnMouseLeave ), nullptr, this);
updateTheme();
@ -48,14 +48,12 @@ void ModemProperties::updateTheme() {
m_propertyGrid->SetLineColour(btn);
}
ModemProperties::~ModemProperties() {
}
ModemProperties::~ModemProperties() = default;
void ModemProperties::initDefaultProperties() {
if (!audioOutputDevices.size()) {
if (audioOutputDevices.empty()) {
std::vector<string> outputOpts;
std::vector<string> outputOptNames;
@ -63,7 +61,7 @@ void ModemProperties::initDefaultProperties() {
int i = 0;
for (auto aDev : audioDevices) {
for (const auto& aDev : audioDevices) {
if (aDev.inputChannels) {
audioInputDevices[i] = aDev;
}
@ -73,23 +71,23 @@ void ModemProperties::initDefaultProperties() {
i++;
}
int defaultDevice = 0;
int dc = 0;
// int defaultDevice = 0;
// int dc = 0;
for (auto mdevices_i : audioOutputDevices) {
for (const auto& mdevices_i : audioOutputDevices) {
outputOpts.push_back(std::to_string(mdevices_i.first));
outputOptNames.push_back(mdevices_i.second.name);
if (mdevices_i.second.isDefaultOutput) {
defaultDevice = dc;
}
dc++;
// if (mdevices_i.second.isDefaultOutput) {
// defaultDevice = dc;
// }
// dc++;
}
outputArg.key ="._audio_output";
outputArg.name = "Audio Out";
outputArg.description = "Set the current modem's audio output device.";
outputArg.type = ModemArgInfo::STRING;
outputArg.type = ModemArgInfo::Type::STRING;
outputArg.options = outputOpts;
outputArg.optionNames = outputOptNames;
}
@ -101,7 +99,7 @@ void ModemProperties::initDefaultProperties() {
defaultProps["._audio_output"] = addArgInfoProperty(m_propertyGrid, outputArg);
}
void ModemProperties::initProperties(ModemArgInfoList newArgs, DemodulatorInstance *demodInstance) {
void ModemProperties::initProperties(ModemArgInfoList newArgs, const DemodulatorInstancePtr& demodInstance) {
args = newArgs;
demodContext = demodInstance;
@ -139,10 +137,10 @@ wxPGProperty *ModemProperties::addArgInfoProperty(wxPropertyGrid *pg, ModemArgIn
std::vector<std::string>::iterator stringIter;
switch (arg.type) {
case ModemArgInfo::INT:
case ModemArgInfo::Type::INT:
try {
intVal = std::stoi(arg.value);
} catch (std::invalid_argument e) {
} catch (const std::invalid_argument &) {
intVal = 0;
}
prop = pg->Append( new wxIntProperty(arg.name, wxPG_LABEL, intVal) );
@ -151,10 +149,10 @@ wxPGProperty *ModemProperties::addArgInfoProperty(wxPropertyGrid *pg, ModemArgIn
pg->SetPropertyAttribute( prop, wxPG_ATTR_MAX, arg.range.maximum());
}
break;
case ModemArgInfo::FLOAT:
case ModemArgInfo::Type::FLOAT:
try {
floatVal = std::stod(arg.value);
} catch (std::invalid_argument e) {
} catch (const std::invalid_argument &) {
floatVal = 0;
}
prop = pg->Append( new wxFloatProperty(arg.name, wxPG_LABEL, floatVal) );
@ -163,17 +161,17 @@ wxPGProperty *ModemProperties::addArgInfoProperty(wxPropertyGrid *pg, ModemArgIn
pg->SetPropertyAttribute( prop, wxPG_ATTR_MAX, arg.range.maximum());
}
break;
case ModemArgInfo::BOOL:
case ModemArgInfo::Type::BOOL:
prop = pg->Append( new wxBoolProperty(arg.name, wxPG_LABEL, (arg.value=="true")) );
break;
case ModemArgInfo::STRING:
if (arg.options.size()) {
case ModemArgInfo::Type::STRING:
if (!arg.options.empty()) {
intVal = 0;
prop = pg->Append( new wxEnumProperty(arg.name, wxPG_LABEL) );
for (stringIter = arg.options.begin(); stringIter != arg.options.end(); stringIter++) {
std::string optName = (*stringIter);
std::string displayName = optName;
if (arg.optionNames.size()) {
if (!arg.optionNames.empty()) {
displayName = arg.optionNames[intVal];
}
@ -188,22 +186,22 @@ wxPGProperty *ModemProperties::addArgInfoProperty(wxPropertyGrid *pg, ModemArgIn
prop = pg->Append( new wxStringProperty(arg.name, wxPG_LABEL, arg.value) );
}
break;
case ModemArgInfo::PATH_DIR:
case ModemArgInfo::Type::PATH_DIR:
break;
case ModemArgInfo::PATH_FILE:
case ModemArgInfo::Type::PATH_FILE:
break;
case ModemArgInfo::COLOR:
case ModemArgInfo::Type::COLOR:
break;
}
if (prop != NULL) {
if (prop != nullptr) {
prop->SetHelpString(arg.name + ": " + arg.description);
}
return prop;
}
std::string ModemProperties::readProperty(std::string key) {
std::string ModemProperties::readProperty(const std::string& key) {
int i = 0;
ModemArgInfoList::const_iterator args_i;
@ -212,10 +210,10 @@ std::string ModemProperties::readProperty(std::string key) {
if (arg.key == key) {
wxPGProperty *prop = props[key];
std::string result = "";
if (arg.type == ModemArgInfo::STRING && arg.options.size()) {
std::string result;
if (arg.type == ModemArgInfo::Type::STRING && !arg.options.empty()) {
return arg.options[prop->GetChoiceSelection()];
} else if (arg.type == ModemArgInfo::BOOL) {
} else if (arg.type == ModemArgInfo::Type::BOOL) {
return (prop->GetValueAsString()=="True")?"true":"false";
} else {
return prop->GetValueAsString().ToStdString();
@ -241,7 +239,7 @@ void ModemProperties::OnChange(wxPropertyGridEvent &event) {
if (demodContext) {
try {
demodContext->setOutputDevice(std::stoi(outputArg.value));
} catch (exception e) {
} catch (const exception &) {
// .. this should never happen ;)
}
@ -261,11 +259,11 @@ void ModemProperties::OnChange(wxPropertyGridEvent &event) {
}
}
void ModemProperties::OnCollapse(wxPropertyGridEvent &event) {
void ModemProperties::OnCollapse(wxPropertyGridEvent & /* event */) {
collapsed = true;
}
void ModemProperties::OnExpand(wxPropertyGridEvent &event) {
void ModemProperties::OnExpand(wxPropertyGridEvent &/* event */) {
collapsed = false;
}
@ -292,7 +290,7 @@ void ModemProperties::setCollapsed(bool state) {
}
}
bool ModemProperties::isCollapsed() {
bool ModemProperties::isCollapsed() const {
return collapsed;
}

View File

@ -13,7 +13,7 @@
class ModemProperties : public wxPanel {
public:
ModemProperties(
explicit ModemProperties(
wxWindow *parent,
wxWindowID winid = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
@ -21,20 +21,20 @@ public:
long style = wxTAB_TRAVERSAL | wxNO_BORDER,
const wxString& name = wxPanelNameStr
);
~ModemProperties();
~ModemProperties() override;
void initDefaultProperties();
void initProperties(ModemArgInfoList newArgs, DemodulatorInstance *demodInstance);
void initProperties(ModemArgInfoList newArgs, const DemodulatorInstancePtr& demodInstance);
bool isMouseInView();
void setCollapsed(bool state);
bool isCollapsed();
bool isCollapsed() const;
void fitColumns();
void updateTheme();
private:
wxPGProperty *addArgInfoProperty(wxPropertyGrid *pg, ModemArgInfo arg);
std::string readProperty(std::string);
std::string readProperty(const std::string&);
void OnChange(wxPropertyGridEvent &event);
void OnShow(wxShowEvent &event);
void OnCollapse(wxPropertyGridEvent &event);
@ -46,7 +46,8 @@ private:
wxBoxSizer* bSizer;
wxPropertyGrid* m_propertyGrid;
ModemArgInfoList args;
DemodulatorInstance *demodContext;
DemodulatorInstancePtr demodContext;
std::map<std::string, wxPGProperty *> props;
bool mouseInView, collapsed;

195
src/SessionMgr.cpp Normal file
View File

@ -0,0 +1,195 @@
// Copyright (c) Charles J. Cliffe
// SPDX-License-Identifier: GPL-2.0+
#include "SessionMgr.h"
#include "CubicSDR.h"
void SessionMgr::saveSession(std::string fileName) {
DataTree s("cubicsdr_session");
DataNode *header = s.rootNode()->newChild("header");
//save as wstring to prevent problems
header->newChild("version")->element()->set(wxString(CUBICSDR_VERSION).ToStdWstring());
*header->newChild("center_freq") = wxGetApp().getFrequency();
*header->newChild("sample_rate") = wxGetApp().getSampleRate();
*header->newChild("solo_mode") = wxGetApp().getSoloMode()?1:0;
WaterfallCanvas *waterfallCanvas = wxGetApp().getAppFrame()->getWaterfallCanvas();
if (waterfallCanvas->getViewState()) {
DataNode *viewState = header->newChild("view_state");
*viewState->newChild("center_freq") = waterfallCanvas->getCenterFrequency();
*viewState->newChild("bandwidth") = waterfallCanvas->getBandwidth();
}
DataNode *demods = s.rootNode()->newChild("demodulators");
//make a local copy snapshot of the list
std::vector<DemodulatorInstancePtr> instances = wxGetApp().getDemodMgr().getDemodulators();
for (const auto &instance : instances) {
DataNode *demod = demods->newChild("demodulator");
wxGetApp().getDemodMgr().saveInstance(demod, instance);
} //end for demodulators
// Make sure the file name actually ends in .xml
std::string lcFileName = fileName;
std::transform(lcFileName.begin(), lcFileName.end(), lcFileName.begin(), ::tolower);
if (lcFileName.find_last_of(".xml") != lcFileName.length()-1) {
fileName.append(".xml");
}
s.SaveToFileXML(fileName);
}
bool SessionMgr::loadSession(const std::string& fileName) {
DataTree l;
if (!l.LoadFromFileXML(fileName)) {
return false;
}
//Check if it is a session file, read the root node.
if (l.rootNode()->getName() != "cubicsdr_session") {
return false;
}
wxGetApp().getDemodMgr().setActiveDemodulator(nullptr, false);
wxGetApp().getDemodMgr().terminateAll();
WaterfallCanvas *waterfallCanvas = wxGetApp().getAppFrame()->getWaterfallCanvas();
SpectrumCanvas *spectrumCanvas = wxGetApp().getAppFrame()->getSpectrumCanvas();
try {
if (!l.rootNode()->hasAnother("header")) {
return false;
}
DataNode *header = l.rootNode()->getNext("header");
if (header->hasAnother("version")) {
//"Force" the retrieving of the value as string, even if it looks like a number internally ! (ex: "0.2.0")
DataNode *versionNode = header->getNext("version");
std::wstring version;
try {
versionNode->element()->get(version);
std::cout << "Loading session file version: '" << version << "'..." << std::endl;
}
catch (DataTypeMismatchException &e) {
//this is for managing the old session format NOT encoded as std:wstring,
//force current version
std::cout << "Warning while Loading session file version, probably old format :'" << e.what() << "' please consider re-saving the current session..." << std::endl << std::flush;
version = wxString(CUBICSDR_VERSION).ToStdWstring();
}
}
if (header->hasAnother("sample_rate")) {
long sample_rate = (long)*header->getNext("sample_rate");
SDRDeviceInfo *dev = wxGetApp().getSDRThread()->getDevice();
if (dev) {
//retrieve the available sample rates. A valid previously chosen manual
//value is constrained within these limits. If it doesn't behave, lets the device choose
//for us.
long minRate = MANUAL_SAMPLE_RATE_MIN;
long maxRate = MANUAL_SAMPLE_RATE_MAX;
std::vector<long> sampleRates = dev->getSampleRates(SOAPY_SDR_RX, 0);
if (!sampleRates.empty()) {
minRate = sampleRates.front();
maxRate = sampleRates.back();
}
//If it is beyond limits, make device choose a reasonable value
if (sample_rate < minRate || sample_rate > maxRate) {
sample_rate = dev->getSampleRateNear(SOAPY_SDR_RX, 0, sample_rate);
}
//update applied value
wxGetApp().setSampleRate(sample_rate);
} else {
wxGetApp().setSampleRate(sample_rate);
}
}
if (header->hasAnother("solo_mode")) {
int solo_mode_activated = (int)*header->getNext("solo_mode");
wxGetApp().setSoloMode(solo_mode_activated > 0);
}
else {
wxGetApp().setSoloMode(false);
}
DemodulatorInstancePtr loadedActiveDemod = nullptr;
DemodulatorInstancePtr newDemod = nullptr;
if (l.rootNode()->hasAnother("demodulators")) {
DataNode *demodulators = l.rootNode()->getNext("demodulators");
std::vector<DemodulatorInstancePtr> demodsLoaded;
while (demodulators->hasAnother("demodulator")) {
DataNode *demod = demodulators->getNext("demodulator");
if (!demod->hasAnother("bandwidth") || !demod->hasAnother("frequency")) {
continue;
}
newDemod = wxGetApp().getDemodMgr().loadInstance(demod);
if (demod->hasAnother("active")) {
loadedActiveDemod = newDemod;
}
newDemod->run();
newDemod->setActive(true);
demodsLoaded.push_back(newDemod);
}
if (!demodsLoaded.empty()) {
wxGetApp().notifyDemodulatorsChanged();
}
} // if l.rootNode()->hasAnother("demodulators")
if (header->hasAnother("center_freq")) {
long long center_freq = (long long)*header->getNext("center_freq");
wxGetApp().setFrequency(center_freq);
// std::cout << "\tCenter Frequency: " << center_freq << std::endl;
}
if (header->hasAnother("view_state")) {
DataNode *viewState = header->getNext("view_state");
if (viewState->hasAnother("center_freq") && viewState->hasAnother("bandwidth")) {
auto center_freq = (long long)*viewState->getNext("center_freq");
auto bandwidth = (int)*viewState->getNext("bandwidth");
spectrumCanvas->setView(center_freq, bandwidth);
waterfallCanvas->setView(center_freq, bandwidth);
}
} else {
spectrumCanvas->disableView();
waterfallCanvas->disableView();
spectrumCanvas->setCenterFrequency(wxGetApp().getFrequency());
waterfallCanvas->setCenterFrequency(wxGetApp().getFrequency());
}
if (loadedActiveDemod || newDemod) {
wxGetApp().getDemodMgr().setActiveDemodulator(loadedActiveDemod?loadedActiveDemod:newDemod, false);
}
} catch (DataTypeMismatchException &e) {
std::cout << e.what() << std::endl;
return false;
}
return true;
}

14
src/SessionMgr.h Normal file
View File

@ -0,0 +1,14 @@
// Copyright (c) Charles J. Cliffe
// SPDX-License-Identifier: GPL-2.0+
#pragma once
#include "DataTree.h"
#include "AppFrame.h"
class SessionMgr {
public:
void saveSession(std::string fileName);
bool loadSession(const std::string& fileName);
};

46
src/audio/AudioFile.cpp Normal file
View File

@ -0,0 +1,46 @@
// Copyright (c) Charles J. Cliffe
// SPDX-License-Identifier: GPL-2.0+
#include "AudioFile.h"
#include "CubicSDR.h"
#include <sstream>
AudioFile::AudioFile() = default;
AudioFile::~AudioFile() = default;
void AudioFile::setOutputFileName(std::string filename) {
filenameBase = filename;
}
std::string AudioFile::getOutputFileName() {
std::string recPath = wxGetApp().getConfig()->getRecordingPath();
// Strip any invalid characters from the name
std::string stripChars("<>:\"/\\|?*");
std::string filenameBaseSafe = filenameBase;
for (size_t i = 0, iMax = filenameBaseSafe.length(); i < iMax; i++) {
if (stripChars.find(filenameBaseSafe[i]) != std::string::npos) {
filenameBaseSafe.replace(i,1,"_");
}
}
// Create output file name
std::stringstream outputFileName;
outputFileName << recPath << filePathSeparator << filenameBaseSafe;
int idx = 0;
// If the file exists; then find the next non-existing file in sequence.
std::string fileNameCandidate = outputFileName.str();
while (FILE *file = fopen((fileNameCandidate + "." + getExtension()).c_str(), "r")) {
fclose(file);
fileNameCandidate = outputFileName.str() + "-" + std::to_string(++idx);
}
return fileNameCandidate + "." + getExtension();
}

25
src/audio/AudioFile.h Normal file
View File

@ -0,0 +1,25 @@
// Copyright (c) Charles J. Cliffe
// SPDX-License-Identifier: GPL-2.0+
#pragma once
#include "AudioThread.h"
class AudioFile
{
public:
AudioFile();
virtual ~AudioFile();
virtual void setOutputFileName(std::string filename);
virtual std::string getExtension() = 0;
virtual std::string getOutputFileName();
virtual bool writeToFile(AudioThreadInputPtr input) = 0;
virtual bool closeFile() = 0;
protected:
std::string filenameBase;
};

219
src/audio/AudioFileWAV.cpp Normal file
View File

@ -0,0 +1,219 @@
// Copyright (c) Charles J. Cliffe
// SPDX-License-Identifier: GPL-2.0+
#include "AudioFileWAV.h"
#include "CubicSDR.h"
#include <iomanip>
//limit file size to 2GB (- margin) for maximum compatibility.
#define MAX_WAV_FILE_SIZE (0x7FFFFFFF - 1024)
// Simple endian io read/write handling from
// http://www.cplusplus.com/forum/beginner/31584/#msg171056
namespace little_endian_io
{
template <typename Word>
std::ostream& write_word(std::ostream& outs, Word value, unsigned size = sizeof(Word)) {
for (; size; --size, value >>= 8) {
outs.put(static_cast <char> (value & 0xFF));
}
return outs;
}
template <typename Word>
std::istream& read_word(std::istream& ins, Word& value, unsigned size = sizeof(Word)) {
value = 0;
for (unsigned n = 0; n < size; ++n) {
value |= ins.get() << (8 * n);
}
return ins;
}
}
namespace big_endian_io
{
template <typename Word>
std::ostream& write_word(std::ostream& outs, Word value, unsigned size = sizeof(Word)) {
while (size) {
outs.put(static_cast <char> ((value >> (8 * --size)) & 0xFF));
}
return outs;
}
template <typename Word>
std::istream& read_word(std::istream& ins, Word& value, unsigned size = sizeof(Word)) {
for (value = 0; size; --size) {
value = (value << 8) | ins.get();
}
return ins;
}
}
using namespace little_endian_io;
AudioFileWAV::AudioFileWAV() : AudioFile(), dataChunkPos(0) {
}
AudioFileWAV::~AudioFileWAV() = default;
std::string AudioFileWAV::getExtension()
{
return "wav";
}
bool AudioFileWAV::writeToFile(AudioThreadInputPtr input)
{
if (!outputFileStream.is_open()) {
std::string ofName = getOutputFileName();
outputFileStream.open(ofName.c_str(), std::ios::binary);
currentFileSize = 0;
writeHeaderToFileStream(input);
}
size_t maxRoomInCurrentFileInSamples = getMaxWritableNumberOfSamples(input);
if (maxRoomInCurrentFileInSamples >= input->data.size()) {
writePayloadToFileStream(input, 0, input->data.size());
}
else {
//we complete the current file and open another:
writePayloadToFileStream(input, 0, maxRoomInCurrentFileInSamples);
closeFile();
// Open a new file with the next sequence number, and dump the rest of samples in it.
currentSequenceNumber++;
currentFileSize = 0;
std::string ofName = getOutputFileName();
outputFileStream.open(ofName.c_str(), std::ios::binary);
writeHeaderToFileStream(input);
writePayloadToFileStream(input, maxRoomInCurrentFileInSamples, input->data.size());
}
return true;
}
bool AudioFileWAV::closeFile()
{
if (outputFileStream.is_open()) {
size_t file_length = outputFileStream.tellp();
// Fix the data chunk header to contain the data size
outputFileStream.seekp(dataChunkPos + 4);
write_word(outputFileStream, file_length - (dataChunkPos + 8), 4);
// Fix the file header to contain the proper RIFF chunk size, which is (file size - 8) bytes
outputFileStream.seekp(0 + 4);
write_word(outputFileStream, file_length - 8, 4);
outputFileStream.close();
currentFileSize = 0;
}
return true;
}
void AudioFileWAV::writeHeaderToFileStream(const AudioThreadInputPtr& input) {
// Based on simple wav file output code from
// http://www.cplusplus.com/forum/beginner/166954/
// Write the wav file headers
outputFileStream << "RIFF----WAVEfmt "; // (chunk size to be filled in later)
write_word(outputFileStream, 16, 4); // no extension data
write_word(outputFileStream, 1, 2); // PCM - integer samples
write_word(outputFileStream, input->channels, 2); // channels
write_word(outputFileStream, input->sampleRate, 4); // samples per second (Hz)
write_word(outputFileStream, (input->sampleRate * 16 * input->channels) / 8, 4); // (Sample Rate * BitsPerSample * Channels) / 8
write_word(outputFileStream, input->channels * 2, 2); // data block size (size of integer samples, one for each channel, in bytes)
write_word(outputFileStream, 16, 2); // number of bits per sample (use a multiple of 8)
// Write the data chunk header
dataChunkPos = outputFileStream.tellp();
currentFileSize = dataChunkPos;
outputFileStream << "data----"; // (chunk size to be filled in later)
}
void AudioFileWAV::writePayloadToFileStream(const AudioThreadInputPtr& input, size_t startInputPosition, size_t endInputPosition) {
// Prevent clipping
float intScale = (input->peak < 1.0) ? 32767.0f : (32767.0f / input->peak);
if (input->channels == 1) {
for (size_t i = startInputPosition, iMax = endInputPosition; i < iMax; i++) {
write_word(outputFileStream, int(input->data[i] * intScale), 2);
currentFileSize += 2;
}
}
else if (input->channels == 2) {
for (size_t i = startInputPosition, iMax = endInputPosition / 2; i < iMax; i++) {
write_word(outputFileStream, int(input->data[i * 2] * intScale), 2);
write_word(outputFileStream, int(input->data[i * 2 + 1] * intScale), 2);
currentFileSize += 4;
}
}
}
size_t AudioFileWAV::getMaxWritableNumberOfSamples(const AudioThreadInputPtr& input) const {
long long remainingBytesInFile = (long long)(MAX_WAV_FILE_SIZE) - currentFileSize;
return (size_t)(remainingBytesInFile / (input->channels * 2));
}
void AudioFileWAV::setOutputFileName(std::string filename) {
if (filename != filenameBase) {
currentSequenceNumber = 0;
}
AudioFile::setOutputFileName(filename);
}
std::string AudioFileWAV::getOutputFileName() {
std::string recPath = wxGetApp().getConfig()->getRecordingPath();
// Strip any invalid characters from the name
std::string stripChars("<>:\"/\\|?*");
std::string filenameBaseSafe = filenameBase;
for (size_t i = 0, iMax = filenameBaseSafe.length(); i < iMax; i++) {
if (stripChars.find(filenameBaseSafe[i]) != std::string::npos) {
filenameBaseSafe.replace(i, 1, "_");
}
}
// Create output file name
std::stringstream outputFileName;
outputFileName << recPath << filePathSeparator << filenameBaseSafe;
//customized part: append a sequence number.
if (currentSequenceNumber > 0) {
outputFileName << "_" << std::setfill('0') << std::setw(3) << currentSequenceNumber;
}
int idx = 0;
// If the file exists; then find the next non-existing file in sequence.
std::string fileNameCandidate = outputFileName.str();
while (FILE *file = fopen((fileNameCandidate + "." + getExtension()).c_str(), "r")) {
fclose(file);
fileNameCandidate = outputFileName.str() + "-" + std::to_string(++idx);
}
return fileNameCandidate + "." + getExtension();
}

42
src/audio/AudioFileWAV.h Normal file
View File

@ -0,0 +1,42 @@
// Copyright (c) Charles J. Cliffe
// SPDX-License-Identifier: GPL-2.0+
#pragma once
#include "AudioFile.h"
#include <fstream>
class AudioFileWAV : public AudioFile {
public:
AudioFileWAV();
~AudioFileWAV() override;
//override to manage name change with multi-part WAV.
void setOutputFileName(std::string filename) override;
//override of the base method to generate multi-part
//WAV to overcome the WAV format size limit.
std::string getOutputFileName() override;
std::string getExtension() override;
bool writeToFile(AudioThreadInputPtr input) override;
bool closeFile() override;
protected:
std::ofstream outputFileStream;
size_t dataChunkPos;
long long currentFileSize = 0;
int currentSequenceNumber = 0;
private:
size_t getMaxWritableNumberOfSamples(const AudioThreadInputPtr& input) const;
void writeHeaderToFileStream(const AudioThreadInputPtr& input);
//write [startInputPosition; endInputPosition[ samples from input into the file.
void writePayloadToFileStream(const AudioThreadInputPtr& input, size_t startInputPosition, size_t endInputPosition);
};

View File

@ -0,0 +1,140 @@
// Copyright (c) Charles J. Cliffe
// SPDX-License-Identifier: GPL-2.0+
#include "AudioSinkFileThread.h"
#include <ctime>
#define HEARTBEAT_CHECK_PERIOD_MICROS (50 * 1000)
AudioSinkFileThread::AudioSinkFileThread() : AudioSinkThread() {
}
AudioSinkFileThread::~AudioSinkFileThread() {
if (audioFileHandler != nullptr) {
audioFileHandler->closeFile();
}
}
void AudioSinkFileThread::sink(AudioThreadInputPtr input) {
if (!audioFileHandler) {
return;
}
//by default, always write something
bool isSomethingToWrite = true;
if (input->is_squelch_active) {
if (squelchOption == SQUELCH_RECORD_SILENCE) {
//patch with "silence"
input->data.assign(input->data.size(), 0.0f);
input->peak = 0.0f;
}
else if (squelchOption == SQUELCH_SKIP_SILENCE) {
isSomethingToWrite = false;
}
}
//else, nothing to do record as if squelch was not enabled.
if (!isSomethingToWrite) {
return;
}
if (fileTimeLimit > 0) {
durationMeasurement.update();
//duration exeeded, close this file and create another
//with "now" as timestamp.
if (durationMeasurement.getSeconds() > fileTimeLimit) {
audioFileHandler->closeFile();
//initialize the filename of the AudioFile with the current time
time_t t = std::time(nullptr);
tm ltm = *std::localtime(&t);
// GCC 5+
// fileName << "_" << std::put_time(&ltm, "%d-%m-%Y_%H-%M-%S");
char timeStr[512];
//International format: Year.Month.Day, also lexicographically sortable
strftime(timeStr, sizeof(timeStr), "%Y-%m-%d_%H-%M-%S", &ltm);
audioFileHandler->setOutputFileName(fileNameBase + std::string("_") + timeStr);
//reset duration counter
durationMeasurement.start();
//the following writeToFile will take care of creating another file.
}
}
// forward to output file handler
audioFileHandler->writeToFile(input);
}
void AudioSinkFileThread::inputChanged(AudioThreadInput /* oldProps */, AudioThreadInputPtr /* newProps */) {
// close, set new parameters, adjust file name sequence and re-open?
if (!audioFileHandler) {
return;
}
audioFileHandler->closeFile();
//reset duration counter
durationMeasurement.start();
}
void AudioSinkFileThread::setAudioFileNameBase(const std::string& baseName) {
fileNameBase = baseName;
}
void AudioSinkFileThread::setAudioFileHandler(AudioFile * output) {
audioFileHandler = output;
//initialize the filename of the AudioFile with the current time
time_t t = std::time(nullptr);
tm ltm = *std::localtime(&t);
// GCC 5+
// fileName << "_" << std::put_time(&ltm, "%d-%m-%Y_%H-%M-%S");
char timeStr[512];
//International format: Year.Month.Day, also lexicographically sortable
strftime(timeStr, sizeof(timeStr), "%Y-%m-%d_%H-%M-%S", &ltm);
audioFileHandler->setOutputFileName(fileNameBase + std::string("_") + timeStr);
// reset Timer
durationMeasurement.start();
}
void AudioSinkFileThread::setSquelchOption(int squelchOptEnumValue) {
if (squelchOptEnumValue == AudioSinkFileThread::SQUELCH_RECORD_SILENCE) {
squelchOption = AudioSinkFileThread::SQUELCH_RECORD_SILENCE;
}
else if (squelchOptEnumValue == AudioSinkFileThread::SQUELCH_SKIP_SILENCE) {
squelchOption = AudioSinkFileThread::SQUELCH_SKIP_SILENCE;
}
else if (squelchOptEnumValue == AudioSinkFileThread::SQUELCH_RECORD_ALWAYS) {
squelchOption = AudioSinkFileThread::SQUELCH_RECORD_ALWAYS;
}
else {
squelchOption = AudioSinkFileThread::SQUELCH_RECORD_SILENCE;
}
}
// Time limit
void AudioSinkFileThread::setFileTimeLimit(int nbSeconds) {
if (nbSeconds > 0) {
fileTimeLimit = nbSeconds;
}
else {
fileTimeLimit = 0;
}
}

View File

@ -0,0 +1,50 @@
// Copyright (c) Charles J. Cliffe
// SPDX-License-Identifier: GPL-2.0+
#pragma once
#include "AudioSinkThread.h"
#include "AudioFile.h"
#include "Timer.h"
class AudioSinkFileThread : public AudioSinkThread {
public:
AudioSinkFileThread();
~AudioSinkFileThread() override;
enum SquelchOption {
SQUELCH_RECORD_SILENCE = 0, // default value, record as a user would hear it.
SQUELCH_SKIP_SILENCE = 1, // skip below-squelch level.
SQUELCH_RECORD_ALWAYS = 2, // record irrespective of the squelch level.
SQUELCH_RECORD_MAX
};
void sink(AudioThreadInputPtr input) override;
void inputChanged(AudioThreadInput oldProps, AudioThreadInputPtr newProps) override;
void setAudioFileHandler(AudioFile *output);
void setAudioFileNameBase(const std::string& baseName);
//Squelch
void setSquelchOption(int squelchOptEnumValue);
// Time limit
void setFileTimeLimit(int nbSeconds);
protected:
std::string fileNameBase;
AudioFile *audioFileHandler = nullptr;
SquelchOption squelchOption = SQUELCH_RECORD_SILENCE;
int fileTimeLimit = 0;
int fileTimeDurationSeconds = -1;
Timer durationMeasurement;
};

View File

@ -0,0 +1,52 @@
// Copyright (c) Charles J. Cliffe
// SPDX-License-Identifier: GPL-2.0+
#include "AudioSinkThread.h"
#define HEARTBEAT_CHECK_PERIOD_MICROS (50 * 1000)
AudioSinkThread::AudioSinkThread() {
inputQueuePtr = std::make_shared<AudioThreadInputQueue>();
inputQueuePtr->set_max_num_items(1000);
setInputQueue("input", inputQueuePtr);
}
AudioSinkThread::~AudioSinkThread() = default;
void AudioSinkThread::run() {
#ifdef __APPLE__
pthread_t tID = pthread_self(); // ID of this thread
int priority = sched_get_priority_max(SCHED_RR) - 1;
sched_param prio = { priority }; // scheduling priority of thread
pthread_setschedparam(tID, SCHED_RR, &prio);
#endif
AudioThreadInputPtr inp;
AudioThreadInput inputRef;
while (!stopping) {
if (!inputQueuePtr->pop(inp, HEARTBEAT_CHECK_PERIOD_MICROS)) {
continue;
}
if (inputRef.channels != inp->channels ||
inputRef.frequency != inp->frequency ||
inputRef.inputRate != inp->inputRate ||
inputRef.sampleRate != inp->sampleRate) {
inputChanged(inputRef, inp);
inputRef.channels = inp->channels;
inputRef.frequency = inp->frequency;
inputRef.inputRate = inp->inputRate;
inputRef.sampleRate = inp->sampleRate;
}
sink(inp);
}
}
void AudioSinkThread::terminate() {
IOThread::terminate();
inputQueuePtr->flush();
}

View File

@ -0,0 +1,25 @@
// Copyright (c) Charles J. Cliffe
// SPDX-License-Identifier: GPL-2.0+
#pragma once
#include "AudioThread.h"
class AudioSinkThread : public IOThread {
public:
AudioSinkThread();
~AudioSinkThread() override;
void run() override;
void terminate() override;
virtual void sink(AudioThreadInputPtr input) = 0;
virtual void inputChanged(AudioThreadInput oldProps, AudioThreadInputPtr newProps) = 0;
protected:
std::recursive_mutex m_mutex;
AudioThreadInputQueuePtr inputQueuePtr;
};

View File

@ -2,32 +2,44 @@
// SPDX-License-Identifier: GPL-2.0+
#include "AudioThread.h"
#include "CubicSDRDefs.h"
#include <vector>
#include <algorithm>
#include "CubicSDR.h"
#include "DemodulatorThread.h"
#include "DemodulatorInstance.h"
#include <memory.h>
#include <mutex>
//50 ms
#define HEARTBEAT_CHECK_PERIOD_MICROS (50 * 1000)
std::map<int, AudioThread* > AudioThread::deviceController;
std::map<int, AudioThread *> AudioThread::deviceController;
std::map<int, int> AudioThread::deviceSampleRate;
std::map<int, std::thread *> AudioThread::deviceThread;
AudioThread::AudioThread() : IOThread(),
currentInput(nullptr), inputQueue(nullptr), nBufferFrames(1024), sampleRate(0) {
std::recursive_mutex AudioThread::m_device_mutex;
audioQueuePtr.store(0);
underflowCount.store(0);
active.store(false);
outputDevice.store(-1);
AudioThread::AudioThread() : IOThread(), nBufferFrames(1024), sampleRate(0), controllerThread(nullptr) {
audioQueuePtr = 0;
underflowCount = 0;
active.store(false);
outputDevice.store(-1);
gain = 1.0;
}
AudioThread::~AudioThread() {
if (controllerThread != nullptr) {
//
//NOT PROTECTED by m_mutex on purpose, to prevent deadlocks with controllerThread
// it doesn't matter, it is only called when all "normal" audio threads are detached from the controller.
//
terminate();
controllerThread->join();
delete controllerThread;
controllerThread = nullptr;
}
}
std::recursive_mutex & AudioThread::getMutex()
@ -35,6 +47,11 @@ std::recursive_mutex & AudioThread::getMutex()
return m_mutex;
}
void AudioThread::attachControllerThread(std::thread* controllerThread_in) {
controllerThread = controllerThread_in;
}
void AudioThread::bindThread(AudioThread *other) {
std::lock_guard<std::recursive_mutex> lock(m_mutex);
@ -45,36 +62,42 @@ void AudioThread::bindThread(AudioThread *other) {
}
void AudioThread::removeThread(AudioThread *other) {
std::lock_guard<std::recursive_mutex> lock(m_mutex);
std::vector<AudioThread *>::iterator i;
i = std::find(boundThreads.begin(), boundThreads.end(), other);
auto i = std::find(boundThreads.begin(), boundThreads.end(), other);
if (i != boundThreads.end()) {
boundThreads.erase(i);
}
}
void AudioThread::deviceCleanup() {
std::map<int, AudioThread *>::iterator i;
for (i = deviceController.begin(); i != deviceController.end(); i++) {
i->second->terminate();
//
//NOT PROTECTED by m_device_mutex on purpose, to prevent deadlocks with i->second->controllerThread
// it doesn't matter, it is only called when all "normal" audio threads are detached from the controller.
//
for (auto & i : deviceController) {
delete i.second;
}
deviceController.clear();
}
static int audioCallback(void *outputBuffer, void * /* inputBuffer */, unsigned int nBufferFrames, double /* streamTime */, RtAudioStreamStatus status,
void *userData) {
void *userData) {
float *out = (float*)outputBuffer;
//Zero output buffer in all cases: this allow to mute audio if no AudioThread data is
//actually active.
memset(out, 0, nBufferFrames * 2 * sizeof(float));
::memset(out, 0, nBufferFrames * 2 * sizeof(float));
AudioThread *src = (AudioThread *) userData;
//src in the controller thread:
auto *src = (AudioThread *)userData;
//by construction, src is a controller thread, from deviceController:
std::lock_guard<std::recursive_mutex> lock(src->getMutex());
if (src->isTerminated()) {
@ -82,17 +105,12 @@ static int audioCallback(void *outputBuffer, void * /* inputBuffer */, unsigned
}
if (status) {
std::cout << "Audio buffer underflow.." << (src->underflowCount++) << std::endl;
std::cout << "Audio buffer underflow.." << (src->underflowCount++) << std::endl << std::flush;
}
if (src->boundThreads.empty()) {
return 0;
}
double peak = 0.0;
//for all boundThreads
//Process the bound threads audio:
for (size_t j = 0; j < src->boundThreads.size(); j++) {
AudioThread *srcmix = src->boundThreads[j];
@ -107,23 +125,23 @@ static int audioCallback(void *outputBuffer, void * /* inputBuffer */, unsigned
if (!srcmix->currentInput) {
srcmix->audioQueuePtr = 0;
if (!srcmix->inputQueue->try_pop(srcmix->currentInput)) {
continue;
}
continue;
}
if (srcmix->currentInput->sampleRate != src->getSampleRate()) {
while (srcmix->inputQueue->try_pop(srcmix->currentInput)) {
if (srcmix->currentInput) {
if (srcmix->currentInput->sampleRate == src->getSampleRate()) {
break;
}
srcmix->currentInput->decRefCount();
}
srcmix->currentInput = nullptr;
} //end while
@ -136,17 +154,17 @@ static int audioCallback(void *outputBuffer, void * /* inputBuffer */, unsigned
}
if (srcmix->currentInput->channels == 0 || !srcmix->currentInput->data.size()) {
if (srcmix->currentInput->channels == 0 || srcmix->currentInput->data.empty()) {
if (!srcmix->inputQueue->empty()) {
srcmix->audioQueuePtr = 0;
if (srcmix->currentInput) {
srcmix->currentInput->decRefCount();
srcmix->currentInput = nullptr;
}
if (!srcmix->inputQueue->try_pop(srcmix->currentInput)) {
continue;
}
}
}
continue;
}
@ -160,7 +178,7 @@ static int audioCallback(void *outputBuffer, void * /* inputBuffer */, unsigned
if (srcmix->audioQueuePtr >= srcmix->currentInput->data.size()) {
srcmix->audioQueuePtr = 0;
if (srcmix->currentInput) {
srcmix->currentInput->decRefCount();
srcmix->currentInput = nullptr;
}
@ -168,26 +186,27 @@ static int audioCallback(void *outputBuffer, void * /* inputBuffer */, unsigned
break;
}
double srcPeak = srcmix->currentInput->peak * srcmix->gain;
if (mixPeak < srcPeak) {
mixPeak = srcPeak;
}
}
if (srcmix->currentInput && srcmix->currentInput->data.size()) {
if (srcmix->currentInput && !srcmix->currentInput->data.empty()) {
float v = srcmix->currentInput->data[srcmix->audioQueuePtr] * srcmix->gain;
out[i * 2] += v;
out[i * 2 + 1] += v;
}
srcmix->audioQueuePtr++;
}
} else {
for (int i = 0, iMax = srcmix->currentInput->channels * nBufferFrames; i < iMax; i++) {
}
else {
for (unsigned int i = 0, iMax = srcmix->currentInput->channels * nBufferFrames; i < iMax; i++) {
if (srcmix->audioQueuePtr >= srcmix->currentInput->data.size()) {
srcmix->audioQueuePtr = 0;
if (srcmix->currentInput) {
srcmix->currentInput->decRefCount();
srcmix->currentInput = nullptr;
}
@ -200,7 +219,7 @@ static int audioCallback(void *outputBuffer, void * /* inputBuffer */, unsigned
mixPeak = srcPeak;
}
}
if (srcmix->currentInput && srcmix->currentInput->data.size()) {
if (srcmix->currentInput && !srcmix->currentInput->data.empty()) {
out[i] = out[i] + srcmix->currentInput->data[srcmix->audioQueuePtr] * srcmix->gain;
}
@ -226,9 +245,9 @@ static int audioCallback(void *outputBuffer, void * /* inputBuffer */, unsigned
void AudioThread::enumerateDevices(std::vector<RtAudio::DeviceInfo> &devs) {
RtAudio endac;
int numDevices = endac.getDeviceCount();
unsigned int numDevices = endac.getDeviceCount();
for (int i = 0; i < numDevices; i++) {
for (unsigned int i = 0; i < numDevices; i++) {
RtAudio::DeviceInfo info = endac.getDeviceInfo(i);
devs.push_back(info);
@ -276,59 +295,82 @@ void AudioThread::enumerateDevices(std::vector<RtAudio::DeviceInfo> &devs) {
}
void AudioThread::setDeviceSampleRate(int deviceId, int sampleRate) {
if (deviceController.find(deviceId) != deviceController.end()) {
AudioThread* matchingControllerThread = nullptr;
//scope lock here to minimize the common unique static lock contention
{
std::lock_guard<std::recursive_mutex> lock(m_device_mutex);
if (deviceController.find(deviceId) != deviceController.end()) {
matchingControllerThread = deviceController[deviceId];
}
}
//out-of-lock test
if (matchingControllerThread != nullptr) {
AudioThreadCommand refreshDevice;
refreshDevice.cmd = AudioThreadCommand::AUDIO_THREAD_CMD_SET_SAMPLE_RATE;
refreshDevice.cmdType = AudioThreadCommand::Type::AUDIO_THREAD_CMD_SET_SAMPLE_RATE;
refreshDevice.int_value = sampleRate;
//VSO : blocking push !
deviceController[deviceId]->getCommandQueue()->push(refreshDevice);
matchingControllerThread->getCommandQueue()->push(refreshDevice);
}
}
void AudioThread::setSampleRate(int sampleRate) {
void AudioThread::setSampleRate(int sampleRate_in) {
bool thisIsAController = false;
//scope lock here to minimize the common unique static lock contention
{
std::lock_guard<std::recursive_mutex> lock(m_device_mutex);
if (deviceController[outputDevice.load()] == this) {
thisIsAController = true;
deviceSampleRate[outputDevice.load()] = sampleRate_in;
}
}
std::lock_guard<std::recursive_mutex> lock(m_mutex);
if (deviceController[outputDevice.load()] == this) {
deviceSampleRate[outputDevice.load()] = sampleRate;
if (thisIsAController) {
dac.stopStream();
dac.closeStream();
for (size_t j = 0; j < boundThreads.size(); j++) {
AudioThread *srcmix = boundThreads[j];
srcmix->setSampleRate(sampleRate);
//Set bounded sample rate:
for (auto srcmix : boundThreads) {
srcmix->setSampleRate(sampleRate_in);
}
std::vector<DemodulatorInstance *>::iterator demod_i;
std::vector<DemodulatorInstance *> *demodulators;
//make a local copy, snapshot of the list of demodulators
std::vector<DemodulatorInstancePtr> demodulators = wxGetApp().getDemodMgr().getDemodulators();
demodulators = &wxGetApp().getDemodMgr().getDemodulators();
for (demod_i = demodulators->begin(); demod_i != demodulators->end(); demod_i++) {
if ((*demod_i)->getOutputDevice() == outputDevice.load()) {
(*demod_i)->setAudioSampleRate(sampleRate);
for (const auto& demod : demodulators) {
if (demod->getOutputDevice() == outputDevice.load()) {
demod->setAudioSampleRate(sampleRate_in);
}
}
dac.openStream(&parameters, NULL, RTAUDIO_FLOAT32, sampleRate, &nBufferFrames, &audioCallback, (void *) this, &opts);
dac.openStream(&parameters, nullptr, RTAUDIO_FLOAT32, sampleRate_in, &nBufferFrames, &audioCallback, (void *)this, &opts);
dac.startStream();
}
this->sampleRate = sampleRate;
sampleRate = sampleRate_in;
}
int AudioThread::getSampleRate() {
std::lock_guard<std::recursive_mutex> lock(m_mutex);
return this->sampleRate;
return sampleRate;
}
void AudioThread::setupDevice(int deviceId) {
std::lock_guard<std::recursive_mutex> lock(m_mutex);
//global lock to setup the device...
std::lock_guard<std::recursive_mutex> lock(m_device_mutex);
parameters.deviceId = deviceId;
parameters.nChannels = 2;
@ -338,6 +380,11 @@ void AudioThread::setupDevice(int deviceId) {
try {
if (deviceController.find(outputDevice.load()) != deviceController.end()) {
//'this' is not the controller, so remove it from the bounded list:
//beware, we must take the controller mutex, because the audio callback may use the list of bounded
//threads at that moment:
std::lock_guard<std::recursive_mutex> lock(deviceController[outputDevice.load()]->getMutex());
deviceController[outputDevice.load()]->removeThread(this);
}
#ifndef _MSC_VER
@ -348,30 +395,44 @@ void AudioThread::setupDevice(int deviceId) {
if (deviceSampleRate.find(parameters.deviceId) != deviceSampleRate.end()) {
sampleRate = deviceSampleRate[parameters.deviceId];
} else {
std::cout << "Error, device sample rate wasn't initialized?" << std::endl;
return;
// sampleRate = AudioThread::getDefaultAudioSampleRate();
// deviceSampleRate[parameters.deviceId] = sampleRate;
}
else {
std::cout << "Error, device sample rate wasn't initialized?" << std::endl;
return;
// sampleRate = AudioThread::getDefaultAudioSampleRate();
// deviceSampleRate[parameters.deviceId] = sampleRate;
}
//Create a new controller:
if (deviceController.find(parameters.deviceId) == deviceController.end()) {
deviceController[parameters.deviceId] = new AudioThread();
deviceController[parameters.deviceId]->setInitOutputDevice(parameters.deviceId, sampleRate);
deviceController[parameters.deviceId]->bindThread(this);
//Create a new controller thread for parameters.deviceId:
auto* newController = new AudioThread();
newController->setInitOutputDevice(parameters.deviceId, sampleRate);
newController->bindThread(this);
newController->attachControllerThread(new std::thread(&AudioThread::threadMain, newController));
deviceController[parameters.deviceId] = newController;
}
else if (deviceController[parameters.deviceId] == this) {
deviceThread[parameters.deviceId] = new std::thread(&AudioThread::threadMain, deviceController[parameters.deviceId]);
} else if (deviceController[parameters.deviceId] == this) {
//Attach callback
dac.openStream(&parameters, NULL, RTAUDIO_FLOAT32, sampleRate, &nBufferFrames, &audioCallback, (void *) this, &opts);
dac.openStream(&parameters, nullptr, RTAUDIO_FLOAT32, sampleRate, &nBufferFrames, &audioCallback, (void *)this, &opts);
dac.startStream();
} else {
}
else {
//we are a bound thread, add ourselves to the controller deviceController[parameters.deviceId].
//beware, we must take the controller mutex, because the audio callback may use the list of bounded
//threads at that moment:
std::lock_guard<std::recursive_mutex> lock(deviceController[parameters.deviceId]->getMutex());
deviceController[parameters.deviceId]->bindThread(this);
}
active = true;
} catch (RtAudioError& e) {
}
catch (RtAudioError& e) {
e.printMessage();
return;
}
@ -381,6 +442,7 @@ void AudioThread::setupDevice(int deviceId) {
}
int AudioThread::getOutputDevice() {
std::lock_guard<std::recursive_mutex> lock(m_mutex);
if (outputDevice == -1) {
@ -389,30 +451,32 @@ int AudioThread::getOutputDevice() {
return outputDevice;
}
void AudioThread::setInitOutputDevice(int deviceId, int sampleRate) {
std::lock_guard<std::recursive_mutex> lock(m_mutex);
void AudioThread::setInitOutputDevice(int deviceId, int sampleRate_in) {
//global lock
std::lock_guard<std::recursive_mutex> lock(m_device_mutex);
outputDevice = deviceId;
if (sampleRate == -1) {
if (sampleRate_in == -1) {
if (deviceSampleRate.find(parameters.deviceId) != deviceSampleRate.end()) {
sampleRate = deviceSampleRate[deviceId];
sampleRate_in = deviceSampleRate[deviceId];
}
} else {
deviceSampleRate[deviceId] = sampleRate;
}
this->sampleRate = sampleRate;
else {
deviceSampleRate[deviceId] = sampleRate_in;
}
sampleRate = sampleRate_in;
}
void AudioThread::run() {
#ifdef __APPLE__
pthread_t tID = pthread_self(); // ID of this thread
int priority = sched_get_priority_max( SCHED_RR) - 1;
sched_param prio = {priority}; // scheduling priority of thread
int priority = sched_get_priority_max(SCHED_RR) - 1;
sched_param prio = { priority }; // scheduling priority of thread
pthread_setschedparam(tID, SCHED_RR, &prio);
#endif
// std::cout << "Audio thread initializing.." << std::endl;
// std::cout << "Audio thread initializing.." << std::endl;
if (dac.getDeviceCount() < 1) {
std::cout << "No audio devices found!" << std::endl;
@ -421,67 +485,67 @@ void AudioThread::run() {
setupDevice((outputDevice.load() == -1) ? (dac.getDefaultOutputDevice()) : outputDevice.load());
// std::cout << "Audio thread started." << std::endl;
// std::cout << "Audio thread started." << std::endl;
inputQueue = std::static_pointer_cast<AudioThreadInputQueue>(getInputQueue("AudioDataInput"));
inputQueue = static_cast<AudioThreadInputQueue *>(getInputQueue("AudioDataInput"));
//Infinite loop, witing for commands or for termination
while (!stopping) {
AudioThreadCommand command;
cmdQueue.pop(command);
if (!cmdQueue.pop(command, HEARTBEAT_CHECK_PERIOD_MICROS)) {
continue;
}
if (command.cmd == AudioThreadCommand::AUDIO_THREAD_CMD_SET_DEVICE) {
if (command.cmdType == AudioThreadCommand::Type::AUDIO_THREAD_CMD_SET_DEVICE) {
setupDevice(command.int_value);
}
if (command.cmd == AudioThreadCommand::AUDIO_THREAD_CMD_SET_SAMPLE_RATE) {
if (command.cmdType == AudioThreadCommand::Type::AUDIO_THREAD_CMD_SET_SAMPLE_RATE) {
setSampleRate(command.int_value);
}
}
//Thread termination, prevent fancy things to happen, lock the whole thing:
//This way audioThreadCallback is rightly protected from thread termination
std::lock_guard<std::recursive_mutex> lock(m_mutex);
} //end while
// Drain any remaining inputs, with a non-blocking pop
AudioThreadInput *ref;
while (inputQueue && inputQueue->try_pop(ref)) {
if (ref) {
ref->decRefCount();
}
} //end while
//Nullify currentInput...
if (currentInput) {
currentInput->setRefCount(0);
currentInput = nullptr;
if (inputQueue != nullptr) {
inputQueue->flush();
}
//Stop
if (deviceController[parameters.deviceId] != this) {
deviceController[parameters.deviceId]->removeThread(this);
} else {
//Nullify currentInput...
currentInput = nullptr;
//Stop : Retrieve the matching controlling thread in a scope lock:
AudioThread* controllerMatchingThread;
{
std::lock_guard<std::recursive_mutex> global_lock(m_device_mutex);
controllerMatchingThread = deviceController[parameters.deviceId];
}
if (controllerMatchingThread != this) {
//'this' is not the controller, so remove it from the bounded list:
//beware, we must take the controller mutex, because the audio callback may use the list of bounded
//threads at that moment:
std::lock_guard<std::recursive_mutex> lock(controllerMatchingThread->getMutex());
controllerMatchingThread->removeThread(this);
}
else {
// 'this' is a controller thread:
try {
if (dac.isStreamOpen()) {
if (dac.isStreamRunning()) {
dac.stopStream();
}
dac.closeStream();
dac.stopStream();
}
} catch (RtAudioError& e) {
dac.closeStream();
}
catch (RtAudioError& e) {
e.printMessage();
}
}
// std::cout << "Audio thread done." << std::endl;
// std::cout << "Audio thread done." << std::endl;
}
void AudioThread::terminate() {
IOThread::terminate();
AudioThreadCommand endCond; // push an empty input to bump the queue
//VSO: blocking push
cmdQueue.push(endCond);
}
bool AudioThread::isActive() {
@ -491,25 +555,35 @@ bool AudioThread::isActive() {
}
void AudioThread::setActive(bool state) {
AudioThread* matchingControllerThread = nullptr;
std::lock_guard<std::recursive_mutex> lock(m_mutex);
AudioThreadInput *dummy;
//scope lock here to minimize the common unique static lock contention
{
std::lock_guard<std::recursive_mutex> lock(m_device_mutex);
if (deviceController.find(parameters.deviceId) != deviceController.end()) {
matchingControllerThread = deviceController[parameters.deviceId];
}
}
if (matchingControllerThread == nullptr) {
return;
}
if (state && !active && inputQueue) {
deviceController[parameters.deviceId]->bindThread(this);
} else if (!state && active) {
deviceController[parameters.deviceId]->removeThread(this);
matchingControllerThread->bindThread(this);
}
else if (!state && active) {
matchingControllerThread->removeThread(this);
}
// Activity state changing, clear any inputs
if(inputQueue) {
while (inputQueue->try_pop(dummy)) { // flush queue, non-blocking pop
if (dummy) {
dummy->decRefCount();
}
}
if (inputQueue) {
inputQueue->flush();
}
active = state;
}
@ -519,21 +593,12 @@ AudioThreadCommandQueue *AudioThread::getCommandQueue() {
}
void AudioThread::setGain(float gain_in) {
std::lock_guard<std::recursive_mutex> lock(m_mutex);
if (gain < 0.0) {
gain = 0.0;
if (gain_in < 0.0) {
gain_in = 0.0;
}
if (gain > 2.0) {
gain = 2.0;
if (gain_in > 2.0) {
gain_in = 2.0;
}
gain = gain_in;
}
float AudioThread::getGain() {
std::lock_guard<std::recursive_mutex> lock(m_mutex);
return gain;
}

Some files were not shown because too many files have changed in this diff Show More