Compare commits

...

244 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 4240b0efc2 Merge remote-tracking branch 'origin/master' into firpbch2_mode 2018-04-26 20:09:42 -04:00
Charles J. Cliffe cdaae140fd
Merge pull request #637 from cjcliffe/master
Updates from master
2018-03-20 16:55:05 -04: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
Charles J. Cliffe afc29303c9 2x channel bandwidth firpfbch2_crcf optional path 2018-02-14 21:24:22 -05:00
Sebastien F4GRX aa29aa41c6 Avoid build failure when liquid-dsp is not in a default libdir 2017-08-03 15:38:01 +02:00
260 changed files with 38623 additions and 31321 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 "4")
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
@ -433,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
@ -447,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
@ -466,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
@ -675,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}")
@ -774,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)
@ -903,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()
@ -947,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 .)
@ -994,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\\\" /passive /norestart'")
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:
--------
@ -24,11 +25,6 @@ Optional Libs:
- FFTW3 (can be compiled into liquid-dsp if desired) (http://www.fftw.org/ -- https://github.com/FFTW/fftw3)
- hamlib (https://github.com/Hamlib/Hamlib)
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.
Recommended minimum requirements:
--------------------
- Multi-core processor system with at least 1GB RAM.
@ -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

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

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

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
@ -53,15 +53,15 @@
/* 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
# 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,8 +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,8 +23,15 @@
#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.
@ -49,7 +56,7 @@
*
* 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
* 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
@ -61,6 +68,9 @@
#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)
/*
@ -101,9 +111,18 @@
#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)
/*
@ -122,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)
@ -151,7 +170,15 @@
#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
@ -190,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)
@ -228,7 +255,14 @@
#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)
/* next one is 79 */
#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 */
/*
@ -299,7 +333,7 @@
/*
* Radio Shack
* Actualy, they might be either Icom or Uniden. TBC --SF
* Actually, they might be either Icom or Uniden. TBC --SF
*/
#define RIG_RADIOSHACK 7
#define RIG_BACKEND_RADIOSHACK "radioshack"
@ -440,6 +474,7 @@
#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)
/*
@ -492,7 +527,7 @@
/*
* VEB Funkwerk Köpenick RFT
* VEB Funkwerk Köpenick RFT
*/
#define RIG_RFT 24
#define RIG_BACKEND_RFT "rft"
@ -571,6 +606,7 @@
#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)
/*
@ -587,6 +623,15 @@
#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
/*
@ -600,7 +645,7 @@
/*! \typedef typedef int rig_model_t
\brief Convenience type definition for rig model.
*/
typedef int rig_model_t;
typedef uint32_t rig_model_t;
/*

View File

@ -31,11 +31,13 @@
*/
/**
* \file rotator.h
* \brief Hamlib rotator data structures.
* \file rotator.h
* \brief Hamlib rotator data structures.
*
* This file contains the data structures and declarations for the Hamlib
* rotator API. see the rotator.c file for more details on the rotator API.
* This file contains the data structures and declarations for the Hamlib
* rotator Application Programming Interface (API).
*
* See the rotator.c file for more details on the rotator API functions.
*/
@ -49,70 +51,89 @@ struct rot_state;
/**
* \typedef typedef struct rot ROT
* \brief Rotator structure definition (see rot for details).
* \typedef typedef struct s_rot ROT
* \brief Main rotator handle type definition.
*
* The #ROT handle is returned by rot_init() and is passed as a parameter to
* every rotator specific API call.
*
* rot_cleanup() must be called when this handle is no longer needed.
*/
typedef struct rot ROT;
typedef struct s_rot ROT;
/**
* \typedef typedef float elevation_t
* \brief Type definition for elevation.
* \typedef typedef float elevation_t
* \brief Type definition for elevation.
*
* The elevation_t type is used as parameter for the rot_set_position() and
* rot_get_position() functions.
* The \a elevation_t type is used as parameter for the rot_set_position() and
* rot_get_position() functions.
*
* Unless specified otherwise, the unit of elevation_t is decimal degrees.
* Unless specified otherwise, the unit of \a elevation_t is decimal degrees.
*/
typedef float elevation_t;
/**
* \typedef typedef float azimuth_t
* \brief Type definition for azimuth.
* \typedef typedef float azimuth_t
* \brief Type definition for azimuth.
*
* The azimuth_t type is used as parameter for the rot_set_position() and
* rot_get_position() functions.
* The \a azimuth_t type is used as parameter for the rot_set_position() and
* rot_get_position() functions.
*
* Unless specified otherwise, the unit of azimuth_t is decimal degrees.
* Unless specified otherwise, the unit of \a azimuth_t is decimal degrees.
*/
typedef float azimuth_t;
/**
* \brief Token in the netrotctl protocol for returning error code
* \brief The token in the netrotctl protocol for returning an error condition code.
*/
#define NETROTCTL_RET "RPRT "
/**
* \def ROT_RESET_ALL
* \brief A macro that returns the flag for the \b reset operation.
* \sa rot_reset(), rot_reset_t()
* \def ROT_RESET_ALL
* \brief A macro that returns the flag for the \b reset operation.
*
* \sa rot_reset(), rot_reset_t
*/
#define ROT_RESET_ALL 1
/**
* \typedef typedef int rot_reset_t
* \brief Type definition for rotator reset.
* \typedef typedef int rot_reset_t
* \brief Type definition for rotator reset.
*
* The rot_reset_t type is used as parameter for the rot_reset() API
* function.
* The \a rot_reset_t type is used as parameter for the rot_reset() API
* function.
*/
typedef int rot_reset_t;
/**
* \brief Rotator type flags
* \brief Rotator type flags for bitmasks.
*/
typedef enum {
ROT_FLAG_AZIMUTH = (1 << 1), /*!< Azimuth */
ROT_FLAG_ELEVATION = (1 << 2) /*!< Elevation */
} rot_type_t;
//! @cond Doxygen_Suppress
/* So far only used in ests/dumpcaps_rot.c. */
#define ROT_TYPE_MASK (ROT_FLAG_AZIMUTH|ROT_FLAG_ELEVATION)
//! @endcond
/**
* \def ROT_TYPE_OTHER
* \brief Other type of rotator.
* \def ROT_TYPE_AZIMUTH
* \brief Azimuth only rotator.
* \def ROT_TYPE_ELEVATION
* \brief Elevation only rotator.
* \def ROT_TYPE_AZEL
* \brief Combination azimuth/elevation rotator.
*/
#define ROT_TYPE_OTHER 0
#define ROT_TYPE_AZIMUTH ROT_FLAG_AZIMUTH
#define ROT_TYPE_ELEVATION ROT_FLAG_ELEVATION
@ -120,112 +141,223 @@ typedef enum {
/**
* \def ROT_MOVE_UP
* \brief A macro that returns the flag for the \b UP direction.
* \def ROT_MOVE_UP
* \brief A macro that returns the flag for the \b UP direction.
*
* This macro defines the value of the \b UP direction which can be
* used with the rot_move() function.
* This macro defines the value of the \b UP direction which can be
* used with the rot_move() function.
*
* \sa rot_move(), ROT_MOVE_DOWN, ROT_MOVE_LEFT, ROT_MOVE_CCW,
* ROT_MOVE_RIGHT, ROT_MOVE_CW
* \sa rot_move(), ROT_MOVE_DOWN, ROT_MOVE_LEFT, ROT_MOVE_CCW,
* ROT_MOVE_RIGHT, ROT_MOVE_CW
*/
#define ROT_MOVE_UP (1<<1)
/**
* \def ROT_MOVE_DOWN
* \brief A macro that returns the flag for the \b DOWN direction.
* \def ROT_MOVE_DOWN
* \brief A macro that returns the flag for the \b DOWN direction.
*
* This macro defines the value of the \b DOWN direction which can be
* used with the rot_move() function.
* This macro defines the value of the \b DOWN direction which can be
* used with the rot_move() function.
*
* \sa rot_move(), ROT_MOVE_UP, ROT_MOVE_LEFT, ROT_MOVE_CCW, ROT_MOVE_RIGHT,
* ROT_MOVE_CW
* \sa rot_move(), ROT_MOVE_UP, ROT_MOVE_LEFT, ROT_MOVE_CCW, ROT_MOVE_RIGHT,
* ROT_MOVE_CW
*/
#define ROT_MOVE_DOWN (1<<2)
/**
* \def ROT_MOVE_LEFT
* \brief A macro that returns the flag for the \b LEFT direction.
* \def ROT_MOVE_LEFT
* \brief A macro that returns the flag for the \b LEFT direction.
*
* This macro defines the value of the \b LEFT direction which can be
* used with the rot_move function.
* This macro defines the value of the \b LEFT direction which can be
* used with the rot_move function.
*
* \sa rot_move(), ROT_MOVE_UP, ROT_MOVE_DOWN, ROT_MOVE_CCW, ROT_MOVE_RIGHT,
* ROT_MOVE_CW
* \sa rot_move(), ROT_MOVE_UP, ROT_MOVE_DOWN, ROT_MOVE_CCW, ROT_MOVE_RIGHT,
* ROT_MOVE_CW
*/
#define ROT_MOVE_LEFT (1<<3)
/**
* \def ROT_MOVE_CCW
* \brief A macro that returns the flag for the \b counterclockwise direction.
* \def ROT_MOVE_CCW
* \brief A macro that returns the flag for the \b counterclockwise direction.
*
* This macro defines the value of the \b counterclockwise direction which
* can be used with the rot_move() function. This value is equivalent to
* ROT_MOVE_LEFT .
* This macro defines the value of the \b counterclockwise direction which
* can be used with the rot_move() function. This value is equivalent to
* ROT_MOVE_LEFT.
*
* \sa rot_move(), ROT_MOVE_UP, ROT_MOVE_DOWN, ROT_MOVE_LEFT, ROT_MOVE_RIGHT,
* ROT_MOVE_CW
* \sa rot_move(), ROT_MOVE_UP, ROT_MOVE_DOWN, ROT_MOVE_LEFT, ROT_MOVE_RIGHT,
* ROT_MOVE_CW
*/
#define ROT_MOVE_CCW ROT_MOVE_LEFT
/**
* \def ROT_MOVE_RIGHT
* \brief A macro that returns the flag for the \b RIGHT direction.
* \def ROT_MOVE_RIGHT
* \brief A macro that returns the flag for the \b RIGHT direction.
*
* This macro defines the value of the \b RIGHT direction which can be used
* with the rot_move() function.
* This macro defines the value of the \b RIGHT direction which can be used
* with the rot_move() function.
*
* \sa rot_move(), ROT_MOVE_UP, ROT_MOVE_DOWN, ROT_MOVE_LEFT, ROT_MOVE_CCW,
* ROT_MOVE_CW
* \sa rot_move(), ROT_MOVE_UP, ROT_MOVE_DOWN, ROT_MOVE_LEFT, ROT_MOVE_CCW,
* ROT_MOVE_CW
*/
#define ROT_MOVE_RIGHT (1<<4)
/**
* \def ROT_MOVE_CW
* \brief A macro that returns the flag for the \b clockwise direction.
* \def ROT_MOVE_CW
* \brief A macro that returns the flag for the \b clockwise direction.
*
* This macro defines the value of the \b clockwise direction wich can be
* used with the rot_move() function. This value is equivalent to
* ROT_MOVE_RIGHT .
* This macro defines the value of the \b clockwise direction which can be
* used with the rot_move() function. This value is equivalent to
* ROT_MOVE_RIGHT.
*
* \sa rot_move(), ROT_MOVE_UP, ROT_MOVE_DOWN, ROT_MOVE_LEFT, ROT_MOVE_CCW,
* ROT_MOVE_RIGHT
* \sa rot_move(), ROT_MOVE_UP, ROT_MOVE_DOWN, ROT_MOVE_LEFT, ROT_MOVE_CCW,
* ROT_MOVE_RIGHT
*/
#define ROT_MOVE_CW ROT_MOVE_RIGHT
/**
* \brief Rotator status flags
*/
typedef enum {
ROT_STATUS_NONE = 0, /*!< '' -- No status. */
ROT_STATUS_BUSY = (1 << 0), /*!< Rotator is busy, not accepting commands. */
ROT_STATUS_MOVING = (1 << 1), /*!< Rotator is currently moving (direction type not specified). */
ROT_STATUS_MOVING_AZ = (1 << 2), /*!< Azimuth rotator is currently moving (direction not specified). */
ROT_STATUS_MOVING_LEFT = (1 << 3), /*!< Azimuth rotator is currently moving left. */
ROT_STATUS_MOVING_RIGHT = (1 << 4), /*!< Azimuth rotator is currently moving right. */
ROT_STATUS_MOVING_EL = (1 << 5), /*!< Elevation rotator is currently moving (direction not specified). */
ROT_STATUS_MOVING_UP = (1 << 6), /*!< Elevation rotator is currently moving up. */
ROT_STATUS_MOVING_DOWN = (1 << 7), /*!< Elevation rotator is currently moving down. */
ROT_STATUS_LIMIT_UP = (1 << 8), /*!< The elevation rotator has reached its limit to move up. */
ROT_STATUS_LIMIT_DOWN = (1 << 9), /*!< The elevation rotator has reached its limit to move down.*/
ROT_STATUS_LIMIT_LEFT = (1 << 10), /*!< The azimuth rotator has reached its limit to move left (CCW). */
ROT_STATUS_LIMIT_RIGHT = (1 << 11), /*!< The azimuth rotator has reached its limit to move right (CW). */
ROT_STATUS_OVERLAP_UP = (1 << 12), /*!< The elevation rotator has rotated up past 360 degrees. */
ROT_STATUS_OVERLAP_DOWN = (1 << 13), /*!< The elevation rotator has rotated down past 0 degrees. */
ROT_STATUS_OVERLAP_LEFT = (1 << 14), /*!< The azimuth rotator has rotated left (CCW) past 0 degrees. */
ROT_STATUS_OVERLAP_RIGHT = (1 << 16), /*!< The azimuth rotator has rotated right (CW) past 360 degrees. */
} rot_status_t;
//! @cond Doxygen_Suppress
/* So far only used in tests/sprintflst.c. */
#define ROT_STATUS_N(n) (1u<<(n))
//! @endcond
/**
* \brief Macro for not changing the rotator speed with move() function.
*/
#define ROT_SPEED_NOCHANGE (-1)
/**
* \brief Rotator Level Settings.
*
* Various operating levels supported by a rotator.
*
* \c STRING used in the \c rotctl and \c rotctld utilities.
*
* \sa rot_parse_level(), rot_strlevel()
*/
enum rot_level_e {
ROT_LEVEL_NONE = 0, /*!< '' -- No Level. */
ROT_LEVEL_SPEED = (1 << 0), /*!< \c SPEED -- Rotation speed, arg int (default range 1-100 if not specified). */
ROT_LEVEL_63 = CONSTANT_64BIT_FLAG(63), /*!< **Future use**, last level. */
};
//! @cond Doxygen_Suppress
#define ROT_LEVEL_FLOAT_LIST (0)
#define ROT_LEVEL_READONLY_LIST (0)
#define ROT_LEVEL_IS_FLOAT(l) ((l)&ROT_LEVEL_FLOAT_LIST)
#define ROT_LEVEL_SET(l) ((l)&~ROT_LEVEL_READONLY_LIST)
//! @endcond
/** @cond Doxygen_Suppress
* FIXME: The following needs more explanation about how STRING relates
* to this macro.
* @endcond
*/
/**
* \brief Rotator Parameters
*
* Parameters are settings that are not related to core rotator functionality,
* i.e. antenna rotation.
*
* \c STRING used in the \c rotctl and \c rotctld utilities.
*
* \sa rot_parse_parm(), rot_strparm()
*/
enum rot_parm_e {
ROT_PARM_NONE = 0, /*!< '' -- No Parm */
};
//! @cond Doxygen_Suppress
#define ROT_PARM_FLOAT_LIST (0)
#define ROT_PARM_READONLY_LIST (0)
#define ROT_PARM_IS_FLOAT(l) ((l)&ROT_PARM_FLOAT_LIST)
#define ROT_PARM_SET(l) ((l)&~ROT_PARM_READONLY_LIST)
//! @endcond
/** @cond Doxygen_Suppress
* FIXME: The following needs more explanation about how STRING relates
* to these macros.
* @endcond
*/
/**
* \brief Rotator Function Settings.
*
* Various operating functions supported by a rotator.
*
* \c STRING used in the \c rotctl and \c rotctld utilities.
*
* \sa rot_parse_func(), rot_strfunc()
*/
#define ROT_FUNC_NONE 0 /*!< '' -- No Function */
#ifndef SWIGLUAHIDE
/* Hide the top 32 bits from the old Lua binding as they can't be represented */
#define ROT_FUNC_BIT63 CONSTANT_64BIT_FLAG (63) /*!< **Future use**, ROT_FUNC items. */
/* 63 is this highest bit number that can be used */
#endif
/* Basic rot type, can store some useful info about different rotators. Each
* lib must be able to populate this structure, so we can make useful
* enquiries about capablilities.
* enquiries about capabilities.
*/
/**
* Rotator Caps
* \struct rot_caps
* \brief Rotator data structure.
* \brief Rotator capability data structure.
*
* The main idea of this struct is that it will be defined by the backend
* rotator driver, and will remain readonly for the application. Fields that
* need to be modifiable by the application are copied into the struct
* rot_state, which is a kind of private of the ROT instance.
* The main idea of this structure is that it will be defined by the backend
* rotator driver, and will remain read-only for the application. Fields that
* need to be modifiable by the application are copied into the rot_state
* structure, which is the private memory area of the #ROT instance.
*
* This way, you can have several rigs running within the same application,
* sharing the struct rot_caps of the backend, while keeping their own
* customized data.
* This way, you can have several rotators running within the same
* application, sharing the rot_caps structure of the backend, while keeping
* their own customized data.
*
* n.b.: Don't move fields around, as the backends depend on it when
* initializing their caps.
* \b Note: Don't move fields around and only add new fields at the end of the
* rot_caps structure. Shared libraries and DLLs depend on a constant
* structure to maintain compatibility.
*/
struct rot_caps {
rot_model_t rot_model; /*!< Rotator model. */
const char *model_name; /*!< Model name. */
const char *mfg_name; /*!< Manufacturer. */
const char *version; /*!< Driver version. */
const char *copyright; /*!< Copyright info. */
rot_model_t rot_model; /*!< Rotator model as defined in rotlist.h. */
const char *model_name; /*!< Model name, e.g. TT-360. */
const char *mfg_name; /*!< Manufacturer, e.g. Tower Torquer. */
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 rot_type; /*!< Rotator type. */
enum rig_port_e port_type; /*!< Type of communication port. */
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. */
@ -237,7 +369,24 @@ struct rot_caps {
int write_delay; /*!< Write delay. */
int post_write_delay; /*!< Post-write delay. */
int timeout; /*!< Timeout. */
int retry; /*!< Number of retry if command fails. */
int retry; /*!< Number of retries if command fails. */
setting_t has_get_func; /*!< List of get functions. */
setting_t has_set_func; /*!< List of set functions. */
setting_t has_get_level; /*!< List of get levels. */
setting_t has_set_level; /*!< List of set levels. */
setting_t has_get_parm; /*!< List of get parameters. */
setting_t has_set_parm; /*!< List of set parameters. */
rot_status_t has_status; /*!< Supported status flags. */
gran_t level_gran[RIG_SETTING_MAX]; /*!< level granularity (i.e. steps). */
gran_t parm_gran[RIG_SETTING_MAX]; /*!< parm granularity (i.e. steps). */
const struct confparams *extparms; /*!< Extension parameters list, \sa rot_ext.c. */
const struct confparams *extlevels; /*!< Extension levels list, \sa rot_ext.c. */
const struct confparams *extfuncs; /*!< Extension functions list, \sa rot_ext.c. */
int *ext_tokens; /*!< Extension token list. */
/*
* Movement range, az is relative to North
@ -251,7 +400,7 @@ struct rot_caps {
max_el; /*!< Upper limit for elevation. */
const struct confparams *cfgparams; /*!< Configuration parametres. */
const struct confparams *cfgparams; /*!< Configuration parameters. */
const rig_ptr_t priv; /*!< Private data. */
/*
@ -259,44 +408,66 @@ struct rot_caps {
*
*/
int (*rot_init)(ROT *rot);
int (*rot_cleanup)(ROT *rot);
int (*rot_open)(ROT *rot);
int (*rot_close)(ROT *rot);
int (*rot_init)(ROT *rot); /*!< Pointer to backend implementation of ::rot_init(). */
int (*rot_cleanup)(ROT *rot); /*!< Pointer to backend implementation of ::rot_cleanup(). */
int (*rot_open)(ROT *rot); /*!< Pointer to backend implementation of ::rot_open(). */
int (*rot_close)(ROT *rot); /*!< Pointer to backend implementation of ::rot_close(). */
int (*set_conf)(ROT *rot, token_t token, const char *val);
int (*get_conf)(ROT *rot, token_t token, char *val);
int (*set_conf)(ROT *rot, token_t token, const char *val); /*!< Pointer to backend implementation of ::rot_set_conf(). */
int (*get_conf)(ROT *rot, token_t token, char *val); /*!< Pointer to backend implementation of ::rot_get_conf(). */
/*
* General API commands, from most primitive to least.. :()
* List Set/Get functions pairs
*/
int (*set_position)(ROT *rot, azimuth_t azimuth, elevation_t elevation);
int (*get_position)(ROT *rot, azimuth_t *azimuth, elevation_t *elevation);
int (*set_position)(ROT *rot, azimuth_t azimuth, elevation_t elevation); /*!< Pointer to backend implementation of ::rot_set_position(). */
int (*get_position)(ROT *rot, azimuth_t *azimuth, elevation_t *elevation); /*!< Pointer to backend implementation of ::rot_get_position(). */
int (*stop)(ROT *rot);
int (*park)(ROT *rot);
int (*reset)(ROT *rot, rot_reset_t reset);
int (*move)(ROT *rot, int direction, int speed);
int (*stop)(ROT *rot); /*!< Pointer to backend implementation of ::rot_stop(). */
int (*park)(ROT *rot); /*!< Pointer to backend implementation of ::rot_park(). */
int (*reset)(ROT *rot, rot_reset_t reset); /*!< Pointer to backend implementation of ::rot_reset(). */
int (*move)(ROT *rot, int direction, int speed); /*!< Pointer to backend implementation of ::rot_move(). */
/* get firmware info, etc. */
const char * (*get_info)(ROT *rot);
const char * (*get_info)(ROT *rot); /*!< Pointer to backend implementation of ::rot_get_info(). */
/* more to come... */
int (*set_level)(ROT *rot, setting_t level, value_t val); /*!< Pointer to backend implementation of ::rot_set_level(). */
int (*get_level)(ROT *rot, setting_t level, value_t *val); /*!< Pointer to backend implementation of ::rot_get_level(). */
int (*set_func)(ROT *rot, setting_t func, int status); /*!< Pointer to backend implementation of ::rot_set_func(). */
int (*get_func)(ROT *rot, setting_t func, int *status); /*!< Pointer to backend implementation of ::rot_get_func(). */
int (*set_parm)(ROT *rot, setting_t parm, value_t val); /*!< Pointer to backend implementation of ::rot_set_parm(). */
int (*get_parm)(ROT *rot, setting_t parm, value_t *val); /*!< Pointer to backend implementation of ::rot_get_parm(). */
int (*set_ext_level)(ROT *rot, token_t token, value_t val); /*!< Pointer to backend implementation of ::rot_set_ext_level(). */
int (*get_ext_level)(ROT *rot, token_t token, value_t *val); /*!< Pointer to backend implementation of ::rot_get_ext_level(). */
int (*set_ext_func)(ROT *rot, token_t token, int status); /*!< Pointer to backend implementation of ::rot_set_ext_func(). */
int (*get_ext_func)(ROT *rot, token_t token, int *status); /*!< Pointer to backend implementation of ::rot_get_ext_func(). */
int (*set_ext_parm)(ROT *rot, token_t token, value_t val); /*!< Pointer to backend implementation of ::rot_set_ext_parm(). */
int (*get_ext_parm)(ROT *rot, token_t token, value_t *val); /*!< Pointer to backend implementation of ::rot_get_ext_parm(). */
int (*get_status)(ROT *rot, rot_status_t *status); /*!< Pointer to backend implementation of ::rot_get_status(). */
const char *macro_name; /*!< Rotator model macro name. */
};
//! @cond Doxygen_Suppress
#define ROT_MODEL(arg) .rot_model=arg,.macro_name=#arg
//! @endcond
/**
* Rotator state
* \struct rot_state
* \brief Live data and customized fields.
* \brief Rotator state structure
*
* This struct contains live data, as well as a copy of capability fields
* that may be updated (ie. customized)
* This structure contains live data, as well as a copy of capability fields
* that may be updated, i.e. customized while the #ROT handle is instantiated.
*
* It is fine to move fields around, as this kind of struct should
* not be initialized like caps are.
* It is fine to move fields around, as this kind of structure should not be
* initialized like rot_caps are.
*/
struct rot_state {
/*
@ -306,38 +477,55 @@ struct rot_state {
azimuth_t max_az; /*!< Upper limit for azimuth (overridable). */
elevation_t min_el; /*!< Lower limit for elevation (overridable). */
elevation_t max_el; /*!< Upper limit for elevation (overridable). */
int south_zero; /*!< South is zero degrees. */
azimuth_t az_offset; /*!< Offset to be applied to azimuth. */
elevation_t el_offset; /*!< Offset to be applied to elevation. */
setting_t has_get_func; /*!< List of get functions. */
setting_t has_set_func; /*!< List of set functions. */
setting_t has_get_level; /*!< List of get levels. */
setting_t has_set_level; /*!< List of set levels. */
setting_t has_get_parm; /*!< List of get parameters. */
setting_t has_set_parm; /*!< List of set parameters. */
rot_status_t has_status; /*!< Supported status flags. */
gran_t level_gran[RIG_SETTING_MAX]; /*!< Level granularity. */
gran_t parm_gran[RIG_SETTING_MAX]; /*!< Parameter granularity. */
/*
* non overridable fields, internal use
*/
hamlib_port_t rotport; /*!< Rotator port (internal use). */
hamlib_port_t rotport2; /*!< 2nd Rotator port (internal use). */
int comm_state; /*!< Comm port state, opened/closed. */
int comm_state; /*!< Comm port state, i.e. opened or closed. */
rig_ptr_t priv; /*!< Pointer to private rotator state data. */
rig_ptr_t obj; /*!< Internal use by hamlib++ for event handling. */
int current_speed; /*!< Current speed 1-100, to be used when no change to speed is requested. */
/* etc... */
};
/**
* Rotator structure
* \struct rot
* \brief This is the master data structure,
* acting as a handle for the controlled rotator.
* \struct s_rot
* \brief Master rotator structure.
*
* This is the master data structure, acting as a handle for the controlled
* rotator. A pointer to this structure is returned by the rot_init() API
* function and is passed as a parameter to every rotator specific API call.
* This is the master data structure acting as the #ROT handle for the
* controlled rotator. A pointer to this structure is returned by the
* rot_init() API function and is passed as a parameter to every rotator
* specific API call.
*
* \sa rot_init(), rot_caps(), rot_state()
* \sa rot_init(), rot_caps, rot_state
*/
struct rot {
struct s_rot {
struct rot_caps *caps; /*!< Rotator caps. */
struct rot_state state; /*!< Rotator state. */
};
//! @cond Doxygen_Suppress
/* --------------- API function prototypes -----------------*/
extern HAMLIB_EXPORT(ROT *)
@ -389,9 +577,88 @@ rot_move HAMLIB_PARAMS((ROT *rot,
int direction,
int speed));
extern HAMLIB_EXPORT(setting_t)
rot_has_get_level HAMLIB_PARAMS((ROT *rot,
setting_t level));
extern HAMLIB_EXPORT(setting_t)
rot_has_set_level HAMLIB_PARAMS((ROT *rot,
setting_t level));
extern HAMLIB_EXPORT(setting_t)
rot_has_get_parm HAMLIB_PARAMS((ROT *rot,
setting_t parm));
extern HAMLIB_EXPORT(setting_t)
rot_has_set_parm HAMLIB_PARAMS((ROT *rot,
setting_t parm));
extern HAMLIB_EXPORT(setting_t)
rot_has_get_func HAMLIB_PARAMS((ROT *rot,
setting_t func));
extern HAMLIB_EXPORT(setting_t)
rot_has_set_func HAMLIB_PARAMS((ROT *rot,
setting_t func));
extern HAMLIB_EXPORT(int)
rot_set_func HAMLIB_PARAMS((ROT *rot,
setting_t func,
int status));
extern HAMLIB_EXPORT(int)
rot_get_func HAMLIB_PARAMS((ROT *rot,
setting_t func,
int *status));
extern HAMLIB_EXPORT(int)
rot_set_level HAMLIB_PARAMS((ROT *rig,
setting_t level,
value_t val));
extern HAMLIB_EXPORT(int)
rot_get_level HAMLIB_PARAMS((ROT *rig,
setting_t level,
value_t *val));
extern HAMLIB_EXPORT(int)
rot_set_parm HAMLIB_PARAMS((ROT *rig,
setting_t parm,
value_t val));
extern HAMLIB_EXPORT(int)
rot_get_parm HAMLIB_PARAMS((ROT *rig,
setting_t parm,
value_t *val));
extern HAMLIB_EXPORT(int)
rot_set_ext_level HAMLIB_PARAMS((ROT *rig,
token_t token,
value_t val));
extern HAMLIB_EXPORT(int)
rot_get_ext_level HAMLIB_PARAMS((ROT *rig,
token_t token,
value_t *val));
extern HAMLIB_EXPORT(int)
rot_set_ext_func HAMLIB_PARAMS((ROT *rig,
token_t token,
int status));
extern HAMLIB_EXPORT(int)
rot_get_ext_func HAMLIB_PARAMS((ROT *rig,
token_t token,
int *status));
extern HAMLIB_EXPORT(int)
rot_set_ext_parm HAMLIB_PARAMS((ROT *rig,
token_t token,
value_t val));
extern HAMLIB_EXPORT(int)
rot_get_ext_parm HAMLIB_PARAMS((ROT *rig,
token_t token,
value_t *val));
extern HAMLIB_EXPORT(const char *)
rot_get_info HAMLIB_PARAMS((ROT *rot));
extern HAMLIB_EXPORT(int)
rot_get_status HAMLIB_PARAMS((ROT *rot,
rot_status_t *status));
extern HAMLIB_EXPORT(int)
rot_register HAMLIB_PARAMS((const struct rot_caps *caps));
@ -429,6 +696,36 @@ extern HAMLIB_EXPORT(token_t)
rot_token_lookup HAMLIB_PARAMS((ROT *rot,
const char *name));
extern HAMLIB_EXPORT(int)
rot_ext_func_foreach HAMLIB_PARAMS((ROT *rot,
int (*cfunc)(ROT *,
const struct confparams *,
rig_ptr_t),
rig_ptr_t data));
extern HAMLIB_EXPORT(int)
rot_ext_level_foreach HAMLIB_PARAMS((ROT *rot,
int (*cfunc)(ROT *,
const struct confparams *,
rig_ptr_t),
rig_ptr_t data));
extern HAMLIB_EXPORT(int)
rot_ext_parm_foreach HAMLIB_PARAMS((ROT *rot,
int (*cfunc)(ROT *,
const struct confparams *,
rig_ptr_t),
rig_ptr_t data));
extern HAMLIB_EXPORT(const struct confparams *)
rot_ext_lookup HAMLIB_PARAMS((ROT *rot,
const char *name));
extern HAMLIB_EXPORT(const struct confparams *)
rot_ext_lookup_tok HAMLIB_PARAMS((ROT *rot,
token_t token));
extern HAMLIB_EXPORT(token_t)
rot_ext_token_lookup HAMLIB_PARAMS((ROT *rot,
const char *name));
extern HAMLIB_EXPORT(const struct rot_caps *)
rot_get_caps HAMLIB_PARAMS((rot_model_t rot_model));
@ -479,17 +776,25 @@ dec2dmmm HAMLIB_PARAMS((double dec,
extern HAMLIB_EXPORT(double)
dmmm2dec HAMLIB_PARAMS((int degrees,
double minutes,
double seconds,
int sw));
extern HAMLIB_EXPORT(setting_t) rot_parse_func(const char *s);
extern HAMLIB_EXPORT(setting_t) rot_parse_level(const char *s);
extern HAMLIB_EXPORT(setting_t) rot_parse_parm(const char *s);
extern HAMLIB_EXPORT(const char *) rot_strfunc(setting_t);
extern HAMLIB_EXPORT(const char *) rot_strlevel(setting_t);
extern HAMLIB_EXPORT(const char *) rot_strparm(setting_t);
extern HAMLIB_EXPORT(const char *) rot_strstatus(rot_status_t);
//! @endcond
/**
* \def rot_debug
* \brief Convenience definition for debug level.
* \def rot_debug
* \brief Convenience macro for generating debugging messages.
*
* This is just as convenience definition of the rotator debug level,
* and is the same as for the rig debug level.
*
* \sa rig_debug()
* This is an alias of the rig_debug() function call and is used in the same
* manner.
*/
#define rot_debug rig_debug

View File

@ -23,8 +23,10 @@
#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
/**
@ -33,123 +35,151 @@
*/
/**
* \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_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.
*/
/**
* \def ROT_MODEL_NETROTCTL
* \brief A macro that returns the model number for the Network backend.
* \brief A macro that returns the model number for the NETROTCTL backend.
*
* This backend allows use of the rotctld daemon through the normal
* Hamlib API.
* \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_EASYCOMM1
*
* The EASYCOMM1 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.
* \brief A macro that returns the model number of the EASYCOMM 2 backend.
*
* The EasyComm 2 backend can be used with rotators that support the
* EASYCOMM II Standard.
* \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_ROTOREZ
*
* 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_ROTORCARD
* \brief A macro that returns the model number of the Rotor Card backend.
* \brief A macro that returns the model number of the ROTORCARD backend.
*
* The Rotor-EZ backend can be used with Yaesu rotators that support the
* extended DCU command set by Idiom Press Rotor Card board.
* \def ROT_MODEL_ROTORCARD
*
* 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_DCU
* \brief A macro that returns the model number of the DCU 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 Hy-Gain (currently the DCU-1).
* \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).
*/
/**
* \def ROT_MODEL_ERC
* \brief A macro that returns the model number of the ERC backend.
* \brief A macro that returns the model number of the ERC backend.
*
* The Rotor-EZ backend can be used with rotators that support the DCU
* command set by DF9GR (currently the ERC).
* \def ROT_MODEL_ERC
*
* The ERC backend can be used with rotators that support the DCU command set
* by DF9GR (currently the ERC).
*/
/**
* \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 RT21 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_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)
@ -158,201 +188,446 @@
/**
* \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_GS232A
*
* The GS232A 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.
* \brief A macro that returns the model number of the GS232 backend.
*
* The GS-232 backend can be used with rotators that support the GS-232
* protocol.
* \def ROT_MODEL_GS232_GENERIC
*
* The GS232_GENERIC backend can be used with rotators that support the
* generic (even if not coded correctly) GS-232 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 GS232B backend.
*
* The GS-232B backend can be used with rotators that support the GS-232B
* protocol.
* \def ROT_MODEL_GS232B
*
* The GS232B backend can be used with rotators that support the GS232B
* protocol.
*/
/**
* \def ROT_MODEL_F1TETRACKER
* \brief A macro that returns the model number of the F1TETRACKER backend.
* \brief A macro that returns the model number of the F1TETRACKER backend.
*
* The F1TETRACKER backend can be used with rotators that support the
* F1TETRACKER protocol.
* \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_ROT2PROG
*
* The SPID_ROT2PROG backend can be used with rotators that support the SPID
* azimuth and elevation protocol.
*/
/**
* \def ROT_MODEL_SPID_ROT1PROG
* \brief A macro that returns the model number of the ROT1PROG backend.
* \brief A macro that returns the model number of the ROT1PROG backend.
*
* The SPID backend can be used with rotators that support the SPID protocol.
* \def ROT_MODEL_SPID_ROT1PROG
*
* The SPID_ROT1PROG backend can be used with rotators that support the SPID
* azimuth protocol.
*/
/**
* \def ROT_MODEL_SPID_MD01_ROT2PROG
* \brief A macro that returns the model number of the MD-01/02 (ROT2PROG protocol) backend.
* \brief A macro that returns the model number of the SPID_MD01_ROT2PROG backend.
*
* The SPID backend can be used with rotators that support the SPID protocol.
* \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_AZEL
*
* The RCI_AZEL backend can be used with rotators that support the ARS azimuth
* and elevation protocol.
*/
/**
* \def ROT_MODEL_RCI_AZ
* \brief A macro that returns the model number of the RCI_AZ backend.
* \brief A macro that returns the model number of the RCI_AZ backend.
*
* The ARS backend can be used with rotators that support the ARS protocol.
* \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;

View File

@ -4,7 +4,7 @@
- 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 -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.mingw32 -j' to compile a libliquid.dll 64bit 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.

BIN
external/msvc/x86/libgcc_s_dw2-1.dll vendored Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

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-2017 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,7 +46,21 @@
#ifndef __RTAUDIO_H
#define __RTAUDIO_H
#define RTAUDIO_VERSION "5.0.0"
#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>
@ -102,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
@ -179,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
@ -200,7 +216,7 @@ typedef int (*RtAudioCallback)( void *outputBuffer, void *inputBuffer,
*/
/************************************************************************/
class RtAudioError : public std::runtime_error
class RTAUDIO_DLL_PUBLIC RtAudioError : public std::runtime_error
{
public:
//! Defined RtAudioError types.
@ -210,12 +226,12 @@ class RtAudioError : public std::runtime_error
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.
@ -260,7 +276,7 @@ typedef void (*RtAudioErrorCallback)( RtAudioError::Type type, const std::string
class RtApi;
class RtAudio
class RTAUDIO_DLL_PUBLIC RtAudio
{
public:
@ -274,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.
@ -333,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
@ -366,14 +374,10 @@ 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.
@ -387,6 +391,29 @@ class RtAudio
*/
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.
/*!
The constructor performs minor initialization tasks. An exception
@ -487,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,
@ -576,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
@ -606,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), priority(0) {}
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{};
};
// **************************************************************** //
@ -645,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; }
@ -671,7 +698,7 @@ class S24 {
#include <sstream>
class RtApi
class RTAUDIO_DLL_PUBLIC RtApi
{
public:
@ -855,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 );
@ -879,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 );
};
@ -893,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:
@ -913,7 +938,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;
bool shouldAutoconnect_;
};
@ -928,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:
@ -951,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
@ -964,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:
@ -990,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
@ -1003,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_;
@ -1022,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 );
@ -1040,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:
@ -1061,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
@ -1072,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
@ -1106,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:
@ -1125,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
@ -1137,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-2017 (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.
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-2017 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

@ -6,35 +6,35 @@
#include <wx/msgdlg.h>
DeviceConfig::DeviceConfig() : deviceId("") {
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() {
@ -49,8 +49,8 @@ const std::string& DeviceConfig::getAntennaName() {
return antennaName;
}
void DeviceConfig::setAGCMode(bool agcMode) {
this->agcMode.store(agcMode);
void DeviceConfig::setAGCMode(bool agcMode_in) {
agcMode.store(agcMode_in);
}
bool DeviceConfig::getAGCMode() {
@ -58,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;
}
@ -74,18 +74,16 @@ 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;
}
@ -105,19 +103,19 @@ void DeviceConfig::save(DataNode *node) {
*node->newChild("antenna") = antennaName;
}
if (streamOpts.size()) {
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");
@ -125,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");
@ -157,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");
@ -178,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);
}
}
@ -190,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);
}
}
@ -201,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);
@ -215,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);
}
}
@ -236,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;
}
@ -248,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;
}
@ -268,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];
}
@ -299,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);
@ -334,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();
}
@ -393,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() {
@ -519,7 +517,7 @@ 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 'File' Menu."), wxT("Recording Path Error"), wxICON_INFORMATION);
wxMessageBox( wxT("Recording path is not set. Please use 'Set Recording Path' from the 'Recording' Menu."), wxT("Recording Path Error"), wxICON_INFORMATION);
return false;
}
@ -527,7 +525,7 @@ bool AppConfig::verifyRecordingPath() {
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 'File' Menu."), wxT("Recording Path Error"), wxICON_INFORMATION);
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;
}
@ -540,7 +538,7 @@ void AppConfig::setRecordingSquelchOption(int enumChoice) {
recordingSquelchOption = enumChoice;
}
int AppConfig::getRecordingSquelchOption() {
int AppConfig::getRecordingSquelchOption() const {
return recordingSquelchOption;
}
@ -548,13 +546,13 @@ void AppConfig::setRecordingFileTimeLimit(int nbSeconds) {
recordingFileTimeLimitSeconds = nbSeconds;
}
int AppConfig::getRecordingFileTimeLimit() {
int AppConfig::getRecordingFileTimeLimit() const {
return recordingFileTimeLimitSeconds;
}
void AppConfig::setConfigName(std::string configName) {
this->configName = configName;
void AppConfig::setConfigName(std::string configName_in) {
configName = configName_in;
}
std::string AppConfig::getConfigFileName(bool ignoreName) {
@ -590,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();
@ -620,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;
}
}
@ -689,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");
@ -708,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);
}
@ -759,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")) {
@ -850,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;
@ -868,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
@ -904,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,43 +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 setAntennaName(const std::string& name);
const std::string& getAntennaName();
void setAGCMode(bool agcMode);
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);
@ -70,10 +70,10 @@ private:
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;
@ -83,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();
@ -99,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);
@ -144,20 +152,20 @@ public:
bool verifyRecordingPath();
void setRecordingSquelchOption(int enumChoice);
int getRecordingSquelchOption();
int getRecordingSquelchOption() const;
void setRecordingFileTimeLimit(int nbSeconds);
int getRecordingFileTimeLimit();
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();
@ -175,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();
@ -184,24 +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::string recordingPath = "";
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"
@ -30,73 +31,6 @@
#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_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 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_ANTENNA_CURRENT 2500
#define wxID_ANTENNA_CURRENT_TX 2501
#define wxID_ANTENNAS_BASE 2502
#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
#ifdef USE_HAMLIB
class PortSelectorDialog;
@ -106,34 +40,21 @@ class PortSelectorDialog;
class AppFrame: public wxFrame {
public:
AppFrame();
~AppFrame();
~AppFrame() override;
wxMenu *makeFileMenu();
wxMenu *makeRecordingMenu();
void updateRecordingMenu();
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(DemodulatorInstancePtr demod, int snap);
void gkNudgeRight(DemodulatorInstancePtr demod, int snap);
int OnGlobalKeyDown(wxKeyEvent &event);
int OnGlobalKeyUp(wxKeyEvent &event);
void toggleActiveDemodRecording();
void toggleAllActiveDemodRecording();
void setWaterfallLinesPerSecond(int lps);
void setSpectrumAvgSpeed(double avg);
@ -159,139 +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);
void OnNewWindow(wxCommandEvent& event);
/**
* Session Management
*/
void saveSession(const std::string& fileName);
bool loadSession(const std::string& fileName);
/**
* Keyboard handlers
*/
void gkNudge(const DemodulatorInstancePtr& demod, int snap);
void toggleActiveDemodRecording();
void toggleAllActiveDemodRecording();
/**
* 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);
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 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);
wxString getSettingsLabel(const std::string& settingsName,
const std::string& settingsValue,
const std::string& settingsSuffix = "");
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;
//Use a raw pointer here to prevent a dangling reference
DemodulatorInstance* activeDemodulator;
/**
* 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();
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 *> antennaMenuItems;
//depending on context, maps the item id to wxMenuItem*,
//OR the submenu item id to its parent wxMenuItem*.
std::map<int, wxMenuItem *> settingsMenuItems;
std::map<int, wxMenuItem *> audioSampleRateMenuItems;
//
std::map<int, wxMenuItem *> recordingMenuItems;
std::map<int, wxMenuItem *> directSamplingMenuItems;
wxMenuBar *menuBar;
wxMenu *sampleRateMenu = nullptr;
wxMenu *displayMenu = nullptr;
wxMenuItem *agcMenuItem = nullptr;
wxMenuItem *iqSwapMenuItem = nullptr;
wxMenuItem *lowPerfMenuItem = nullptr;
wxMenu *fileMenu = nullptr;
wxMenu *settingsMenu = nullptr;
wxMenu *recordingMenu = nullptr;
SoapySDR::ArgInfoList settingArgs;
int settingsIdMax;
std::vector<long> sampleRates;
long manualSampleRate = -1;
std::vector<std::string> antennaNames;
std::string currentTXantennaName;
std::string currentSessionFile;
std::string currentBookmarkFile;
FFTVisualDataThread *waterfallDataThread;
std::thread *t_FFTData;
SDRDeviceInfo *devInfo;
std::atomic_bool deviceChanged;
ModemProperties *modemProps;
std::atomic_bool modemPropertiesUpdated;
wxMenuItem *showTipMenuItem;
bool lowPerfMode;
wxMenuItem *hideBookmarksItem;
bool saveDisabled;
AboutDialog *aboutDlg;
std::string lastToolTip;
/**
* 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;
@ -299,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

@ -4,7 +4,6 @@
#include "BookmarkMgr.h"
#include "CubicSDR.h"
#include "DataTree.h"
#include <wx/string.h>
#define BOOKMARK_RECENTS_MAX 25
@ -16,7 +15,7 @@ BookmarkMgr::BookmarkMgr() {
rangesSorted = false;
}
//
void BookmarkMgr::saveToFile(std::string bookmarkFn, bool backup, bool useFullpath) {
void BookmarkMgr::saveToFile(const std::string& bookmarkFn, bool backup, bool useFullpath) {
std::lock_guard < std::recursive_mutex > lock(busy_lock);
@ -33,7 +32,7 @@ void BookmarkMgr::saveToFile(std::string bookmarkFn, bool backup, bool useFullpa
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;
@ -69,7 +68,7 @@ void BookmarkMgr::saveToFile(std::string bookmarkFn, bool backup, bool useFullpa
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);
}
@ -98,7 +97,7 @@ void BookmarkMgr::saveToFile(std::string bookmarkFn, bool backup, bool useFullpa
}
}
bool BookmarkMgr::loadFromFile(std::string bookmarkFn, bool backup, bool useFullpath) {
bool BookmarkMgr::loadFromFile(const std::string& bookmarkFn, bool backup, bool useFullpath) {
std::lock_guard < std::recursive_mutex > lock(busy_lock);
@ -157,10 +156,10 @@ bool BookmarkMgr::loadFromFile(std::string bookmarkFn, bool backup, bool useFull
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")) {
@ -183,20 +182,20 @@ bool BookmarkMgr::loadFromFile(std::string bookmarkFn, bool backup, bool useFull
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);
if (be) {
addBookmark(groupName.c_str(), be);
addBookmark(groupName, be);
} else {
std::cout << "error loading bookmarked modem.." << std::endl;
loadStatusOk = false;
@ -227,7 +226,7 @@ bool BookmarkMgr::loadFromFile(std::string bookmarkFn, bool backup, bool useFull
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());
@ -241,16 +240,27 @@ bool BookmarkMgr::loadFromFile(std::string bookmarkFn, bool backup, bool useFull
void BookmarkMgr::loadDefaultRanges() {
addRange(std::make_shared<BookmarkRangeEntry>(L"160 Meters", 1900000, 1800000, 2000000));
addRange(std::make_shared<BookmarkRangeEntry>(L"80 Meters", 3750000, 3500000, 4000000));
addRange(std::make_shared<BookmarkRangeEntry>(L"60 Meters", 5368500, 5332000, 5405000));
addRange(std::make_shared<BookmarkRangeEntry>(L"40 Meters", 7150000, 7000000, 7300000));
addRange(std::make_shared<BookmarkRangeEntry>(L"30 Meters", 10125000, 10100000, 10150000));
addRange(std::make_shared<BookmarkRangeEntry>(L"20 Meters", 14175000, 14000000, 14350000));
addRange(std::make_shared<BookmarkRangeEntry>(L"17 Meters", 18068180, 17044180, 19092180));
addRange(std::make_shared<BookmarkRangeEntry>(L"15 Meters", 21225000, 21000000, 21450000));
addRange(std::make_shared<BookmarkRangeEntry>(L"12 Meters", 24940000, 24890000, 24990000));
addRange(std::make_shared<BookmarkRangeEntry>(L"10 Meters", 28850000, 28000000, 29700000));
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() {
@ -267,17 +277,17 @@ void BookmarkMgr::resetBookmarks() {
}
bool BookmarkMgr::hasLastLoad(std::string bookmarkFn) {
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, DemodulatorInstancePtr 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
@ -288,7 +298,7 @@ void BookmarkMgr::addBookmark(std::string group, DemodulatorInstancePtr 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);
@ -296,14 +306,14 @@ void BookmarkMgr::addBookmark(std::string group, BookmarkEntryPtr be) {
}
void BookmarkMgr::removeBookmark(std::string group, BookmarkEntryPtr be) {
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()) {
@ -311,22 +321,22 @@ void BookmarkMgr::removeBookmark(std::string group, BookmarkEntryPtr be) {
}
}
void BookmarkMgr::removeBookmark(BookmarkEntryPtr be) {
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) {
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;
@ -341,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()) {
@ -349,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()) {
@ -360,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);
@ -381,7 +391,7 @@ void BookmarkMgr::renameGroup(std::string group, std::string ngroup) {
}
}
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()) {
@ -389,7 +399,7 @@ BookmarkList BookmarkMgr::getBookmarks(std::string group) {
}
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;
}
@ -400,28 +410,28 @@ BookmarkList BookmarkMgr::getBookmarks(std::string group) {
void BookmarkMgr::getGroups(BookmarkNames &arr) {
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 > 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);
@ -454,7 +464,7 @@ void BookmarkMgr::updateBookmarks() {
}
}
void BookmarkMgr::updateBookmarks(std::string group) {
void BookmarkMgr::updateBookmarks(const std::string& group) {
BookmarkView *bmv = wxGetApp().getAppFrame()->getBookmarkView();
@ -464,7 +474,7 @@ void BookmarkMgr::updateBookmarks(std::string group) {
}
void BookmarkMgr::addRecent(DemodulatorInstancePtr demod) {
void BookmarkMgr::addRecent(const DemodulatorInstancePtr& demod) {
std::lock_guard < std::recursive_mutex > lock(busy_lock);
recents.push_back(demodToBookmarkEntry(demod));
@ -472,7 +482,7 @@ void BookmarkMgr::addRecent(DemodulatorInstancePtr 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);
@ -482,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);
@ -515,17 +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()) {
@ -538,7 +548,7 @@ 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;
}
@ -553,7 +563,7 @@ void BookmarkMgr::clearRanges() {
}
BookmarkEntryPtr BookmarkMgr::demodToBookmarkEntry(DemodulatorInstancePtr demod) {
BookmarkEntryPtr BookmarkMgr::demodToBookmarkEntry(const DemodulatorInstancePtr& demod) {
BookmarkEntryPtr be(new BookmarkEntry);
@ -570,6 +580,38 @@ BookmarkEntryPtr BookmarkMgr::demodToBookmarkEntry(DemodulatorInstancePtr demod)
return be;
}
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;
@ -582,7 +624,7 @@ BookmarkEntryPtr BookmarkMgr::nodeToBookmark(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();
@ -596,10 +638,10 @@ BookmarkEntryPtr BookmarkMgr::nodeToBookmark(DataNode *node) {
}
std::wstring BookmarkMgr::getBookmarkEntryDisplayName(BookmarkEntryPtr bmEnt) {
std::wstring BookmarkMgr::getBookmarkEntryDisplayName(const BookmarkEntryPtr& bmEnt) {
std::wstring dispName = bmEnt->label;
if (dispName == L"") {
if (dispName.empty()) {
std::string freqStr = frequencyToStr(bmEnt->frequency) + " " + bmEnt->type;
dispName = wxString(freqStr).ToStdWstring();
@ -608,10 +650,10 @@ std::wstring BookmarkMgr::getBookmarkEntryDisplayName(BookmarkEntryPtr bmEnt) {
return dispName;
}
std::wstring BookmarkMgr::getActiveDisplayName(DemodulatorInstancePtr demod) {
std::wstring BookmarkMgr::getActiveDisplayName(const DemodulatorInstancePtr& demod) {
std::wstring activeName = demod->getDemodulatorUserLabel();
if (activeName == L"") {
if (activeName.empty()) {
std::string wstr = frequencyToStr(demod->getFrequency()) + " " + demod->getDemodulatorType();
activeName = wxString(wstr).ToStdWstring();
@ -620,7 +662,7 @@ std::wstring BookmarkMgr::getActiveDisplayName(DemodulatorInstancePtr demod) {
return activeName;
}
void BookmarkMgr::removeActive(DemodulatorInstancePtr demod) {
void BookmarkMgr::removeActive(const DemodulatorInstancePtr& demod) {
if (demod == nullptr) {
return;

View File

@ -32,7 +32,7 @@ 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) {
@ -48,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;
@ -77,64 +60,69 @@ public:
BookmarkMgr();
//if useFullpath = false, use the application config dir.
//else assume bookmarkFn is a full path and use it for location.
void saveToFile(std::string bookmarkFn, bool backup = true, bool useFullpath = false);
bool loadFromFile(std::string bookmarkFn, bool backup = true, bool useFullpath = false);
void saveToFile(const std::string& bookmarkFn, bool backup = true, bool useFullpath = false);
bool loadFromFile(const std::string& bookmarkFn, bool backup = true, bool useFullpath = false);
void resetBookmarks();
bool hasLastLoad(std::string bookmarkFn);
bool hasBackup(std::string bookmarkFn);
bool hasLastLoad(const std::string& bookmarkFn);
bool hasBackup(const std::string& bookmarkFn);
void addBookmark(std::string group, DemodulatorInstancePtr 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);
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);
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(std::string group);
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(DemodulatorInstancePtr demod);
void addRecent(BookmarkEntryPtr be);
void removeRecent(BookmarkEntryPtr be);
void addRecent(const DemodulatorInstancePtr& demod);
void addRecent(const BookmarkEntryPtr& be);
void removeRecent(const BookmarkEntryPtr& be);
//return an independent copy on purpose
BookmarkList getRecents();
void clearRecents();
void removeActive(DemodulatorInstancePtr demod);
void removeActive(const DemodulatorInstancePtr& demod);
void addRange(BookmarkRangeEntryPtr re);
void removeRange(BookmarkRangeEntryPtr re);
void addRange(const BookmarkRangeEntryPtr& re);
void removeRange(const BookmarkRangeEntryPtr& re);
//return an independent copy on purpose
BookmarkRangeList getRanges();
void clearRanges();
static std::wstring getBookmarkEntryDisplayName(BookmarkEntryPtr bmEnt);
static std::wstring getActiveDisplayName(DemodulatorInstancePtr demod);
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(DemodulatorInstancePtr demod);
BookmarkEntryPtr demodToBookmarkEntry(const DemodulatorInstancePtr& demod);
BookmarkEntryPtr nodeToBookmark(DataNode *node);
BookmarkMap bmData;

View File

@ -81,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) {
@ -133,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;
}
@ -148,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);
}
@ -162,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();
@ -181,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);
@ -198,8 +198,22 @@ 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);
@ -211,11 +225,32 @@ CubicSDR::CubicSDR() : frequency(0), offset(0), ppm(0), snap(1), sampleRate(DEFA
m_glContextAttributes = new wxGLContextAttrs();
wxGLContextAttrs glSettings;
glSettings.PlatformDefaults().EndList();
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() {
//use the current locale most appropriate to this system,
@ -240,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)
@ -271,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);
@ -298,6 +334,8 @@ bool CubicSDR::OnInit() {
devicesFailed.store(false);
deviceSelectorOpen.store(false);
initAudioDevices();
// Visual Data
spectrumVisualThread = new SpectrumVisualDataThread();
@ -503,7 +541,7 @@ int CubicSDR::OnExit() {
PrimaryGLContext& CubicSDR::GetContext(wxGLCanvas *canvas) {
PrimaryGLContext *glContext;
if (!m_glContext) {
m_glContext = new PrimaryGLContext(canvas, NULL, GetContextAttributes());
m_glContext = new PrimaryGLContext(canvas, nullptr, GetContextAttributes());
}
glContext = m_glContext;
@ -521,14 +559,12 @@ void CubicSDR::OnInitCmdLine(wxCmdLineParser& parser) {
}
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")) {
@ -540,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 = "";
@ -566,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);
@ -659,6 +700,21 @@ 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() {
return frequency;
}
@ -710,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);
@ -826,12 +882,16 @@ 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() {
@ -852,7 +912,7 @@ long long CubicSDR::getSampleRate() {
return sampleRate;
}
void CubicSDR::removeDemodulator(DemodulatorInstancePtr demod) {
void CubicSDR::removeDemodulator(const DemodulatorInstancePtr& demod) {
if (!demod) {
return;
}
@ -889,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)");
@ -898,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;
@ -915,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() {
DemodulatorInstancePtr activeDemod = wxGetApp().getDemodMgr().getActiveDemodulator();
DemodulatorInstancePtr activeDemod = wxGetApp().getDemodMgr().getActiveContextModem();
if (activeDemod != nullptr) {
@ -944,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() {
@ -1004,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);
}
@ -1109,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"
@ -73,14 +75,14 @@ public:
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);
@ -95,6 +97,9 @@ public:
void setAntennaName(const std::string& name);
const std::string& getAntennaName();
void setChannelizerType(SDRPostThreadChannelizerType chType);
SDRPostThreadChannelizerType getChannelizerType();
void setSampleRate(long long rate_in);
@ -116,15 +121,16 @@ public:
DemodulatorMgr &getDemodMgr();
BookmarkMgr &getBookmarkMgr();
SessionMgr &getSessionMgr();
SDRPostThread *getSDRPostThread();
SDRThread *getSDRThread();
void notifyDemodulatorsChanged();
void removeDemodulator(DemodulatorInstancePtr demod);
void removeDemodulator(const DemodulatorInstancePtr& demod);
void setFrequencySnap(int snap);
void setFrequencySnap(int snap_in);
int getFrequencySnap();
AppConfig *getConfig();
@ -133,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();
@ -144,8 +150,8 @@ public:
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();
@ -155,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);
@ -180,7 +186,7 @@ public:
#endif
private:
int FilterEvent(wxEvent& event);
int FilterEvent(wxEvent& event) override;
AppFrame *appframe = nullptr;
AppConfig config;
@ -191,6 +197,7 @@ private:
DemodulatorMgr demodMgr;
BookmarkMgr bookmarkMgr;
SessionMgr sessionMgr;
std::atomic_llong frequency;
std::atomic_llong offset;
@ -245,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
@ -62,4 +70,4 @@ const char filePathSeparator =
//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
#define DEVICE_SAMPLE_RATES_MAX_NB 25

View File

@ -19,7 +19,7 @@ DemodLabelDialog::DemodLabelDialog(wxWindow * parent, wxWindowID id, const wxStr
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

@ -25,7 +25,6 @@ public:
private:
DemodulatorInstancePtr activeDemod = nullptr;
void OnEnter ( wxCommandEvent &event );
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,15 +13,15 @@ EVT_CHAR_HOOK(FrequencyDialog::OnChar)
EVT_SHOW(FrequencyDialog::OnShow)
wxEND_EVENT_TABLE()
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, 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) {
@ -29,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") {
@ -38,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());
}
@ -48,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 = 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);
@ -78,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:
@ -97,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);
@ -105,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) {
@ -143,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 {
@ -152,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;
}
@ -167,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;
}
@ -179,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);
@ -218,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
@ -240,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

@ -35,7 +35,6 @@ public:
private:
DemodulatorInstancePtr activeDemod;
void OnEnter ( wxCommandEvent &event );
void OnChar ( wxKeyEvent &event );
void OnShow(wxShowEvent &event);
FrequencyDialogTarget targetMode;

View File

@ -2,7 +2,6 @@
// SPDX-License-Identifier: GPL-2.0+
#include "IOThread.h"
#include <typeinfo>
#include <memory>
#define SPIN_WAIT_SLEEP_MS 5
@ -53,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 */, ThreadQueueBasePtr /* threadQueue */) {
};
}
void IOThread::onBindInput(std::string /* name */, ThreadQueueBasePtr /* threadQueue */) {
};
}
void IOThread::setInputQueue(std::string qname, ThreadQueueBasePtr 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);
};
}
ThreadQueueBasePtr 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, ThreadQueueBasePtr 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);
};
}
ThreadQueueBasePtr 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) {
@ -109,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;
}

View File

@ -15,8 +15,9 @@
#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
{
@ -36,11 +37,11 @@ public:
PtrType ptr;
int age;
virtual ~ReBufferAge() {};
virtual ~ReBufferAge() = default;;
};
#define REBUFFER_GC_LIMIT 100
#define REBUFFER_WARNING_THRESHOLD 150
#define REBUFFER_WARNING_THRESHOLD 2000
template<typename BufferType>
class ReBuffer {
@ -50,19 +51,17 @@ class ReBuffer {
public:
//Virtual destructor to assure correct freeing of all descendants.
virtual ~ReBuffer() {
//nothing
}
virtual ~ReBuffer() = default;
//constructor
ReBuffer(std::string bufferId) : bufferId(bufferId) {
explicit ReBuffer(std::string bufferId) : bufferId(bufferId) {
//nothing
}
/// Return a new ReBuffer_ptr usable by the application.
ReBufferPtr getBuffer() {
std::lock_guard < std::mutex > lock(m_mutex);
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.
@ -131,7 +130,7 @@ public:
/// Purge the cache.
void purge() {
std::lock_guard < std::mutex > lock(m_mutex);
std::lock_guard < SpinMutex > lock(m_mutex);
// since outputBuffers are full std::shared_ptr,
//purging if will effectively loose the local reference,
@ -152,7 +151,7 @@ private:
typedef typename std::deque< ReBufferAge < ReBufferPtr > >::iterator outputBuffersI;
//mutex protecting access to outputBuffers.
std::mutex m_mutex;
SpinMutex m_mutex;
};
@ -186,10 +185,10 @@ public:
virtual void onBindOutput(std::string name, ThreadQueueBasePtr threadQueue);
virtual void onBindInput(std::string name, ThreadQueueBasePtr threadQueue);
void setInputQueue(std::string qname, ThreadQueueBasePtr threadQueue);
ThreadQueueBasePtr getInputQueue(std::string qname);
void setOutputQueue(std::string qname, ThreadQueueBasePtr threadQueue);
ThreadQueueBasePtr 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, ThreadQueueBasePtr, map_string_less> input_queues;

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, DemodulatorInstancePtr 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, DemodulatorInstancePtr 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);

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);
};

View File

@ -5,13 +5,9 @@
#include "CubicSDR.h"
#include <sstream>
AudioFile::AudioFile() {
AudioFile::AudioFile() = default;
}
AudioFile::~AudioFile() {
}
AudioFile::~AudioFile() = default;
void AudioFile::setOutputFileName(std::string filename) {
filenameBase = filename;

View File

@ -22,7 +22,8 @@ namespace little_endian_io
template <typename Word>
std::istream& read_word(std::istream& ins, Word& value, unsigned size = sizeof(Word)) {
for (unsigned n = 0, value = 0; n < size; ++n) {
value = 0;
for (unsigned n = 0; n < size; ++n) {
value |= ins.get() << (8 * n);
}
return ins;
@ -50,11 +51,10 @@ namespace big_endian_io
using namespace little_endian_io;
AudioFileWAV::AudioFileWAV() : AudioFile() {
AudioFileWAV::AudioFileWAV() : AudioFile(), dataChunkPos(0) {
}
AudioFileWAV::~AudioFileWAV() {
}
AudioFileWAV::~AudioFileWAV() = default;
std::string AudioFileWAV::getExtension()
@ -119,7 +119,7 @@ bool AudioFileWAV::closeFile()
return true;
}
void AudioFileWAV::writeHeaderToFileStream(AudioThreadInputPtr input) {
void AudioFileWAV::writeHeaderToFileStream(const AudioThreadInputPtr& input) {
// Based on simple wav file output code from
// http://www.cplusplus.com/forum/beginner/166954/
@ -140,7 +140,7 @@ void AudioFileWAV::writeHeaderToFileStream(AudioThreadInputPtr input) {
outputFileStream << "data----"; // (chunk size to be filled in later)
}
void AudioFileWAV::writePayloadToFileStream(AudioThreadInputPtr input, size_t startInputPosition, size_t endInputPosition) {
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);
@ -164,7 +164,7 @@ void AudioFileWAV::writePayloadToFileStream(AudioThreadInputPtr input, size_t st
}
}
size_t AudioFileWAV::getMaxWritableNumberOfSamples(AudioThreadInputPtr input) {
size_t AudioFileWAV::getMaxWritableNumberOfSamples(const AudioThreadInputPtr& input) const {
long long remainingBytesInFile = (long long)(MAX_WAV_FILE_SIZE) - currentFileSize;

View File

@ -11,19 +11,19 @@ class AudioFileWAV : public AudioFile {
public:
AudioFileWAV();
~AudioFileWAV();
~AudioFileWAV() override;
//override to manage name change with multi-part WAV.
virtual void setOutputFileName(std::string filename);
void setOutputFileName(std::string filename) override;
//override of the base method to generate multi-part
//WAV to overcome the WAV format size limit.
virtual std::string getOutputFileName();
std::string getOutputFileName() override;
virtual std::string getExtension();
std::string getExtension() override;
virtual bool writeToFile(AudioThreadInputPtr input);
virtual bool closeFile();
bool writeToFile(AudioThreadInputPtr input) override;
bool closeFile() override;
protected:
std::ofstream outputFileStream;
@ -33,10 +33,10 @@ protected:
private:
size_t getMaxWritableNumberOfSamples(AudioThreadInputPtr input);
size_t getMaxWritableNumberOfSamples(const AudioThreadInputPtr& input) const;
void writeHeaderToFileStream(AudioThreadInputPtr input);
void writeHeaderToFileStream(const AudioThreadInputPtr& input);
//write [startInputPosition; endInputPosition[ samples from input into the file.
void writePayloadToFileStream(AudioThreadInputPtr input, size_t startInputPosition, size_t endInputPosition);
void writePayloadToFileStream(const AudioThreadInputPtr& input, size_t startInputPosition, size_t endInputPosition);
};

View File

@ -75,7 +75,7 @@ void AudioSinkFileThread::sink(AudioThreadInputPtr input) {
audioFileHandler->writeToFile(input);
}
void AudioSinkFileThread::inputChanged(AudioThreadInput oldProps, AudioThreadInputPtr newProps) {
void AudioSinkFileThread::inputChanged(AudioThreadInput /* oldProps */, AudioThreadInputPtr /* newProps */) {
// close, set new parameters, adjust file name sequence and re-open?
if (!audioFileHandler) {
return;

View File

@ -11,7 +11,7 @@ class AudioSinkFileThread : public AudioSinkThread {
public:
AudioSinkFileThread();
~AudioSinkFileThread();
~AudioSinkFileThread() override;
enum SquelchOption {
SQUELCH_RECORD_SILENCE = 0, // default value, record as a user would hear it.
@ -20,8 +20,8 @@ public:
SQUELCH_RECORD_MAX
};
virtual void sink(AudioThreadInputPtr input);
virtual void inputChanged(AudioThreadInput oldProps, AudioThreadInputPtr newProps);
void sink(AudioThreadInputPtr input) override;
void inputChanged(AudioThreadInput oldProps, AudioThreadInputPtr newProps) override;
void setAudioFileHandler(AudioFile *output);

View File

@ -11,9 +11,7 @@ AudioSinkThread::AudioSinkThread() {
setInputQueue("input", inputQueuePtr);
}
AudioSinkThread::~AudioSinkThread() {
}
AudioSinkThread::~AudioSinkThread() = default;
void AudioSinkThread::run() {
#ifdef __APPLE__

View File

@ -10,10 +10,10 @@ class AudioSinkThread : public IOThread {
public:
AudioSinkThread();
virtual ~AudioSinkThread();
~AudioSinkThread() override;
virtual void run();
virtual void terminate();
void run() override;
void terminate() override;
virtual void sink(AudioThreadInputPtr input) = 0;
virtual void inputChanged(AudioThreadInput oldProps, AudioThreadInputPtr newProps) = 0;

View File

@ -2,13 +2,10 @@
// 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
@ -80,9 +77,9 @@ void AudioThread::deviceCleanup() {
//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.begin(); i != deviceController.end(); i++) {
for (auto & i : deviceController) {
delete i->second;
delete i.second;
}
deviceController.clear();
@ -98,7 +95,7 @@ static int audioCallback(void *outputBuffer, void * /* inputBuffer */, unsigned
::memset(out, 0, nBufferFrames * 2 * sizeof(float));
//src in the controller thread:
AudioThread *src = (AudioThread *)userData;
auto *src = (AudioThread *)userData;
//by construction, src is a controller thread, from deviceController:
std::lock_guard<std::recursive_mutex> lock(src->getMutex());
@ -157,7 +154,7 @@ 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) {
@ -195,7 +192,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()) {
float v = srcmix->currentInput->data[srcmix->audioQueuePtr] * srcmix->gain;
out[i * 2] += v;
out[i * 2 + 1] += v;
@ -204,7 +201,7 @@ static int audioCallback(void *outputBuffer, void * /* inputBuffer */, unsigned
}
}
else {
for (int i = 0, iMax = srcmix->currentInput->channels * nBufferFrames; i < iMax; i++) {
for (unsigned int i = 0, iMax = srcmix->currentInput->channels * nBufferFrames; i < iMax; i++) {
if (srcmix->audioQueuePtr >= srcmix->currentInput->data.size()) {
srcmix->audioQueuePtr = 0;
@ -222,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;
}
@ -248,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);
@ -315,14 +312,14 @@ void AudioThread::setDeviceSampleRate(int deviceId, int sampleRate) {
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 !
matchingControllerThread->getCommandQueue()->push(refreshDevice);
}
}
void AudioThread::setSampleRate(int sampleRate) {
void AudioThread::setSampleRate(int sampleRate_in) {
bool thisIsAController = false;
@ -332,7 +329,7 @@ void AudioThread::setSampleRate(int sampleRate) {
if (deviceController[outputDevice.load()] == this) {
thisIsAController = true;
deviceSampleRate[outputDevice.load()] = sampleRate;
deviceSampleRate[outputDevice.load()] = sampleRate_in;
}
}
@ -344,31 +341,30 @@ void AudioThread::setSampleRate(int sampleRate) {
dac.closeStream();
//Set bounded sample rate:
for (size_t j = 0; j < boundThreads.size(); j++) {
AudioThread *srcmix = boundThreads[j];
srcmix->setSampleRate(sampleRate);
for (auto srcmix : boundThreads) {
srcmix->setSampleRate(sampleRate_in);
}
//make a local copy, snapshot of the list of demodulators
std::vector<DemodulatorInstancePtr> demodulators = wxGetApp().getDemodMgr().getDemodulators();
for (auto demod : demodulators) {
for (const auto& demod : demodulators) {
if (demod->getOutputDevice() == outputDevice.load()) {
demod->setAudioSampleRate(sampleRate);
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) {
@ -411,7 +407,7 @@ void AudioThread::setupDevice(int deviceId) {
if (deviceController.find(parameters.deviceId) == deviceController.end()) {
//Create a new controller thread for parameters.deviceId:
AudioThread* newController = new AudioThread();
auto* newController = new AudioThread();
newController->setInitOutputDevice(parameters.deviceId, sampleRate);
newController->bindThread(this);
@ -422,7 +418,7 @@ void AudioThread::setupDevice(int 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 {
@ -455,21 +451,21 @@ int AudioThread::getOutputDevice() {
return outputDevice;
}
void AudioThread::setInitOutputDevice(int deviceId, int sampleRate) {
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;
deviceSampleRate[deviceId] = sampleRate_in;
}
this->sampleRate = sampleRate;
sampleRate = sampleRate_in;
}
void AudioThread::run() {
@ -501,10 +497,10 @@ void AudioThread::run() {
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);
}
} //end while
@ -517,20 +513,20 @@ void AudioThread::run() {
//Nullify currentInput...
currentInput = nullptr;
//Stop : Retreive the matching controling thread in a scope lock:
AudioThread* controllerThread = nullptr;
//Stop : Retrieve the matching controlling thread in a scope lock:
AudioThread* controllerMatchingThread;
{
std::lock_guard<std::recursive_mutex> global_lock(m_device_mutex);
controllerThread = deviceController[parameters.deviceId];
controllerMatchingThread = deviceController[parameters.deviceId];
}
if (controllerThread != this) {
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(controllerThread->getMutex());
std::lock_guard<std::recursive_mutex> lock(controllerMatchingThread->getMutex());
controllerThread->removeThread(this);
controllerMatchingThread->removeThread(this);
}
else {
// 'this' is a controller thread:

View File

@ -15,13 +15,13 @@
class AudioThreadInput {
public:
long long frequency;
int inputRate;
int sampleRate;
int channels;
float peak;
int type;
bool is_squelch_active;
long long frequency{};
int inputRate{};
int sampleRate{};
int channels{};
float peak{};
int type{};
bool is_squelch_active{};
std::vector<float> data;
@ -31,7 +31,7 @@ public:
}
AudioThreadInput(AudioThreadInput *copyFrom) {
explicit AudioThreadInput(AudioThreadInput *copyFrom) {
copy(copyFrom);
}
@ -47,9 +47,7 @@ public:
}
virtual ~AudioThreadInput() {
}
virtual ~AudioThreadInput() = default;
};
typedef std::shared_ptr<AudioThreadInput> AudioThreadInputPtr;
@ -60,15 +58,15 @@ typedef std::shared_ptr<DemodulatorThreadOutputQueue> DemodulatorThreadOutputQue
class AudioThreadCommand {
public:
enum AudioThreadCommandEnum {
enum class Type {
AUDIO_THREAD_CMD_NULL, AUDIO_THREAD_CMD_SET_DEVICE, AUDIO_THREAD_CMD_SET_SAMPLE_RATE
};
AudioThreadCommand() :
cmd(AUDIO_THREAD_CMD_NULL), int_value(0) {
cmdType(AudioThreadCommand::Type::AUDIO_THREAD_CMD_NULL), int_value(0) {
}
AudioThreadCommandEnum cmd;
AudioThreadCommand::Type cmdType;
int int_value;
};
@ -83,17 +81,17 @@ class AudioThread : public IOThread {
public:
AudioThread();
virtual ~AudioThread();
~AudioThread() override;
static void enumerateDevices(std::vector<RtAudio::DeviceInfo> &devs);
void setInitOutputDevice(int deviceId, int sampleRate = -1);
void setInitOutputDevice(int deviceId, int sampleRate_in = -1);
int getOutputDevice();
int getSampleRate();
virtual void run();
virtual void terminate();
void run() override;
void terminate() override;
bool isActive();
void setActive(bool state);
@ -141,7 +139,7 @@ private:
std::recursive_mutex m_mutex;
void setupDevice(int deviceId);
void setSampleRate(int sampleRate);
void setSampleRate(int sampleRate_in);
void bindThread(AudioThread *other);
void removeThread(AudioThread *other);

View File

@ -15,20 +15,6 @@
class DemodulatorThread;
class DemodulatorThreadControlCommand {
public:
enum DemodulatorThreadControlCommandEnum {
DEMOD_THREAD_CMD_CTL_NULL, DEMOD_THREAD_CMD_CTL_SQUELCH_ON, DEMOD_THREAD_CMD_CTL_SQUELCH_OFF, DEMOD_THREAD_CMD_CTL_TYPE
};
DemodulatorThreadControlCommand() :
cmd(DEMOD_THREAD_CMD_CTL_NULL), demodType("") {
}
DemodulatorThreadControlCommandEnum cmd;
std::string demodType;
};
class DemodulatorThreadIQData {
public:
long long frequency;
@ -48,9 +34,7 @@ public:
return *this;
}
virtual ~DemodulatorThreadIQData() {
}
virtual ~DemodulatorThreadIQData() = default;
};
class Modem;
@ -71,41 +55,14 @@ public:
}
virtual ~DemodulatorThreadPostIQData() {
}
virtual ~DemodulatorThreadPostIQData() = default;
};
class DemodulatorThreadAudioData {
public:
long long frequency;
unsigned int sampleRate;
unsigned char channels;
std::vector<float> *data;
DemodulatorThreadAudioData() :
frequency(0), sampleRate(0), channels(0), data(NULL) {
}
DemodulatorThreadAudioData(long long frequency, unsigned int sampleRate, std::vector<float> *data) :
frequency(frequency), sampleRate(sampleRate), channels(1), data(data) {
}
virtual ~DemodulatorThreadAudioData() {
}
};
typedef std::shared_ptr<DemodulatorThreadIQData> DemodulatorThreadIQDataPtr;
typedef std::shared_ptr<DemodulatorThreadPostIQData> DemodulatorThreadPostIQDataPtr;
typedef ThreadBlockingQueue<DemodulatorThreadIQDataPtr> DemodulatorThreadInputQueue;
typedef ThreadBlockingQueue<DemodulatorThreadPostIQDataPtr> DemodulatorThreadPostInputQueue;
typedef ThreadBlockingQueue<DemodulatorThreadControlCommand> DemodulatorThreadControlCommandQueue;
typedef std::shared_ptr<DemodulatorThreadInputQueue> DemodulatorThreadInputQueuePtr;
typedef std::shared_ptr<DemodulatorThreadPostInputQueue> DemodulatorThreadPostInputQueuePtr;
typedef std::shared_ptr<DemodulatorThreadControlCommandQueue> DemodulatorThreadControlCommandQueuePtr;

View File

@ -20,9 +20,7 @@ DemodVisualCue::DemodVisualCue() {
squelchBreak.store(false);
}
DemodVisualCue::~DemodVisualCue() {
}
DemodVisualCue::~DemodVisualCue() = default;
void DemodVisualCue::triggerSquelchBreak(int counter) {
squelchBreak.store(counter);
@ -48,7 +46,6 @@ DemodulatorInstance::DemodulatorInstance() {
#endif
active.store(false);
squelch.store(false);
muted.store(false);
recording.store(false);
deltaLock.store(false);
@ -64,7 +61,7 @@ DemodulatorInstance::DemodulatorInstance() {
pipeIQInputData = std::make_shared<DemodulatorThreadInputQueue>();
pipeIQInputData->set_max_num_items(100);
pipeIQDemodData = std::make_shared< DemodulatorThreadPostInputQueue>();
pipeIQInputData->set_max_num_items(100);
pipeIQDemodData->set_max_num_items(100);
audioThread = new AudioThread();
@ -73,14 +70,10 @@ DemodulatorInstance::DemodulatorInstance() {
demodulatorPreThread->setOutputQueue("IQDataOutput",pipeIQDemodData);
pipeAudioData = std::make_shared<AudioThreadInputQueue>();
pipeAudioData->set_max_num_items(10);
threadQueueControl = std::make_shared<DemodulatorThreadControlCommandQueue>();
threadQueueControl->set_max_num_items(2);
pipeAudioData->set_max_num_items(100);
demodulatorThread = new DemodulatorThread(this);
demodulatorThread->setInputQueue("IQDataInput",pipeIQDemodData);
demodulatorThread->setInputQueue("ControlQueue",threadQueueControl);
demodulatorThread->setOutputQueue("AudioDataOutput", pipeAudioData);
audioThread->setInputQueue("AudioDataInput", pipeAudioData);
@ -121,7 +114,7 @@ DemodulatorInstance::~DemodulatorInstance() {
} //end while
}
void DemodulatorInstance::setVisualOutputQueue(DemodulatorThreadOutputQueuePtr tQueue) {
void DemodulatorInstance::setVisualOutputQueue(const DemodulatorThreadOutputQueuePtr& tQueue) {
demodulatorThread->setOutputQueue("AudioVisualOutput", tQueue);
}
@ -194,7 +187,6 @@ void DemodulatorInstance::terminate() {
pipeIQInputData->flush();
pipeAudioData->flush();
pipeIQDemodData->flush();
threadQueueControl->flush();
}
std::string DemodulatorInstance::getLabel() {
@ -307,30 +299,15 @@ void DemodulatorInstance::setActive(bool state) {
}
void DemodulatorInstance::squelchAuto() {
DemodulatorThreadControlCommand command;
command.cmd = DemodulatorThreadControlCommand::DEMOD_THREAD_CMD_CTL_SQUELCH_ON;
//VSO: blocking push
threadQueueControl->push(command);
squelch = true;
demodulatorThread->setSquelchEnabled(true);
}
bool DemodulatorInstance::isSquelchEnabled() {
return (demodulatorThread->getSquelchLevel() != 0.0);
return demodulatorThread->isSquelchEnabled();
}
void DemodulatorInstance::setSquelchEnabled(bool state) {
if (!state && squelch) {
DemodulatorThreadControlCommand command;
command.cmd = DemodulatorThreadControlCommand::DEMOD_THREAD_CMD_CTL_SQUELCH_OFF;
threadQueueControl->push(command);
} else if (state && !squelch) {
DemodulatorThreadControlCommand command;
command.cmd = DemodulatorThreadControlCommand::DEMOD_THREAD_CMD_CTL_SQUELCH_ON;
//VSO: blocking push!
threadQueueControl->push(command);
}
squelch = state;
demodulatorThread->setSquelchEnabled(state);
}
float DemodulatorInstance::getSignalLevel() {
@ -360,7 +337,7 @@ void DemodulatorInstance::setOutputDevice(int device_id) {
audioThread->setInitOutputDevice(device_id);
} else if (audioThread) {
AudioThreadCommand command;
command.cmd = AudioThreadCommand::AUDIO_THREAD_CMD_SET_DEVICE;
command.cmdType = AudioThreadCommand::Type::AUDIO_THREAD_CMD_SET_DEVICE;
command.int_value = device_id;
//VSO: blocking push
audioThread->getCommandQueue()->push(command);
@ -379,11 +356,11 @@ int DemodulatorInstance::getOutputDevice() {
return currentOutputDevice;
}
void DemodulatorInstance::setDemodulatorType(std::string demod_type_in) {
void DemodulatorInstance::setDemodulatorType(const std::string& demod_type_in) {
setGain(getGain());
if (demodulatorPreThread) {
std::string currentDemodType = demodulatorPreThread->getDemodType();
if ((currentDemodType != "") && (currentDemodType != demod_type_in)) {
if ((!currentDemodType.empty()) && (currentDemodType != demod_type_in)) {
lastModemSettings[currentDemodType] = demodulatorPreThread->readModemSettings();
lastModemBandwidth[currentDemodType] = demodulatorPreThread->getBandwidth();
}
@ -395,7 +372,7 @@ void DemodulatorInstance::setDemodulatorType(std::string demod_type_in) {
demodulatorPreThread->setDemodType(demod_type_in);
int lastbw = 0;
if (currentDemodType != "" && lastModemBandwidth.find(demod_type_in) != lastModemBandwidth.end()) {
if (!currentDemodType.empty() && lastModemBandwidth.find(demod_type_in) != lastModemBandwidth.end()) {
lastbw = lastModemBandwidth[demod_type_in];
}
if (!lastbw) {
@ -407,7 +384,7 @@ void DemodulatorInstance::setDemodulatorType(std::string demod_type_in) {
#if ENABLE_DIGITAL_LAB
if (isModemInitialized() && getModemType() == "digital") {
ModemDigitalOutputConsole *outp = (ModemDigitalOutputConsole *)getOutput();
auto *outp = (ModemDigitalOutputConsole *)getOutput();
outp->setTitle(getDemodulatorType() + ": " + frequencyToStr(getFrequency()));
}
#endif
@ -463,13 +440,14 @@ void DemodulatorInstance::setFrequency(long long freq) {
#if ENABLE_DIGITAL_LAB
if (activeOutput) {
if (isModemInitialized() && getModemType() == "digital") {
ModemDigitalOutputConsole *outp = (ModemDigitalOutputConsole *)getOutput();
auto *outp = (ModemDigitalOutputConsole *)getOutput();
outp->setTitle(getDemodulatorType() + ": " + frequencyToStr(getFrequency()));
}
}
#endif
#if USE_HAMLIB
if (wxGetApp().rigIsActive() && wxGetApp().getRigThread()->getFollowModem() && wxGetApp().getDemodMgr().getLastActiveDemodulator().get() == this) {
if (wxGetApp().rigIsActive() && wxGetApp().getRigThread()->getFollowModem() &&
wxGetApp().getDemodMgr().getCurrentModem().get() == this) {
wxGetApp().getRigThread()->setFrequency(freq,true);
}
#endif
@ -484,10 +462,10 @@ long long DemodulatorInstance::getFrequency() {
}
void DemodulatorInstance::setAudioSampleRate(int sampleRate) {
demodulatorPreThread->setSampleRate(sampleRate);
demodulatorPreThread->setAudioSampleRate(sampleRate);
}
int DemodulatorInstance::getAudioSampleRate() {
int DemodulatorInstance::getAudioSampleRate() const {
if (!audioThread) {
return 0;
}
@ -508,16 +486,16 @@ bool DemodulatorInstance::isFollow() {
return follow.load();
}
void DemodulatorInstance::setFollow(bool follow) {
this->follow.store(follow);
void DemodulatorInstance::setFollow(bool follow_in) {
follow.store(follow_in);
}
bool DemodulatorInstance::isTracking() {
return tracking.load();
}
void DemodulatorInstance::setTracking(bool tracking) {
this->tracking.store(tracking);
void DemodulatorInstance::setTracking(bool tracking_in) {
tracking.store(tracking_in);
}
bool DemodulatorInstance::isDeltaLock() {
@ -540,10 +518,10 @@ bool DemodulatorInstance::isMuted() {
return demodulatorThread->isMuted();
}
void DemodulatorInstance::setMuted(bool muted) {
this->muted = muted;
demodulatorThread->setMuted(muted);
wxGetApp().getDemodMgr().setLastMuted(muted);
void DemodulatorInstance::setMuted(bool muted_in) {
muted = muted_in;
demodulatorThread->setMuted(muted_in);
wxGetApp().getDemodMgr().setLastMuted(muted_in);
}
bool DemodulatorInstance::isRecording()
@ -579,11 +557,11 @@ ModemArgInfoList DemodulatorInstance::getModemArgs() {
return args;
}
std::string DemodulatorInstance::readModemSetting(std::string setting) {
std::string DemodulatorInstance::readModemSetting(const std::string& setting) {
return demodulatorPreThread->readModemSetting(setting);
}
void DemodulatorInstance::writeModemSetting(std::string setting, std::string value) {
void DemodulatorInstance::writeModemSetting(const std::string& setting, std::string value) {
demodulatorPreThread->writeModemSetting(setting, value);
}
@ -609,7 +587,7 @@ std::string DemodulatorInstance::getModemType() {
return "";
}
ModemSettings DemodulatorInstance::getLastModemSettings(std::string demodType) {
ModemSettings DemodulatorInstance::getLastModemSettings(const std::string& demodType) {
if (lastModemSettings.find(demodType) != lastModemSettings.end()) {
return lastModemSettings[demodType];
} else {
@ -624,8 +602,8 @@ void DemodulatorInstance::startRecording() {
return;
}
AudioSinkFileThread *newSinkThread = new AudioSinkFileThread();
AudioFileWAV *afHandler = new AudioFileWAV();
auto *newSinkThread = new AudioSinkFileThread();
auto *afHandler = new AudioFileWAV();
std::stringstream fileName;
@ -700,7 +678,7 @@ void DemodulatorInstance::hideOutput() {
void DemodulatorInstance::closeOutput() {
if (isModemInitialized()) {
if (getModemType() == "digital") {
ModemDigital *dModem = (ModemDigital *)demodulatorPreThread->getModem();
auto *dModem = (ModemDigital *)demodulatorPreThread->getModem();
dModem->setOutput(nullptr);
}
}

View File

@ -50,7 +50,7 @@ public:
DemodulatorInstance();
~DemodulatorInstance();
void setVisualOutputQueue(DemodulatorThreadOutputQueuePtr tQueue);
void setVisualOutputQueue(const DemodulatorThreadOutputQueuePtr& tQueue);
void run();
void terminate();
@ -76,7 +76,7 @@ public:
void setOutputDevice(int device_id);
int getOutputDevice();
void setDemodulatorType(std::string demod_type_in);
void setDemodulatorType(const std::string& demod_type_in);
std::string getDemodulatorType();
std::wstring getDemodulatorUserLabel();
@ -95,13 +95,13 @@ public:
long long getFrequency();
void setAudioSampleRate(int sampleRate);
int getAudioSampleRate();
int getAudioSampleRate() const;
bool isFollow();
void setFollow(bool follow);
void setFollow(bool follow_in);
bool isTracking();
void setTracking(bool tracking);
void setTracking(bool tracking_in);
bool isDeltaLock();
void setDeltaLock(bool lock);
@ -109,7 +109,7 @@ public:
int getDeltaLockOfs();
bool isMuted();
void setMuted(bool muted);
void setMuted(bool muted_in);
bool isRecording();
void setRecording(bool recording);
@ -119,14 +119,14 @@ public:
DemodulatorThreadInputQueuePtr getIQInputDataPipe();
ModemArgInfoList getModemArgs();
std::string readModemSetting(std::string setting);
std::string readModemSetting(const std::string& setting);
ModemSettings readModemSettings();
void writeModemSetting(std::string setting, std::string value);
void writeModemSetting(const std::string& setting, std::string value);
void writeModemSettings(ModemSettings settings);
bool isModemInitialized();
std::string getModemType();
ModemSettings getLastModemSettings(std::string demodType);
ModemSettings getLastModemSettings(const std::string& demodType);
#if ENABLE_DIGITAL_LAB
ModemDigitalOutput *getOutput();
@ -145,7 +145,6 @@ private:
AudioThreadInputQueuePtr pipeAudioData;
DemodulatorPreThread *demodulatorPreThread;
DemodulatorThread *demodulatorThread;
DemodulatorThreadControlCommandQueuePtr threadQueueControl;
AudioSinkThread *audioSinkThread = nullptr;
std::thread *t_AudioSink = nullptr;
@ -159,7 +158,6 @@ private:
std::atomic<std::wstring *> user_label;
std::atomic_bool active;
std::atomic_bool squelch;
std::atomic_bool muted;
std::atomic_bool deltaLock;
std::atomic_bool recording;

View File

@ -2,13 +2,9 @@
// SPDX-License-Identifier: GPL-2.0+
#include <DemodulatorMgr.h>
#include <sstream>
#include <algorithm>
#include <string>
#include <sstream>
#include <algorithm>
#include "DemodulatorMgr.h"
#include "CubicSDR.h"
#if USE_HAMLIB
@ -16,9 +12,10 @@
#endif
#include "DataTree.h"
#include <wx/string.h>
bool demodFreqCompare (DemodulatorInstancePtr i, DemodulatorInstancePtr j) { return (i->getFrequency() < j->getFrequency()); }
bool inactiveCompare (DemodulatorInstancePtr i, DemodulatorInstancePtr j) { return (i->isActive() < j->isActive()); }
bool demodFreqCompare (const DemodulatorInstancePtr& i, const DemodulatorInstancePtr& j) { return (i->getFrequency() < j->getFrequency()); }
bool inactiveCompare (const DemodulatorInstancePtr& i, const DemodulatorInstancePtr& j) { return (i->isActive() < j->isActive()); }
DemodulatorMgr::DemodulatorMgr() {
@ -54,7 +51,7 @@ void DemodulatorMgr::terminateAll() {
std::lock_guard < std::recursive_mutex > lock(demods_busy);
while (demods.size()) {
while (!demods.empty()) {
DemodulatorInstancePtr d = demods.back();
demods.pop_back();
@ -94,9 +91,9 @@ std::vector<DemodulatorInstancePtr> DemodulatorMgr::getOrderedDemodulators(bool
return demods_ordered;
}
DemodulatorInstancePtr DemodulatorMgr::getPreviousDemodulator(DemodulatorInstancePtr demod, bool actives) {
DemodulatorInstancePtr DemodulatorMgr::getPreviousDemodulator(const DemodulatorInstancePtr& demod, bool actives) {
std::lock_guard < std::recursive_mutex > lock(demods_busy);
if (!getLastActiveDemodulator()) {
if (!getCurrentModem()) {
return nullptr;
}
auto demods_ordered = getOrderedDemodulators(actives);
@ -111,9 +108,9 @@ DemodulatorInstancePtr DemodulatorMgr::getPreviousDemodulator(DemodulatorInstanc
return *(--p);
}
DemodulatorInstancePtr DemodulatorMgr::getNextDemodulator(DemodulatorInstancePtr demod, bool actives) {
DemodulatorInstancePtr DemodulatorMgr::getNextDemodulator(const DemodulatorInstancePtr& demod, bool actives) {
std::lock_guard < std::recursive_mutex > lock(demods_busy);
if (!getLastActiveDemodulator()) {
if (!getCurrentModem()) {
return nullptr;
}
auto demods_ordered = getOrderedDemodulators(actives);
@ -143,7 +140,7 @@ DemodulatorInstancePtr DemodulatorMgr::getFirstDemodulator() {
return getOrderedDemodulators().front();
}
void DemodulatorMgr::deleteThread(DemodulatorInstancePtr demod) {
void DemodulatorMgr::deleteThread(const DemodulatorInstancePtr& demod) {
std::lock_guard < std::recursive_mutex > lock(demods_busy);
@ -151,11 +148,11 @@ void DemodulatorMgr::deleteThread(DemodulatorInstancePtr demod) {
auto i = std::find(demods.begin(), demods.end(), demod);
if (activeDemodulator == demod) {
activeDemodulator = nullptr;
if (activeContextModem == demod) {
activeContextModem = nullptr;
}
if (lastActiveDemodulator == demod) {
lastActiveDemodulator = nullptr;
if (currentModem == demod) {
currentModem = nullptr;
}
if (activeVisualDemodulator == demod) {
activeVisualDemodulator = nullptr;
@ -175,9 +172,7 @@ std::vector<DemodulatorInstancePtr> DemodulatorMgr::getDemodulatorsAt(long long
std::vector<DemodulatorInstancePtr> foundDemods;
for (int i = 0, iMax = demods.size(); i < iMax; i++) {
DemodulatorInstancePtr testDemod = demods[i];
for (auto testDemod : demods) {
long long freqTest = testDemod->getFrequency();
long long bandwidthTest = testDemod->getBandwidth();
long long halfBandwidthTest = bandwidthTest / 2;
@ -194,9 +189,7 @@ std::vector<DemodulatorInstancePtr> DemodulatorMgr::getDemodulatorsAt(long long
bool DemodulatorMgr::anyDemodulatorsAt(long long freq, int bandwidth) {
std::lock_guard < std::recursive_mutex > lock(demods_busy);
for (int i = 0, iMax = demods.size(); i < iMax; i++) {
DemodulatorInstancePtr testDemod = demods[i];
for (auto testDemod : demods) {
long long freqTest = testDemod->getFrequency();
long long bandwidthTest = testDemod->getBandwidth();
long long halfBandwidthTest = bandwidthTest / 2;
@ -213,26 +206,31 @@ bool DemodulatorMgr::anyDemodulatorsAt(long long freq, int bandwidth) {
}
void DemodulatorMgr::setActiveDemodulator(DemodulatorInstancePtr demod, bool temporary) {
void DemodulatorMgr::setActiveDemodulator(const DemodulatorInstancePtr& demod, bool temporary) {
std::lock_guard < std::recursive_mutex > lock(demods_busy);
// Should this be made the current modem (i.e. clicked, toggled)
if (!temporary) {
if (activeDemodulator != nullptr) {
lastActiveDemodulator = activeDemodulator;
if (activeContextModem != nullptr) {
currentModem = activeContextModem;
updateLastState();
} else {
lastActiveDemodulator = demod;
currentModem = demod;
}
updateLastState();
wxGetApp().getBookmarkMgr().updateActiveList();
#if USE_HAMLIB
if (wxGetApp().rigIsActive() && wxGetApp().getRigThread()->getFollowModem() && lastActiveDemodulator) {
wxGetApp().getRigThread()->setFrequency(lastActiveDemodulator->getFrequency(),true);
if (wxGetApp().rigIsActive() && wxGetApp().getRigThread()->getFollowModem() && currentModem) {
wxGetApp().getRigThread()->setFrequency(currentModem->getFrequency(),true);
}
#endif
wxGetApp().getBookmarkMgr().updateActiveList();
}
}
// TODO: This is probably unnecessary and confusing
if (activeVisualDemodulator) {
activeVisualDemodulator->setVisualOutputQueue(nullptr);
}
@ -240,22 +238,22 @@ void DemodulatorMgr::setActiveDemodulator(DemodulatorInstancePtr demod, bool tem
demod->setVisualOutputQueue(wxGetApp().getAudioVisualQueue());
activeVisualDemodulator = demod;
} else {
DemodulatorInstancePtr last = getLastActiveDemodulator();
DemodulatorInstancePtr last = getCurrentModem();
if (last) {
last->setVisualOutputQueue(wxGetApp().getAudioVisualQueue());
}
activeVisualDemodulator = last;
}
// :ODOT
activeDemodulator = demod;
activeContextModem = demod;
}
//Dangerous: this is only intended by some internal classes
void DemodulatorMgr::setActiveDemodulatorByRawPointer(DemodulatorInstance* demod, bool temporary) {
std::lock_guard < std::recursive_mutex > lock(demods_busy);
for (auto existing_demod : demods) {
for (const auto& existing_demod : demods) {
if (existing_demod.get() == demod) {
@ -265,17 +263,27 @@ void DemodulatorMgr::setActiveDemodulatorByRawPointer(DemodulatorInstance* demod
}
}
DemodulatorInstancePtr DemodulatorMgr::getActiveDemodulator() {
/**
* Get the currently focused modem, i.e. the one hovered by interaction
* If no active context modem is available the current modem is returned
* @return Active Context Modem
*/
DemodulatorInstancePtr DemodulatorMgr::getActiveContextModem() {
std::lock_guard < std::recursive_mutex > lock(demods_busy);
if (activeDemodulator && !activeDemodulator->isActive()) {
activeDemodulator = getLastActiveDemodulator();
if (activeContextModem && !activeContextModem->isActive()) {
activeContextModem = getCurrentModem();
}
return activeDemodulator;
return activeContextModem;
}
DemodulatorInstancePtr DemodulatorMgr::getLastActiveDemodulator() {
return lastActiveDemodulator;
/**
* Get the last selected / focused modem
* This is the currently active modem
* @return Current Modem
*/
DemodulatorInstancePtr DemodulatorMgr::getCurrentModem() {
return currentModem;
}
DemodulatorInstancePtr DemodulatorMgr::getLastDemodulatorWith(const std::string& type,
@ -303,27 +311,27 @@ DemodulatorInstancePtr DemodulatorMgr::getLastDemodulatorWith(const std::string&
void DemodulatorMgr::updateLastState() {
std::lock_guard < std::recursive_mutex > lock(demods_busy);
if (std::find(demods.begin(), demods.end(), lastActiveDemodulator) == demods.end()) {
if (activeDemodulator && activeDemodulator->isActive()) {
lastActiveDemodulator = activeDemodulator;
} else if (activeDemodulator && !activeDemodulator->isActive()){
activeDemodulator = nullptr;
lastActiveDemodulator = nullptr;
if (std::find(demods.begin(), demods.end(), currentModem) == demods.end()) {
if (activeContextModem && activeContextModem->isActive()) {
currentModem = activeContextModem;
} else if (activeContextModem && !activeContextModem->isActive()){
activeContextModem = nullptr;
currentModem = nullptr;
}
}
if (lastActiveDemodulator && !lastActiveDemodulator->isActive()) {
lastActiveDemodulator = nullptr;
if (currentModem && !currentModem->isActive()) {
currentModem = nullptr;
}
if (lastActiveDemodulator) {
lastBandwidth = lastActiveDemodulator->getBandwidth();
lastDemodType = lastActiveDemodulator->getDemodulatorType();
lastDemodLock = lastActiveDemodulator->getDemodulatorLock()?true:false;
lastSquelchEnabled = lastActiveDemodulator->isSquelchEnabled();
lastSquelch = lastActiveDemodulator->getSquelchLevel();
lastGain = lastActiveDemodulator->getGain();
lastModemSettings[lastDemodType] = lastActiveDemodulator->readModemSettings();
if (currentModem) {
lastBandwidth = currentModem->getBandwidth();
lastDemodType = currentModem->getDemodulatorType();
lastDemodLock = currentModem->getDemodulatorLock() != 0;
lastSquelchEnabled = currentModem->isSquelchEnabled();
lastSquelch = currentModem->getSquelchLevel();
lastGain = currentModem->getGain();
lastModemSettings[lastDemodType] = currentModem->readModemSettings();
}
}
@ -332,29 +340,29 @@ int DemodulatorMgr::getLastBandwidth() const {
return lastBandwidth;
}
void DemodulatorMgr::setLastBandwidth(int lastBandwidth) {
if (lastBandwidth < MIN_BANDWIDTH) {
lastBandwidth = MIN_BANDWIDTH;
} else if (lastBandwidth > wxGetApp().getSampleRate()) {
lastBandwidth = wxGetApp().getSampleRate();
void DemodulatorMgr::setLastBandwidth(int lastBandwidth_in) {
if (lastBandwidth_in < MIN_BANDWIDTH) {
lastBandwidth_in = MIN_BANDWIDTH;
} else if (lastBandwidth_in > wxGetApp().getSampleRate()) {
lastBandwidth_in = wxGetApp().getSampleRate();
}
this->lastBandwidth = lastBandwidth;
lastBandwidth = lastBandwidth_in;
}
std::string DemodulatorMgr::getLastDemodulatorType() const {
return lastDemodType;
}
void DemodulatorMgr::setLastDemodulatorType(std::string lastDemodType) {
this->lastDemodType = lastDemodType;
void DemodulatorMgr::setLastDemodulatorType(std::string lastDemodType_in) {
lastDemodType = lastDemodType_in;
}
float DemodulatorMgr::getLastGain() const {
return lastGain;
}
void DemodulatorMgr::setLastGain(float lastGain) {
this->lastGain = lastGain;
void DemodulatorMgr::setLastGain(float lastGain_in) {
lastGain = lastGain_in;
}
@ -370,31 +378,31 @@ float DemodulatorMgr::getLastSquelchLevel() const {
return lastSquelch;
}
void DemodulatorMgr::setLastSquelchLevel(float lastSquelch) {
this->lastSquelch = lastSquelch;
void DemodulatorMgr::setLastSquelchLevel(float lastSquelch_in) {
lastSquelch = lastSquelch_in;
}
bool DemodulatorMgr::isLastSquelchEnabled() const {
return lastSquelchEnabled;
}
void DemodulatorMgr::setLastSquelchEnabled(bool lastSquelchEnabled) {
this->lastSquelchEnabled = lastSquelchEnabled;
void DemodulatorMgr::setLastSquelchEnabled(bool lastSquelchEnabled_in) {
lastSquelchEnabled = lastSquelchEnabled_in;
}
bool DemodulatorMgr::isLastMuted() const {
return lastMuted;
}
void DemodulatorMgr::setLastMuted(bool lastMuted) {
this->lastMuted = lastMuted;
void DemodulatorMgr::setLastMuted(bool lastMuted_in) {
lastMuted = lastMuted_in;
}
ModemSettings DemodulatorMgr::getLastModemSettings(std::string modemType) {
ModemSettings DemodulatorMgr::getLastModemSettings(const std::string& modemType) {
return lastModemSettings[modemType];
}
void DemodulatorMgr::setLastModemSettings(std::string modemType, ModemSettings settings) {
void DemodulatorMgr::setLastModemSettings(const std::string& modemType, ModemSettings settings) {
lastModemSettings[modemType] = settings;
}
@ -402,7 +410,11 @@ void DemodulatorMgr::setOutputDevices(std::map<int,RtAudio::DeviceInfo> devs) {
outputDevices = devs;
}
void DemodulatorMgr::saveInstance(DataNode *node, DemodulatorInstancePtr inst) {
std::map<int, RtAudio::DeviceInfo> DemodulatorMgr::getOutputDevices() {
return outputDevices;
}
void DemodulatorMgr::saveInstance(DataNode *node, const DemodulatorInstancePtr& inst) {
*node->newChild("bandwidth") = inst->getBandwidth();
*node->newChild("frequency") = inst->getFrequency();
@ -419,12 +431,12 @@ void DemodulatorMgr::saveInstance(DataNode *node, DemodulatorInstancePtr inst) {
*node->newChild("delta_lock") = inst->isDeltaLock() ? 1 : 0;
*node->newChild("delta_ofs") = inst->getDeltaLockOfs();
}
if (inst == getLastActiveDemodulator()) {
if (inst == getCurrentModem()) {
*node->newChild("active") = 1;
}
ModemSettings saveSettings = inst->readModemSettings();
if (saveSettings.size()) {
if (!saveSettings.empty()) {
DataNode *settingsNode = node->newChild("settings");
for (ModemSettings::const_iterator msi = saveSettings.begin(); msi != saveSettings.end(); msi++) {
*settingsNode->newChild(msi->first.c_str()) = msi->second;
@ -432,6 +444,36 @@ void DemodulatorMgr::saveInstance(DataNode *node, DemodulatorInstancePtr inst) {
}
}
std::wstring DemodulatorMgr::getSafeWstringValue(DataNode* node) {
std::wstring decodedWString;
if (node != nullptr) {
//1) decode as encoded wstring:
try {
node->element()->get(decodedWString);
} catch (const DataTypeMismatchException &) {
//2) wstring decode fail, try simple std::string
std::string decodedStdString;
try {
node->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;
}
DemodulatorInstancePtr DemodulatorMgr::loadInstance(DataNode *node) {
std::lock_guard < std::recursive_mutex > lock(demods_busy);
@ -440,22 +482,22 @@ DemodulatorInstancePtr DemodulatorMgr::loadInstance(DataNode *node) {
node->rewindAll();
long bandwidth = *node->getNext("bandwidth");
long long freq = *node->getNext("frequency");
long bandwidth = (long)*node->getNext("bandwidth");
long long freq = (long long)*node->getNext("frequency");
float squelch_level = node->hasAnother("squelch_level") ? (float) *node->getNext("squelch_level") : 0;
int squelch_enabled = node->hasAnother("squelch_enabled") ? (int) *node->getNext("squelch_enabled") : 0;
int muted = node->hasAnother("muted") ? (int) *node->getNext("muted") : 0;
int delta_locked = node->hasAnother("delta_lock") ? (int) *node->getNext("delta_lock") : 0;
int delta_ofs = node->hasAnother("delta_ofs") ? (int) *node->getNext("delta_ofs") : 0;
std::string output_device = node->hasAnother("output_device") ? string(*(node->getNext("output_device"))) : "";
float gain = node->hasAnother("gain") ? (float) *node->getNext("gain") : 1.0;
std::string output_device = node->hasAnother("output_device") ? ((string)*(node->getNext("output_device"))) : "";
float gain = node->hasAnother("gain") ? (float) *node->getNext("gain") : 1.0f;
std::string type = "FM";
DataNode *demodTypeNode = node->hasAnother("type")?node->getNext("type"):nullptr;
if (demodTypeNode && demodTypeNode->element()->getDataType() == DATA_INT) {
int legacyType = *demodTypeNode;
if (demodTypeNode && demodTypeNode->element()->getDataType() == DataElement::Type::DATA_INT) {
int legacyType = (int)*demodTypeNode;
int legacyStereo = node->hasAnother("stereo") ? (int) *node->getNext("stereo") : 0;
switch (legacyType) { // legacy demod ID
case 1: type = legacyStereo?"FMS":"FM"; break;
@ -476,17 +518,18 @@ DemodulatorInstancePtr DemodulatorMgr::loadInstance(DataNode *node) {
case 16: type = "I/Q"; break;
default: type = "FM"; break;
}
} else if (demodTypeNode && demodTypeNode->element()->getDataType() == DATA_STRING) {
} else if (demodTypeNode && demodTypeNode->element()->getDataType() == DataElement::Type::DATA_STRING) {
demodTypeNode->element()->get(type);
}
//read the user label associated with the demodulator
std::wstring user_label = L"";
std::wstring user_label;
DataNode *demodUserLabel = node->hasAnother("user_label") ? node->getNext("user_label") : nullptr;
if (demodUserLabel) {
demodUserLabel->element()->get(user_label);
user_label = DemodulatorMgr::getSafeWstringValue(demodUserLabel);
}
ModemSettings mSettings;
@ -498,7 +541,7 @@ DemodulatorInstancePtr DemodulatorMgr::loadInstance(DataNode *node) {
std::string keyName = settingNode->getName();
std::string strSettingValue = settingNode->element()->toString();
if (keyName != "" && strSettingValue != "") {
if (!keyName.empty() && !strSettingValue.empty()) {
mSettings[keyName] = strSettingValue;
}
}
@ -513,7 +556,7 @@ DemodulatorInstancePtr DemodulatorMgr::loadInstance(DataNode *node) {
newDemod->setFrequency(freq);
newDemod->setGain(gain);
newDemod->updateLabel(freq);
newDemod->setMuted(muted?true:false);
newDemod->setMuted(muted != 0);
if (delta_locked) {
newDemod->setDeltaLock(true);
newDemod->setDeltaLockOfs(delta_ofs);

View File

@ -24,65 +24,71 @@ public:
std::vector<DemodulatorInstancePtr> getOrderedDemodulators(bool actives = true);
std::vector<DemodulatorInstancePtr> getDemodulatorsAt(long long freq, int bandwidth);
DemodulatorInstancePtr getPreviousDemodulator(DemodulatorInstancePtr demod, bool actives = true);
DemodulatorInstancePtr getNextDemodulator(DemodulatorInstancePtr demod, bool actives = true);
DemodulatorInstancePtr getPreviousDemodulator(const DemodulatorInstancePtr& demod, bool actives = true);
DemodulatorInstancePtr getNextDemodulator(const DemodulatorInstancePtr& demod, bool actives = true);
DemodulatorInstancePtr getLastDemodulator();
DemodulatorInstancePtr getFirstDemodulator();
bool anyDemodulatorsAt(long long freq, int bandwidth);
void deleteThread(DemodulatorInstancePtr);
void deleteThread(const DemodulatorInstancePtr&);
void terminateAll();
void setActiveDemodulator(DemodulatorInstancePtr demod, bool temporary = true);
void setActiveDemodulator(const DemodulatorInstancePtr& demod, bool temporary = true);
//Dangerous: this is only intended by some internal classes,
// and only set a pre-existing demod
void setActiveDemodulatorByRawPointer(DemodulatorInstance* demod, bool temporary = true);
DemodulatorInstancePtr getActiveDemodulator();
DemodulatorInstancePtr getLastActiveDemodulator();
DemodulatorInstancePtr getActiveContextModem();
DemodulatorInstancePtr getCurrentModem();
DemodulatorInstancePtr getLastDemodulatorWith(const std::string& type,
const std::wstring& userLabel,
long long frequency,
int bandwidth);
int getLastBandwidth() const;
void setLastBandwidth(int lastBandwidth);
void setLastBandwidth(int lastBandwidth_in);
std::string getLastDemodulatorType() const;
void setLastDemodulatorType(std::string lastDemodType);
void setLastDemodulatorType(std::string lastDemodType_in);
float getLastGain() const;
void setLastGain(float lastGain);
void setLastGain(float lastGain_in);
bool getLastDeltaLock() const;
void setLastDeltaLock(bool lock);
float getLastSquelchLevel() const;
void setLastSquelchLevel(float lastSquelch);
void setLastSquelchLevel(float lastSquelch_in);
bool isLastSquelchEnabled() const;
void setLastSquelchEnabled(bool lastSquelchEnabled);
void setLastSquelchEnabled(bool lastSquelchEnabled_in);
bool isLastMuted() const;
void setLastMuted(bool lastMuted);
void setLastMuted(bool lastMuted_in);
ModemSettings getLastModemSettings(std::string);
void setLastModemSettings(std::string, ModemSettings);
ModemSettings getLastModemSettings(const std::string&);
void setLastModemSettings(const std::string&, ModemSettings);
void updateLastState();
void setOutputDevices(std::map<int,RtAudio::DeviceInfo> devs);
void saveInstance(DataNode *node, DemodulatorInstancePtr inst);
std::map<int, RtAudio::DeviceInfo> getOutputDevices();
void saveInstance(DataNode *node, const DemodulatorInstancePtr& inst);
DemodulatorInstancePtr loadInstance(DataNode *node);
private:
//utility method that attempts to decode node value as std::wstring, else as std::string, else
//return an empty string.
static std::wstring getSafeWstringValue(DataNode* node);
std::vector<DemodulatorInstancePtr> demods;
DemodulatorInstancePtr activeDemodulator;
DemodulatorInstancePtr lastActiveDemodulator;
DemodulatorInstancePtr activeContextModem;
DemodulatorInstancePtr currentModem;
DemodulatorInstancePtr activeVisualDemodulator;
int lastBandwidth;

View File

@ -1,7 +1,6 @@
// Copyright (c) Charles J. Cliffe
// SPDX-License-Identifier: GPL-2.0+
#include "CubicSDRDefs.h"
#include <vector>
#ifdef __APPLE__
@ -15,7 +14,7 @@
//50 ms
#define HEARTBEAT_CHECK_PERIOD_MICROS (50 * 1000)
DemodulatorPreThread::DemodulatorPreThread(DemodulatorInstance* parent) : IOThread(), iqResampler(NULL), iqResampleRatio(1), cModem(nullptr), cModemKit(nullptr)
DemodulatorPreThread::DemodulatorPreThread(DemodulatorInstance* parent) : IOThread(), iqResampler(nullptr), iqResampleRatio(1), cModem(nullptr), cModemKit(nullptr)
{
initialized.store(false);
this->parent = parent;
@ -34,7 +33,7 @@ DemodulatorPreThread::DemodulatorPreThread(DemodulatorInstance* parent) : IOThre
workerThread->setOutputQueue("WorkerResultQueue",workerResults);
newSampleRate = currentSampleRate = 0;
newBandwidth = currentBandwidth = 0;
currentBandwidth = 0;
newAudioSampleRate = currentAudioSampleRate = 0;
newFrequency = currentFrequency = 0;
@ -50,8 +49,7 @@ bool DemodulatorPreThread::isInitialized() {
return initialized.load();
}
DemodulatorPreThread::~DemodulatorPreThread() {
}
DemodulatorPreThread::~DemodulatorPreThread() = default;
void DemodulatorPreThread::run() {
#ifdef __APPLE__
@ -98,27 +96,26 @@ void DemodulatorPreThread::run() {
audioSampleRateChanged.store(true);
}
} else if (parent->getAudioSampleRate() != newAudioSampleRate) {
int newRate;
if ((newRate = parent->getAudioSampleRate())) {
if (parent->getAudioSampleRate()) {
newAudioSampleRate = parent->getAudioSampleRate();
audioSampleRateChanged.store(true);
}
}
if (demodTypeChanged.load() && (newSampleRate && newAudioSampleRate && newBandwidth)) {
DemodulatorWorkerThreadCommand command(DemodulatorWorkerThreadCommand::DEMOD_WORKER_THREAD_CMD_MAKE_DEMOD);
if (demodTypeChanged.load() && (newSampleRate && newAudioSampleRate && currentBandwidth)) {
DemodulatorWorkerThreadCommand command(DemodulatorWorkerThreadCommand::Type::DEMOD_WORKER_THREAD_CMD_MAKE_DEMOD);
command.frequency = newFrequency;
command.sampleRate = newSampleRate;
command.demodType = newDemodType;
command.bandwidth = newBandwidth;
command.bandwidth = currentBandwidth;
command.audioSampleRate = newAudioSampleRate;
demodType = newDemodType;
sampleRateChanged.store(false);
audioSampleRateChanged.store(false);
ModemSettings lastSettings = parent->getLastModemSettings(newDemodType);
if (lastSettings.size() != 0) {
if (!lastSettings.empty()) {
command.settings = lastSettings;
if (modemSettingsBuffered.size()) {
if (!modemSettingsBuffered.empty()) {
for (ModemSettings::const_iterator msi = modemSettingsBuffered.begin(); msi != modemSettingsBuffered.end(); msi++) {
command.settings[msi->first] = msi->second;
}
@ -138,12 +135,12 @@ void DemodulatorPreThread::run() {
else if (
cModemKit && cModem &&
(bandwidthChanged.load() || sampleRateChanged.load() || audioSampleRateChanged.load() || cModem->shouldRebuildKit()) &&
(newSampleRate && newAudioSampleRate && newBandwidth)
(newSampleRate && newAudioSampleRate && currentBandwidth)
) {
DemodulatorWorkerThreadCommand command(DemodulatorWorkerThreadCommand::DEMOD_WORKER_THREAD_CMD_BUILD_FILTERS);
DemodulatorWorkerThreadCommand command(DemodulatorWorkerThreadCommand::Type::DEMOD_WORKER_THREAD_CMD_BUILD_FILTERS);
command.frequency = newFrequency;
command.sampleRate = newSampleRate;
command.bandwidth = newBandwidth;
command.bandwidth = currentBandwidth;
command.audioSampleRate = newAudioSampleRate;
bandwidthChanged.store(false);
sampleRateChanged.store(false);
@ -168,7 +165,7 @@ void DemodulatorPreThread::run() {
// std::lock_guard < std::mutex > lock(inp->m_mutex);
std::vector<liquid_float_complex> *data = &inp->data;
if (data->size() && (inp->sampleRate == currentSampleRate) && cModem && cModemKit) {
if (!data->empty() && (inp->sampleRate == currentSampleRate) && cModem && cModemKit) {
size_t bufSize = data->size();
if (in_buf_data.size() != bufSize) {
@ -184,7 +181,7 @@ void DemodulatorPreThread::run() {
liquid_float_complex *in_buf = &in_buf_data[0];
liquid_float_complex *out_buf = &out_buf_data[0];
liquid_float_complex *temp_buf = NULL;
liquid_float_complex *temp_buf;
if (shiftFrequency != 0) {
if (shiftFrequency < 0) {
@ -228,7 +225,7 @@ void DemodulatorPreThread::run() {
while (!stopping && workerResults->try_pop(result)) {
switch (result.cmd) {
case DemodulatorWorkerThreadResult::DEMOD_WORKER_THREAD_RESULT_FILTERS:
case DemodulatorWorkerThreadResult::Type::DEMOD_WORKER_THREAD_RESULT_FILTERS:
if (result.iqResampler) {
if (iqResampler) {
msresamp_crcf_destroy(iqResampler);
@ -241,7 +238,7 @@ void DemodulatorPreThread::run() {
cModem = result.modem;
#if ENABLE_DIGITAL_LAB
if (cModem->getType() == "digital") {
ModemDigital *mDigi = (ModemDigital *)cModem;
auto *mDigi = (ModemDigital *)cModem;
mDigi->setOutput(parent->getOutput());
}
#endif
@ -252,15 +249,11 @@ void DemodulatorPreThread::run() {
currentAudioSampleRate = cModemKit->audioSampleRate;
}
if (result.bandwidth) {
currentBandwidth = result.bandwidth;
}
if (result.sampleRate) {
currentSampleRate = result.sampleRate;
}
if (result.modemName != "") {
if (!result.modemName.empty()) {
demodType = result.modemName;
demodTypeChanged.store(false);
}
@ -285,8 +278,8 @@ void DemodulatorPreThread::run() {
iqInputQueue->flush();
}
void DemodulatorPreThread::setDemodType(std::string demodType) {
newDemodType = demodType;
void DemodulatorPreThread::setDemodType(std::string demodType_in) {
newDemodType = demodType_in;
demodTypeChanged.store(true);
}
@ -298,8 +291,8 @@ std::string DemodulatorPreThread::getDemodType() {
}
void DemodulatorPreThread::setFrequency(long long freq) {
frequencyChanged.store(true);
newFrequency = freq;
frequencyChanged.store(true);
}
long long DemodulatorPreThread::getFrequency() {
@ -310,8 +303,8 @@ long long DemodulatorPreThread::getFrequency() {
}
void DemodulatorPreThread::setSampleRate(long long sampleRate) {
sampleRateChanged.store(true);
newSampleRate = sampleRate;
sampleRateChanged.store(true);
}
long long DemodulatorPreThread::getSampleRate() {
@ -322,21 +315,17 @@ long long DemodulatorPreThread::getSampleRate() {
}
void DemodulatorPreThread::setBandwidth(int bandwidth) {
currentBandwidth = bandwidth;
bandwidthChanged.store(true);
newBandwidth = bandwidth;
}
int DemodulatorPreThread::getBandwidth() {
if (bandwidthChanged.load()) {
return newBandwidth;
}
return currentBandwidth;
}
void DemodulatorPreThread::setAudioSampleRate(int rate) {
audioSampleRateChanged.store(true);
newAudioSampleRate = rate;
audioSampleRateChanged.store(true);
}
int DemodulatorPreThread::getAudioSampleRate() {
@ -377,7 +366,7 @@ ModemKit *DemodulatorPreThread::getModemKit() {
}
std::string DemodulatorPreThread::readModemSetting(std::string setting) {
std::string DemodulatorPreThread::readModemSetting(const std::string& setting) {
if (cModem) {
return cModem->readSetting(setting);
} else if (modemSettingsBuffered.find(setting) != modemSettingsBuffered.end()) {
@ -386,7 +375,7 @@ std::string DemodulatorPreThread::readModemSetting(std::string setting) {
return "";
}
void DemodulatorPreThread::writeModemSetting(std::string setting, std::string value) {
void DemodulatorPreThread::writeModemSetting(const std::string& setting, std::string value) {
modemSettingsBuffered[setting] = value;
modemSettingsChanged.store(true);
}

View File

@ -17,12 +17,12 @@ class DemodulatorInstance;
class DemodulatorPreThread : public IOThread {
public:
DemodulatorPreThread(DemodulatorInstance* parent);
virtual ~DemodulatorPreThread();
explicit DemodulatorPreThread(DemodulatorInstance* parent);
~DemodulatorPreThread() override;
virtual void run();
void run() override;
void setDemodType(std::string demodType);
void setDemodType(std::string demodType_in);
std::string getDemodType();
void setFrequency(long long sampleRate);
@ -39,13 +39,13 @@ public:
bool isInitialized();
virtual void terminate();
void terminate() override;
Modem *getModem();
ModemKit *getModemKit();
std::string readModemSetting(std::string setting);
void writeModemSetting(std::string setting, std::string value);
std::string readModemSetting(const std::string& setting);
void writeModemSetting(const std::string& setting, std::string value);
ModemSettings readModemSettings();
void writeModemSettings(ModemSettings settings);
@ -62,7 +62,7 @@ protected:
std::atomic_llong currentSampleRate, newSampleRate;
std::atomic_llong currentFrequency, newFrequency;
std::atomic_int currentBandwidth, newBandwidth;
std::atomic_int currentBandwidth;
std::atomic_int currentAudioSampleRate, newAudioSampleRate;
std::atomic_bool sampleRateChanged, frequencyChanged, bandwidthChanged, audioSampleRateChanged;

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