├── .circleci ├── config.yml └── scripts │ ├── build_cubicsdr.sh │ ├── build_liquiddsp.sh │ ├── build_soapysdr.sh │ └── build_wxwidgets.sh ├── .gitignore ├── CMakeLists.txt ├── LICENSE ├── README.md ├── cmake ├── CubicSDR.desktop.in ├── CubicSDRInfo.plist.in ├── Modules │ ├── FindJack.cmake │ ├── FindLiquid.cmake │ ├── FindRtAudio.cmake │ └── Findhamlib.cmake ├── cmake_uninstall.cmake.in ├── code_sign.sh.in └── dmg_sign.sh.in ├── cubicsdr.rc ├── external ├── cubicvr2 │ └── math │ │ ├── aabb.h │ │ ├── cubic_math.cpp │ │ ├── cubic_math.h │ │ ├── cubic_types.h │ │ ├── frustum.h │ │ ├── mat3.h │ │ ├── mat4.h │ │ ├── plane.h │ │ ├── quaternion.h │ │ ├── sphere.h │ │ ├── transform.h │ │ ├── triangle.h │ │ ├── vec2.h │ │ ├── vec3.h │ │ └── vec4.h ├── deb │ └── deb_post.sh.in ├── hamlib │ ├── 32 │ │ ├── libhamlib-4.def │ │ ├── libhamlib-4.dll │ │ ├── libhamlib-4.exp │ │ └── libhamlib-4.lib │ ├── 64 │ │ ├── libhamlib-4.def │ │ ├── libhamlib-4.dll │ │ ├── libhamlib-4.exp │ │ └── libhamlib-4.lib │ ├── Hamlib_deps_on_Windows.txt │ └── hamlib │ │ ├── amplifier.h │ │ ├── amplist.h │ │ ├── rig.h │ │ ├── rig_dll.h │ │ ├── riglist.h │ │ ├── rotator.h │ │ └── rotlist.h ├── liquid-dsp │ ├── COPYING │ ├── How_to_build_liquid_dsp_for_Windows.txt │ ├── config.h │ ├── gcc │ │ ├── 32 │ │ │ ├── libliquid.a │ │ │ └── libliquid.dll │ │ └── 64 │ │ │ ├── libliquid.a │ │ │ └── libliquid.dll │ ├── include │ │ └── liquid │ │ │ └── liquid.h │ ├── makefile.mingw32 │ ├── makefile.mingw64 │ └── msvc │ │ ├── 32 │ │ ├── libliquid.def │ │ ├── libliquid.dll │ │ └── libliquid.lib │ │ └── 64 │ │ ├── libliquid.def │ │ ├── libliquid.dll │ │ └── libliquid.lib ├── lodepng │ ├── lodepng.cpp │ └── lodepng.h ├── msvc │ ├── x64 │ │ └── libwinpthread-1.dll │ └── x86 │ │ ├── libgcc_s_dw2-1.dll │ │ ├── libgcc_s_sjlj-1.dll │ │ └── libwinpthread-1.dll ├── rs232 │ ├── README │ ├── README.md │ ├── rs232-linux.cpp │ ├── rs232-win.cpp │ └── rs232.h ├── rtaudio │ ├── README.md │ ├── RtAudio.cpp │ └── RtAudio.h ├── tinyxml │ ├── tinystr.cpp │ ├── tinystr.h │ ├── tinyxml.cpp │ ├── tinyxml.h │ ├── tinyxmlerror.cpp │ ├── tinyxmlparser.cpp │ └── xmltest.cpp └── wglext │ └── wglext.h ├── font ├── vera_sans_mono12.bmfc ├── vera_sans_mono12.fnt ├── vera_sans_mono12_0.png ├── vera_sans_mono16.bmfc ├── vera_sans_mono16.fnt ├── vera_sans_mono16_0.png ├── vera_sans_mono18.bmfc ├── vera_sans_mono18.fnt ├── vera_sans_mono18_0.png ├── vera_sans_mono24.bmfc ├── vera_sans_mono24.fnt ├── vera_sans_mono24_0.png ├── vera_sans_mono27.bmfc ├── vera_sans_mono27.fnt ├── vera_sans_mono27_0.png ├── vera_sans_mono32.bmfc ├── vera_sans_mono32.fnt ├── vera_sans_mono32_0.png ├── vera_sans_mono36.bmfc ├── vera_sans_mono36.fnt ├── vera_sans_mono36_0.png ├── vera_sans_mono48.bmfc ├── vera_sans_mono48.fnt ├── vera_sans_mono48_0.png ├── vera_sans_mono64.bmfc ├── vera_sans_mono64.fnt ├── vera_sans_mono64_0.png ├── vera_sans_mono72.bmfc ├── vera_sans_mono72.fnt ├── vera_sans_mono72_0.png ├── vera_sans_mono96.bmfc ├── vera_sans_mono96.fnt └── vera_sans_mono96_0.png ├── icon ├── CubicSDR.icns ├── CubicSDR.ico └── NSIS_Header.bmp └── src ├── AppConfig.cpp ├── AppConfig.h ├── AppFrame.cpp ├── AppFrame.h ├── BookmarkMgr.cpp ├── BookmarkMgr.h ├── CubicSDR.cpp ├── CubicSDR.h ├── CubicSDR.png ├── CubicSDR.xpm ├── CubicSDRDefs.h ├── DemodLabelDialog.cpp ├── DemodLabelDialog.h ├── FrequencyDialog.cpp ├── FrequencyDialog.h ├── IOThread.cpp ├── IOThread.h ├── ModemProperties.cpp ├── ModemProperties.h ├── SessionMgr.cpp ├── SessionMgr.h ├── audio ├── AudioFile.cpp ├── AudioFile.h ├── AudioFileWAV.cpp ├── AudioFileWAV.h ├── AudioSinkFileThread.cpp ├── AudioSinkFileThread.h ├── AudioSinkThread.cpp ├── AudioSinkThread.h ├── AudioThread.cpp └── AudioThread.h ├── demod ├── DemodDefs.h ├── DemodulatorInstance.cpp ├── DemodulatorInstance.h ├── DemodulatorMgr.cpp ├── DemodulatorMgr.h ├── DemodulatorPreThread.cpp ├── DemodulatorPreThread.h ├── DemodulatorThread.cpp ├── DemodulatorThread.h ├── DemodulatorWorkerThread.cpp └── DemodulatorWorkerThread.h ├── forms ├── Bookmark │ ├── BookmarkPanel.cpp │ ├── BookmarkPanel.fbp │ ├── BookmarkPanel.h │ ├── BookmarkView.cpp │ └── BookmarkView.h ├── Dialog │ ├── AboutDialog.cpp │ ├── AboutDialog.fbp │ ├── AboutDialog.h │ ├── AboutDialogBase.cpp │ ├── AboutDialogBase.h │ ├── ActionDialog.cpp │ ├── ActionDialog.h │ ├── ActionDialogBase.cpp │ ├── ActionDialogBase.fbp │ ├── ActionDialogBase.h │ ├── PortSelectorDialog.cpp │ ├── PortSelectorDialog.fbp │ ├── PortSelectorDialog.h │ ├── PortSelectorDialogBase.cpp │ └── PortSelectorDialogBase.h ├── DigitalConsole │ ├── DigitalConsole.cpp │ ├── DigitalConsole.fbp │ ├── DigitalConsole.h │ ├── DigitalConsoleFrame.cpp │ └── DigitalConsoleFrame.h └── SDRDevices │ ├── SDRDeviceAdd.cpp │ ├── SDRDeviceAdd.fbp │ ├── SDRDeviceAdd.h │ ├── SDRDeviceAddForm.cpp │ ├── SDRDeviceAddForm.h │ ├── SDRDevices.cpp │ ├── SDRDevices.fbp │ ├── SDRDevices.h │ ├── SDRDevicesForm.cpp │ └── SDRDevicesForm.h ├── modules └── modem │ ├── Modem.cpp │ ├── Modem.h │ ├── ModemAnalog.cpp │ ├── ModemAnalog.h │ ├── ModemDigital.cpp │ ├── ModemDigital.h │ ├── analog │ ├── ModemAM.cpp │ ├── ModemAM.h │ ├── ModemCW.cpp │ ├── ModemCW.h │ ├── ModemDSB.cpp │ ├── ModemDSB.h │ ├── ModemFM.cpp │ ├── ModemFM.h │ ├── ModemFMStereo.cpp │ ├── ModemFMStereo.h │ ├── ModemIQ.cpp │ ├── ModemIQ.h │ ├── ModemLSB.cpp │ ├── ModemLSB.h │ ├── ModemNBFM.cpp │ ├── ModemNBFM.h │ ├── ModemUSB.cpp │ └── ModemUSB.h │ └── digital │ ├── ModemAPSK.cpp │ ├── ModemAPSK.h │ ├── ModemASK.cpp │ ├── ModemASK.h │ ├── ModemBPSK.cpp │ ├── ModemBPSK.h │ ├── ModemDPSK.cpp │ ├── ModemDPSK.h │ ├── ModemFSK.cpp │ ├── ModemFSK.h │ ├── ModemGMSK.cpp │ ├── ModemGMSK.h │ ├── ModemOOK.cpp │ ├── ModemOOK.h │ ├── ModemPSK.cpp │ ├── ModemPSK.h │ ├── ModemQAM.cpp │ ├── ModemQAM.h │ ├── ModemQPSK.cpp │ ├── ModemQPSK.h │ ├── ModemSQAM.cpp │ ├── ModemSQAM.h │ ├── ModemST.cpp │ └── ModemST.h ├── panel ├── MeterPanel.cpp ├── MeterPanel.h ├── ScopePanel.cpp ├── ScopePanel.h ├── SpectrumPanel.cpp ├── SpectrumPanel.h ├── WaterfallPanel.cpp └── WaterfallPanel.h ├── process ├── FFTDataDistributor.cpp ├── FFTDataDistributor.h ├── FFTVisualDataThread.cpp ├── FFTVisualDataThread.h ├── ScopeVisualProcessor.cpp ├── ScopeVisualProcessor.h ├── SpectrumVisualDataThread.cpp ├── SpectrumVisualDataThread.h ├── SpectrumVisualProcessor.cpp ├── SpectrumVisualProcessor.h ├── VisualProcessor.cpp └── VisualProcessor.h ├── rig ├── RigThread.cpp └── RigThread.h ├── sdr ├── SDRDeviceInfo.cpp ├── SDRDeviceInfo.h ├── SDREnumerator.cpp ├── SDREnumerator.h ├── SDRPostThread.cpp ├── SDRPostThread.h ├── SoapySDRThread.cpp └── SoapySDRThread.h ├── ui ├── GLPanel.cpp ├── GLPanel.h ├── UITestCanvas.cpp ├── UITestCanvas.h ├── UITestContext.cpp └── UITestContext.h ├── util ├── DataTree.cpp ├── DataTree.h ├── GLExt.cpp ├── GLExt.h ├── GLFont.cpp ├── GLFont.h ├── Gradient.cpp ├── Gradient.h ├── MouseTracker.cpp ├── MouseTracker.h ├── SpinMutex.h ├── ThreadBlockingQueue.cpp ├── ThreadBlockingQueue.h ├── Timer.cpp └── Timer.h └── visual ├── ColorTheme.cpp ├── ColorTheme.h ├── GainCanvas.cpp ├── GainCanvas.h ├── ImagePanel.cpp ├── ImagePanel.h ├── InteractiveCanvas.cpp ├── InteractiveCanvas.h ├── MeterCanvas.cpp ├── MeterCanvas.h ├── MeterContext.cpp ├── MeterContext.h ├── ModeSelectorCanvas.cpp ├── ModeSelectorCanvas.h ├── ModeSelectorContext.cpp ├── ModeSelectorContext.h ├── PrimaryGLContext.cpp ├── PrimaryGLContext.h ├── ScopeCanvas.cpp ├── ScopeCanvas.h ├── ScopeContext.cpp ├── ScopeContext.h ├── SpectrumCanvas.cpp ├── SpectrumCanvas.h ├── TuningCanvas.cpp ├── TuningCanvas.h ├── TuningContext.cpp ├── TuningContext.h ├── WaterfallCanvas.cpp └── WaterfallCanvas.h /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2.1 2 | jobs: 3 | build: 4 | docker: 5 | - image: cimg/base:current-22.04 6 | resource_class: medium 7 | environment: 8 | - CACHE_DIR: ~/build/wxWidgets/staticlib 9 | steps: 10 | - checkout 11 | - restore_cache: 12 | keys: 13 | - cache-{{ checksum ".circleci/scripts/build_wxwidgets.sh" }} 14 | - run: 15 | name: Install Dependencies 16 | command: | 17 | sudo apt-get update 18 | sudo apt-get install -y build-essential cmake libpulse-dev libgtk-3-dev freeglut3 freeglut3-dev libhamlib-dev 19 | - run: 20 | name: Build wxWidgets 21 | command: bash .circleci/scripts/build_wxwidgets.sh 22 | - run: 23 | name: Build LiquidDSP 24 | command: bash .circleci/scripts/build_liquiddsp.sh 25 | - run: 26 | name: Build SoapySDR 27 | command: bash .circleci/scripts/build_soapysdr.sh 28 | - run: 29 | name: Build CubicSDR 30 | command: bash .circleci/scripts/build_cubicsdr.sh 31 | - save_cache: 32 | key: cache-{{ checksum ".circleci/scripts/build_wxwidgets.sh" }} 33 | paths: 34 | - ~/build/wxWidgets/staticlib 35 | -------------------------------------------------------------------------------- /.circleci/scripts/build_cubicsdr.sh: -------------------------------------------------------------------------------- 1 | # CubicSDR 2 | mkdir -p $HOME/build/cjcliffe/CubicSDR-build 3 | cd $HOME/build/cjcliffe/CubicSDR-build 4 | cmake ~/project -DCMAKE_BUILD_TYPE=Release -DwxWidgets_CONFIG_EXECUTABLE=$HOME/build/wxWidgets/staticlib/bin/wx-config -DUSE_HAMLIB=1 -DENABLE_DIGITAL_LAB=1 5 | make -j2 6 | -------------------------------------------------------------------------------- /.circleci/scripts/build_liquiddsp.sh: -------------------------------------------------------------------------------- 1 | # Liquid-DSP 2 | mkdir -p $HOME/build/jgaeddert 3 | cd $HOME/build/jgaeddert 4 | git clone https://github.com/jgaeddert/liquid-dsp.git 5 | 6 | cd $HOME/build/jgaeddert/liquid-dsp 7 | ./bootstrap.sh 8 | 9 | echo "Configuring liquid-dsp.." 10 | ./configure > /dev/null 11 | 12 | echo "Building liquid-dsp.." 13 | make -j2 > /dev/null 14 | sudo make install 15 | -------------------------------------------------------------------------------- /.circleci/scripts/build_soapysdr.sh: -------------------------------------------------------------------------------- 1 | # Soapy SDR 2 | mkdir -p $HOME/build/pothosware/SoapySDR-build 3 | 4 | cd $HOME/build/pothosware 5 | git clone https://github.com/pothosware/SoapySDR.git 6 | 7 | cd $HOME/build/pothosware/SoapySDR-build 8 | cmake $HOME/build/pothosware/SoapySDR -DCMAKE_BUILD_TYPE=Release 9 | 10 | echo "Building SoapySDR.." 11 | make -j2 > /dev/null 12 | 13 | sudo make install 14 | -------------------------------------------------------------------------------- /.circleci/scripts/build_wxwidgets.sh: -------------------------------------------------------------------------------- 1 | # wxWidgets 2 | if [ -f "$HOME/build/wxWidgets/staticlib/bin/wx-config" ]; then 3 | echo "wxWidgets cache found; skipping.." 4 | exit 0 5 | else 6 | echo "wxWidgets cache not found; building.." 7 | fi 8 | 9 | 10 | echo "Fetch wxWidgets.." 11 | mkdir -p $HOME/build/wxWidgets/staticlib 12 | cd $HOME/build/wxWidgets 13 | wget https://github.com/wxWidgets/wxWidgets/releases/download/v3.2.1/wxWidgets-3.2.1.tar.bz2 > /dev/null 14 | 15 | echo "Unpacking wxWidgets.." 16 | tar -xvjf wxWidgets-3.2.1.tar.bz2 > /dev/null 17 | cd wxWidgets-3.2.1/ 18 | ./autogen.sh 19 | 20 | 21 | if [ "$(uname)" == "Linux" ]; then 22 | ./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" 23 | elif [ "$(uname)" == "Darwin" ]; then 24 | ./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 25 | fi 26 | 27 | echo "Building wxWidgets.." 28 | make V=1 -j2 29 | make install 30 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | cmake_build/ 3 | dist/ 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 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) 2 | ======== 3 | 4 | Cross-Platform Software-Defined Radio Application 5 | 6 | - The latest releases are available on the [CubicSDR Releases](https://github.com/cjcliffe/CubicSDR/releases) page. 7 | - Build instructions can be found at the [CubicSDR Wiki](https://github.com/cjcliffe/CubicSDR/wiki) page. 8 | - Manual is available at [cubicsdr.readthedocs.io](http://cubicsdr.readthedocs.io). 9 | - Manual contributions can be submitted to the [CubicSDR-Manual](https://github.com/cjcliffe/CubicSDR-Manual) repository. 10 | 11 | Utilizes: 12 | -------- 13 | - liquid-dsp (http://liquidsdr.org/ -- https://github.com/jgaeddert/liquid-dsp) 14 | - SoapySDR (http://www.pothosware.com/ -- https://github.com/pothosware/SoapySDR) 15 | - RtAudio (http://www.music.mcgill.ca/~gary/rtaudio/ -- http://github.com/thestk/rtaudio/) 16 | - LodePNG (http://lodev.org/lodepng/) 17 | - BMFont (http://www.angelcode.com/ -- http://www.angelcode.com/products/bmfont/) 18 | - Bitstream Vera font (http://en.wikipedia.org/wiki/Bitstream_Vera) 19 | - OpenGL (https://www.opengl.org/) 20 | - wxWidgets (https://www.wxwidgets.org/) 21 | - CMake (http://www.cmake.org/) 22 | 23 | Optional Libs: 24 | -------- 25 | - FFTW3 (can be compiled into liquid-dsp if desired) (http://www.fftw.org/ -- https://github.com/FFTW/fftw3) 26 | - hamlib (https://github.com/Hamlib/Hamlib) 27 | 28 | Recommended minimum requirements: 29 | -------------------- 30 | - Multi-core processor system with at least 1GB RAM. 31 | - Graphics card with at least 128MB video memory and OpenGL 3.x or ES 2.0 support. 32 | - OSX 10.9+ for Mac binary releases. 33 | - Windows 7+ for 64 or 32-bit Windows binary releases. 34 | - Linux and other embedded distribution support yet to be indexed, known to at least work on Debian 8+ and Ubuntu 14+. 35 | 36 | Platform build scripts and test builds: 37 | -------------------------------------- 38 | - MacOS (https://github.com/cjcliffe/CubicSDR-macOSBuild) 39 | - Windows (https://github.com/cjcliffe/CubicSDR-WinBuild) 40 | - Linux (AppImage) (https://github.com/cjcliffe/CubicSDR-AppImageKit) 41 | 42 | 43 | License: 44 | ------- 45 | - GPL-2.0+ 46 | -------------------------------------------------------------------------------- /cmake/CubicSDR.desktop.in: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Type=Application 3 | Exec=CubicSDR %u 4 | Icon=@CMAKE_INSTALL_PREFIX@/share/cubicsdr/CubicSDR 5 | Terminal=false 6 | Name=CubicSDR 7 | GenericName=CubicSDR 8 | Comment=Software-Defined Radio Application 9 | Categories=Science;HamRadio;DataVisualization; 10 | -------------------------------------------------------------------------------- /cmake/CubicSDRInfo.plist.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${MACOSX_BUNDLE_EXECUTABLE_NAME} 9 | CFBundleGetInfoString 10 | ${MACOSX_BUNDLE_INFO_STRING} 11 | CFBundleIconFile 12 | ${MACOSX_BUNDLE_ICON_FILE} 13 | CFBundleIdentifier 14 | ${MACOSX_BUNDLE_GUI_IDENTIFIER} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleLongVersionString 18 | ${MACOSX_BUNDLE_LONG_VERSION_STRING} 19 | CFBundleName 20 | ${MACOSX_BUNDLE_BUNDLE_NAME} 21 | CFBundlePackageType 22 | APPL 23 | CFBundleShortVersionString 24 | ${MACOSX_BUNDLE_SHORT_VERSION_STRING} 25 | CFBundleSignature 26 | ???? 27 | CFBundleVersion 28 | ${MACOSX_BUNDLE_BUNDLE_VERSION} 29 | CSResourcesFileMapped 30 | 31 | LSRequiresCarbon 32 | 33 | NSHumanReadableCopyright 34 | ${MACOSX_BUNDLE_COPYRIGHT} 35 | NSHighResolutionCapable 36 | 37 | NSSupportsAutomaticGraphicsSwitching 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /cmake/Modules/FindJack.cmake: -------------------------------------------------------------------------------- 1 | # Try to find JACK 2 | # This will define the following variables: 3 | # 4 | # JACK_FOUND - Whether Jack was found. 5 | # JACK_INCLUDE_DIRS - Jack include directories. 6 | # JACK_LIBRARIES - Jack libraries. 7 | 8 | include(FindPackageHandleStandardArgs) 9 | 10 | if(JACK_LIBRARIES AND JACK_INCLUDE_DIRS) 11 | 12 | # in cache already 13 | set(JACK_FOUND TRUE) 14 | 15 | else() 16 | 17 | find_package(PkgConfig) 18 | if(PKG_CONFIG_FOUND) 19 | pkg_check_modules(_JACK jack) 20 | endif(PKG_CONFIG_FOUND) 21 | 22 | find_path(JACK_INCLUDE_DIR 23 | NAMES 24 | jack/jack.h 25 | PATHS 26 | ${_JACK_INCLUDEDIR} 27 | ) 28 | 29 | find_library(JACK_LIBRARY 30 | NAMES 31 | jack 32 | PATHS 33 | ${_JACK_LIBDIR} 34 | ) 35 | 36 | set(JACK_INCLUDE_DIRS 37 | ${JACK_INCLUDE_DIR} 38 | ) 39 | 40 | set(JACK_LIBRARIES 41 | ${JACK_LIBRARY} 42 | ) 43 | 44 | find_package_handle_standard_args(Jack DEFAULT_MSG JACK_LIBRARIES JACK_INCLUDE_DIRS) 45 | 46 | # show the JACK_INCLUDE_DIRS and JACK_LIBRARIES variables only in the advanced view 47 | mark_as_advanced(JACK_INCLUDE_DIR JACK_LIBRARY JACK_INCLUDE_DIRS JACK_LIBRARIES) 48 | 49 | endif() 50 | 51 | -------------------------------------------------------------------------------- /cmake/Modules/FindLiquid.cmake: -------------------------------------------------------------------------------- 1 | # - Find LIQUID 2 | # Find the native LIQUID includes and library 3 | # 4 | # LIQUID_INCLUDES - where to find LIQUID.h 5 | # LIQUID_LIBRARIES - List of libraries when using LIQUID. 6 | # LIQUID_FOUND - True if LIQUID found. 7 | 8 | if (LIQUID_INCLUDES) 9 | # Already in cache, be silent 10 | set (LIQUID_FIND_QUIETLY TRUE) 11 | endif (LIQUID_INCLUDES) 12 | 13 | find_path (LIQUID_INCLUDES liquid/liquid.h) 14 | 15 | find_library (LIQUID_LIBRARIES NAMES liquid) 16 | 17 | # handle the QUIETLY and REQUIRED arguments and set LIQUID_FOUND to TRUE if 18 | # all listed variables are TRUE 19 | include (FindPackageHandleStandardArgs) 20 | find_package_handle_standard_args (LIQUID DEFAULT_MSG LIQUID_LIBRARIES LIQUID_INCLUDES) 21 | 22 | #mark_as_advanced (LIQUID_LIBRARIES LIQUID_INCLUDES) 23 | -------------------------------------------------------------------------------- /cmake/Modules/FindRtAudio.cmake: -------------------------------------------------------------------------------- 1 | # https://github.com/idiap/juicer/blob/master/cmake/FindRtAudio.cmake 2 | # 3 | # Copyright 2015 by Idiap Research Institute 4 | # 5 | # Licensed under 3-clause BSD. 6 | # 7 | # Author(s): 8 | # Phil Garner, November 2015 9 | # 10 | # ...but basically copied from FindSndFile in libube, in turn from the examples 11 | # on the web. 12 | # 13 | 14 | # 15 | # Try to find RtAudio 16 | # Once done this will define 17 | # RTAUDIO_FOUND - System has RtAudio 18 | # RTAUDIO_INCLUDE_DIR - The RtAudio include directories 19 | # RTAUDIO_LIBRARIES - The libraries needed to use RtAudio 20 | # RTAUDIO_DEFINITIONS - Compiler switches required for using RtAudio 21 | # RTAUDIO_VERSION_STRING - the version of RtAudio found 22 | # 23 | 24 | find_package(PkgConfig) 25 | pkg_check_modules(PC_RTAUDIO rtaudio) 26 | 27 | set(RTAUDIO_DEFINITIONS ${PC_RTAUDIO_CFLAGS_OTHER}) 28 | set(RTAUDIO_VERSION_STRING ${PC_RTAUDIO_VERSION}) 29 | 30 | find_path( 31 | RTAUDIO_INCLUDE_DIR RtAudio.h 32 | HINTS ${PC_RTAUDIO_INCLUDEDIR} ${PC_RTAUDIO_INCLUDE_DIRS} 33 | ) 34 | 35 | find_library( 36 | RTAUDIO_LIBRARIES NAMES rtaudio 37 | HINTS ${PC_RTAUDIO_LIBDIR} ${PC_RTAUDIO_LIBRARY_DIRS} 38 | ) 39 | 40 | include(FindPackageHandleStandardArgs) 41 | find_package_handle_standard_args( 42 | RtAudio 43 | REQUIRED_VARS RTAUDIO_LIBRARIES RTAUDIO_INCLUDE_DIR 44 | VERSION_VAR RTAUDIO_VERSION_STRING 45 | ) 46 | 47 | #mark_as_advanced(RTAUDIO_INCLUDE_DIR RTAUDIO_LIBRARIES) 48 | 49 | -------------------------------------------------------------------------------- /cmake/Modules/Findhamlib.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find Hamlib 2 | # Author: George L. Emigh - AB4BD 3 | # 4 | # Change Log: Charles J. Cliffe 5 | # Updates: 6 | # Jan 2015 - Add /opt/ paths for OSX MacPorts 7 | # - Fix HAMLIB_INCLUDE_DIR absolute search 8 | # - Add static lib support 9 | # TODO: 10 | # Windows support 11 | # 12 | # HAMLIB_FOUND - system has Hamlib 13 | # HAMLIB_LIBRARY - location of the library for hamlib 14 | # HAMLIB_INCLUDE_DIR - location of the include files for hamlib 15 | 16 | set(HAMLIB_FOUND FALSE) 17 | 18 | find_path(HAMLIB_INCLUDE_DIR 19 | NAMES hamlib/rig.h 20 | PATHS 21 | /usr/include 22 | /usr/local/include 23 | /opt/local/include 24 | ) 25 | 26 | find_library(HAMLIB_LIBRARY 27 | NAMES hamlib 28 | PATHS 29 | /usr/lib64/hamlib 30 | /usr/lib/hamlib 31 | /usr/lib64 32 | /usr/lib 33 | /usr/local/lib64/hamlib 34 | /usr/local/lib/hamlib 35 | /usr/local/lib64 36 | /usr/local/lib 37 | /opt/local/lib 38 | /opt/local/lib/hamlib 39 | ) 40 | 41 | find_library(HAMLIB_STATIC_LIBRARY 42 | NAMES libhamlib.a 43 | PATHS 44 | /usr/lib64/hamlib 45 | /usr/lib/hamlib 46 | /usr/lib64 47 | /usr/lib 48 | /usr/local/lib64/hamlib 49 | /usr/local/lib/hamlib 50 | /usr/local/lib64 51 | /usr/local/lib 52 | /opt/local/lib 53 | /opt/local/lib/hamlib 54 | ) 55 | 56 | GET_FILENAME_COMPONENT(HAMLIB_LIB_FOLDER ${HAMLIB_STATIC_LIBRARY} DIRECTORY) 57 | 58 | file(GLOB HAMLIB_STATIC_MODS ${HAMLIB_LIB_FOLDER}/hamlib-*.a) 59 | 60 | if(HAMLIB_INCLUDE_DIR AND HAMLIB_LIBRARY) 61 | set(HAMLIB_FOUND TRUE) 62 | # message(STATUS "Hamlib version: ${VERSION}") 63 | message(STATUS "Found hamlib library at: ${HAMLIB_LIBRARY}") 64 | message(STATUS "Found hamlib static library at: ${HAMLIB_STATIC_LIBRARY}") 65 | message(STATUS "Found hamlib static modules: ${HAMLIB_STATIC_MODS}") 66 | message(STATUS "Found hamlib include directory at: ${HAMLIB_INCLUDE_DIR}") 67 | endif(HAMLIB_INCLUDE_DIR AND HAMLIB_LIBRARY) 68 | 69 | IF(NOT HAMLIB_FOUND) 70 | IF(NOT HAMLIB_FIND_QUIETLY) 71 | MESSAGE(STATUS "HAMLIB was not found.") 72 | ELSE(NOT HAMLIB_FIND_QUIETLY) 73 | IF(HAMLIB_FIND_REQUIRED) 74 | MESSAGE(FATAL_ERROR "HAMLIB was not found.") 75 | ENDIF(HAMLIB_FIND_REQUIRED) 76 | ENDIF(NOT HAMLIB_FIND_QUIETLY) 77 | ENDIF(NOT HAMLIB_FOUND) -------------------------------------------------------------------------------- /cmake/cmake_uninstall.cmake.in: -------------------------------------------------------------------------------- 1 | IF(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/install_manifest.txt") 2 | MESSAGE(FATAL_ERROR "Cannot find install manifest: '${CMAKE_CURRENT_BINARY_DIR}/install_manifest.txt'") 3 | ENDIF(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/install_manifest.txt") 4 | 5 | FILE(READ "${CMAKE_CURRENT_BINARY_DIR}/install_manifest.txt" files) 6 | STRING(REGEX REPLACE " " ";" files "${files}") 7 | STRING(REGEX REPLACE "\n" ";" files "${files}") 8 | FOREACH(file ${files}) 9 | MESSAGE(STATUS "Uninstalling '$ENV{DESTDIR}${file}'") 10 | IF(EXISTS "$ENV{DESTDIR}${file}") 11 | EXEC_PROGRAM( 12 | "${CMAKE_COMMAND}" ARGS "-E remove '$ENV{DESTDIR}${file}'" 13 | OUTPUT_VARIABLE rm_out 14 | RETURN_VALUE rm_retval 15 | ) 16 | IF(NOT "${rm_retval}" STREQUAL 0) 17 | MESSAGE(FATAL_ERROR "Problem when removing '$ENV{DESTDIR}${file}'") 18 | ENDIF(NOT "${rm_retval}" STREQUAL 0) 19 | ELSE(EXISTS "$ENV{DESTDIR}${file}") 20 | MESSAGE(STATUS "File '$ENV{DESTDIR}${file}' does not exist.") 21 | ENDIF(EXISTS "$ENV{DESTDIR}${file}") 22 | ENDFOREACH(file) -------------------------------------------------------------------------------- /cmake/code_sign.sh.in: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | for f in ${APPS}/Contents/**/*.dylib 3 | do 4 | /usr/bin/codesign --force --verify --verbose --sign "${CUBICSDR_CERT}" $f 5 | done 6 | for f in ${APPS}/Contents/MacOS/modules/*.so 7 | do 8 | /usr/bin/codesign --force --verify --verbose --sign "${CUBICSDR_CERT}" $f 9 | done 10 | 11 | /usr/bin/codesign --force --verify --verbose --sign "${CUBICSDR_CERT}" ${APPS} 12 | -------------------------------------------------------------------------------- /cmake/dmg_sign.sh.in: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | /usr/bin/codesign --force --verify --verbose --sign "${CUBICSDR_CERT}" CubicSDR-${CPACK_PACKAGE_VERSION}-Darwin.dmg 3 | -------------------------------------------------------------------------------- /cubicsdr.rc: -------------------------------------------------------------------------------- 1 | id ICON "icon/CubicSDR.ico" 2 | frame_icon ICON "icon/CubicSDR.ico" -------------------------------------------------------------------------------- /external/cubicvr2/math/cubic_math.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // math.cpp 3 | // CubicVR2 4 | // 5 | // Created by Charles J. Cliffe on 2013-02-22. 6 | // Copyright (c) 2013 Charles J. Cliffe. All rights reserved. 7 | // 8 | 9 | #include "cubic_math.h" 10 | 11 | namespace CubicVR { 12 | std::ostream& operator<<(std::ostream &strm, const vec4 &v) { 13 | return strm << "{" << v.x << ", " << v.y << ", " << v.z << ", " << v.w << "}"; 14 | } 15 | std::ostream& operator<<(std::ostream &strm, const vec3 &v) { 16 | return strm << "{" << v.x << ", " << v.y << ", " << v.z << "}"; 17 | } 18 | std::ostream& operator<<(std::ostream &strm, const vec2 &v) { 19 | return strm << "{" << v.x << ", " << v.y << "}"; 20 | } 21 | std::ostream& operator<<(std::ostream &strm, const mat4 &m) { 22 | return strm << "{ " << m[0] << ", " << m[1] << ", " << m[2] << ", " << m[3] << endl 23 | << " " << m[4] << ", " << m[5] << ", " << m[6] << ", " << m[7] << endl 24 | << " " << m[8] << ", " << m[9] << ", " << m[10] << ", " << m[11] << endl 25 | << " " << m[12] << ", " << m[13] << ", " << m[14] << ", " << m[15] << " }" << endl; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /external/cubicvr2/math/cubic_math.h: -------------------------------------------------------------------------------- 1 | // 2 | // math.h 3 | // CubicVR2 4 | // 5 | // Created by Charles J. Cliffe on 2013-02-22. 6 | // Copyright (c) 2013 Charles J. Cliffe. All rights reserved. 7 | // 8 | 9 | #ifndef __CubicVR2__math__ 10 | #define __CubicVR2__math__ 11 | 12 | #include 13 | 14 | #include "aabb.h" 15 | #include "mat3.h" 16 | #include "mat4.h" 17 | #include "quaternion.h" 18 | #include "transform.h" 19 | #include "triangle.h" 20 | #include "vec2.h" 21 | #include "vec3.h" 22 | #include "vec4.h" 23 | #include "plane.h" 24 | #include "sphere.h" 25 | #include "frustum.h" 26 | 27 | namespace CubicVR { 28 | std::ostream& operator<<(std::ostream &strm, const vec4 &v); 29 | std::ostream& operator<<(std::ostream &strm, const vec3 &v); 30 | std::ostream& operator<<(std::ostream &strm, const vec2 &v); 31 | std::ostream& operator<<(std::ostream &strm, const mat4 &m); 32 | } 33 | 34 | 35 | #endif /* defined(__CubicVR2__math__) */ 36 | -------------------------------------------------------------------------------- /external/cubicvr2/math/cubic_types.h: -------------------------------------------------------------------------------- 1 | // 2 | // types.h 3 | // CubicVR2 4 | // 5 | // Created by Charles J. Cliffe on 2013-02-21. 6 | // Copyright (c) 2013 Charles J. Cliffe. All rights reserved. 7 | // 8 | 9 | #ifndef CubicVR2_types_h 10 | #define CubicVR2_types_h 11 | 12 | namespace CubicVR { 13 | 14 | typedef double __float64; 15 | typedef float __float32; 16 | 17 | typedef __float32 __float; 18 | 19 | #define COMBINE(x,y) x ## y 20 | #define floatSG(c, x,y) \ 21 | __float COMBINE(get,x)() { return y; } \ 22 | c & COMBINE(set,x)(__float value) { y = value; return *this; } 23 | #define intSG(c, x,y) \ 24 | int COMBINE(get,x)() { return y; } \ 25 | c & COMBINE(set,x)(int value) { y = value; return *this; } 26 | #define uintSG(c, x,y) \ 27 | unsigned int COMBINE(get,x)() { return y; } \ 28 | c & COMBINE(set,x)(unsigned int value) { y = value; return *this; } 29 | #define boolSG(c,x,y) \ 30 | bool COMBINE(get,x)() { return y; } \ 31 | c & COMBINE(set,x)(bool value) { y = value; return *this; } 32 | #define stringSG(c,x,y) \ 33 | string COMBINE(get,x)() { return y; } \ 34 | c & COMBINE(set,x)(string value) { y = value; return *this; } 35 | #define isBoolSG(c,x,y) \ 36 | bool COMBINE(is,x)() { return y; } \ 37 | c & COMBINE(set,x)(bool value) { y = value; return *this; } 38 | 39 | } 40 | 41 | #include 42 | #ifndef M_PI 43 | #define M_PI 3.14159265358979323846 44 | #endif 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /external/cubicvr2/math/mat3.h: -------------------------------------------------------------------------------- 1 | // 2 | // mat3.h 3 | // CubicVR2 4 | // 5 | // Created by Charles J. Cliffe on 2013-02-22. 6 | // Copyright (c) 2013 Charles J. Cliffe. All rights reserved. 7 | // 8 | 9 | #ifndef __CubicVR2__mat3__ 10 | #define __CubicVR2__mat3__ 11 | 12 | #include 13 | #include "vec3.h" 14 | #include 15 | #include 16 | namespace CubicVR { 17 | 18 | #define mat3SG(c,x,y) \ 19 | mat3 COMBINE(get,x)() { return y; } \ 20 | c & COMBINE(set,x)(mat3 value) { y = value; return *this; } 21 | 22 | struct mat3 { 23 | 24 | __float a,b,c,d,e,f,g,h,i; 25 | 26 | //access as-array: 27 | inline __float& operator [] (size_t i) { 28 | __float* as_array = (__float*)this; 29 | return (as_array[i]); 30 | } 31 | 32 | inline const __float& operator [] (size_t i) const { 33 | __float* as_array = (__float*)this; 34 | return (as_array[i]); 35 | } 36 | 37 | mat3(__float ai,__float bi,__float ci,__float di,__float ei,__float fi,__float gi,__float hi,__float ii) { 38 | a = ai; b = bi; c = ci; d = di; e = ei; f = fi; g = gi; h = hi; i = ii; 39 | }; 40 | 41 | mat3() { memset((__float *)this, 0, sizeof(mat3)); } 42 | // mat3 operator* (mat4 m) { return mat3::multiply(*this,m); }; 43 | // void operator*= (mat4 m) { *this = mat3::multiply(*this,m); }; 44 | 45 | 46 | static mat3 identity() { 47 | return mat3(1.0f, 0.0f, 0.0f, 48 | 0.0f, 1.0f, 0.0f, 49 | 0.0f, 0.0f, 1.0f); 50 | } 51 | 52 | static void transpose_inline(mat3 &mat) { 53 | __float a01 = mat[1], a02 = mat[2], a12 = mat[5]; 54 | 55 | mat[1] = mat[3]; 56 | mat[2] = mat[6]; 57 | mat[3] = a01; 58 | mat[5] = mat[7]; 59 | mat[6] = a02; 60 | mat[7] = a12; 61 | }; 62 | 63 | static mat3 transpose(mat3 mat_in) { 64 | __float a01 = mat_in[1], a02 = mat_in[2], a12 = mat_in[5]; 65 | 66 | mat3 mat; 67 | 68 | mat[1] = mat_in[3]; 69 | mat[2] = mat_in[6]; 70 | mat[3] = a01; 71 | mat[5] = mat_in[7]; 72 | mat[6] = a02; 73 | mat[7] = a12; 74 | 75 | return mat; 76 | }; 77 | 78 | static vec3 multiply(mat3 m1, vec3 m2) { 79 | vec3 mOut; 80 | 81 | mOut[0] = m2[0] * m1[0] + m2[3] * m1[1] + m2[6] * m1[2] ; 82 | mOut[1] = m2[1] * m1[0] + m2[4] * m1[1] + m2[7] * m1[2] ; 83 | mOut[2] = m2[2] * m1[0] + m2[5] * m1[1] + m2[8] * m1[2]; 84 | 85 | return mOut; 86 | }; 87 | }; 88 | 89 | 90 | } 91 | 92 | #endif /* defined(__CubicVR2__mat3__) */ 93 | -------------------------------------------------------------------------------- /external/cubicvr2/math/plane.h: -------------------------------------------------------------------------------- 1 | // 2 | // plane.h 3 | // CubicVR2 4 | // 5 | // Created by Charles J. Cliffe on 2013-02-22. 6 | // Copyright (c) 2013 Charles J. Cliffe. All rights reserved. 7 | // 8 | 9 | #ifndef CubicVR2_plane_h 10 | #define CubicVR2_plane_h 11 | 12 | #include "vec4.h" 13 | #include "vec3.h" 14 | 15 | namespace CubicVR { 16 | 17 | struct plane : vec4 { 18 | static int classifyPoint(vec4 plane, vec3 pt) { 19 | __float dist = (plane[0] * pt[0]) + (plane[1] * pt[1]) + (plane[2] * pt[2]) + (plane[3]); 20 | if (dist < 0) { 21 | return -1; 22 | } 23 | else if (dist > 0) { 24 | return 1; 25 | } 26 | return 0; 27 | }; 28 | }; 29 | 30 | } 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /external/cubicvr2/math/sphere.h: -------------------------------------------------------------------------------- 1 | // 2 | // sphere.h 3 | // CubicVR2 4 | // 5 | // Created by Charles J. Cliffe on 2013-02-22. 6 | // Copyright (c) 2013 Charles J. Cliffe. All rights reserved. 7 | // 8 | 9 | #ifndef CubicVR2_sphere_h 10 | #define CubicVR2_sphere_h 11 | 12 | #include "vec3.h" 13 | #include "vec4.h" 14 | 15 | namespace CubicVR { 16 | 17 | struct sphere { 18 | bool intersects(vec4 sphere, vec4 other) { 19 | vec3 spherePos(sphere[0], sphere[1], sphere[2]); 20 | vec3 otherPos(other[0], other[1], other[2]); 21 | vec3 diff = vec3::subtract(spherePos, otherPos); 22 | 23 | __float mag = sqrtf(diff[0] * diff[0] + diff[1] * diff[1] + diff[2] * diff[2]); 24 | __float sum_radii = sphere[3] + other[3]; 25 | 26 | if (mag * mag < sum_radii * sum_radii) { 27 | return true; 28 | } 29 | return false; 30 | } 31 | }; 32 | } 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /external/cubicvr2/math/triangle.h: -------------------------------------------------------------------------------- 1 | // 2 | // triangle.h 3 | // CubicVR2 4 | // 5 | // Created by Charles J. Cliffe on 2013-02-22. 6 | // Copyright (c) 2013 Charles J. Cliffe. All rights reserved. 7 | // 8 | 9 | #ifndef __CubicVR2__triangle__ 10 | #define __CubicVR2__triangle__ 11 | 12 | #include 13 | #include "vec3.h" 14 | 15 | namespace CubicVR { 16 | 17 | struct triangle { 18 | static vec3 normal(vec3 pt1, vec3 pt2, vec3 pt3) { 19 | 20 | __float v10 = pt1[0] - pt2[0]; 21 | __float v11 = pt1[1] - pt2[1]; 22 | __float v12 = pt1[2] - pt2[2]; 23 | __float v20 = pt2[0] - pt3[0]; 24 | __float v21 = pt2[1] - pt3[1]; 25 | __float v22 = pt2[2] - pt3[2]; 26 | 27 | vec3 mOut; 28 | 29 | mOut[0] = v11 * v22 - v12 * v21; 30 | mOut[1] = v12 * v20 - v10 * v22; 31 | mOut[2] = v10 * v21 - v11 * v20; 32 | 33 | return mOut; 34 | }; 35 | }; 36 | 37 | } 38 | 39 | 40 | #endif /* defined(__CubicVR2__triangle__) */ 41 | -------------------------------------------------------------------------------- /external/cubicvr2/math/vec4.h: -------------------------------------------------------------------------------- 1 | // 2 | // vec4.h 3 | // CubicVR2 4 | // 5 | // Created by Charles J. Cliffe on 2013-02-22. 6 | // Copyright (c) 2013 Charles J. Cliffe. All rights reserved. 7 | // 8 | 9 | #ifndef __CubicVR2__vec4__ 10 | #define __CubicVR2__vec4__ 11 | 12 | #include 13 | #include "cubic_types.h" 14 | #include 15 | #include 16 | 17 | namespace CubicVR { 18 | 19 | #define vec4SG(c,x,y) \ 20 | vec3 COMBINE(get,x)() { return y; } \ 21 | c & COMBINE(set,x)(vec3 value) { y = value; return *this; } 22 | 23 | struct vec4 { 24 | 25 | __float x, y, z, w; 26 | 27 | public: 28 | __float& r() { return x; } 29 | __float& g() { return y; } 30 | __float& b() { return z; } 31 | __float& a() { return w; } 32 | 33 | //access as-array: 34 | inline __float& operator [] (size_t i) { 35 | __float* as_array = (__float*)this; 36 | return (as_array[i]); 37 | } 38 | 39 | inline const __float& operator [] (size_t i) const { 40 | __float* as_array = (__float*)this; 41 | return (as_array[i]); 42 | } 43 | 44 | vec4 (__float xi,__float yi,__float zi,__float wi) { x = xi; y = yi; z = zi; w = wi; } 45 | vec4 () { x = y = z = w = 0.0f; } 46 | 47 | vec4 operator*(__float v) { return vec4(x*v, y*v, z*v, w*v); } 48 | // vec4 operator*(vec4 v) { return vec4::cross(*this,v); } 49 | // vec4 operator+(vec4 v) { return vec4::add(*this,v); } 50 | // vec4 operator-(vec4 v) { return vec4::subtract(*this,v); } 51 | 52 | static __float length(vec4 a, vec4 b) { 53 | __float v[4] = {a[0]-b[0],a[1]-b[1],a[2]-b[2],a[3]-b[3]}; 54 | return sqrtf(v[0] * v[0] + v[1] * v[1] + v[2] * v[2] + v[3] * v[3]); 55 | }; 56 | 57 | static __float length(vec4 v) { 58 | return sqrtf(v[0] * v[0] + v[1] * v[1] + v[2] * v[2] + v[3] * v[3]); 59 | }; 60 | 61 | static vec4 normalize(vec4 v) { 62 | __float n = sqrtf(vec4::length(v)); 63 | 64 | v[0] /= n; 65 | v[1] /= n; 66 | v[2] /= n; 67 | v[3] /= n; 68 | 69 | return v; 70 | }; 71 | 72 | static __float dot(vec4 v1, vec4 v2) { 73 | return v1[0] * v2[0] + v1[1] * v2[1] + v1[2] * v2[2] + v1[3] * v2[3]; 74 | }; 75 | 76 | }; 77 | 78 | } 79 | 80 | #endif /* defined(__CubicVR2__vec4__) */ 81 | -------------------------------------------------------------------------------- /external/deb/deb_post.sh.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # found at https://github.com/paralect/robomongo/blob/master/install/linux/fixup_deb.sh.in 3 | set -e 4 | mkdir fix_up_deb 5 | dpkg-deb -x @CPACK_PACKAGE_FILE_NAME@.deb fix_up_deb 6 | dpkg-deb --control @CPACK_PACKAGE_FILE_NAME@.deb fix_up_deb/DEBIAN 7 | rm @CPACK_PACKAGE_FILE_NAME@.deb 8 | chmod 0644 fix_up_deb/DEBIAN/md5sums 9 | find -type d -print0 | xargs -0 chmod 755 10 | fakeroot dpkg -b fix_up_deb @CPACK_PACKAGE_FILE_NAME@.deb 11 | rm -rf fix_up_deb 12 | -------------------------------------------------------------------------------- /external/hamlib/32/libhamlib-4.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjcliffe/CubicSDR/033330367cd179d7b04503027d41afa7514036f4/external/hamlib/32/libhamlib-4.dll -------------------------------------------------------------------------------- /external/hamlib/32/libhamlib-4.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjcliffe/CubicSDR/033330367cd179d7b04503027d41afa7514036f4/external/hamlib/32/libhamlib-4.exp -------------------------------------------------------------------------------- /external/hamlib/32/libhamlib-4.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjcliffe/CubicSDR/033330367cd179d7b04503027d41afa7514036f4/external/hamlib/32/libhamlib-4.lib -------------------------------------------------------------------------------- /external/hamlib/64/libhamlib-4.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjcliffe/CubicSDR/033330367cd179d7b04503027d41afa7514036f4/external/hamlib/64/libhamlib-4.dll -------------------------------------------------------------------------------- /external/hamlib/64/libhamlib-4.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjcliffe/CubicSDR/033330367cd179d7b04503027d41afa7514036f4/external/hamlib/64/libhamlib-4.exp -------------------------------------------------------------------------------- /external/hamlib/64/libhamlib-4.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjcliffe/CubicSDR/033330367cd179d7b04503027d41afa7514036f4/external/hamlib/64/libhamlib-4.lib -------------------------------------------------------------------------------- /external/hamlib/Hamlib_deps_on_Windows.txt: -------------------------------------------------------------------------------- 1 | The Hamlib specific dependencies on Windows platforms are: 2 | - libwinpthread-1.dll 3 | for both x86 and x64, 4 | and also 5 | - libgcc_s_sjlj-1.dll for x86 targets only. 6 | 7 | Those dependencies are installed from external/msvc/[x86|x64] dirs. 8 | 9 | In addition, Hamlib also uses libusb but since it is a common 10 | dependency with SoapySDR, it is not included in the external dirs. 11 | 12 | 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: 13 | - Open the 'Developper Command Prompt for VS 2022' 14 | - For Win32, go to hamlib/32 directory and run 'LIB /DEF:libhamlib-4.def /MACHINE:X86' 15 | - For Win64, go to hamlib/64 directory and run 'LIB /DEF:libhamlib-4.def /MACHINE:X64' 16 | -------------------------------------------------------------------------------- /external/hamlib/hamlib/rig_dll.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Hamlib Win32 DLL build definitions 3 | * Copyright (c) 2001-2009 by Stephane Fillod 4 | * 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | /* 23 | * Provide definitions to compile in Windows 24 | * using C-friendly options, e.g. 25 | * 26 | * HAMLIB_API -> __cdecl 27 | * HAMLIB_EXPORT, HAMLIB_EXPORT_VAR -> __declspec(dllexport) 28 | * BACKEND_EXPORT, BACKEND_EXPORT_VAR -> __declspec(dllexport) 29 | * 30 | * No effect in non-Windows environments. 31 | */ 32 | 33 | #if defined(_WIN32) && !defined(__CYGWIN__) 34 | # undef HAMLIB_IMPEXP 35 | # undef HAMLIB_CPP_IMPEXP 36 | # undef HAMLIB_API 37 | # undef HAMLIB_EXPORT 38 | # undef HAMLIB_EXPORT_VAR 39 | # undef BACKEND_EXPORT 40 | # undef BACKEND_EXPORT_VAR 41 | # undef HAMLIB_DLL_IMPORT 42 | # undef HAMLIB_DLL_EXPORT 43 | 44 | # if defined (__BORLANDC__) 45 | # define HAMLIB_DLL_IMPORT __import 46 | # define HAMLIB_DLL_EXPORT __export 47 | # else 48 | # define HAMLIB_DLL_IMPORT __declspec(dllimport) 49 | # define HAMLIB_DLL_EXPORT __declspec(dllexport) 50 | # endif 51 | 52 | # ifdef DLL_EXPORT 53 | /* HAMLIB_API may be set to __stdcall for VB, .. */ 54 | # define HAMLIB_API __cdecl 55 | # ifdef IN_HAMLIB 56 | # define HAMLIB_CPP_IMPEXP HAMLIB_DLL_EXPORT 57 | # define HAMLIB_IMPEXP HAMLIB_DLL_EXPORT 58 | # else 59 | # define HAMLIB_CPP_IMPEXP HAMLIB_DLL_IMPORT 60 | # define HAMLIB_IMPEXP HAMLIB_DLL_IMPORT 61 | # endif 62 | # else 63 | /* static build, only export the backend entry points for lt_dlsym */ 64 | # define HAMLIB_CPP_IMPEXP HAMLIB_DLL_EXPORT 65 | # endif 66 | #endif 67 | 68 | 69 | /* Take care of non-cygwin platforms */ 70 | #if !defined(HAMLIB_IMPEXP) 71 | # define HAMLIB_IMPEXP 72 | #endif 73 | #if !defined(HAMLIB_CPP_IMPEXP) 74 | # define HAMLIB_CPP_IMPEXP 75 | #endif 76 | #if !defined(HAMLIB_API) 77 | # define HAMLIB_API 78 | #endif 79 | #if !defined(HAMLIB_EXPORT) 80 | # define HAMLIB_EXPORT(type) HAMLIB_IMPEXP type HAMLIB_API 81 | #endif 82 | #if !defined(HAMLIB_EXPORT_VAR) 83 | # define HAMLIB_EXPORT_VAR(type) HAMLIB_IMPEXP type 84 | #endif 85 | #if !defined(BACKEND_EXPORT) 86 | # define BACKEND_EXPORT(type) HAMLIB_CPP_IMPEXP type HAMLIB_API 87 | #endif 88 | #if !defined(BACKEND_EXPORT_VAR) 89 | # define BACKEND_EXPORT_VAR(type) HAMLIB_CPP_IMPEXP type 90 | #endif 91 | -------------------------------------------------------------------------------- /external/liquid-dsp/How_to_build_liquid_dsp_for_Windows.txt: -------------------------------------------------------------------------------- 1 | - Building libliquid.dll and libliquid.a: 2 | ----------------------------------------- 3 | - Install the Msys2 distribution as described on their site (https://msys2.github.io/) 4 | - Add mingw32 and mingw64 compiler to the Msys2 installation. 5 | - Copy config.h, makefile.mingw32, makefile.mingw64 in the liquid-dsp root directory. 6 | - 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. 7 | - 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. 8 | 9 | This process generates a .dll, .a together with libliquid.def the listing exported functions, and libliquid.lib the import lib matching the dll. 10 | 11 | In order to develop with Visual Studio, you need both the include/liquid.h at source level, and the libliquid.lib import library referenced in your project. -------------------------------------------------------------------------------- /external/liquid-dsp/gcc/32/libliquid.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjcliffe/CubicSDR/033330367cd179d7b04503027d41afa7514036f4/external/liquid-dsp/gcc/32/libliquid.a -------------------------------------------------------------------------------- /external/liquid-dsp/gcc/32/libliquid.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjcliffe/CubicSDR/033330367cd179d7b04503027d41afa7514036f4/external/liquid-dsp/gcc/32/libliquid.dll -------------------------------------------------------------------------------- /external/liquid-dsp/gcc/64/libliquid.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjcliffe/CubicSDR/033330367cd179d7b04503027d41afa7514036f4/external/liquid-dsp/gcc/64/libliquid.a -------------------------------------------------------------------------------- /external/liquid-dsp/gcc/64/libliquid.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjcliffe/CubicSDR/033330367cd179d7b04503027d41afa7514036f4/external/liquid-dsp/gcc/64/libliquid.dll -------------------------------------------------------------------------------- /external/liquid-dsp/msvc/32/libliquid.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjcliffe/CubicSDR/033330367cd179d7b04503027d41afa7514036f4/external/liquid-dsp/msvc/32/libliquid.dll -------------------------------------------------------------------------------- /external/liquid-dsp/msvc/32/libliquid.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjcliffe/CubicSDR/033330367cd179d7b04503027d41afa7514036f4/external/liquid-dsp/msvc/32/libliquid.lib -------------------------------------------------------------------------------- /external/liquid-dsp/msvc/64/libliquid.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjcliffe/CubicSDR/033330367cd179d7b04503027d41afa7514036f4/external/liquid-dsp/msvc/64/libliquid.dll -------------------------------------------------------------------------------- /external/liquid-dsp/msvc/64/libliquid.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjcliffe/CubicSDR/033330367cd179d7b04503027d41afa7514036f4/external/liquid-dsp/msvc/64/libliquid.lib -------------------------------------------------------------------------------- /external/msvc/x64/libwinpthread-1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjcliffe/CubicSDR/033330367cd179d7b04503027d41afa7514036f4/external/msvc/x64/libwinpthread-1.dll -------------------------------------------------------------------------------- /external/msvc/x86/libgcc_s_dw2-1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjcliffe/CubicSDR/033330367cd179d7b04503027d41afa7514036f4/external/msvc/x86/libgcc_s_dw2-1.dll -------------------------------------------------------------------------------- /external/msvc/x86/libgcc_s_sjlj-1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjcliffe/CubicSDR/033330367cd179d7b04503027d41afa7514036f4/external/msvc/x86/libgcc_s_sjlj-1.dll -------------------------------------------------------------------------------- /external/msvc/x86/libwinpthread-1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjcliffe/CubicSDR/033330367cd179d7b04503027d41afa7514036f4/external/msvc/x86/libwinpthread-1.dll -------------------------------------------------------------------------------- /external/rs232/README: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjcliffe/CubicSDR/033330367cd179d7b04503027d41afa7514036f4/external/rs232/README -------------------------------------------------------------------------------- /external/rs232/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjcliffe/CubicSDR/033330367cd179d7b04503027d41afa7514036f4/external/rs232/README.md -------------------------------------------------------------------------------- /external/rs232/rs232-win.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjcliffe/CubicSDR/033330367cd179d7b04503027d41afa7514036f4/external/rs232/rs232-win.cpp -------------------------------------------------------------------------------- /external/rs232/rs232.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjcliffe/CubicSDR/033330367cd179d7b04503027d41afa7514036f4/external/rs232/rs232.h -------------------------------------------------------------------------------- /external/tinyxml/tinystr.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | www.sourceforge.net/projects/tinyxml 3 | 4 | This software is provided 'as-is', without any express or implied 5 | warranty. In no event will the authors be held liable for any 6 | damages arising from the use of this software. 7 | 8 | Permission is granted to anyone to use this software for any 9 | purpose, including commercial applications, and to alter it and 10 | redistribute it freely, subject to the following restrictions: 11 | 12 | 1. The origin of this software must not be misrepresented; you must 13 | not claim that you wrote the original software. If you use this 14 | software in a product, an acknowledgment in the product documentation 15 | would be appreciated but is not required. 16 | 17 | 2. Altered source versions must be plainly marked as such, and 18 | must not be misrepresented as being the original software. 19 | 20 | 3. This notice may not be removed or altered from any source 21 | distribution. 22 | */ 23 | 24 | 25 | #ifndef TIXML_USE_STL 26 | 27 | #include "tinystr.h" 28 | 29 | // Error value for find primitive 30 | const TiXmlString::size_type TiXmlString::npos = static_cast< TiXmlString::size_type >(-1); 31 | 32 | 33 | // Null rep. 34 | TiXmlString::Rep TiXmlString::nullrep_ = { 0, 0, { '\0' } }; 35 | 36 | 37 | void TiXmlString::reserve (size_type cap) 38 | { 39 | if (cap > capacity()) 40 | { 41 | TiXmlString tmp; 42 | tmp.init(length(), cap); 43 | memcpy(tmp.start(), data(), length()); 44 | swap(tmp); 45 | } 46 | } 47 | 48 | 49 | TiXmlString& TiXmlString::assign(const char* str, size_type len) 50 | { 51 | size_type cap = capacity(); 52 | if (len > cap || cap > 3*(len + 8)) 53 | { 54 | TiXmlString tmp; 55 | tmp.init(len); 56 | memcpy(tmp.start(), str, len); 57 | swap(tmp); 58 | } 59 | else 60 | { 61 | memmove(start(), str, len); 62 | set_size(len); 63 | } 64 | return *this; 65 | } 66 | 67 | 68 | TiXmlString& TiXmlString::append(const char* str, size_type len) 69 | { 70 | size_type newsize = length() + len; 71 | if (newsize > capacity()) 72 | { 73 | reserve (newsize + capacity()); 74 | } 75 | memmove(finish(), str, len); 76 | set_size(newsize); 77 | return *this; 78 | } 79 | 80 | 81 | TiXmlString operator + (const TiXmlString & a, const TiXmlString & b) 82 | { 83 | TiXmlString tmp; 84 | tmp.reserve(a.length() + b.length()); 85 | tmp += a; 86 | tmp += b; 87 | return tmp; 88 | } 89 | 90 | TiXmlString operator + (const TiXmlString & a, const char* b) 91 | { 92 | TiXmlString tmp; 93 | TiXmlString::size_type b_len = static_cast( strlen(b) ); 94 | tmp.reserve(a.length() + b_len); 95 | tmp += a; 96 | tmp.append(b, b_len); 97 | return tmp; 98 | } 99 | 100 | TiXmlString operator + (const char* a, const TiXmlString & b) 101 | { 102 | TiXmlString tmp; 103 | TiXmlString::size_type a_len = static_cast( strlen(a) ); 104 | tmp.reserve(a_len + b.length()); 105 | tmp.append(a, a_len); 106 | tmp += b; 107 | return tmp; 108 | } 109 | 110 | 111 | #endif // TIXML_USE_STL 112 | -------------------------------------------------------------------------------- /external/tinyxml/tinyxmlerror.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | www.sourceforge.net/projects/tinyxml 3 | Original code (2.0 and earlier )copyright (c) 2000-2006 Lee Thomason (www.grinninglizard.com) 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any 7 | damages arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any 10 | purpose, including commercial applications, and to alter it and 11 | redistribute it freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must 14 | not claim that you wrote the original software. If you use this 15 | software in a product, an acknowledgment in the product documentation 16 | would be appreciated but is not required. 17 | 18 | 2. Altered source versions must be plainly marked as such, and 19 | must not be misrepresented as being the original software. 20 | 21 | 3. This notice may not be removed or altered from any source 22 | distribution. 23 | */ 24 | 25 | #include "tinyxml.h" 26 | 27 | // The goal of the seperate error file is to make the first 28 | // step towards localization. tinyxml (currently) only supports 29 | // english error messages, but the could now be translated. 30 | // 31 | // It also cleans up the code a bit. 32 | // 33 | 34 | const char* TiXmlBase::errorString[ TiXmlBase::TIXML_ERROR_STRING_COUNT ] = 35 | { 36 | "No error", 37 | "Error", 38 | "Failed to open file", 39 | "Error parsing Element.", 40 | "Failed to read Element name", 41 | "Error reading Element value.", 42 | "Error reading Attributes.", 43 | "Error: empty tag.", 44 | "Error reading end tag.", 45 | "Error parsing Unknown.", 46 | "Error parsing Comment.", 47 | "Error parsing Declaration.", 48 | "Error document empty.", 49 | "Error null (0) or unexpected EOF found in input stream.", 50 | "Error parsing CDATA.", 51 | "Error when TiXmlDocument added to document, because TiXmlDocument can only be at the root.", 52 | }; 53 | -------------------------------------------------------------------------------- /external/tinyxml/xmltest.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjcliffe/CubicSDR/033330367cd179d7b04503027d41afa7514036f4/external/tinyxml/xmltest.cpp -------------------------------------------------------------------------------- /font/vera_sans_mono12.bmfc: -------------------------------------------------------------------------------- 1 | # AngelCode Bitmap Font Generator configuration file 2 | fileVersion=1 3 | 4 | # font settings 5 | fontName=Bitstream Vera Sans Mono 6 | fontFile=VeraMono.ttf 7 | charSet=0 8 | fontSize=12 9 | aa=1 10 | scaleH=100 11 | useSmoothing=0 12 | isBold=0 13 | isItalic=0 14 | useUnicode=1 15 | disableBoxChars=1 16 | outputInvalidCharGlyph=0 17 | dontIncludeKerningPairs=0 18 | useHinting=1 19 | renderFromOutline=0 20 | useClearType=0 21 | 22 | # character alignment 23 | paddingDown=0 24 | paddingUp=0 25 | paddingRight=0 26 | paddingLeft=0 27 | spacingHoriz=1 28 | spacingVert=1 29 | useFixedHeight=1 30 | forceZero=0 31 | 32 | # output file 33 | outWidth=256 34 | outHeight=128 35 | outBitDepth=32 36 | fontDescFormat=0 37 | fourChnlPacked=0 38 | textureFormat=png 39 | textureCompression=0 40 | alphaChnl=1 41 | redChnl=0 42 | greenChnl=0 43 | blueChnl=0 44 | invA=0 45 | invR=0 46 | invG=0 47 | invB=0 48 | 49 | # outline 50 | outlineThickness=0 51 | 52 | # selected chars 53 | chars=32-126,160-255,262-263,268-269,273,286-287,304-305,321-322,338-339,350-353,376,381-382,402,710-711 54 | chars=728-733,937,960,8211-8212,8216-8218,8220-8222,8224-8226,8230,8240,8249-8250,8364,8482,8706,8710 55 | chars=8719,8721-8722,8725,8729-8730,8734,8747,8776,8800,8804-8805,9674 56 | 57 | # imported icon images 58 | -------------------------------------------------------------------------------- /font/vera_sans_mono12_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjcliffe/CubicSDR/033330367cd179d7b04503027d41afa7514036f4/font/vera_sans_mono12_0.png -------------------------------------------------------------------------------- /font/vera_sans_mono16.bmfc: -------------------------------------------------------------------------------- 1 | # AngelCode Bitmap Font Generator configuration file 2 | fileVersion=1 3 | 4 | # font settings 5 | fontName=Bitstream Vera Sans Mono 6 | fontFile=VeraMono.ttf 7 | charSet=0 8 | fontSize=16 9 | aa=1 10 | scaleH=100 11 | useSmoothing=1 12 | isBold=0 13 | isItalic=0 14 | useUnicode=1 15 | disableBoxChars=1 16 | outputInvalidCharGlyph=0 17 | dontIncludeKerningPairs=0 18 | useHinting=1 19 | renderFromOutline=0 20 | useClearType=0 21 | 22 | # character alignment 23 | paddingDown=0 24 | paddingUp=0 25 | paddingRight=0 26 | paddingLeft=0 27 | spacingHoriz=1 28 | spacingVert=1 29 | useFixedHeight=1 30 | forceZero=0 31 | 32 | # output file 33 | outWidth=256 34 | outHeight=128 35 | outBitDepth=32 36 | fontDescFormat=0 37 | fourChnlPacked=0 38 | textureFormat=png 39 | textureCompression=0 40 | alphaChnl=1 41 | redChnl=0 42 | greenChnl=0 43 | blueChnl=0 44 | invA=0 45 | invR=0 46 | invG=0 47 | invB=0 48 | 49 | # outline 50 | outlineThickness=0 51 | 52 | # selected chars 53 | chars=32-126,160-255,262-263,268-269,273,286-287,304-305,321-322,338-339,350-353,376,381-382,402,710-711 54 | chars=728-733,937,960,8211-8212,8216-8218,8220-8222,8224-8226,8230,8240,8249-8250,8364,8482,8706,8710 55 | chars=8719,8721-8722,8725,8729-8730,8734,8747,8776,8800,8804-8805,9674 56 | 57 | # imported icon images 58 | -------------------------------------------------------------------------------- /font/vera_sans_mono16_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjcliffe/CubicSDR/033330367cd179d7b04503027d41afa7514036f4/font/vera_sans_mono16_0.png -------------------------------------------------------------------------------- /font/vera_sans_mono18.bmfc: -------------------------------------------------------------------------------- 1 | # AngelCode Bitmap Font Generator configuration file 2 | fileVersion=1 3 | 4 | # font settings 5 | fontName=Bitstream Vera Sans Mono 6 | fontFile=VeraMono.ttf 7 | charSet=0 8 | fontSize=18 9 | aa=1 10 | scaleH=100 11 | useSmoothing=1 12 | isBold=0 13 | isItalic=0 14 | useUnicode=1 15 | disableBoxChars=1 16 | outputInvalidCharGlyph=0 17 | dontIncludeKerningPairs=0 18 | useHinting=1 19 | renderFromOutline=0 20 | useClearType=1 21 | 22 | # character alignment 23 | paddingDown=0 24 | paddingUp=0 25 | paddingRight=0 26 | paddingLeft=0 27 | spacingHoriz=1 28 | spacingVert=1 29 | useFixedHeight=1 30 | forceZero=0 31 | 32 | # output file 33 | outWidth=256 34 | outHeight=256 35 | outBitDepth=32 36 | fontDescFormat=0 37 | fourChnlPacked=0 38 | textureFormat=png 39 | textureCompression=0 40 | alphaChnl=1 41 | redChnl=0 42 | greenChnl=0 43 | blueChnl=0 44 | invA=0 45 | invR=0 46 | invG=0 47 | invB=0 48 | 49 | # outline 50 | outlineThickness=0 51 | 52 | # selected chars 53 | chars=32-126,160-255,262-263,268-269,273,286-287,304-305,321-322,338-339,350-353,376,381-382,402,710-711 54 | chars=728-733,937,960,8211-8212,8216-8218,8220-8222,8224-8226,8230,8240,8249-8250,8364,8482,8706,8710 55 | chars=8719,8721-8722,8725,8729-8730,8734,8747,8776,8800,8804-8805,9674 56 | 57 | # imported icon images 58 | -------------------------------------------------------------------------------- /font/vera_sans_mono18_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjcliffe/CubicSDR/033330367cd179d7b04503027d41afa7514036f4/font/vera_sans_mono18_0.png -------------------------------------------------------------------------------- /font/vera_sans_mono24.bmfc: -------------------------------------------------------------------------------- 1 | # AngelCode Bitmap Font Generator configuration file 2 | fileVersion=1 3 | 4 | # font settings 5 | fontName=Bitstream Vera Sans Mono 6 | fontFile=VeraMono.ttf 7 | charSet=0 8 | fontSize=24 9 | aa=1 10 | scaleH=100 11 | useSmoothing=1 12 | isBold=0 13 | isItalic=0 14 | useUnicode=1 15 | disableBoxChars=1 16 | outputInvalidCharGlyph=0 17 | dontIncludeKerningPairs=0 18 | useHinting=1 19 | renderFromOutline=0 20 | useClearType=1 21 | 22 | # character alignment 23 | paddingDown=0 24 | paddingUp=0 25 | paddingRight=0 26 | paddingLeft=0 27 | spacingHoriz=1 28 | spacingVert=1 29 | useFixedHeight=1 30 | forceZero=0 31 | 32 | # output file 33 | outWidth=512 34 | outHeight=256 35 | outBitDepth=32 36 | fontDescFormat=0 37 | fourChnlPacked=0 38 | textureFormat=png 39 | textureCompression=0 40 | alphaChnl=1 41 | redChnl=0 42 | greenChnl=0 43 | blueChnl=0 44 | invA=0 45 | invR=0 46 | invG=0 47 | invB=0 48 | 49 | # outline 50 | outlineThickness=0 51 | 52 | # selected chars 53 | chars=32-126,160-255,262-263,268-269,273,286-287,304-305,321-322,338-339,350-353,376,381-382,402,710-711 54 | chars=728-733,937,960,8211-8212,8216-8218,8220-8222,8224-8226,8230,8240,8249-8250,8364,8482,8706,8710 55 | chars=8719,8721-8722,8725,8729-8730,8734,8747,8776,8800,8804-8805,9674 56 | 57 | # imported icon images 58 | -------------------------------------------------------------------------------- /font/vera_sans_mono24_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjcliffe/CubicSDR/033330367cd179d7b04503027d41afa7514036f4/font/vera_sans_mono24_0.png -------------------------------------------------------------------------------- /font/vera_sans_mono27.bmfc: -------------------------------------------------------------------------------- 1 | # AngelCode Bitmap Font Generator configuration file 2 | fileVersion=1 3 | 4 | # font settings 5 | fontName=Bitstream Vera Sans Mono 6 | fontFile=VeraMoBd.ttf 7 | charSet=0 8 | fontSize=27 9 | aa=1 10 | scaleH=100 11 | useSmoothing=1 12 | isBold=0 13 | isItalic=0 14 | useUnicode=1 15 | disableBoxChars=1 16 | outputInvalidCharGlyph=0 17 | dontIncludeKerningPairs=0 18 | useHinting=1 19 | renderFromOutline=0 20 | useClearType=1 21 | 22 | # character alignment 23 | paddingDown=0 24 | paddingUp=0 25 | paddingRight=0 26 | paddingLeft=0 27 | spacingHoriz=1 28 | spacingVert=1 29 | useFixedHeight=1 30 | forceZero=0 31 | 32 | # output file 33 | outWidth=512 34 | outHeight=256 35 | outBitDepth=32 36 | fontDescFormat=0 37 | fourChnlPacked=0 38 | textureFormat=png 39 | textureCompression=0 40 | alphaChnl=1 41 | redChnl=0 42 | greenChnl=0 43 | blueChnl=0 44 | invA=0 45 | invR=0 46 | invG=0 47 | invB=0 48 | 49 | # outline 50 | outlineThickness=0 51 | 52 | # selected chars 53 | chars=32-126,160-255,262-263,268-269,273,286-287,304-305,321-322,338-339,350-353,376,381-382,402,710-711 54 | chars=728-733,937,960,8211-8212,8216-8218,8220-8222,8224-8226,8230,8240,8249-8250,8364,8482,8706,8710 55 | chars=8719,8721-8722,8725,8729-8730,8734,8747,8776,8800,8804-8805,9674 56 | 57 | # imported icon images 58 | -------------------------------------------------------------------------------- /font/vera_sans_mono27_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjcliffe/CubicSDR/033330367cd179d7b04503027d41afa7514036f4/font/vera_sans_mono27_0.png -------------------------------------------------------------------------------- /font/vera_sans_mono32.bmfc: -------------------------------------------------------------------------------- 1 | # AngelCode Bitmap Font Generator configuration file 2 | fileVersion=1 3 | 4 | # font settings 5 | fontName=Bitstream Vera Sans Mono 6 | fontFile=VeraMono.ttf 7 | charSet=0 8 | fontSize=32 9 | aa=1 10 | scaleH=100 11 | useSmoothing=1 12 | isBold=0 13 | isItalic=0 14 | useUnicode=1 15 | disableBoxChars=1 16 | outputInvalidCharGlyph=0 17 | dontIncludeKerningPairs=0 18 | useHinting=1 19 | renderFromOutline=0 20 | useClearType=0 21 | 22 | # character alignment 23 | paddingDown=0 24 | paddingUp=0 25 | paddingRight=0 26 | paddingLeft=0 27 | spacingHoriz=1 28 | spacingVert=1 29 | useFixedHeight=1 30 | forceZero=0 31 | 32 | # output file 33 | outWidth=512 34 | outHeight=256 35 | outBitDepth=32 36 | fontDescFormat=0 37 | fourChnlPacked=0 38 | textureFormat=png 39 | textureCompression=0 40 | alphaChnl=1 41 | redChnl=0 42 | greenChnl=0 43 | blueChnl=0 44 | invA=0 45 | invR=0 46 | invG=0 47 | invB=0 48 | 49 | # outline 50 | outlineThickness=0 51 | 52 | # selected chars 53 | chars=32-126,160-255,262-263,268-269,273,286-287,304-305,321-322,338-339,350-353,376,381-382,402,710-711 54 | chars=728-733,937,960,8211-8212,8216-8218,8220-8222,8224-8226,8230,8240,8249-8250,8364,8482,8706,8710 55 | chars=8719,8721-8722,8725,8729-8730,8734,8747,8776,8800,8804-8805,9674 56 | 57 | # imported icon images 58 | -------------------------------------------------------------------------------- /font/vera_sans_mono32_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjcliffe/CubicSDR/033330367cd179d7b04503027d41afa7514036f4/font/vera_sans_mono32_0.png -------------------------------------------------------------------------------- /font/vera_sans_mono36.bmfc: -------------------------------------------------------------------------------- 1 | # AngelCode Bitmap Font Generator configuration file 2 | fileVersion=1 3 | 4 | # font settings 5 | fontName=Bitstream Vera Sans Mono 6 | fontFile=VeraMoBd.ttf 7 | charSet=0 8 | fontSize=36 9 | aa=1 10 | scaleH=100 11 | useSmoothing=1 12 | isBold=0 13 | isItalic=0 14 | useUnicode=1 15 | disableBoxChars=1 16 | outputInvalidCharGlyph=0 17 | dontIncludeKerningPairs=0 18 | useHinting=1 19 | renderFromOutline=0 20 | useClearType=1 21 | 22 | # character alignment 23 | paddingDown=0 24 | paddingUp=0 25 | paddingRight=0 26 | paddingLeft=0 27 | spacingHoriz=1 28 | spacingVert=1 29 | useFixedHeight=1 30 | forceZero=0 31 | 32 | # output file 33 | outWidth=512 34 | outHeight=512 35 | outBitDepth=32 36 | fontDescFormat=0 37 | fourChnlPacked=0 38 | textureFormat=png 39 | textureCompression=0 40 | alphaChnl=1 41 | redChnl=0 42 | greenChnl=0 43 | blueChnl=0 44 | invA=0 45 | invR=0 46 | invG=0 47 | invB=0 48 | 49 | # outline 50 | outlineThickness=0 51 | 52 | # selected chars 53 | chars=32-126,160-255,262-263,268-269,273,286-287,304-305,321-322,338-339,350-353,376,381-382,402,710-711 54 | chars=728-733,937,960,8211-8212,8216-8218,8220-8222,8224-8226,8230,8240,8249-8250,8364,8482,8706,8710 55 | chars=8719,8721-8722,8725,8729-8730,8734,8747,8776,8800,8804-8805,9674 56 | 57 | # imported icon images 58 | -------------------------------------------------------------------------------- /font/vera_sans_mono36_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjcliffe/CubicSDR/033330367cd179d7b04503027d41afa7514036f4/font/vera_sans_mono36_0.png -------------------------------------------------------------------------------- /font/vera_sans_mono48.bmfc: -------------------------------------------------------------------------------- 1 | # AngelCode Bitmap Font Generator configuration file 2 | fileVersion=1 3 | 4 | # font settings 5 | fontName=Bitstream Vera Sans Mono 6 | fontFile=VeraMono.ttf 7 | charSet=0 8 | fontSize=48 9 | aa=1 10 | scaleH=100 11 | useSmoothing=1 12 | isBold=0 13 | isItalic=0 14 | useUnicode=1 15 | disableBoxChars=1 16 | outputInvalidCharGlyph=0 17 | dontIncludeKerningPairs=0 18 | useHinting=1 19 | renderFromOutline=0 20 | useClearType=1 21 | 22 | # character alignment 23 | paddingDown=0 24 | paddingUp=0 25 | paddingRight=0 26 | paddingLeft=0 27 | spacingHoriz=1 28 | spacingVert=1 29 | useFixedHeight=1 30 | forceZero=0 31 | 32 | # output file 33 | outWidth=1024 34 | outHeight=512 35 | outBitDepth=32 36 | fontDescFormat=0 37 | fourChnlPacked=0 38 | textureFormat=png 39 | textureCompression=0 40 | alphaChnl=1 41 | redChnl=0 42 | greenChnl=0 43 | blueChnl=0 44 | invA=0 45 | invR=0 46 | invG=0 47 | invB=0 48 | 49 | # outline 50 | outlineThickness=0 51 | 52 | # selected chars 53 | chars=32-126,160-255,262-263,268-269,273,286-287,304-305,321-322,338-339,350-353,376,381-382,402,710-711 54 | chars=728-733,937,960,8211-8212,8216-8218,8220-8222,8224-8226,8230,8240,8249-8250,8364,8482,8706,8710 55 | chars=8719,8721-8722,8725,8729-8730,8734,8747,8776,8800,8804-8805,9674 56 | 57 | # imported icon images 58 | -------------------------------------------------------------------------------- /font/vera_sans_mono48_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjcliffe/CubicSDR/033330367cd179d7b04503027d41afa7514036f4/font/vera_sans_mono48_0.png -------------------------------------------------------------------------------- /font/vera_sans_mono64.bmfc: -------------------------------------------------------------------------------- 1 | # AngelCode Bitmap Font Generator configuration file 2 | fileVersion=1 3 | 4 | # font settings 5 | fontName=Bitstream Vera Sans Mono 6 | fontFile=VeraMoBd.ttf 7 | charSet=0 8 | fontSize=64 9 | aa=1 10 | scaleH=100 11 | useSmoothing=1 12 | isBold=0 13 | isItalic=0 14 | useUnicode=1 15 | disableBoxChars=1 16 | outputInvalidCharGlyph=0 17 | dontIncludeKerningPairs=0 18 | useHinting=1 19 | renderFromOutline=0 20 | useClearType=1 21 | 22 | # character alignment 23 | paddingDown=0 24 | paddingUp=0 25 | paddingRight=0 26 | paddingLeft=0 27 | spacingHoriz=1 28 | spacingVert=1 29 | useFixedHeight=1 30 | forceZero=0 31 | 32 | # output file 33 | outWidth=1024 34 | outHeight=512 35 | outBitDepth=32 36 | fontDescFormat=0 37 | fourChnlPacked=0 38 | textureFormat=png 39 | textureCompression=0 40 | alphaChnl=1 41 | redChnl=0 42 | greenChnl=0 43 | blueChnl=0 44 | invA=0 45 | invR=0 46 | invG=0 47 | invB=0 48 | 49 | # outline 50 | outlineThickness=0 51 | 52 | # selected chars 53 | chars=32-126,160-255,262-263,268-269,273,286-287,304-305,321-322,338-339,350-353,376,381-382,402,710-711 54 | chars=728-733,937,960,8211-8212,8216-8218,8220-8222,8224-8226,8230,8240,8249-8250,8364,8482,8706,8710 55 | chars=8719,8721-8722,8725,8729-8730,8734,8747,8776,8800,8804-8805,9674 56 | 57 | # imported icon images 58 | -------------------------------------------------------------------------------- /font/vera_sans_mono64_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjcliffe/CubicSDR/033330367cd179d7b04503027d41afa7514036f4/font/vera_sans_mono64_0.png -------------------------------------------------------------------------------- /font/vera_sans_mono72.bmfc: -------------------------------------------------------------------------------- 1 | # AngelCode Bitmap Font Generator configuration file 2 | fileVersion=1 3 | 4 | # font settings 5 | fontName=Bitstream Vera Sans Mono 6 | fontFile=VeraMoBd.ttf 7 | charSet=0 8 | fontSize=72 9 | aa=1 10 | scaleH=100 11 | useSmoothing=1 12 | isBold=0 13 | isItalic=0 14 | useUnicode=1 15 | disableBoxChars=1 16 | outputInvalidCharGlyph=0 17 | dontIncludeKerningPairs=0 18 | useHinting=1 19 | renderFromOutline=0 20 | useClearType=1 21 | 22 | # character alignment 23 | paddingDown=0 24 | paddingUp=0 25 | paddingRight=0 26 | paddingLeft=0 27 | spacingHoriz=1 28 | spacingVert=1 29 | useFixedHeight=1 30 | forceZero=0 31 | 32 | # output file 33 | outWidth=1024 34 | outHeight=1024 35 | outBitDepth=32 36 | fontDescFormat=0 37 | fourChnlPacked=0 38 | textureFormat=png 39 | textureCompression=0 40 | alphaChnl=1 41 | redChnl=0 42 | greenChnl=0 43 | blueChnl=0 44 | invA=0 45 | invR=0 46 | invG=0 47 | invB=0 48 | 49 | # outline 50 | outlineThickness=0 51 | 52 | # selected chars 53 | chars=32-126,160-255,262-263,268-269,273,286-287,304-305,321-322,338-339,350-353,376,381-382,402,710-711 54 | chars=728-733,937,960,8211-8212,8216-8218,8220-8222,8224-8226,8230,8240,8249-8250,8364,8482,8706,8710 55 | chars=8719,8721-8722,8725,8729-8730,8734,8747,8776,8800,8804-8805,9674 56 | 57 | # imported icon images 58 | -------------------------------------------------------------------------------- /font/vera_sans_mono72_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjcliffe/CubicSDR/033330367cd179d7b04503027d41afa7514036f4/font/vera_sans_mono72_0.png -------------------------------------------------------------------------------- /font/vera_sans_mono96.bmfc: -------------------------------------------------------------------------------- 1 | # AngelCode Bitmap Font Generator configuration file 2 | fileVersion=1 3 | 4 | # font settings 5 | fontName=Bitstream Vera Sans Mono 6 | fontFile=VeraMoBd.ttf 7 | charSet=0 8 | fontSize=96 9 | aa=1 10 | scaleH=100 11 | useSmoothing=1 12 | isBold=0 13 | isItalic=0 14 | useUnicode=1 15 | disableBoxChars=1 16 | outputInvalidCharGlyph=0 17 | dontIncludeKerningPairs=0 18 | useHinting=1 19 | renderFromOutline=0 20 | useClearType=1 21 | 22 | # character alignment 23 | paddingDown=0 24 | paddingUp=0 25 | paddingRight=0 26 | paddingLeft=0 27 | spacingHoriz=1 28 | spacingVert=1 29 | useFixedHeight=1 30 | forceZero=0 31 | 32 | # output file 33 | outWidth=1024 34 | outHeight=1024 35 | outBitDepth=32 36 | fontDescFormat=0 37 | fourChnlPacked=0 38 | textureFormat=png 39 | textureCompression=0 40 | alphaChnl=1 41 | redChnl=0 42 | greenChnl=0 43 | blueChnl=0 44 | invA=0 45 | invR=0 46 | invG=0 47 | invB=0 48 | 49 | # outline 50 | outlineThickness=0 51 | 52 | # selected chars 53 | chars=32-126,160-255,262-263,268-269,273,286-287,304-305,321-322,338-339,350-353,376,381-382,402,710-711 54 | chars=728-733,937,960,8211-8212,8216-8218,8220-8222,8224-8226,8230,8240,8249-8250,8364,8482,8706,8710 55 | chars=8719,8721-8722,8725,8729-8730,8734,8747,8776,8800,8804-8805,9674 56 | 57 | # imported icon images 58 | -------------------------------------------------------------------------------- /font/vera_sans_mono96_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjcliffe/CubicSDR/033330367cd179d7b04503027d41afa7514036f4/font/vera_sans_mono96_0.png -------------------------------------------------------------------------------- /icon/CubicSDR.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjcliffe/CubicSDR/033330367cd179d7b04503027d41afa7514036f4/icon/CubicSDR.icns -------------------------------------------------------------------------------- /icon/CubicSDR.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjcliffe/CubicSDR/033330367cd179d7b04503027d41afa7514036f4/icon/CubicSDR.ico -------------------------------------------------------------------------------- /icon/NSIS_Header.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjcliffe/CubicSDR/033330367cd179d7b04503027d41afa7514036f4/icon/NSIS_Header.bmp -------------------------------------------------------------------------------- /src/CubicSDR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cjcliffe/CubicSDR/033330367cd179d7b04503027d41afa7514036f4/src/CubicSDR.png -------------------------------------------------------------------------------- /src/CubicSDRDefs.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | 6 | #if defined(__linux__) || defined(__FreeBSD__) 7 | #include 8 | #endif 9 | 10 | #define CUBICSDR_TITLE "" CUBICSDR_BUILD_TITLE 11 | 12 | #ifndef __BYTE_ORDER 13 | #ifdef _WIN32 14 | #define ATTRIBUTE 15 | #define __LITTLE_ENDIAN 1234 16 | #define __BIG_ENDIAN 4321 17 | #define __PDP_ENDIAN 3412 18 | #define __BYTE_ORDER __LITTLE_ENDIAN 19 | #else 20 | #ifdef __APPLE__ 21 | #include 22 | #else 23 | #ifdef __FreeBSD__ 24 | #include 25 | #else 26 | #include 27 | #endif 28 | #endif 29 | #endif 30 | #endif 31 | 32 | const char filePathSeparator = 33 | #ifdef _WIN32 34 | '\\'; 35 | #else 36 | '/'; 37 | #endif 38 | 39 | #define BUF_SIZE (16384*6) 40 | 41 | #define DEFAULT_SAMPLE_RATE 2500000 42 | 43 | // 44 | #define DEFAULT_FFT_SIZE 2048 45 | #define DEFAULT_DMOD_FFT_SIZE (DEFAULT_FFT_SIZE / 2) 46 | #define DEFAULT_SCOPE_FFT_SIZE (DEFAULT_FFT_SIZE / 2) 47 | 48 | //Both must be a power of 2 to prevent terrible OpenGL performance. 49 | //TODO: Make the waterfall resolutions an option. 50 | #define DEFAULT_MAIN_WATERFALL_LINES_NB 512 // 1024 51 | #define DEFAULT_DEMOD_WATERFALL_LINES_NB 256 52 | 53 | #define DEFAULT_DEMOD_TYPE "FM" 54 | #define DEFAULT_DEMOD_BW 200000 55 | 56 | #define DEFAULT_WATERFALL_LPS 30 57 | 58 | //Dmod waterfall lines per second is adjusted 59 | //so that the whole demod waterfall show DEMOD_WATERFALL_DURATION_IN_SECONDS 60 | //seconds. 61 | #define DEMOD_WATERFALL_DURATION_IN_SECONDS 4.0 62 | 63 | #define CHANNELIZER_RATE_MAX 500000 64 | 65 | #define MANUAL_SAMPLE_RATE_MIN 2000000 // 2MHz 66 | #define MANUAL_SAMPLE_RATE_MAX 200000000 // 200MHz (We are 2017+ after all) 67 | 68 | //Represents the amount of time to process in the FFT distributor. 69 | #define FFT_DISTRIBUTOR_BUFFER_IN_SECONDS 0.250 70 | 71 | //The maximum number of listed sample rates for a device, to be able to handle 72 | //devices returning an insane amount because they have quasi-continuous ranges (UHD...) 73 | #define DEVICE_SAMPLE_RATES_MAX_NB 25 74 | -------------------------------------------------------------------------------- /src/DemodLabelDialog.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | 6 | #include "wx/dialog.h" 7 | #include "wx/textctrl.h" 8 | #include "wx/string.h" 9 | #include "wx/button.h" 10 | #include "DemodulatorInstance.h" 11 | 12 | #define wxID_LABEL_INPUT 3002 13 | 14 | class DemodLabelDialog : public wxDialog 15 | { 16 | public: 17 | 18 | DemodLabelDialog( wxWindow * parent, wxWindowID id, const wxString & title, 19 | DemodulatorInstancePtr demod = nullptr, 20 | const wxPoint & pos = wxDefaultPosition, 21 | const wxSize & size = wxDefaultSize, 22 | long style = wxDEFAULT_DIALOG_STYLE); 23 | 24 | wxTextCtrl * dialogText; 25 | 26 | private: 27 | DemodulatorInstancePtr activeDemod = nullptr; 28 | void OnChar ( wxKeyEvent &event ); 29 | void OnShow(wxShowEvent &event); 30 | DECLARE_EVENT_TABLE() 31 | }; 32 | -------------------------------------------------------------------------------- /src/FrequencyDialog.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | 6 | #include "wx/dialog.h" 7 | #include "wx/textctrl.h" 8 | #include "wx/string.h" 9 | #include "wx/button.h" 10 | #include "DemodulatorInstance.h" 11 | 12 | #define wxID_FREQ_INPUT 3001 13 | 14 | class FrequencyDialog: public wxDialog 15 | { 16 | public: 17 | typedef enum FrequencyDialogTarget { 18 | FDIALOG_TARGET_DEFAULT, 19 | FDIALOG_TARGET_CENTERFREQ, 20 | FDIALOG_TARGET_FREQ, 21 | FDIALOG_TARGET_BANDWIDTH, 22 | FDIALOG_TARGET_WATERFALL_LPS, 23 | FDIALOG_TARGET_SPECTRUM_AVG, 24 | FDIALOG_TARGET_GAIN 25 | } FrequencyDialogTarget; 26 | FrequencyDialog ( wxWindow * parent, wxWindowID id, const wxString & title, 27 | DemodulatorInstancePtr demod = nullptr, 28 | const wxPoint & pos = wxDefaultPosition, 29 | const wxSize & size = wxDefaultSize, 30 | long style = wxDEFAULT_DIALOG_STYLE, 31 | FrequencyDialogTarget targetMode = FDIALOG_TARGET_DEFAULT, 32 | wxString initString = ""); 33 | 34 | wxTextCtrl * dialogText; 35 | 36 | private: 37 | DemodulatorInstancePtr activeDemod; 38 | void OnChar ( wxKeyEvent &event ); 39 | void OnShow(wxShowEvent &event); 40 | FrequencyDialogTarget targetMode; 41 | std::string initialString; 42 | DECLARE_EVENT_TABLE() 43 | }; 44 | -------------------------------------------------------------------------------- /src/ModemProperties.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include "DemodulatorInstance.h" 12 | #include "Modem.h" 13 | 14 | class ModemProperties : public wxPanel { 15 | public: 16 | explicit ModemProperties( 17 | wxWindow *parent, 18 | wxWindowID winid = wxID_ANY, 19 | const wxPoint& pos = wxDefaultPosition, 20 | const wxSize& size = wxDefaultSize, 21 | long style = wxTAB_TRAVERSAL | wxNO_BORDER, 22 | const wxString& name = wxPanelNameStr 23 | ); 24 | ~ModemProperties() override; 25 | 26 | void initDefaultProperties(); 27 | void initProperties(ModemArgInfoList newArgs, const DemodulatorInstancePtr& demodInstance); 28 | bool isMouseInView(); 29 | void setCollapsed(bool state); 30 | bool isCollapsed() const; 31 | void fitColumns(); 32 | 33 | void updateTheme(); 34 | 35 | private: 36 | wxPGProperty *addArgInfoProperty(wxPropertyGrid *pg, ModemArgInfo arg); 37 | std::string readProperty(const std::string&); 38 | void OnChange(wxPropertyGridEvent &event); 39 | void OnShow(wxShowEvent &event); 40 | void OnCollapse(wxPropertyGridEvent &event); 41 | void OnExpand(wxPropertyGridEvent &event); 42 | 43 | void OnMouseEnter(wxMouseEvent &event); 44 | void OnMouseLeave(wxMouseEvent &event); 45 | 46 | wxBoxSizer* bSizer; 47 | wxPropertyGrid* m_propertyGrid; 48 | ModemArgInfoList args; 49 | DemodulatorInstancePtr demodContext; 50 | 51 | std::map props; 52 | bool mouseInView, collapsed; 53 | 54 | ModemArgInfoList defaultArgs; 55 | ModemArgInfo outputArg; 56 | std::map defaultProps; 57 | 58 | std::vector audioDevices; 59 | std::map audioInputDevices; 60 | std::map audioOutputDevices; 61 | }; -------------------------------------------------------------------------------- /src/SessionMgr.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | 6 | #include "DataTree.h" 7 | #include "AppFrame.h" 8 | 9 | 10 | class SessionMgr { 11 | public: 12 | void saveSession(std::string fileName); 13 | bool loadSession(const std::string& fileName); 14 | }; 15 | -------------------------------------------------------------------------------- /src/audio/AudioFile.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #include "AudioFile.h" 5 | #include "CubicSDR.h" 6 | #include 7 | 8 | AudioFile::AudioFile() = default; 9 | 10 | AudioFile::~AudioFile() = default; 11 | 12 | void AudioFile::setOutputFileName(std::string filename) { 13 | filenameBase = filename; 14 | } 15 | 16 | std::string AudioFile::getOutputFileName() { 17 | 18 | std::string recPath = wxGetApp().getConfig()->getRecordingPath(); 19 | 20 | // Strip any invalid characters from the name 21 | std::string stripChars("<>:\"/\\|?*"); 22 | std::string filenameBaseSafe = filenameBase; 23 | 24 | for (size_t i = 0, iMax = filenameBaseSafe.length(); i < iMax; i++) { 25 | if (stripChars.find(filenameBaseSafe[i]) != std::string::npos) { 26 | filenameBaseSafe.replace(i,1,"_"); 27 | } 28 | } 29 | 30 | // Create output file name 31 | std::stringstream outputFileName; 32 | outputFileName << recPath << filePathSeparator << filenameBaseSafe; 33 | 34 | int idx = 0; 35 | 36 | // If the file exists; then find the next non-existing file in sequence. 37 | std::string fileNameCandidate = outputFileName.str(); 38 | 39 | while (FILE *file = fopen((fileNameCandidate + "." + getExtension()).c_str(), "r")) { 40 | fclose(file); 41 | fileNameCandidate = outputFileName.str() + "-" + std::to_string(++idx); 42 | } 43 | 44 | return fileNameCandidate + "." + getExtension(); 45 | } 46 | 47 | -------------------------------------------------------------------------------- /src/audio/AudioFile.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | 6 | #include "AudioThread.h" 7 | 8 | class AudioFile 9 | { 10 | 11 | public: 12 | AudioFile(); 13 | virtual ~AudioFile(); 14 | 15 | virtual void setOutputFileName(std::string filename); 16 | virtual std::string getExtension() = 0; 17 | virtual std::string getOutputFileName(); 18 | 19 | virtual bool writeToFile(AudioThreadInputPtr input) = 0; 20 | virtual bool closeFile() = 0; 21 | 22 | protected: 23 | std::string filenameBase; 24 | 25 | }; -------------------------------------------------------------------------------- /src/audio/AudioFileWAV.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | 6 | #include "AudioFile.h" 7 | 8 | #include 9 | 10 | class AudioFileWAV : public AudioFile { 11 | 12 | public: 13 | AudioFileWAV(); 14 | ~AudioFileWAV() override; 15 | 16 | //override to manage name change with multi-part WAV. 17 | void setOutputFileName(std::string filename) override; 18 | 19 | //override of the base method to generate multi-part 20 | //WAV to overcome the WAV format size limit. 21 | std::string getOutputFileName() override; 22 | 23 | std::string getExtension() override; 24 | 25 | bool writeToFile(AudioThreadInputPtr input) override; 26 | bool closeFile() override; 27 | 28 | protected: 29 | std::ofstream outputFileStream; 30 | size_t dataChunkPos; 31 | long long currentFileSize = 0; 32 | int currentSequenceNumber = 0; 33 | 34 | private: 35 | 36 | size_t getMaxWritableNumberOfSamples(const AudioThreadInputPtr& input) const; 37 | 38 | void writeHeaderToFileStream(const AudioThreadInputPtr& input); 39 | 40 | //write [startInputPosition; endInputPosition[ samples from input into the file. 41 | void writePayloadToFileStream(const AudioThreadInputPtr& input, size_t startInputPosition, size_t endInputPosition); 42 | }; -------------------------------------------------------------------------------- /src/audio/AudioSinkFileThread.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | 6 | #include "AudioSinkThread.h" 7 | #include "AudioFile.h" 8 | #include "Timer.h" 9 | 10 | class AudioSinkFileThread : public AudioSinkThread { 11 | 12 | public: 13 | AudioSinkFileThread(); 14 | ~AudioSinkFileThread() override; 15 | 16 | enum SquelchOption { 17 | SQUELCH_RECORD_SILENCE = 0, // default value, record as a user would hear it. 18 | SQUELCH_SKIP_SILENCE = 1, // skip below-squelch level. 19 | SQUELCH_RECORD_ALWAYS = 2, // record irrespective of the squelch level. 20 | SQUELCH_RECORD_MAX 21 | }; 22 | 23 | void sink(AudioThreadInputPtr input) override; 24 | void inputChanged(AudioThreadInput oldProps, AudioThreadInputPtr newProps) override; 25 | 26 | void setAudioFileHandler(AudioFile *output); 27 | 28 | void setAudioFileNameBase(const std::string& baseName); 29 | 30 | //Squelch 31 | void setSquelchOption(int squelchOptEnumValue); 32 | 33 | // Time limit 34 | void setFileTimeLimit(int nbSeconds); 35 | 36 | protected: 37 | 38 | std::string fileNameBase; 39 | 40 | AudioFile *audioFileHandler = nullptr; 41 | 42 | SquelchOption squelchOption = SQUELCH_RECORD_SILENCE; 43 | int fileTimeLimit = 0; 44 | 45 | int fileTimeDurationSeconds = -1; 46 | 47 | Timer durationMeasurement; 48 | 49 | }; 50 | 51 | -------------------------------------------------------------------------------- /src/audio/AudioSinkThread.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #include "AudioSinkThread.h" 5 | 6 | #define HEARTBEAT_CHECK_PERIOD_MICROS (50 * 1000) 7 | 8 | AudioSinkThread::AudioSinkThread() { 9 | inputQueuePtr = std::make_shared(); 10 | inputQueuePtr->set_max_num_items(1000); 11 | setInputQueue("input", inputQueuePtr); 12 | } 13 | 14 | AudioSinkThread::~AudioSinkThread() = default; 15 | 16 | void AudioSinkThread::run() { 17 | #ifdef __APPLE__ 18 | pthread_t tID = pthread_self(); // ID of this thread 19 | int priority = sched_get_priority_max(SCHED_RR) - 1; 20 | sched_param prio = { priority }; // scheduling priority of thread 21 | pthread_setschedparam(tID, SCHED_RR, &prio); 22 | #endif 23 | 24 | AudioThreadInputPtr inp; 25 | AudioThreadInput inputRef; 26 | 27 | while (!stopping) { 28 | if (!inputQueuePtr->pop(inp, HEARTBEAT_CHECK_PERIOD_MICROS)) { 29 | continue; 30 | } 31 | 32 | if (inputRef.channels != inp->channels || 33 | inputRef.frequency != inp->frequency || 34 | inputRef.inputRate != inp->inputRate || 35 | inputRef.sampleRate != inp->sampleRate) { 36 | 37 | inputChanged(inputRef, inp); 38 | 39 | inputRef.channels = inp->channels; 40 | inputRef.frequency = inp->frequency; 41 | inputRef.inputRate = inp->inputRate; 42 | inputRef.sampleRate = inp->sampleRate; 43 | } 44 | 45 | sink(inp); 46 | } 47 | } 48 | 49 | void AudioSinkThread::terminate() { 50 | IOThread::terminate(); 51 | inputQueuePtr->flush(); 52 | } 53 | -------------------------------------------------------------------------------- /src/audio/AudioSinkThread.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | 6 | #include "AudioThread.h" 7 | 8 | class AudioSinkThread : public IOThread { 9 | 10 | public: 11 | 12 | AudioSinkThread(); 13 | ~AudioSinkThread() override; 14 | 15 | void run() override; 16 | void terminate() override; 17 | 18 | virtual void sink(AudioThreadInputPtr input) = 0; 19 | virtual void inputChanged(AudioThreadInput oldProps, AudioThreadInputPtr newProps) = 0; 20 | 21 | protected: 22 | std::recursive_mutex m_mutex; 23 | AudioThreadInputQueuePtr inputQueuePtr; 24 | 25 | }; 26 | -------------------------------------------------------------------------------- /src/demod/DemodDefs.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | 6 | #include "ThreadBlockingQueue.h" 7 | #include "CubicSDRDefs.h" 8 | #include "liquid/liquid.h" 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #include "IOThread.h" 15 | 16 | class DemodulatorThread; 17 | 18 | class DemodulatorThreadIQData { 19 | public: 20 | long long frequency; 21 | long long sampleRate; 22 | std::vector data; 23 | 24 | 25 | DemodulatorThreadIQData() : 26 | frequency(0), sampleRate(0) { 27 | 28 | } 29 | 30 | DemodulatorThreadIQData & operator=(const DemodulatorThreadIQData &other) { 31 | frequency = other.frequency; 32 | sampleRate = other.sampleRate; 33 | data.assign(other.data.begin(), other.data.end()); 34 | return *this; 35 | } 36 | 37 | virtual ~DemodulatorThreadIQData() = default; 38 | }; 39 | 40 | class Modem; 41 | class ModemKit; 42 | 43 | class DemodulatorThreadPostIQData { 44 | public: 45 | std::vector data; 46 | 47 | long long sampleRate; 48 | std::string modemName; 49 | std::string modemType; 50 | Modem *modem; 51 | ModemKit *modemKit; 52 | 53 | DemodulatorThreadPostIQData() : 54 | sampleRate(0), modem(nullptr), modemKit(nullptr) { 55 | 56 | } 57 | 58 | virtual ~DemodulatorThreadPostIQData() = default; 59 | }; 60 | 61 | typedef std::shared_ptr DemodulatorThreadIQDataPtr; 62 | typedef std::shared_ptr DemodulatorThreadPostIQDataPtr; 63 | 64 | typedef ThreadBlockingQueue DemodulatorThreadInputQueue; 65 | typedef ThreadBlockingQueue DemodulatorThreadPostInputQueue; 66 | 67 | typedef std::shared_ptr DemodulatorThreadInputQueuePtr; 68 | typedef std::shared_ptr DemodulatorThreadPostInputQueuePtr; 69 | -------------------------------------------------------------------------------- /src/demod/DemodulatorPreThread.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include "CubicSDRDefs.h" 12 | #include "DemodDefs.h" 13 | #include "DemodulatorWorkerThread.h" 14 | 15 | class DemodulatorInstance; 16 | 17 | class DemodulatorPreThread : public IOThread { 18 | public: 19 | 20 | explicit DemodulatorPreThread(DemodulatorInstance* parent); 21 | ~DemodulatorPreThread() override; 22 | 23 | void run() override; 24 | 25 | void setDemodType(std::string demodType_in); 26 | std::string getDemodType(); 27 | 28 | void setFrequency(long long sampleRate); 29 | long long getFrequency(); 30 | 31 | void setSampleRate(long long sampleRate); 32 | long long getSampleRate(); 33 | 34 | void setBandwidth(int bandwidth); 35 | int getBandwidth(); 36 | 37 | void setAudioSampleRate(int rate); 38 | int getAudioSampleRate(); 39 | 40 | bool isInitialized(); 41 | 42 | void terminate() override; 43 | 44 | Modem *getModem(); 45 | ModemKit *getModemKit(); 46 | 47 | std::string readModemSetting(const std::string& setting); 48 | void writeModemSetting(const std::string& setting, std::string value); 49 | ModemSettings readModemSettings(); 50 | void writeModemSettings(ModemSettings settings); 51 | 52 | protected: 53 | 54 | DemodulatorInstance* parent; 55 | 56 | msresamp_crcf iqResampler; 57 | double iqResampleRatio; 58 | std::vector resampledData; 59 | 60 | Modem *cModem; 61 | ModemKit *cModemKit; 62 | 63 | std::atomic_llong currentSampleRate, newSampleRate; 64 | std::atomic_llong currentFrequency, newFrequency; 65 | std::atomic_int currentBandwidth; 66 | std::atomic_int currentAudioSampleRate, newAudioSampleRate; 67 | 68 | std::atomic_bool sampleRateChanged, frequencyChanged, bandwidthChanged, audioSampleRateChanged; 69 | 70 | ModemSettings modemSettingsBuffered; 71 | std::atomic_bool modemSettingsChanged; 72 | 73 | nco_crcf freqShifter; 74 | int shiftFrequency; 75 | 76 | std::atomic_bool initialized; 77 | std::atomic_bool demodTypeChanged; 78 | std::string demodType; 79 | std::string newDemodType; 80 | 81 | DemodulatorWorkerThread *workerThread; 82 | std::thread *t_Worker; 83 | 84 | DemodulatorThreadWorkerCommandQueuePtr workerQueue; 85 | DemodulatorThreadWorkerResultQueuePtr workerResults; 86 | 87 | DemodulatorThreadInputQueuePtr iqInputQueue; 88 | DemodulatorThreadPostInputQueuePtr iqOutputQueue; 89 | }; 90 | -------------------------------------------------------------------------------- /src/demod/DemodulatorThread.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | #include "DemodDefs.h" 11 | #include "AudioThread.h" 12 | #include "Modem.h" 13 | #include "SpinMutex.h" 14 | 15 | #define DEMOD_VIS_SIZE 2048 16 | #define DEMOD_SIGNAL_MIN -30 17 | #define DEMOD_SIGNAL_MAX 30 18 | 19 | class DemodulatorInstance; 20 | 21 | class DemodulatorThread : public IOThread { 22 | public: 23 | 24 | explicit DemodulatorThread(DemodulatorInstance* parent); 25 | ~DemodulatorThread() override; 26 | 27 | void onBindOutput(std::string name, ThreadQueueBasePtr threadQueue) override; 28 | 29 | void run() override; 30 | void terminate() override; 31 | 32 | void setMuted(bool muted_in); 33 | bool isMuted(); 34 | 35 | float getSignalLevel(); 36 | float getSignalCeil(); 37 | void setSquelchEnabled(bool squelchEnabled_in); 38 | bool isSquelchEnabled(); 39 | float getSignalFloor(); 40 | void setSquelchLevel(float signal_level_in); 41 | float getSquelchLevel(); 42 | 43 | bool getSquelchBreak(); 44 | 45 | 46 | static void releaseSquelchLock(DemodulatorInstance* inst); 47 | protected: 48 | 49 | double abMagnitude(float inphase, float quadrature); 50 | double linearToDb(double linear); 51 | 52 | DemodulatorInstance* demodInstance; 53 | ReBuffer outputBuffers; 54 | 55 | std::atomic_bool muted; 56 | 57 | std::atomic squelchLevel; 58 | std::atomic signalLevel, signalFloor, signalCeil; 59 | std::atomic squelchEnabled, squelchBreak; 60 | 61 | static DemodulatorInstance* squelchLock; 62 | static std::mutex squelchLockMutex; 63 | 64 | 65 | Modem *cModem = nullptr; 66 | ModemKit *cModemKit = nullptr; 67 | 68 | DemodulatorThreadPostInputQueuePtr iqInputQueue; 69 | AudioThreadInputQueuePtr audioOutputQueue; 70 | DemodulatorThreadOutputQueuePtr audioVisOutputQueue; 71 | DemodulatorThreadOutputQueuePtr audioSinkOutputQueue = nullptr; 72 | 73 | //protects the audioVisOutputQueue dynamic binding change at runtime (in DemodulatorMgr) 74 | SpinMutex m_mutexAudioVisOutputQueue; 75 | }; 76 | -------------------------------------------------------------------------------- /src/forms/Dialog/AboutDialog.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #include "AboutDialog.h" 5 | 6 | AboutDialog::AboutDialog( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style) 7 | : AboutDialogBase(parent, id, title, pos, size, style) { 8 | m_appName->SetLabelText(CUBICSDR_INSTALL_NAME " v" CUBICSDR_VERSION); 9 | } 10 | -------------------------------------------------------------------------------- /src/forms/Dialog/AboutDialog.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | 6 | #include "AboutDialogBase.h" 7 | #include "CubicSDRDefs.h" 8 | 9 | class AboutDialog : public AboutDialogBase { 10 | public: 11 | explicit AboutDialog( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("About"), 12 | const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 530, 420 ), 13 | long style = wxDEFAULT_DIALOG_STYLE ); 14 | 15 | }; 16 | -------------------------------------------------------------------------------- /src/forms/Dialog/ActionDialog.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #include "ActionDialog.h" 5 | 6 | 7 | ActionDialog *ActionDialog::activeDialog = nullptr; 8 | 9 | ActionDialog::ActionDialog( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style) 10 | : ActionDialogBase(parent, id, title, pos, size, style) { 11 | } 12 | 13 | 14 | ActionDialog::~ActionDialog() = default; 15 | 16 | void ActionDialog::showDialog(ActionDialog *dlg) { 17 | if (activeDialog) { // rejected 18 | delete dlg; 19 | return; 20 | } 21 | activeDialog = dlg; 22 | dlg->Layout(); 23 | dlg->Fit(); 24 | dlg->ShowModal(); 25 | } 26 | 27 | ActionDialog *ActionDialog::getActiveDialog() { 28 | return activeDialog; 29 | } 30 | 31 | 32 | void ActionDialog::setActiveDialog(ActionDialog *dlg) { 33 | activeDialog = dlg; 34 | } 35 | 36 | 37 | void ActionDialog::onClickCancel( wxCommandEvent& /* event */ ) { 38 | ActionDialog *dlg = activeDialog; 39 | ActionDialog::setActiveDialog(nullptr); 40 | dlg->EndModal(0); 41 | doClickCancel(); 42 | delete dlg; 43 | } 44 | 45 | 46 | void ActionDialog::onClickOK( wxCommandEvent& /* event */ ) { 47 | ActionDialog *dlg = activeDialog; 48 | ActionDialog::setActiveDialog(nullptr); 49 | dlg->EndModal(0); 50 | doClickOK(); 51 | delete dlg; 52 | } 53 | 54 | 55 | void ActionDialog::doClickCancel() { 56 | 57 | } 58 | 59 | 60 | void ActionDialog::doClickOK() { 61 | 62 | } 63 | -------------------------------------------------------------------------------- /src/forms/Dialog/ActionDialog.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #include "ActionDialogBase.h" 5 | #include 6 | 7 | class ActionDialog : public ActionDialogBase { 8 | public: 9 | explicit ActionDialog( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("QuestionTitle"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE ); 10 | ~ActionDialog() override; 11 | 12 | void onClickCancel( wxCommandEvent& event ) override; 13 | void onClickOK( wxCommandEvent& event ) override; 14 | 15 | virtual void doClickCancel(); 16 | virtual void doClickOK(); 17 | 18 | static ActionDialog *getActiveDialog(); 19 | static void setActiveDialog(ActionDialog *dlg); 20 | static void showDialog(ActionDialog *dlg); 21 | 22 | private: 23 | static ActionDialog *activeDialog; 24 | }; 25 | -------------------------------------------------------------------------------- /src/forms/Dialog/ActionDialogBase.cpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////// 2 | // C++ code generated with wxFormBuilder (version Aug 8 2018) 3 | // http://www.wxformbuilder.org/ 4 | // 5 | // PLEASE DO *NOT* EDIT THIS FILE! 6 | /////////////////////////////////////////////////////////////////////////// 7 | 8 | #include "ActionDialogBase.h" 9 | 10 | /////////////////////////////////////////////////////////////////////////// 11 | 12 | ActionDialogBase::ActionDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) 13 | { 14 | this->SetSizeHints( wxDefaultSize, wxDefaultSize ); 15 | 16 | wxBoxSizer* mainSizer; 17 | mainSizer = new wxBoxSizer( wxVERTICAL ); 18 | 19 | m_questionText = new wxStaticText( this, wxID_ANY, wxT("Question"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER_HORIZONTAL ); 20 | m_questionText->Wrap( -1 ); 21 | mainSizer->Add( m_questionText, 1, wxALL|wxEXPAND, 5 ); 22 | 23 | wxBoxSizer* buttonSizer; 24 | buttonSizer = new wxBoxSizer( wxHORIZONTAL ); 25 | 26 | m_cancelButton = new wxButton( this, wxID_ANY, wxT("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); 27 | buttonSizer->Add( m_cancelButton, 1, wxALL|wxEXPAND, 5 ); 28 | 29 | m_okButton = new wxButton( this, wxID_ANY, wxT("OK"), wxDefaultPosition, wxDefaultSize, 0 ); 30 | buttonSizer->Add( m_okButton, 1, wxALL|wxEXPAND, 5 ); 31 | 32 | 33 | mainSizer->Add( buttonSizer, 1, wxEXPAND, 5 ); 34 | 35 | 36 | this->SetSizer( mainSizer ); 37 | this->Layout(); 38 | mainSizer->Fit( this ); 39 | 40 | this->Centre( wxBOTH ); 41 | 42 | // Connect Events 43 | m_cancelButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ActionDialogBase::onClickCancel ), NULL, this ); 44 | m_okButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ActionDialogBase::onClickOK ), NULL, this ); 45 | } 46 | 47 | ActionDialogBase::~ActionDialogBase() 48 | { 49 | // Disconnect Events 50 | m_cancelButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ActionDialogBase::onClickCancel ), NULL, this ); 51 | m_okButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ActionDialogBase::onClickOK ), NULL, this ); 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/forms/Dialog/ActionDialogBase.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////// 2 | // C++ code generated with wxFormBuilder (version Aug 8 2018) 3 | // http://www.wxformbuilder.org/ 4 | // 5 | // PLEASE DO *NOT* EDIT THIS FILE! 6 | /////////////////////////////////////////////////////////////////////////// 7 | 8 | #ifndef __ACTIONDIALOGBASE_H__ 9 | #define __ACTIONDIALOGBASE_H__ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | /////////////////////////////////////////////////////////////////////////// 27 | 28 | 29 | /////////////////////////////////////////////////////////////////////////////// 30 | /// Class ActionDialogBase 31 | /////////////////////////////////////////////////////////////////////////////// 32 | class ActionDialogBase : public wxDialog 33 | { 34 | private: 35 | 36 | protected: 37 | wxStaticText* m_questionText; 38 | wxButton* m_cancelButton; 39 | wxButton* m_okButton; 40 | 41 | // Virtual event handlers, override them in your derived class 42 | virtual void onClickCancel( wxCommandEvent& event ) { event.Skip(); } 43 | virtual void onClickOK( wxCommandEvent& event ) { event.Skip(); } 44 | 45 | 46 | public: 47 | 48 | ActionDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("QuestionTitle"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE ); 49 | ~ActionDialogBase(); 50 | 51 | }; 52 | 53 | #endif //__ACTIONDIALOGBASE_H__ 54 | -------------------------------------------------------------------------------- /src/forms/Dialog/PortSelectorDialog.cpp: -------------------------------------------------------------------------------- 1 | #include "PortSelectorDialog.h" 2 | 3 | #include "rs232.h" 4 | #include "CubicSDR.h" 5 | 6 | PortSelectorDialog::PortSelectorDialog( wxWindow* parent, wxWindowID id, const std::string& defaultPort ) : PortSelectorDialogBase(parent, id) { 7 | comEnumerate(); 8 | 9 | int nPorts = comGetNoPorts(); 10 | 11 | if (!defaultPort.empty()) { 12 | m_portList->Append(defaultPort); 13 | } 14 | 15 | for (int i = 0; i < nPorts; i++) { 16 | #ifdef WIN32 17 | string portName(comGetPortName(i)); 18 | #else 19 | string portName(comGetInternalName(i)); 20 | #endif 21 | if (portName != defaultPort) { 22 | m_portList->Append(portName); 23 | } 24 | } 25 | 26 | comTerminate(); 27 | 28 | m_portSelection->SetValue(defaultPort); 29 | } 30 | 31 | void PortSelectorDialog::onListSelect( wxCommandEvent& /* event */ ) { 32 | int pSelect = m_portList->GetSelection(); 33 | if (pSelect != -1) { 34 | m_portSelection->SetValue(m_portList->GetString(pSelect)); 35 | } 36 | } 37 | 38 | 39 | void PortSelectorDialog::onCancelButton( wxCommandEvent& /* event */ ) { 40 | wxGetApp().getAppFrame()->dismissRigControlPortDialog(); 41 | } 42 | 43 | 44 | void PortSelectorDialog::onOKButton( wxCommandEvent& /* event */ ) { 45 | wxGetApp().getAppFrame()->setRigControlPort(m_portSelection->GetValue().ToStdString()); 46 | } 47 | 48 | 49 | void PortSelectorDialog::onClose(wxCloseEvent & /* event */) { 50 | wxGetApp().getAppFrame()->dismissRigControlPortDialog(); 51 | } 52 | -------------------------------------------------------------------------------- /src/forms/Dialog/PortSelectorDialog.h: -------------------------------------------------------------------------------- 1 | #include "PortSelectorDialogBase.h" 2 | 3 | class PortSelectorDialog : public PortSelectorDialogBase { 4 | public: 5 | explicit PortSelectorDialog( wxWindow* parent, wxWindowID id = wxID_ANY, const std::string& defaultPort = "" ); 6 | 7 | protected: 8 | void onListSelect( wxCommandEvent& event ) override; 9 | void onCancelButton( wxCommandEvent& event ) override; 10 | void onOKButton( wxCommandEvent& event ) override; 11 | void onClose( wxCloseEvent& event ) override; 12 | }; 13 | -------------------------------------------------------------------------------- /src/forms/Dialog/PortSelectorDialogBase.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////// 2 | // C++ code generated with wxFormBuilder (version Oct 26 2018) 3 | // http://www.wxformbuilder.org/ 4 | // 5 | // PLEASE DO *NOT* EDIT THIS FILE! 6 | /////////////////////////////////////////////////////////////////////////// 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | /////////////////////////////////////////////////////////////////////////// 28 | 29 | 30 | /////////////////////////////////////////////////////////////////////////////// 31 | /// Class PortSelectorDialogBase 32 | /////////////////////////////////////////////////////////////////////////////// 33 | class PortSelectorDialogBase : public wxDialog 34 | { 35 | private: 36 | 37 | protected: 38 | wxStaticText* m_staticText1; 39 | wxListBox* m_portList; 40 | wxStaticText* m_staticText2; 41 | wxTextCtrl* m_portSelection; 42 | wxButton* m_cancelButton; 43 | wxButton* m_okButton; 44 | 45 | // Virtual event handlers, override them in your derived class 46 | virtual void onClose( wxCloseEvent& event ) { event.Skip(); } 47 | virtual void onListSelect( wxCommandEvent& event ) { event.Skip(); } 48 | virtual void onCancelButton( wxCommandEvent& event ) { event.Skip(); } 49 | virtual void onOKButton( wxCommandEvent& event ) { event.Skip(); } 50 | 51 | 52 | public: 53 | 54 | PortSelectorDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Select Port"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 320,260 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); 55 | ~PortSelectorDialogBase(); 56 | 57 | }; 58 | 59 | -------------------------------------------------------------------------------- /src/forms/DigitalConsole/DigitalConsole.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #include "DigitalConsoleFrame.h" 13 | #include "ModemDigital.h" 14 | 15 | class ModemDigitalOutputConsole; 16 | class DigitalConsole: public DigitalConsoleFrame { 17 | public: 18 | DigitalConsole( wxWindow* parent, ModemDigitalOutputConsole *doParent ); 19 | ~DigitalConsole() override; 20 | 21 | 22 | void write(const std::string& outp); 23 | void write(char outc); 24 | 25 | private: 26 | void DoRefresh( wxTimerEvent& event ) override; 27 | void OnClose( wxCloseEvent& event ) override; 28 | void OnClear( wxCommandEvent& event ) override; 29 | 30 | void OnCopy( wxCommandEvent& event ) override; 31 | void OnPause( wxCommandEvent& event ) override; 32 | 33 | std::stringstream streamBuf; 34 | std::mutex stream_busy; 35 | std::atomic streamWritten; 36 | std::atomic streamPaused; 37 | ModemDigitalOutputConsole *doParent; 38 | }; 39 | 40 | class ModemDigitalOutputConsole: public ModemDigitalOutput { 41 | public: 42 | ModemDigitalOutputConsole(); 43 | ~ModemDigitalOutputConsole() override; 44 | 45 | void setDialog(DigitalConsole *dialog_in); 46 | DigitalConsole *getDialog(); 47 | 48 | void setTitle(const std::string& title); 49 | 50 | void write(std::string outp) override; 51 | void write(char outc) override; 52 | 53 | void Show() override; 54 | void Hide() override; 55 | void Close() override; 56 | 57 | private: 58 | DigitalConsole *dialog; 59 | std::stringstream streamBuf; 60 | std::mutex stream_busy; 61 | std::atomic streamWritten; 62 | std::string dialogTitle; 63 | }; 64 | 65 | -------------------------------------------------------------------------------- /src/forms/DigitalConsole/DigitalConsoleFrame.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////// 2 | // C++ code generated with wxFormBuilder (version Aug 8 2018) 3 | // http://www.wxformbuilder.org/ 4 | // 5 | // PLEASE DO *NOT* EDIT THIS FILE! 6 | /////////////////////////////////////////////////////////////////////////// 7 | 8 | #ifndef __DIGITALCONSOLEFRAME_H__ 9 | #define __DIGITALCONSOLEFRAME_H__ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | /////////////////////////////////////////////////////////////////////////// 28 | 29 | 30 | /////////////////////////////////////////////////////////////////////////////// 31 | /// Class DigitalConsoleFrame 32 | /////////////////////////////////////////////////////////////////////////////// 33 | class DigitalConsoleFrame : public wxFrame 34 | { 35 | private: 36 | 37 | protected: 38 | wxTextCtrl* m_dataView; 39 | wxButton* m_clearButton; 40 | wxButton* m_copyButton; 41 | wxButton* m_pauseButton; 42 | wxTimer m_refreshTimer; 43 | 44 | // Virtual event handlers, override them in your derived class 45 | virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } 46 | virtual void OnClear( wxCommandEvent& event ) { event.Skip(); } 47 | virtual void OnCopy( wxCommandEvent& event ) { event.Skip(); } 48 | virtual void OnPause( wxCommandEvent& event ) { event.Skip(); } 49 | virtual void DoRefresh( wxTimerEvent& event ) { event.Skip(); } 50 | 51 | 52 | public: 53 | 54 | DigitalConsoleFrame( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Digital Output"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 441,394 ), long style = wxCAPTION|wxFRAME_FLOAT_ON_PARENT|wxMAXIMIZE|wxMAXIMIZE_BOX|wxMINIMIZE|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxFULL_REPAINT_ON_RESIZE|wxTAB_TRAVERSAL ); 55 | 56 | ~DigitalConsoleFrame(); 57 | 58 | }; 59 | 60 | #endif //__DIGITALCONSOLEFRAME_H__ 61 | -------------------------------------------------------------------------------- /src/forms/SDRDevices/SDRDeviceAdd.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #include "SDRDeviceAdd.h" 5 | #include "SDREnumerator.h" 6 | 7 | SDRDeviceAddDialog::SDRDeviceAddDialog( wxWindow* parent ): SDRDeviceAddForm( parent ) { 8 | okPressed = false; 9 | selectedModule = ""; 10 | moduleParam = ""; 11 | selectedModule = "SoapyRemote"; 12 | 13 | m_soapyModule->Append("SoapyRemote"); 14 | m_paramLabel->SetLabel("Remote Address (address[:port])"); 15 | 16 | std::vector &factories = SDREnumerator::getFactories(); 17 | std::vector::iterator factory_i; 18 | 19 | for (factory_i = factories.begin(); factory_i != factories.end(); factory_i++) { 20 | if (*factory_i != "remote" && *factory_i != "null") { 21 | m_soapyModule->Append(*factory_i); 22 | } 23 | } 24 | } 25 | 26 | void SDRDeviceAddDialog::OnSoapyModuleChanged( wxCommandEvent& /* event */) { 27 | wxString strSel = m_soapyModule->GetStringSelection(); 28 | 29 | selectedModule = strSel.ToStdString(); 30 | 31 | if (selectedModule == "SoapyRemote") { 32 | m_paramLabel->SetLabelText("Remote Address (address[:port])"); 33 | } else { 34 | m_paramLabel->SetLabel("SoapySDR Device Parameters, i.e. 'addr=192.168.1.105'"); 35 | } 36 | } 37 | 38 | void SDRDeviceAddDialog::OnCancelButton( wxCommandEvent& /* event */) { 39 | okPressed = false; 40 | Close(true); 41 | } 42 | 43 | void SDRDeviceAddDialog::OnOkButton( wxCommandEvent& /* event */) { 44 | wxString strSel = m_soapyModule->GetStringSelection(); 45 | selectedModule = strSel.ToStdString(); 46 | moduleParam = m_paramText->GetValue().ToStdString(); 47 | okPressed = true; 48 | Close(true); 49 | } 50 | 51 | bool SDRDeviceAddDialog::wasOkPressed() const { 52 | return okPressed; 53 | } 54 | 55 | std::string SDRDeviceAddDialog::getSelectedModule() { 56 | return selectedModule; 57 | } 58 | 59 | std::string SDRDeviceAddDialog::getModuleParam() { 60 | return moduleParam; 61 | } 62 | -------------------------------------------------------------------------------- /src/forms/SDRDevices/SDRDeviceAdd.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | 6 | #include "SDRDeviceAddForm.h" 7 | 8 | class SDRDeviceAddDialog : public SDRDeviceAddForm { 9 | public: 10 | explicit SDRDeviceAddDialog( wxWindow* parent ); 11 | 12 | void OnSoapyModuleChanged( wxCommandEvent& event ) override; 13 | void OnCancelButton( wxCommandEvent& event ) override; 14 | void OnOkButton( wxCommandEvent& event ) override; 15 | 16 | bool wasOkPressed() const; 17 | std::string getSelectedModule(); 18 | std::string getModuleParam(); 19 | 20 | private: 21 | bool okPressed; 22 | std::string selectedModule; 23 | std::string moduleParam; 24 | }; -------------------------------------------------------------------------------- /src/forms/SDRDevices/SDRDeviceAddForm.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////// 2 | // C++ code generated with wxFormBuilder (version Aug 8 2018) 3 | // http://www.wxformbuilder.org/ 4 | // 5 | // PLEASE DO *NOT* EDIT THIS FILE! 6 | /////////////////////////////////////////////////////////////////////////// 7 | 8 | #ifndef __SDRDEVICEADDFORM_H__ 9 | #define __SDRDEVICEADDFORM_H__ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | /////////////////////////////////////////////////////////////////////////// 29 | 30 | 31 | /////////////////////////////////////////////////////////////////////////////// 32 | /// Class SDRDeviceAddForm 33 | /////////////////////////////////////////////////////////////////////////////// 34 | class SDRDeviceAddForm : public wxDialog 35 | { 36 | private: 37 | 38 | protected: 39 | wxStaticText* m_staticText4; 40 | wxChoice* m_soapyModule; 41 | wxStaticText* m_paramLabel; 42 | wxTextCtrl* m_paramText; 43 | wxButton* m_cancelButton; 44 | wxButton* m_OkButton; 45 | 46 | // Virtual event handlers, override them in your derived class 47 | virtual void OnSoapyModuleChanged( wxCommandEvent& event ) { event.Skip(); } 48 | virtual void OnCancelButton( wxCommandEvent& event ) { event.Skip(); } 49 | virtual void OnOkButton( wxCommandEvent& event ) { event.Skip(); } 50 | 51 | 52 | public: 53 | 54 | SDRDeviceAddForm( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Add SoapySDR Device"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 395,293 ), long style = wxDEFAULT_DIALOG_STYLE ); 55 | ~SDRDeviceAddForm(); 56 | 57 | }; 58 | 59 | #endif //__SDRDEVICEADDFORM_H__ 60 | -------------------------------------------------------------------------------- /src/forms/SDRDevices/SDRDevices.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | 9 | #include "SDRDevicesForm.h" 10 | #include "SoapySDRThread.h" 11 | #include "SDREnumerator.h" 12 | #include "SDRDeviceAdd.h" 13 | 14 | class SDRDevicesDialog: public devFrame { 15 | public: 16 | explicit SDRDevicesDialog( wxWindow* parent, const wxPoint &wxPos = wxDefaultPosition); 17 | 18 | void OnClose( wxCloseEvent& event ) override; 19 | void OnDeleteItem( wxTreeEvent& event ) override; 20 | void OnSelectionChanged( wxTreeEvent& event ) override; 21 | void OnAddRemote( wxMouseEvent& event ) override; 22 | void OnUseSelected( wxMouseEvent& event ) override; 23 | void OnTreeDoubleClick( wxMouseEvent& event ) override; 24 | void OnDeviceTimer( wxTimerEvent& event ) override; 25 | void OnRefreshDevices( wxMouseEvent& event ) override; 26 | void OnPropGridChanged( wxPropertyGridEvent& event ) override; 27 | void OnPropGridFocus( wxFocusEvent& event ) override; 28 | 29 | private: 30 | void refreshDeviceProperties(); 31 | void doRefreshDevices(); 32 | 33 | SDRDeviceInfo *getSelectedDevice(wxTreeItemId selId_in); 34 | wxPGProperty *addArgInfoProperty(wxPropertyGrid *pg, SoapySDR::ArgInfo arg); 35 | 36 | // 37 | std::string getSelectedChoiceOption(wxPGProperty* prop, const SoapySDR::ArgInfo& arg); 38 | 39 | 40 | bool refresh, failed; 41 | std::map* > devs; 42 | std::vector::iterator devs_i; 43 | std::map devItems; 44 | std::map::iterator devItems_i; 45 | SDRDeviceInfo *dev; 46 | std::map deviceArgs; 47 | std::map runtimeProps; 48 | std::map runtimeArgs; 49 | std::map streamProps; 50 | std::map devSettings; 51 | wxTreeItemId selId; 52 | wxTreeItemId editId; 53 | wxTreeItemId removeId; 54 | SDRDeviceAddDialog *devAddDialog; 55 | }; -------------------------------------------------------------------------------- /src/forms/SDRDevices/SDRDevicesForm.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////// 2 | // C++ code generated with wxFormBuilder (version Aug 8 2018) 3 | // http://www.wxformbuilder.org/ 4 | // 5 | // PLEASE DO *NOT* EDIT THIS FILE! 6 | /////////////////////////////////////////////////////////////////////////// 7 | 8 | #ifndef __SDRDEVICESFORM_H__ 9 | #define __SDRDEVICESFORM_H__ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | /////////////////////////////////////////////////////////////////////////// 33 | 34 | 35 | /////////////////////////////////////////////////////////////////////////////// 36 | /// Class devFrame 37 | /////////////////////////////////////////////////////////////////////////////// 38 | class devFrame : public wxFrame 39 | { 40 | private: 41 | 42 | protected: 43 | wxStatusBar* devStatusBar; 44 | wxPanel* m_panel3; 45 | wxPanel* m_panel6; 46 | wxTreeCtrl* devTree; 47 | wxPanel* m_panel4; 48 | wxButton* m_refreshButton; 49 | wxButton* m_addRemoteButton; 50 | wxButton* m_useSelectedButton; 51 | wxPanel* m_panel61; 52 | wxStaticText* m_staticText1; 53 | wxPropertyGrid* m_propertyGrid; 54 | wxTimer m_deviceTimer; 55 | 56 | // Virtual event handlers, override them in your derived class 57 | virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } 58 | virtual void OnTreeDoubleClick( wxMouseEvent& event ) { event.Skip(); } 59 | virtual void OnDeleteItem( wxTreeEvent& event ) { event.Skip(); } 60 | virtual void OnSelectionChanged( wxTreeEvent& event ) { event.Skip(); } 61 | virtual void OnRefreshDevices( wxMouseEvent& event ) { event.Skip(); } 62 | virtual void OnAddRemote( wxMouseEvent& event ) { event.Skip(); } 63 | virtual void OnUseSelected( wxMouseEvent& event ) { event.Skip(); } 64 | virtual void OnPropGridChanged( wxPropertyGridEvent& event ) { event.Skip(); } 65 | virtual void OnPropGridFocus( wxFocusEvent& event ) { event.Skip(); } 66 | virtual void OnDeviceTimer( wxTimerEvent& event ) { event.Skip(); } 67 | 68 | 69 | public: 70 | 71 | devFrame( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("CubicSDR :: SDR Devices"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 700,467 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL ); 72 | 73 | ~devFrame(); 74 | 75 | }; 76 | 77 | #endif //__SDRDEVICESFORM_H__ 78 | -------------------------------------------------------------------------------- /src/modules/modem/Modem.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #include "Modem.h" 5 | 6 | 7 | ModemFactoryList Modem::modemFactories; 8 | DefaultRatesList Modem::modemDefaultRates; 9 | 10 | //! Create an empty range (0.0, 0.0) 11 | ModemRange::ModemRange() { 12 | _min = 0; 13 | _max = 0; 14 | } 15 | 16 | //! Create a min/max range 17 | ModemRange::ModemRange(const double minimum, const double maximum) { 18 | _min = minimum; 19 | _max = maximum; 20 | } 21 | 22 | //! Get the range minimum 23 | double ModemRange::minimum() const { 24 | return _min; 25 | } 26 | 27 | //! Get the range maximum 28 | double ModemRange::maximum() const { 29 | return _max; 30 | } 31 | 32 | ModemArgInfo::ModemArgInfo() = default; 33 | 34 | Modem::Modem() { 35 | useSignalOutput(false); 36 | } 37 | 38 | Modem::~Modem() = default; 39 | 40 | void Modem::addModemFactory(ModemFactoryFn factoryFunc, std::string modemName, int defaultRate) { 41 | modemFactories[modemName] = factoryFunc; 42 | modemDefaultRates[modemName] = defaultRate; 43 | } 44 | 45 | ModemFactoryList Modem::getFactories() { 46 | return modemFactories; 47 | } 48 | 49 | Modem *Modem::makeModem(std::string modemName) { 50 | if (modemFactories.find(modemName) != modemFactories.end()) { 51 | return (Modem *)modemFactories[modemName](); 52 | } 53 | 54 | return nullptr; 55 | } 56 | 57 | int Modem::getModemDefaultSampleRate(std::string modemName) { 58 | if (modemDefaultRates.find(modemName) != modemDefaultRates.end()) { 59 | return modemDefaultRates[modemName]; 60 | } 61 | 62 | return 0; 63 | } 64 | 65 | ModemArgInfoList Modem::getSettings() { 66 | ModemArgInfoList args; 67 | 68 | return args; 69 | } 70 | 71 | int Modem::getDefaultSampleRate() { 72 | return 200000; 73 | } 74 | 75 | void Modem::writeSetting(std::string /* setting */, std::string /* value */) { 76 | // ... 77 | } 78 | 79 | std::string Modem::readSetting(std::string /* setting */) { 80 | return ""; 81 | } 82 | 83 | void Modem::writeSettings(ModemSettings settings) { 84 | for (ModemSettings::const_iterator i = settings.begin(); i != settings.end(); i++) { 85 | writeSetting(i->first, i->second); 86 | } 87 | } 88 | 89 | ModemSettings Modem::readSettings() { 90 | ModemArgInfoList args = getSettings(); 91 | ModemSettings rs; 92 | for (const auto & arg : args) { 93 | rs[arg.key] = readSetting(arg.key); 94 | } 95 | return rs; 96 | } 97 | 98 | bool Modem::shouldRebuildKit() { 99 | return refreshKit.load(); 100 | } 101 | 102 | void Modem::rebuildKit() { 103 | refreshKit.store(true); 104 | } 105 | 106 | void Modem::clearRebuildKit() { 107 | refreshKit.store(false); 108 | } 109 | 110 | 111 | bool Modem::useSignalOutput() { 112 | return _useSignalOutput.load(); 113 | } 114 | 115 | void Modem::useSignalOutput(bool useOutput) { 116 | _useSignalOutput.store(useOutput); 117 | } 118 | -------------------------------------------------------------------------------- /src/modules/modem/ModemAnalog.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | #include "Modem.h" 6 | 7 | class ModemKitAnalog : public ModemKit { 8 | public: 9 | ModemKitAnalog() : ModemKit(), audioResampler(nullptr), audioResampleRatio(0) { 10 | 11 | }; 12 | 13 | msresamp_rrrf audioResampler; 14 | double audioResampleRatio; 15 | }; 16 | 17 | 18 | class ModemAnalog : public Modem { 19 | public: 20 | ModemAnalog(); 21 | std::string getType() override; 22 | int checkSampleRate(long long sampleRate, int audioSampleRate) override; 23 | ModemKit *buildKit(long long sampleRate, int audioSampleRate) override; 24 | void disposeKit(ModemKit *kit) override; 25 | virtual void initOutputBuffers(ModemKitAnalog *akit, ModemIQData *input); 26 | virtual void buildAudioOutput(ModemKitAnalog *akit, AudioThreadInput *audioOut, bool autoGain); 27 | virtual std::vector *getDemodOutputData(); 28 | virtual std::vector *getResampledOutputData(); 29 | protected: 30 | size_t bufSize; 31 | std::vector demodOutputData; 32 | std::vector resampledOutputData; 33 | 34 | float aOutputCeil; 35 | float aOutputCeilMA; 36 | float aOutputCeilMAA; 37 | }; 38 | -------------------------------------------------------------------------------- /src/modules/modem/ModemDigital.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #include "ModemDigital.h" 5 | 6 | 7 | ModemDigitalOutput::ModemDigitalOutput() = default; 8 | 9 | ModemDigital::ModemDigital() : Modem() { 10 | #if ENABLE_DIGITAL_LAB 11 | digitalOut = nullptr; 12 | #endif 13 | } 14 | 15 | ModemDigitalOutput::~ModemDigitalOutput() = default; 16 | 17 | std::string ModemDigital::getType() { 18 | return "digital"; 19 | } 20 | 21 | int ModemDigital::checkSampleRate(long long sampleRate, int /* audioSampleRate */) { 22 | if (sampleRate < MIN_BANDWIDTH) { 23 | return MIN_BANDWIDTH; 24 | } 25 | return (int)sampleRate; 26 | } 27 | 28 | ModemKit *ModemDigital::buildKit(long long sampleRate, int audioSampleRate) { 29 | auto *dkit = new ModemKitDigital; 30 | 31 | dkit->sampleRate = sampleRate; 32 | dkit->audioSampleRate = audioSampleRate; 33 | 34 | return dkit; 35 | } 36 | 37 | void ModemDigital::disposeKit(ModemKit *kit) { 38 | auto *dkit = (ModemKitDigital *)kit; 39 | 40 | delete dkit; 41 | } 42 | 43 | void ModemDigital::setDemodulatorLock(bool demod_lock_in) { 44 | currentDemodLock.store(demod_lock_in); 45 | } 46 | 47 | int ModemDigital::getDemodulatorLock() { 48 | return currentDemodLock.load(); 49 | } 50 | 51 | void ModemDigital::updateDemodulatorLock(modemcf mod, float sensitivity) { 52 | setDemodulatorLock(modemcf_get_demodulator_evm(mod) <= sensitivity); 53 | } 54 | 55 | void ModemDigital::digitalStart(ModemKitDigital * /* kit */, modemcf /* mod */, ModemIQData *input) { 56 | size_t bufSize = input->data.size(); 57 | 58 | if (demodOutputDataDigital.size() != bufSize) { 59 | if (demodOutputDataDigital.capacity() < bufSize) { 60 | demodOutputDataDigital.reserve(bufSize); 61 | } 62 | demodOutputDataDigital.resize(bufSize); 63 | } 64 | } 65 | 66 | void ModemDigital::digitalFinish(ModemKitDigital * /* kit */, modemcf /* mod */) { 67 | #if ENABLE_DIGITAL_LAB 68 | if (digitalOut && outStream.str().length()) { 69 | digitalOut->write(outStream.str()); 70 | outStream.str(""); 71 | } else { 72 | outStream.str(""); 73 | } 74 | #endif 75 | } 76 | 77 | #if ENABLE_DIGITAL_LAB 78 | void ModemDigital::setOutput(ModemDigitalOutput *modemDigitalOutput) { 79 | digitalOut = modemDigitalOutput; 80 | } 81 | #endif 82 | -------------------------------------------------------------------------------- /src/modules/modem/ModemDigital.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | #include "Modem.h" 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | class ModemKitDigital : public ModemKit { 13 | public: 14 | ModemKitDigital() : ModemKit() { 15 | 16 | }; 17 | }; 18 | 19 | class ModemDigitalOutput { 20 | public: 21 | ModemDigitalOutput(); 22 | virtual ~ModemDigitalOutput(); 23 | 24 | virtual void write(std::string outp) = 0; 25 | virtual void write(char outc) = 0; 26 | 27 | virtual void Show() = 0; 28 | virtual void Hide() = 0; 29 | virtual void Close() = 0; 30 | 31 | private: 32 | }; 33 | 34 | class ModemDigital : public Modem { 35 | public: 36 | ModemDigital(); 37 | 38 | std::string getType() override; 39 | 40 | int checkSampleRate(long long sampleRate, int audioSampleRate) override; 41 | 42 | ModemKit *buildKit(long long sampleRate, int audioSampleRate) override; 43 | void disposeKit(ModemKit *kit) override; 44 | 45 | virtual void digitalStart(ModemKitDigital *kit, modemcf mod, ModemIQData *input); 46 | virtual void digitalFinish(ModemKitDigital *kit, modemcf mod); 47 | 48 | virtual void setDemodulatorLock(bool demod_lock_in); 49 | virtual int getDemodulatorLock(); 50 | 51 | virtual void updateDemodulatorLock(modemcf mod, float sensitivity); 52 | 53 | #if ENABLE_DIGITAL_LAB 54 | void setOutput(ModemDigitalOutput *digitalOutput); 55 | #endif 56 | 57 | protected: 58 | std::vector demodOutputDataDigital; 59 | std::atomic_bool currentDemodLock; 60 | #if ENABLE_DIGITAL_LAB 61 | ModemDigitalOutput *digitalOut; 62 | std::stringstream outStream; 63 | #endif 64 | }; -------------------------------------------------------------------------------- /src/modules/modem/analog/ModemAM.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #include "ModemAM.h" 5 | 6 | ModemAM::ModemAM() : ModemAnalog() { 7 | // Create a DC blocker using 25 samples wide window 8 | // and 30dB reduction of the DC level. 9 | mDCBlock = firfilt_rrrf_create_dc_blocker (25,30.0f); 10 | useSignalOutput(true); 11 | } 12 | 13 | ModemAM::~ModemAM() { 14 | firfilt_rrrf_destroy(mDCBlock); 15 | } 16 | 17 | ModemBase *ModemAM::factory() { 18 | return new ModemAM; 19 | } 20 | 21 | std::string ModemAM::getName() { 22 | return "AM"; 23 | } 24 | 25 | int ModemAM::getDefaultSampleRate() { 26 | return 6000; 27 | } 28 | 29 | void ModemAM::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput* audioOut) { 30 | auto *amkit = (ModemKitAnalog *)kit; 31 | 32 | initOutputBuffers(amkit,input); 33 | 34 | if (!bufSize) { 35 | 36 | return; 37 | } 38 | 39 | // Implement an AM demodulator. Compute signal 40 | // amplitude followed by a DC blocker to remove 41 | // the DC offset. 42 | for (size_t i = 0; i < bufSize; i++) { 43 | float I = input->data[i].real; 44 | float Q = input->data[i].imag; 45 | firfilt_rrrf_push (mDCBlock,sqrt(I*I+Q*Q)); 46 | firfilt_rrrf_execute (mDCBlock,&demodOutputData[i]); 47 | } 48 | 49 | buildAudioOutput(amkit,audioOut,true); 50 | } 51 | -------------------------------------------------------------------------------- /src/modules/modem/analog/ModemAM.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | #include "Modem.h" 6 | #include "ModemAnalog.h" 7 | 8 | class ModemAM : public ModemAnalog { 9 | public: 10 | ModemAM(); 11 | ~ModemAM() override; 12 | 13 | std::string getName() override; 14 | 15 | static ModemBase *factory(); 16 | 17 | int getDefaultSampleRate() override; 18 | 19 | void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) override; 20 | 21 | private: 22 | firfilt_rrrf mDCBlock; 23 | }; 24 | -------------------------------------------------------------------------------- /src/modules/modem/analog/ModemCW.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | 6 | #include "Modem.h" 7 | #include "ModemAnalog.h" 8 | 9 | class ModemKitCW : public ModemKitAnalog { 10 | public: 11 | ModemKitCW() : ModemKitAnalog() { 12 | }; 13 | msresamp_cccf mInputResampler{}; 14 | }; 15 | 16 | class ModemCW : public ModemAnalog { 17 | public: 18 | ModemCW(); 19 | 20 | ~ModemCW() override; 21 | 22 | std::string getName() override; 23 | 24 | static ModemBase *factory(); 25 | 26 | int checkSampleRate(long long srate, int arate) override; 27 | 28 | ModemKit *buildKit(long long srate, int arate) override; 29 | 30 | void disposeKit(ModemKit *kit) override; 31 | 32 | void initOutputBuffers(ModemKitAnalog *akit, ModemIQData *input) override; 33 | 34 | int getDefaultSampleRate() override; 35 | 36 | void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) override; 37 | 38 | ModemArgInfoList getSettings() override; 39 | 40 | void writeSetting(std::string setting, std::string value) override; 41 | 42 | std::string readSetting(std::string setting) override; 43 | 44 | // No resampling required. 45 | std::vector *getResampledOutputData() override { return &demodOutputData; } 46 | 47 | private: 48 | float mBeepFrequency; 49 | float mGain; 50 | bool mAutoGain; 51 | nco_crcf mLO; 52 | firhilbf mToReal; 53 | std::vector mInput; 54 | }; 55 | -------------------------------------------------------------------------------- /src/modules/modem/analog/ModemDSB.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #include "ModemDSB.h" 5 | 6 | ModemDSB::ModemDSB() : ModemAnalog() { 7 | demodAM_DSB = ampmodem_create(0.5, LIQUID_AMPMODEM_DSB, 1); 8 | useSignalOutput(true); 9 | } 10 | 11 | ModemDSB::~ModemDSB() { 12 | ampmodem_destroy(demodAM_DSB); 13 | } 14 | 15 | ModemBase *ModemDSB::factory() { 16 | return new ModemDSB; 17 | } 18 | 19 | std::string ModemDSB::getName() { 20 | return "DSB"; 21 | } 22 | 23 | int ModemDSB::getDefaultSampleRate() { 24 | return 5400; 25 | } 26 | 27 | void ModemDSB::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) { 28 | auto *amkit = (ModemKitAnalog *)kit; 29 | 30 | initOutputBuffers(amkit, input); 31 | 32 | if (!bufSize) { 33 | 34 | return; 35 | } 36 | 37 | for (size_t i = 0; i < bufSize; i++) { 38 | ampmodem_demodulate(demodAM_DSB, input->data[i], &demodOutputData[i]); 39 | } 40 | 41 | buildAudioOutput(amkit, audioOut, true); 42 | } 43 | -------------------------------------------------------------------------------- /src/modules/modem/analog/ModemDSB.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | #include "Modem.h" 6 | #include "ModemAnalog.h" 7 | 8 | class ModemDSB : public ModemAnalog { 9 | public: 10 | ModemDSB(); 11 | ~ModemDSB() override; 12 | 13 | std::string getName() override; 14 | 15 | static ModemBase *factory(); 16 | 17 | int getDefaultSampleRate() override; 18 | 19 | void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) override; 20 | 21 | private: 22 | ampmodem demodAM_DSB; 23 | }; -------------------------------------------------------------------------------- /src/modules/modem/analog/ModemFM.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #include "ModemFM.h" 5 | 6 | ModemFM::ModemFM() : ModemAnalog() { 7 | demodFM = freqdem_create(0.5); 8 | } 9 | 10 | ModemFM::~ModemFM() { 11 | freqdem_destroy(demodFM); 12 | } 13 | 14 | ModemBase *ModemFM::factory() { 15 | return new ModemFM; 16 | } 17 | 18 | std::string ModemFM::getName() { 19 | return "FM"; 20 | } 21 | 22 | int ModemFM::getDefaultSampleRate() { 23 | return 200000; 24 | } 25 | 26 | void ModemFM::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) { 27 | auto *fmkit = (ModemKitAnalog *)kit; 28 | 29 | initOutputBuffers(fmkit, input); 30 | 31 | if (!bufSize) { 32 | 33 | return; 34 | } 35 | 36 | freqdem_demodulate_block(demodFM, &input->data[0], (int)bufSize, &demodOutputData[0]); 37 | 38 | buildAudioOutput(fmkit, audioOut, false); 39 | } 40 | -------------------------------------------------------------------------------- /src/modules/modem/analog/ModemFM.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | #include "Modem.h" 6 | #include "ModemAnalog.h" 7 | 8 | class ModemFM : public ModemAnalog { 9 | public: 10 | ModemFM(); 11 | ~ModemFM() override; 12 | 13 | std::string getName() override; 14 | 15 | static ModemBase *factory(); 16 | 17 | int getDefaultSampleRate() override; 18 | 19 | void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) override; 20 | 21 | private: 22 | freqdem demodFM; 23 | }; -------------------------------------------------------------------------------- /src/modules/modem/analog/ModemFMStereo.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | #include "Modem.h" 6 | 7 | class ModemKitFMStereo: public ModemKit { 8 | public: 9 | ModemKitFMStereo() : audioResampler(nullptr), stereoResampler(nullptr), audioResampleRatio(0), firStereoLeft(nullptr), firStereoRight(nullptr), iirStereoPilot(nullptr), 10 | demph(0), iirDemphR(nullptr), iirDemphL(nullptr), firStereoR2C(nullptr), firStereoC2R(nullptr), stereoPilot(nullptr) { 11 | } 12 | 13 | msresamp_rrrf audioResampler; 14 | msresamp_rrrf stereoResampler; 15 | double audioResampleRatio; 16 | 17 | firfilt_rrrf firStereoLeft; 18 | firfilt_rrrf firStereoRight; 19 | iirfilt_crcf iirStereoPilot; 20 | 21 | int demph; 22 | iirfilt_rrrf iirDemphR; 23 | iirfilt_rrrf iirDemphL; 24 | 25 | firhilbf firStereoR2C; 26 | firhilbf firStereoC2R; 27 | 28 | nco_crcf stereoPilot; 29 | }; 30 | 31 | 32 | class ModemFMStereo : public Modem { 33 | public: 34 | ModemFMStereo(); 35 | ~ModemFMStereo() override; 36 | 37 | std::string getType() override; 38 | std::string getName() override; 39 | 40 | static ModemBase *factory(); 41 | 42 | int checkSampleRate(long long sampleRate, int audioSampleRate) override; 43 | int getDefaultSampleRate() override; 44 | 45 | ModemArgInfoList getSettings() override; 46 | void writeSetting(std::string setting, std::string value) override; 47 | std::string readSetting(std::string setting) override; 48 | 49 | ModemKit *buildKit(long long sampleRate, int audioSampleRate) override; 50 | void disposeKit(ModemKit *kit) override; 51 | 52 | void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) override; 53 | 54 | private: 55 | std::vector demodOutputData; 56 | std::vector demodStereoData; 57 | std::vector resampledOutputData; 58 | std::vector resampledStereoData; 59 | freqdem demodFM; 60 | 61 | int _demph; 62 | }; -------------------------------------------------------------------------------- /src/modules/modem/analog/ModemIQ.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #include "ModemIQ.h" 5 | 6 | ModemIQ::ModemIQ() = default; 7 | 8 | std::string ModemIQ::getType() { 9 | return "analog"; 10 | } 11 | 12 | std::string ModemIQ::getName() { 13 | return "I/Q"; 14 | } 15 | 16 | ModemBase *ModemIQ::factory() { 17 | return new ModemIQ; 18 | } 19 | 20 | ModemKit *ModemIQ::buildKit(long long sampleRate, int audioSampleRate) { 21 | auto *kit = new ModemKit; 22 | kit->sampleRate = sampleRate; 23 | kit->audioSampleRate = audioSampleRate; 24 | return kit; 25 | } 26 | 27 | void ModemIQ::disposeKit(ModemKit *kit) { 28 | delete kit; 29 | } 30 | 31 | int ModemIQ::checkSampleRate(long long /* sampleRate */, int audioSampleRate) { 32 | return audioSampleRate; 33 | } 34 | 35 | int ModemIQ::getDefaultSampleRate() { 36 | return 48000; 37 | } 38 | 39 | void ModemIQ::demodulate(ModemKit * /* kit */, ModemIQData *input, AudioThreadInput *audioOut) { 40 | size_t bufSize = input->data.size(); 41 | 42 | if (!bufSize) { 43 | 44 | return; 45 | } 46 | 47 | audioOut->channels = 2; 48 | if (audioOut->data.capacity() < (bufSize * 2)) { 49 | audioOut->data.reserve(bufSize * 2); 50 | } 51 | 52 | audioOut->data.resize(bufSize * 2); 53 | for (size_t i = 0; i < bufSize; i++) { 54 | audioOut->data[i * 2] = input->data[i].imag; 55 | audioOut->data[i * 2 + 1] = input->data[i].real; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/modules/modem/analog/ModemIQ.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | #include "Modem.h" 6 | 7 | class ModemIQ : public Modem { 8 | public: 9 | ModemIQ(); 10 | 11 | std::string getType() override; 12 | std::string getName() override; 13 | 14 | static ModemBase *factory(); 15 | 16 | int checkSampleRate(long long sampleRate, int audioSampleRate) override; 17 | int getDefaultSampleRate() override; 18 | 19 | ModemKit *buildKit(long long sampleRate, int audioSampleRate) override; 20 | 21 | void disposeKit(ModemKit *kit) override; 22 | 23 | void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) override; 24 | 25 | private: 26 | 27 | }; -------------------------------------------------------------------------------- /src/modules/modem/analog/ModemLSB.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #include "ModemLSB.h" 5 | 6 | ModemLSB::ModemLSB() : ModemAnalog() { 7 | // half band filter used for side-band elimination 8 | ssbFilt = iirfilt_crcf_create_lowpass(6, 0.25); 9 | ssbShift = nco_crcf_create(LIQUID_NCO); 10 | nco_crcf_set_frequency(ssbShift, (float)((2.0 * M_PI) * 0.25)); 11 | c2rFilt = firhilbf_create(5, 90.0); 12 | useSignalOutput(true); 13 | } 14 | 15 | ModemBase *ModemLSB::factory() { 16 | return new ModemLSB; 17 | } 18 | 19 | std::string ModemLSB::getName() { 20 | return "LSB"; 21 | } 22 | 23 | ModemLSB::~ModemLSB() { 24 | iirfilt_crcf_destroy(ssbFilt); 25 | nco_crcf_destroy(ssbShift); 26 | firhilbf_destroy(c2rFilt); 27 | } 28 | 29 | int ModemLSB::checkSampleRate(long long sampleRate, int /* audioSampleRate */) { 30 | if (sampleRate < MIN_BANDWIDTH) { 31 | return MIN_BANDWIDTH; 32 | } 33 | if (sampleRate % 2 == 0) { 34 | return (int)sampleRate; 35 | } 36 | return (int)(sampleRate+1); 37 | } 38 | 39 | int ModemLSB::getDefaultSampleRate() { 40 | return 5400; 41 | } 42 | 43 | void ModemLSB::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) { 44 | auto *akit = (ModemKitAnalog *)kit; 45 | 46 | initOutputBuffers(akit,input); 47 | 48 | if (!bufSize) { 49 | 50 | return; 51 | } 52 | 53 | liquid_float_complex x, y; 54 | for (size_t i = 0; i < bufSize; i++) { // Reject upper band 55 | nco_crcf_step(ssbShift); 56 | nco_crcf_mix_up(ssbShift, input->data[i], &x); 57 | iirfilt_crcf_execute(ssbFilt, x, &y); 58 | nco_crcf_mix_down(ssbShift, y, &x); 59 | float usb_discard; 60 | firhilbf_c2r_execute(c2rFilt, x, &demodOutputData[i], &usb_discard); 61 | } 62 | 63 | buildAudioOutput(akit, audioOut, true); 64 | } 65 | -------------------------------------------------------------------------------- /src/modules/modem/analog/ModemLSB.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | #include "ModemAnalog.h" 6 | 7 | class ModemLSB : public ModemAnalog { 8 | public: 9 | ModemLSB(); 10 | ~ModemLSB() override; 11 | 12 | std::string getName() override; 13 | 14 | static ModemBase *factory(); 15 | 16 | int checkSampleRate(long long sampleRate, int audioSampleRate) override; 17 | int getDefaultSampleRate() override; 18 | 19 | void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) override; 20 | 21 | private: 22 | iirfilt_crcf ssbFilt; 23 | firhilbf c2rFilt; 24 | nco_crcf ssbShift; 25 | }; -------------------------------------------------------------------------------- /src/modules/modem/analog/ModemNBFM.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #include "ModemNBFM.h" 5 | 6 | ModemNBFM::ModemNBFM() : ModemAnalog() { 7 | demodFM = freqdem_create(0.5); 8 | } 9 | 10 | ModemNBFM::~ModemNBFM() { 11 | freqdem_destroy(demodFM); 12 | } 13 | 14 | ModemBase *ModemNBFM::factory() { 15 | return new ModemNBFM; 16 | } 17 | 18 | std::string ModemNBFM::getName() { 19 | return "NBFM"; 20 | } 21 | 22 | int ModemNBFM::getDefaultSampleRate() { 23 | return 12500; 24 | } 25 | 26 | void ModemNBFM::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) { 27 | auto *fmkit = (ModemKitAnalog *)kit; 28 | 29 | initOutputBuffers(fmkit, input); 30 | 31 | if (!bufSize) { 32 | 33 | return; 34 | } 35 | 36 | freqdem_demodulate_block(demodFM, &input->data[0], (unsigned int)bufSize, &demodOutputData[0]); 37 | 38 | buildAudioOutput(fmkit, audioOut, false); 39 | } 40 | -------------------------------------------------------------------------------- /src/modules/modem/analog/ModemNBFM.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | #include "Modem.h" 6 | #include "ModemAnalog.h" 7 | 8 | class ModemNBFM : public ModemAnalog { 9 | public: 10 | ModemNBFM(); 11 | ~ModemNBFM() override; 12 | 13 | std::string getName() override; 14 | 15 | static ModemBase *factory(); 16 | 17 | int getDefaultSampleRate() override; 18 | 19 | void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) override; 20 | 21 | private: 22 | freqdem demodFM; 23 | }; -------------------------------------------------------------------------------- /src/modules/modem/analog/ModemUSB.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #include "ModemUSB.h" 5 | 6 | ModemUSB::ModemUSB() : ModemAnalog() { 7 | // half band filter used for side-band elimination 8 | ssbFilt = iirfilt_crcf_create_lowpass(6, 0.25); 9 | ssbShift = nco_crcf_create(LIQUID_NCO); 10 | nco_crcf_set_frequency(ssbShift, (float)((2.0 * M_PI) * 0.25)); 11 | c2rFilt = firhilbf_create(5, 90.0); 12 | useSignalOutput(true); 13 | } 14 | 15 | ModemBase *ModemUSB::factory() { 16 | return new ModemUSB; 17 | } 18 | 19 | std::string ModemUSB::getName() { 20 | return "USB"; 21 | } 22 | 23 | ModemUSB::~ModemUSB() { 24 | iirfilt_crcf_destroy(ssbFilt); 25 | nco_crcf_destroy(ssbShift); 26 | firhilbf_destroy(c2rFilt); 27 | } 28 | 29 | int ModemUSB::checkSampleRate(long long sampleRate, int /* audioSampleRate */) { 30 | if (sampleRate < MIN_BANDWIDTH) { 31 | return MIN_BANDWIDTH; 32 | } 33 | if (sampleRate % 2 == 0) { 34 | return (int)sampleRate; 35 | } 36 | return (int)(sampleRate+1); 37 | } 38 | 39 | int ModemUSB::getDefaultSampleRate() { 40 | return 5400; 41 | } 42 | 43 | void ModemUSB::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) { 44 | auto *akit = (ModemKitAnalog *)kit; 45 | 46 | initOutputBuffers(akit,input); 47 | 48 | if (!bufSize) { 49 | 50 | return; 51 | } 52 | 53 | liquid_float_complex x, y; 54 | for (size_t i = 0; i < bufSize; i++) { // Reject lower band 55 | nco_crcf_step(ssbShift); 56 | nco_crcf_mix_down(ssbShift, input->data[i], &x); 57 | iirfilt_crcf_execute(ssbFilt, x, &y); 58 | nco_crcf_mix_up(ssbShift, y, &x); 59 | float lsb_discard; 60 | firhilbf_c2r_execute(c2rFilt, x, &lsb_discard, &demodOutputData[i]); 61 | } 62 | 63 | buildAudioOutput(akit, audioOut, true); 64 | } 65 | 66 | -------------------------------------------------------------------------------- /src/modules/modem/analog/ModemUSB.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | #include "ModemAnalog.h" 6 | 7 | class ModemUSB : public ModemAnalog { 8 | public: 9 | ModemUSB(); 10 | ~ModemUSB() override; 11 | 12 | std::string getName() override; 13 | 14 | static ModemBase *factory(); 15 | 16 | int checkSampleRate(long long sampleRate, int audioSampleRate) override; 17 | int getDefaultSampleRate() override; 18 | 19 | void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) override; 20 | 21 | private: 22 | iirfilt_crcf ssbFilt; 23 | firhilbf c2rFilt; 24 | nco_crcf ssbShift; 25 | }; -------------------------------------------------------------------------------- /src/modules/modem/digital/ModemAPSK.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | #include "ModemDigital.h" 6 | 7 | class ModemAPSK : public ModemDigital { 8 | public: 9 | ModemAPSK(); 10 | ~ModemAPSK() override; 11 | 12 | std::string getName() override; 13 | 14 | static ModemBase *factory(); 15 | 16 | ModemArgInfoList getSettings() override; 17 | void writeSetting(std::string setting, std::string value) override; 18 | std::string readSetting(std::string setting) override; 19 | 20 | void updateDemodulatorCons(int cons_in); 21 | void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) override; 22 | 23 | private: 24 | int cons; 25 | modemcf demodAPSK; 26 | modemcf demodAPSK4; 27 | modemcf demodAPSK8; 28 | modemcf demodAPSK16; 29 | modemcf demodAPSK32; 30 | modemcf demodAPSK64; 31 | modemcf demodAPSK128; 32 | modemcf demodAPSK256; 33 | }; 34 | -------------------------------------------------------------------------------- /src/modules/modem/digital/ModemASK.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | #include "ModemDigital.h" 6 | 7 | class ModemASK : public ModemDigital { 8 | public: 9 | ModemASK(); 10 | ~ModemASK() override; 11 | 12 | std::string getName() override; 13 | 14 | static ModemBase *factory(); 15 | 16 | ModemArgInfoList getSettings() override; 17 | void writeSetting(std::string setting, std::string value) override; 18 | std::string readSetting(std::string setting) override; 19 | 20 | void updateDemodulatorCons(int cons_in); 21 | void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) override; 22 | 23 | private: 24 | int cons; 25 | modemcf demodASK; 26 | modemcf demodASK2; 27 | modemcf demodASK4; 28 | modemcf demodASK8; 29 | modemcf demodASK16; 30 | modemcf demodASK32; 31 | modemcf demodASK64; 32 | modemcf demodASK128; 33 | modemcf demodASK256; 34 | }; 35 | -------------------------------------------------------------------------------- /src/modules/modem/digital/ModemBPSK.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #include "ModemBPSK.h" 5 | 6 | ModemBPSK::ModemBPSK() : ModemDigital() { 7 | demodBPSK = modemcf_create(LIQUID_MODEM_BPSK); 8 | } 9 | 10 | ModemBase *ModemBPSK::factory() { 11 | return new ModemBPSK; 12 | } 13 | 14 | ModemBPSK::~ModemBPSK() { 15 | modemcf_destroy(demodBPSK); 16 | } 17 | 18 | std::string ModemBPSK::getName() { 19 | return "BPSK"; 20 | } 21 | 22 | void ModemBPSK::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput * /* audioOut */) { 23 | auto *dkit = (ModemKitDigital *)kit; 24 | digitalStart(dkit, demodBPSK, input); 25 | 26 | for (size_t i = 0, bufSize=input->data.size(); i < bufSize; i++) { 27 | modemcf_demodulate(demodBPSK, input->data[i], &demodOutputDataDigital[i]); 28 | } 29 | updateDemodulatorLock(demodBPSK, 0.005f); 30 | 31 | digitalFinish(dkit, demodBPSK); 32 | } 33 | -------------------------------------------------------------------------------- /src/modules/modem/digital/ModemBPSK.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | #include "ModemDigital.h" 6 | 7 | class ModemBPSK : public ModemDigital { 8 | public: 9 | ModemBPSK(); 10 | ~ModemBPSK() override; 11 | 12 | std::string getName() override; 13 | 14 | static ModemBase *factory(); 15 | 16 | void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) override; 17 | 18 | private: 19 | modemcf demodBPSK; 20 | }; 21 | -------------------------------------------------------------------------------- /src/modules/modem/digital/ModemDPSK.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | #include "ModemDigital.h" 6 | 7 | class ModemDPSK : public ModemDigital { 8 | public: 9 | ModemDPSK(); 10 | ~ModemDPSK() override; 11 | 12 | std::string getName() override; 13 | 14 | static ModemBase *factory(); 15 | 16 | ModemArgInfoList getSettings() override; 17 | void writeSetting(std::string setting, std::string value) override; 18 | std::string readSetting(std::string setting) override; 19 | 20 | void updateDemodulatorCons(int cons_in); 21 | void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) override; 22 | 23 | private: 24 | int cons; 25 | modemcf demodDPSK; 26 | modemcf demodDPSK2; 27 | modemcf demodDPSK4; 28 | modemcf demodDPSK8; 29 | modemcf demodDPSK16; 30 | modemcf demodDPSK32; 31 | modemcf demodDPSK64; 32 | modemcf demodDPSK128; 33 | modemcf demodDPSK256; 34 | }; 35 | 36 | -------------------------------------------------------------------------------- /src/modules/modem/digital/ModemFSK.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | #include "ModemDigital.h" 6 | #include 7 | 8 | class ModemKitFSK : public ModemKitDigital { 9 | public: 10 | unsigned int m, k; 11 | float bw; 12 | 13 | fskdem demodFSK; 14 | std::vector inputBuffer; 15 | }; 16 | 17 | 18 | class ModemFSK : public ModemDigital { 19 | public: 20 | ModemFSK(); 21 | ~ModemFSK() override; 22 | 23 | std::string getName() override; 24 | 25 | static ModemBase *factory(); 26 | 27 | int checkSampleRate(long long sampleRate, int audioSampleRate) override; 28 | int getDefaultSampleRate() override; 29 | 30 | ModemArgInfoList getSettings() override; 31 | void writeSetting(std::string setting, std::string value) override; 32 | std::string readSetting(std::string setting) override; 33 | 34 | ModemKit *buildKit(long long sampleRate, int audioSampleRate) override; 35 | void disposeKit(ModemKit *kit) override; 36 | 37 | void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) override; 38 | 39 | private: 40 | int sps, bps; 41 | float bw; 42 | }; 43 | 44 | -------------------------------------------------------------------------------- /src/modules/modem/digital/ModemGMSK.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | #include "ModemDigital.h" 6 | #include 7 | 8 | class ModemKitGMSK : public ModemKitDigital { 9 | public: 10 | unsigned int fdelay, sps; 11 | float ebf; 12 | 13 | gmskdem demodGMSK; 14 | std::vector inputBuffer; 15 | }; 16 | 17 | 18 | class ModemGMSK : public ModemDigital { 19 | public: 20 | ModemGMSK(); 21 | ~ModemGMSK() override; 22 | 23 | std::string getName() override; 24 | 25 | static ModemBase *factory(); 26 | 27 | int checkSampleRate(long long sampleRate, int audioSampleRate) override; 28 | int getDefaultSampleRate() override; 29 | 30 | ModemArgInfoList getSettings() override; 31 | void writeSetting(std::string setting, std::string value) override; 32 | std::string readSetting(std::string setting) override; 33 | 34 | ModemKit *buildKit(long long sampleRate, int audioSampleRate) override; 35 | void disposeKit(ModemKit *kit) override; 36 | 37 | void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) override; 38 | 39 | private: 40 | int _sps; // samples per symbol 41 | int _fdelay; // filter delay 42 | float _ebf; 43 | }; 44 | 45 | -------------------------------------------------------------------------------- /src/modules/modem/digital/ModemOOK.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #include "ModemOOK.h" 5 | 6 | ModemOOK::ModemOOK() : ModemDigital() { 7 | demodOOK = modemcf_create(LIQUID_MODEM_OOK); 8 | } 9 | 10 | ModemOOK::~ModemOOK() { 11 | modemcf_destroy(demodOOK); 12 | } 13 | 14 | std::string ModemOOK::getName() { 15 | return "OOK"; 16 | } 17 | 18 | ModemBase *ModemOOK::factory() { 19 | return new ModemOOK; 20 | } 21 | 22 | int ModemOOK::checkSampleRate(long long sampleRate, int /* audioSampleRate */) { 23 | if (sampleRate < 100) { 24 | return 100; 25 | } 26 | return (int)sampleRate; 27 | } 28 | 29 | void ModemOOK::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput * /* audioOut */) { 30 | auto *dkit = (ModemKitDigital *)kit; 31 | digitalStart(dkit, demodOOK, input); 32 | 33 | for (size_t i = 0, bufSize=input->data.size(); i < bufSize; i++) { 34 | modemcf_demodulate(demodOOK, input->data[i], &demodOutputDataDigital[i]); 35 | } 36 | updateDemodulatorLock(demodOOK, 0.005f); 37 | 38 | digitalFinish(dkit, demodOOK); 39 | } 40 | -------------------------------------------------------------------------------- /src/modules/modem/digital/ModemOOK.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | #include "ModemDigital.h" 6 | 7 | class ModemOOK : public ModemDigital { 8 | public: 9 | ModemOOK(); 10 | ~ModemOOK() override; 11 | 12 | std::string getName() override; 13 | 14 | static ModemBase *factory(); 15 | 16 | int checkSampleRate(long long sampleRate, int audioSampleRate) override; 17 | 18 | void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) override; 19 | 20 | private: 21 | modemcf demodOOK; 22 | }; 23 | -------------------------------------------------------------------------------- /src/modules/modem/digital/ModemPSK.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | #include "ModemDigital.h" 6 | 7 | class ModemPSK : public ModemDigital { 8 | public: 9 | ModemPSK(); 10 | ~ModemPSK() override; 11 | 12 | std::string getName() override; 13 | 14 | static ModemBase *factory(); 15 | 16 | ModemArgInfoList getSettings() override; 17 | void writeSetting(std::string setting, std::string value) override; 18 | std::string readSetting(std::string setting) override; 19 | 20 | void updateDemodulatorCons(int cons_in); 21 | void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) override; 22 | 23 | private: 24 | int cons; 25 | modemcf demodPSK; 26 | modemcf demodPSK2; 27 | modemcf demodPSK4; 28 | modemcf demodPSK8; 29 | modemcf demodPSK16; 30 | modemcf demodPSK32; 31 | modemcf demodPSK64; 32 | modemcf demodPSK128; 33 | modemcf demodPSK256; 34 | }; 35 | 36 | -------------------------------------------------------------------------------- /src/modules/modem/digital/ModemQAM.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | #include "ModemDigital.h" 6 | 7 | class ModemQAM : public ModemDigital { 8 | public: 9 | ModemQAM(); 10 | ~ModemQAM() override; 11 | 12 | std::string getName() override; 13 | 14 | static ModemBase *factory(); 15 | 16 | ModemArgInfoList getSettings() override; 17 | void writeSetting(std::string setting, std::string value) override; 18 | std::string readSetting(std::string setting) override; 19 | 20 | void updateDemodulatorCons(int cons_in); 21 | void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) override; 22 | 23 | private: 24 | int cons; 25 | modemcf demodQAM; 26 | modemcf demodQAM4; 27 | modemcf demodQAM8; 28 | modemcf demodQAM16; 29 | modemcf demodQAM32; 30 | modemcf demodQAM64; 31 | modemcf demodQAM128; 32 | modemcf demodQAM256; 33 | }; 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/modules/modem/digital/ModemQPSK.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #include "ModemQPSK.h" 5 | 6 | ModemQPSK::ModemQPSK() : ModemDigital() { 7 | demodQPSK = modemcf_create(LIQUID_MODEM_QPSK); 8 | } 9 | 10 | ModemBase *ModemQPSK::factory() { 11 | return new ModemQPSK; 12 | } 13 | 14 | ModemQPSK::~ModemQPSK() { 15 | modemcf_destroy(demodQPSK); 16 | } 17 | 18 | std::string ModemQPSK::getName() { 19 | return "QPSK"; 20 | } 21 | 22 | void ModemQPSK::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput * /* audioOut */) { 23 | auto *dkit = (ModemKitDigital *)kit; 24 | digitalStart(dkit, demodQPSK, input); 25 | 26 | for (size_t i = 0, bufSize = input->data.size(); i < bufSize; i++) { 27 | modemcf_demodulate(demodQPSK, input->data[i], &demodOutputDataDigital[i]); 28 | } 29 | updateDemodulatorLock(demodQPSK, 0.8f); 30 | 31 | digitalFinish(dkit, demodQPSK); 32 | } 33 | -------------------------------------------------------------------------------- /src/modules/modem/digital/ModemQPSK.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | #include "ModemDigital.h" 6 | 7 | class ModemQPSK : public ModemDigital { 8 | public: 9 | ModemQPSK(); 10 | ~ModemQPSK() override; 11 | 12 | std::string getName() override; 13 | 14 | static ModemBase *factory(); 15 | 16 | void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) override; 17 | 18 | private: 19 | modemcf demodQPSK; 20 | }; 21 | -------------------------------------------------------------------------------- /src/modules/modem/digital/ModemSQAM.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #include "ModemSQAM.h" 5 | 6 | ModemSQAM::ModemSQAM() : ModemDigital() { 7 | demodSQAM32 = modemcf_create(LIQUID_MODEM_SQAM32); 8 | demodSQAM128 = modemcf_create(LIQUID_MODEM_SQAM128); 9 | demodSQAM = demodSQAM32; 10 | cons = 32; 11 | } 12 | 13 | ModemBase *ModemSQAM::factory() { 14 | return new ModemSQAM; 15 | } 16 | 17 | ModemSQAM::~ModemSQAM() { 18 | modemcf_destroy(demodSQAM32); 19 | modemcf_destroy(demodSQAM128); 20 | } 21 | 22 | std::string ModemSQAM::getName() { 23 | return "SQAM"; 24 | } 25 | 26 | ModemArgInfoList ModemSQAM::getSettings() { 27 | ModemArgInfoList args; 28 | 29 | ModemArgInfo consArg; 30 | consArg.key = "cons"; 31 | consArg.name = "Constellation"; 32 | consArg.description = "Modem Constellation Pattern"; 33 | consArg.value = std::to_string(cons); 34 | consArg.type = ModemArgInfo::Type::STRING; 35 | std::vector consOpts; 36 | consOpts.push_back("32"); 37 | consOpts.push_back("128"); 38 | consArg.options = consOpts; 39 | args.push_back(consArg); 40 | 41 | return args; 42 | } 43 | 44 | void ModemSQAM::writeSetting(std::string setting, std::string value) { 45 | if (setting == "cons") { 46 | int newCons = std::stoi(value); 47 | updateDemodulatorCons(newCons); 48 | } 49 | } 50 | 51 | std::string ModemSQAM::readSetting(std::string setting) { 52 | if (setting == "cons") { 53 | return std::to_string(cons); 54 | } 55 | return ""; 56 | } 57 | 58 | void ModemSQAM::updateDemodulatorCons(int cons_in) { 59 | cons = cons_in; 60 | switch (cons_in) { 61 | case 32: 62 | demodSQAM = demodSQAM32; 63 | break; 64 | case 128: 65 | demodSQAM = demodSQAM128; 66 | break; 67 | } 68 | } 69 | 70 | void ModemSQAM::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput * /* audioOut */) { 71 | auto *dkit = (ModemKitDigital *)kit; 72 | 73 | digitalStart(dkit, demodSQAM, input); 74 | 75 | for (size_t i = 0, bufSize = input->data.size(); i < bufSize; i++) { 76 | modemcf_demodulate(demodSQAM, input->data[i], &demodOutputDataDigital[i]); 77 | } 78 | updateDemodulatorLock(demodSQAM, 0.005f); 79 | 80 | digitalFinish(dkit, demodSQAM); 81 | } 82 | -------------------------------------------------------------------------------- /src/modules/modem/digital/ModemSQAM.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | #include "ModemDigital.h" 6 | 7 | class ModemSQAM : public ModemDigital { 8 | public: 9 | ModemSQAM(); 10 | ~ModemSQAM() override; 11 | 12 | std::string getName() override; 13 | 14 | static ModemBase *factory(); 15 | 16 | ModemArgInfoList getSettings() override; 17 | void writeSetting(std::string setting, std::string value) override; 18 | std::string readSetting(std::string setting) override; 19 | 20 | void updateDemodulatorCons(int cons_in); 21 | void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) override; 22 | 23 | private: 24 | int cons; 25 | modemcf demodSQAM; 26 | modemcf demodSQAM32; 27 | modemcf demodSQAM128; 28 | }; 29 | -------------------------------------------------------------------------------- /src/modules/modem/digital/ModemST.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #include "ModemST.h" 5 | 6 | ModemST::ModemST() : ModemDigital() { 7 | demodST = modemcf_create(LIQUID_MODEM_V29); 8 | } 9 | 10 | ModemBase *ModemST::factory() { 11 | return new ModemST; 12 | } 13 | 14 | std::string ModemST::getName() { 15 | return "ST"; 16 | } 17 | 18 | ModemST::~ModemST() { 19 | modemcf_destroy(demodST); 20 | } 21 | 22 | void ModemST::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput * /* audioOut */) { 23 | auto *dkit = (ModemKitDigital *)kit; 24 | digitalStart(dkit, demodST, input); 25 | 26 | for (size_t i = 0, bufSize = input->data.size(); i < bufSize; i++) { 27 | modemcf_demodulate(demodST, input->data[i], &demodOutputDataDigital[i]); 28 | } 29 | updateDemodulatorLock(demodST, 0.005f); 30 | 31 | digitalFinish(dkit, demodST); 32 | } 33 | -------------------------------------------------------------------------------- /src/modules/modem/digital/ModemST.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | #include "ModemDigital.h" 6 | 7 | class ModemST : public ModemDigital { 8 | public: 9 | ModemST(); 10 | ~ModemST() override; 11 | 12 | std::string getName() override; 13 | 14 | static ModemBase *factory(); 15 | 16 | void demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) override; 17 | 18 | private: 19 | modemcf demodST; 20 | }; 21 | 22 | -------------------------------------------------------------------------------- /src/panel/MeterPanel.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | 6 | #include "GLPanel.h" 7 | 8 | class MeterPanel : public GLPanel { 9 | 10 | public: 11 | MeterPanel(const std::string& name, float low, float high, float current); 12 | ~MeterPanel() override; 13 | void setName(std::string name_in); 14 | std::string getName(); 15 | void setRange(float low_in, float high_in); 16 | float getLow() const; 17 | float getHigh() const; 18 | void setValue(float value); 19 | void setHighlight(float value); 20 | void setHighlightVisible(bool vis); 21 | float getValue() const; 22 | bool isMeterHit(CubicVR::vec2 mousePoint); 23 | float getMeterHitValue(CubicVR::vec2 mousePoint); 24 | void setChanged(bool changed_in); 25 | bool getChanged() const; 26 | 27 | protected: 28 | void drawPanelContents() override; 29 | void setValueLabel(std::string label); 30 | void setPanelLevel(float setValue, GLPanel &panel) const; 31 | 32 | private: 33 | std::string name; 34 | float low, high, current; 35 | bool changed = false; 36 | GLPanel bgPanel; 37 | GLPanel levelPanel; 38 | GLPanel highlightPanel; 39 | GLTextPanel labelPanel; 40 | GLTextPanel valuePanel; 41 | }; -------------------------------------------------------------------------------- /src/panel/ScopePanel.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | 6 | #include "GLPanel.h" 7 | 8 | class ScopePanel : public GLPanel { 9 | 10 | public: 11 | typedef enum ScopeMode { SCOPE_MODE_Y, SCOPE_MODE_2Y, SCOPE_MODE_XY } ScopeMode; 12 | 13 | ScopePanel(); 14 | 15 | void setMode(ScopeMode scopeMode_in); 16 | ScopeMode getMode(); 17 | void setPoints(std::vector &points_in); 18 | 19 | protected: 20 | void drawPanelContents() override; 21 | 22 | private: 23 | std::vector points; 24 | ScopeMode scopeMode; 25 | GLPanel bgPanel; 26 | GLPanel bgPanelStereo[2]; 27 | }; -------------------------------------------------------------------------------- /src/panel/SpectrumPanel.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | 6 | #include "GLPanel.h" 7 | 8 | class SpectrumPanel : public GLPanel { 9 | public: 10 | SpectrumPanel(); 11 | 12 | void setPoints(std::vector &points_in); 13 | void setPeakPoints(std::vector &points_in); 14 | 15 | float getFloorValue() const; 16 | void setFloorValue(float floorValue_in); 17 | 18 | float getCeilValue() const; 19 | void setCeilValue(float ceilValue_in); 20 | 21 | void setFreq(long long freq_in); 22 | long long getFreq() const; 23 | 24 | void setBandwidth(long long bandwidth_in); 25 | long long getBandwidth() const; 26 | 27 | void setFFTSize(int fftSize_in); 28 | int getFFTSize() const; 29 | 30 | void setShowDb(bool showDb_in); 31 | bool getShowDb() const; 32 | 33 | void setUseDBOffset(bool useOfs); 34 | bool getUseDBOffset() const; 35 | 36 | protected: 37 | void drawPanelContents() override; 38 | 39 | private: 40 | float floorValue, ceilValue; 41 | int fftSize; 42 | long long freq; 43 | long long bandwidth; 44 | std::vector points; 45 | std::vector peak_points; 46 | 47 | GLTextPanel dbPanelCeil; 48 | GLTextPanel dbPanelFloor; 49 | bool showDb, useDbOfs; 50 | }; 51 | -------------------------------------------------------------------------------- /src/panel/WaterfallPanel.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | 6 | #include "GLPanel.h" 7 | #include 8 | 9 | class WaterfallPanel : public GLPanel { 10 | public: 11 | WaterfallPanel(); 12 | void setup(unsigned int fft_size_in, int num_waterfall_lines_in); 13 | void refreshTheme(); 14 | void setPoints(std::vector &points_in); 15 | void step(); 16 | void update(); 17 | 18 | protected: 19 | void drawPanelContents() override; 20 | 21 | private: 22 | std::vector points; 23 | 24 | GLuint waterfall[2]; 25 | int waterfall_ofs[2]; 26 | unsigned int fft_size; 27 | int waterfall_lines; 28 | unsigned char *waterfall_slice; 29 | std::vector lineBuffer[2]; 30 | std::vector rLineBuffer[2]; 31 | std::atomic_int lines_buffered; 32 | std::atomic_bool texInitialized, bufferInitialized; 33 | 34 | ColorTheme *activeTheme; 35 | }; 36 | -------------------------------------------------------------------------------- /src/process/FFTDataDistributor.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | 6 | #include "VisualProcessor.h" 7 | #include "DemodDefs.h" 8 | #include 9 | #include 10 | #include 11 | 12 | class FFTDataDistributor : public VisualProcessor { 13 | public: 14 | FFTDataDistributor(); 15 | void setFFTSize(unsigned int size); 16 | void setLinesPerSecond(unsigned int lines); 17 | unsigned int getLinesPerSecond() const; 18 | 19 | protected: 20 | void process() override; 21 | 22 | DemodulatorThreadIQData inputBuffer; 23 | ReBuffer outputBuffers; 24 | std::atomic fftSize; 25 | 26 | unsigned int linesPerSecond; 27 | double lineRateAccum; 28 | size_t bufferMax = 0; 29 | size_t bufferOffset = 0; 30 | size_t bufferedItems = 0; 31 | }; 32 | -------------------------------------------------------------------------------- /src/process/FFTVisualDataThread.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #include "FFTVisualDataThread.h" 5 | 6 | FFTVisualDataThread::FFTVisualDataThread() { 7 | linesPerSecond.store(DEFAULT_WATERFALL_LPS); 8 | lpsChanged.store(true); 9 | } 10 | 11 | FFTVisualDataThread::~FFTVisualDataThread() = default; 12 | 13 | void FFTVisualDataThread::setLinesPerSecond(int lps) { 14 | linesPerSecond.store(lps); 15 | lpsChanged.store(true); 16 | } 17 | 18 | int FFTVisualDataThread::getLinesPerSecond() { 19 | return linesPerSecond.load(); 20 | } 21 | 22 | SpectrumVisualProcessor *FFTVisualDataThread::getProcessor() { 23 | return &wproc; 24 | } 25 | 26 | void FFTVisualDataThread::run() { 27 | 28 | DemodulatorThreadInputQueuePtr pipeIQDataIn = std::static_pointer_cast(getInputQueue("IQDataInput")); 29 | SpectrumVisualDataQueuePtr pipeFFTDataOut = std::static_pointer_cast(getOutputQueue("FFTDataOutput")); 30 | 31 | 32 | fftQueue->set_max_num_items(100); 33 | pipeFFTDataOut->set_max_num_items(100); 34 | 35 | //FFT distributor plumbing: 36 | // IQDataInput push samples to process to FFT Data distributor. 37 | fftDistrib.setInput(pipeIQDataIn); 38 | 39 | //The FFT distributor has actually 1 output only, so it doesn't distribute at all :) 40 | fftDistrib.attachOutput(fftQueue); 41 | 42 | //FFT Distributor output is ==> SpectrumVisualProcessor input. 43 | wproc.setInput(fftQueue); 44 | wproc.attachOutput(pipeFFTDataOut); 45 | wproc.setup(DEFAULT_FFT_SIZE); 46 | 47 | // std::cout << "FFT visual data thread started." << std::endl; 48 | 49 | while(!stopping) { 50 | 51 | //this if fed by FFTDataDistributor which has a buffer of FFT_DISTRIBUTOR_BUFFER_IN_SECONDS 52 | //so sleep for << FFT_DISTRIBUTOR_BUFFER_IN_SECONDS not to be overflown 53 | std::this_thread::sleep_for(std::chrono::milliseconds((int)(FFT_DISTRIBUTOR_BUFFER_IN_SECONDS * 1000.0 / 25.0))); 54 | 55 | int fftSize = wproc.getDesiredInputSize(); 56 | 57 | if (fftSize) { 58 | fftDistrib.setFFTSize(fftSize); 59 | } else { 60 | fftDistrib.setFFTSize(DEFAULT_FFT_SIZE * SPECTRUM_VZM); 61 | } 62 | 63 | if (lpsChanged.load()) { 64 | fftDistrib.setLinesPerSecond(linesPerSecond.load()); 65 | lpsChanged.store(false); 66 | } 67 | 68 | //Make FFT Distributor process IQ samples 69 | //and package them into ready-to-FFT sample sets (representing 1 line) by wproc 70 | fftDistrib.run(); 71 | 72 | // Make wproc do a FFT of each of the sample sets provided by fftDistrib: 73 | while (!stopping && !wproc.isInputEmpty()) { 74 | wproc.run(); 75 | } 76 | } 77 | 78 | pipeIQDataIn->flush(); 79 | pipeFFTDataOut->flush(); 80 | 81 | // std::cout << "FFT visual data thread done." << std::endl; 82 | } 83 | 84 | void FFTVisualDataThread::terminate() { 85 | IOThread::terminate(); 86 | fftDistrib.flushQueues(); 87 | wproc.flushQueues(); 88 | } 89 | 90 | -------------------------------------------------------------------------------- /src/process/FFTVisualDataThread.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | #include 6 | #include "IOThread.h" 7 | #include "SpectrumVisualProcessor.h" 8 | #include "FFTDataDistributor.h" 9 | 10 | class FFTVisualDataThread : public IOThread { 11 | public: 12 | FFTVisualDataThread(); 13 | ~FFTVisualDataThread() override; 14 | 15 | void setLinesPerSecond(int lps); 16 | int getLinesPerSecond(); 17 | SpectrumVisualProcessor *getProcessor(); 18 | 19 | void run() override; 20 | 21 | void terminate() override; 22 | 23 | protected: 24 | FFTDataDistributor fftDistrib; 25 | DemodulatorThreadInputQueuePtr fftQueue = std::make_shared(); 26 | SpectrumVisualProcessor wproc; 27 | 28 | std::atomic_int linesPerSecond; 29 | std::atomic_bool lpsChanged; 30 | }; 31 | -------------------------------------------------------------------------------- /src/process/ScopeVisualProcessor.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | 6 | #include "VisualProcessor.h" 7 | #include "AudioThread.h" 8 | #include "ScopePanel.h" 9 | #include 10 | 11 | class ScopeRenderData { 12 | public: 13 | std::vector waveform_points; 14 | ScopePanel::ScopeMode mode = ScopePanel::SCOPE_MODE_Y; 15 | int inputRate; 16 | int sampleRate; 17 | int channels; 18 | bool spectrum; 19 | int fft_size; 20 | double fft_floor, fft_ceil; 21 | 22 | virtual ~ScopeRenderData() = default; 23 | }; 24 | 25 | typedef std::shared_ptr ScopeRenderDataPtr; 26 | 27 | typedef ThreadBlockingQueue ScopeRenderDataQueue; 28 | 29 | typedef std::shared_ptr ScopeRenderDataQueuePtr; 30 | 31 | class ScopeVisualProcessor : public VisualProcessor { 32 | public: 33 | ScopeVisualProcessor(); 34 | ~ScopeVisualProcessor() override; 35 | void setup(int fftSize_in); 36 | void setScopeEnabled(bool scopeEnable); 37 | void setSpectrumEnabled(bool spectrumEnable); 38 | protected: 39 | void process() override; 40 | ReBuffer outputBuffers; 41 | 42 | std::atomic_bool scopeEnabled; 43 | std::atomic_bool spectrumEnabled; 44 | 45 | std::vector fftInData; 46 | std::vector fftOutput; 47 | fftplan fftPlan; 48 | 49 | unsigned int fftSize = 0; 50 | int desiredInputSize; 51 | unsigned int maxScopeSamples; 52 | 53 | double fft_ceil_ma, fft_ceil_maa; 54 | double fft_floor_ma, fft_floor_maa; 55 | double fft_average_rate; 56 | 57 | std::vector fft_result; 58 | std::vector fft_result_ma; 59 | std::vector fft_result_maa; 60 | }; 61 | -------------------------------------------------------------------------------- /src/process/SpectrumVisualDataThread.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #include "SpectrumVisualDataThread.h" 5 | 6 | SpectrumVisualDataThread::SpectrumVisualDataThread() = default; 7 | 8 | SpectrumVisualDataThread::~SpectrumVisualDataThread() = default; 9 | 10 | SpectrumVisualProcessor *SpectrumVisualDataThread::getProcessor() { 11 | return &sproc; 12 | } 13 | 14 | void SpectrumVisualDataThread::run() { 15 | 16 | while(!stopping) { 17 | //this if fed by FFTDataDistributor which has a buffer of FFT_DISTRIBUTOR_BUFFER_IN_SECONDS 18 | //so sleep for << FFT_DISTRIBUTOR_BUFFER_IN_SECONDS not to be overflown 19 | std::this_thread::sleep_for(std::chrono::milliseconds((int)(FFT_DISTRIBUTOR_BUFFER_IN_SECONDS * 1000.0 / 25.0))); 20 | 21 | sproc.run(); 22 | } 23 | 24 | // std::cout << "Spectrum visual data thread done." << std::endl; 25 | } 26 | 27 | void SpectrumVisualDataThread::terminate() { 28 | IOThread::terminate(); 29 | sproc.flushQueues(); 30 | } -------------------------------------------------------------------------------- /src/process/SpectrumVisualDataThread.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | 6 | #include "IOThread.h" 7 | #include "SpectrumVisualProcessor.h" 8 | 9 | class SpectrumVisualDataThread : public IOThread { 10 | public: 11 | SpectrumVisualDataThread(); 12 | ~SpectrumVisualDataThread() override; 13 | SpectrumVisualProcessor *getProcessor(); 14 | 15 | void run() override; 16 | 17 | void terminate() override; 18 | 19 | protected: 20 | SpectrumVisualProcessor sproc; 21 | }; 22 | -------------------------------------------------------------------------------- /src/process/VisualProcessor.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #include "VisualProcessor.h" 5 | -------------------------------------------------------------------------------- /src/rig/RigThread.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | 6 | #include "IOThread.h" 7 | #include "CubicSDR.h" 8 | #include 9 | #include 10 | 11 | #ifndef FILPATHLEN 12 | #define FILPATHLEN HAMLIB_FILPATHLEN 13 | #endif 14 | 15 | struct rigGreater 16 | { 17 | bool operator()( const struct rig_caps *lx, const struct rig_caps *rx ) const { 18 | std::string ln(std::string(std::string(lx->mfg_name) + " " + std::string(lx->model_name))); 19 | std::string rn(std::string(std::string(rx->mfg_name) + " " + std::string(rx->model_name))); 20 | return ln.compare(rn)<0; 21 | } 22 | }; 23 | 24 | typedef std::vector RigList; 25 | 26 | class RigThread : public IOThread { 27 | public: 28 | RigThread(); 29 | ~RigThread() override; 30 | 31 | void initRig(rig_model_t rig_model, std::string rig_file, int serial_rate); 32 | void run() override; 33 | 34 | freq_t getFrequency(); 35 | void setFrequency(freq_t new_freq, bool oneShot); 36 | 37 | void setControlMode(bool cMode); 38 | bool getControlMode(); 39 | 40 | void setFollowMode(bool fMode); 41 | bool getFollowMode(); 42 | 43 | void setCenterLock(bool cLock); 44 | bool getCenterLock(); 45 | 46 | void setFollowModem(bool mFollow); 47 | bool getFollowModem(); 48 | 49 | bool getErrorState(); 50 | std::string getErrorMessage(); 51 | 52 | static RigList &enumerate(); 53 | static int add_hamlib_rig(const struct rig_caps *rc, void* f); 54 | 55 | protected: 56 | void setErrorStateFromHamlibCode(int errcode); 57 | 58 | private: 59 | RIG *rig; 60 | rig_model_t rigModel; 61 | std::string rigFile; 62 | int serialRate; 63 | int termStatus; 64 | freq_t freq; 65 | freq_t newFreq; 66 | std::atomic_bool freqChanged, setOneShot; 67 | std::atomic_bool controlMode, followMode, centerLock, followModem; 68 | std::atomic_bool errorState; 69 | std::string errorMessage; 70 | static RigList rigCaps; 71 | }; 72 | -------------------------------------------------------------------------------- /src/sdr/SDREnumerator.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | #include 9 | #include "IOThread.h" 10 | #include "SDRDeviceInfo.h" 11 | #include "AppConfig.h" 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | 19 | class SDREnumerator: public IOThread { 20 | private: 21 | 22 | public: 23 | SDREnumerator(); 24 | ~SDREnumerator() override; 25 | enum SDREnumState { SDR_ENUM_DEVICES_READY, SDR_ENUM_MESSAGE, SDR_ENUM_TERMINATED, SDR_ENUM_FAILED }; 26 | 27 | static std::vector *enumerate_devices(const std::string& remoteAddr = "", bool noInit=false); 28 | 29 | void run() override; 30 | 31 | static SoapySDR::Kwargs argsStrToKwargs(const std::string &args); 32 | static void addRemote(const std::string& remoteAddr); 33 | static void removeRemote(const std::string& remoteAddr); 34 | static std::vector &getRemotes(); 35 | static bool hasRemoteModule(); 36 | static void addManual(std::string factory, std::string params); 37 | static void removeManual(const std::string& factory, const std::string& params); 38 | static std::vector &getManuals(); 39 | static void setManuals(std::vector manuals_in); 40 | static void reset(); 41 | static std::vector &getFactories(); 42 | 43 | protected: 44 | static bool soapy_initialized, has_remote; 45 | static std::vector factories; 46 | static std::vector modules; 47 | static std::vector remotes; 48 | static std::map< std::string, std::vector > devs; 49 | static std::vector manuals; 50 | }; 51 | -------------------------------------------------------------------------------- /src/sdr/SDRPostThread.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | 6 | #include "SoapySDRThread.h" 7 | #include 8 | 9 | enum SDRPostThreadChannelizerType { 10 | SDRPostPFBCH = 1, 11 | SDRPostPFBCH2 = 2 12 | }; 13 | 14 | class SDRPostThread : public IOThread { 15 | public: 16 | SDRPostThread(); 17 | ~SDRPostThread() override; 18 | 19 | void notifyDemodulatorsChanged(); 20 | 21 | void run() override; 22 | void terminate() override; 23 | 24 | void resetAllDemodulators(); 25 | 26 | void setChannelizerType(SDRPostThreadChannelizerType chType); 27 | SDRPostThreadChannelizerType getChannelizerType(); 28 | 29 | 30 | protected: 31 | SDRThreadIQDataQueuePtr iqDataInQueue; 32 | DemodulatorThreadInputQueuePtr iqDataOutQueue; 33 | DemodulatorThreadInputQueuePtr iqVisualQueue; 34 | DemodulatorThreadInputQueuePtr iqActiveDemodVisualQueue; 35 | 36 | private: 37 | // Copy the full samplerate into a new DemodulatorThreadIQDataPtr. 38 | DemodulatorThreadIQDataPtr getFullSampleRateIqData(SDRThreadIQData *data_in); 39 | void pushVisualData(const DemodulatorThreadIQDataPtr& iqDataOut); 40 | 41 | void runSingleCH(SDRThreadIQData *data_in); 42 | 43 | void runDemodChannels(int channelBandwidth); 44 | 45 | void initPFBCH(); 46 | void runPFBCH(SDRThreadIQData *data_in); 47 | 48 | void initPFBCH2(); 49 | void runPFBCH2(SDRThreadIQData *data_in); 50 | 51 | void updateActiveDemodulators(); 52 | void updateChannels(); 53 | int getChannelAt(long long frequency_in); 54 | 55 | ReBuffer buffers; 56 | std::vector dataOut; 57 | std::vector chanCenters; 58 | long long chanBw = 0; 59 | 60 | std::vector runDemods; 61 | std::vector demodChannel; 62 | std::vector demodChannelActive; 63 | 64 | ReBuffer visualDataBuffers; 65 | atomic_bool doRefresh; 66 | atomic_int chanMode; 67 | 68 | int numChannels, sampleRate, lastChanMode; 69 | long long frequency; 70 | firpfbch_crcf channelizer; 71 | firpfbch2_crcf channelizer2; 72 | iirfilt_crcf dcFilter; 73 | std::vector dcBuf; 74 | }; 75 | -------------------------------------------------------------------------------- /src/ui/UITestCanvas.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #include "UITestCanvas.h" 5 | 6 | #include "wx/wxprec.h" 7 | 8 | #ifndef WX_PRECOMP 9 | #include "wx/wx.h" 10 | #endif 11 | 12 | #if !wxUSE_GLCANVAS 13 | #error "OpenGL required: set wxUSE_GLCANVAS to 1 and rebuild the library" 14 | #endif 15 | 16 | #include "CubicSDR.h" 17 | #include "CubicSDRDefs.h" 18 | #include 19 | 20 | wxBEGIN_EVENT_TABLE(UITestCanvas, wxGLCanvas) EVT_PAINT(UITestCanvas::OnPaint) 21 | EVT_IDLE(UITestCanvas::OnIdle) 22 | EVT_MOTION(UITestCanvas::OnMouseMoved) 23 | EVT_LEFT_DOWN(UITestCanvas::OnMouseDown) 24 | EVT_LEFT_UP(UITestCanvas::OnMouseReleased) 25 | EVT_LEAVE_WINDOW(UITestCanvas::OnMouseLeftWindow) 26 | EVT_ENTER_WINDOW(UITestCanvas::OnMouseEnterWindow) 27 | wxEND_EVENT_TABLE() 28 | 29 | UITestCanvas::UITestCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs) : 30 | InteractiveCanvas(parent, dispAttrs) { 31 | 32 | glContext = new UITestContext(this, &wxGetApp().GetContext(this), wxGetApp().GetContextAttributes()); 33 | } 34 | 35 | UITestCanvas::~UITestCanvas() = default; 36 | 37 | void UITestCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) { 38 | // wxPaintDC dc(this); 39 | const wxSize ClientSize = GetClientSize() * GetContentScaleFactor(); 40 | 41 | glContext->SetCurrent(*this); 42 | initGLExtensions(); 43 | 44 | glViewport(0, 0, ClientSize.x, ClientSize.y); 45 | 46 | glContext->DrawBegin(); 47 | 48 | glContext->Draw(); 49 | 50 | glContext->DrawEnd(); 51 | 52 | SwapBuffers(); 53 | } 54 | 55 | void UITestCanvas::OnIdle(wxIdleEvent& /* event */) { 56 | Refresh(false); 57 | } 58 | 59 | void UITestCanvas::OnMouseMoved(wxMouseEvent& event) { 60 | InteractiveCanvas::OnMouseMoved(event); 61 | 62 | } 63 | 64 | void UITestCanvas::OnMouseDown(wxMouseEvent& event) { 65 | InteractiveCanvas::OnMouseDown(event); 66 | } 67 | 68 | void UITestCanvas::OnMouseWheelMoved(wxMouseEvent& event) { 69 | InteractiveCanvas::OnMouseWheelMoved(event); 70 | } 71 | 72 | void UITestCanvas::OnMouseReleased(wxMouseEvent& event) { 73 | InteractiveCanvas::OnMouseReleased(event); 74 | } 75 | 76 | void UITestCanvas::OnMouseLeftWindow(wxMouseEvent& event) { 77 | InteractiveCanvas::OnMouseLeftWindow(event); 78 | } 79 | 80 | void UITestCanvas::OnMouseEnterWindow(wxMouseEvent& event) { 81 | InteractiveCanvas::mouseTracker.OnMouseEnterWindow(event); 82 | } 83 | -------------------------------------------------------------------------------- /src/ui/UITestCanvas.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | 6 | #include "wx/glcanvas.h" 7 | #include "wx/timer.h" 8 | 9 | #include 10 | #include 11 | 12 | #include "InteractiveCanvas.h" 13 | #include "UITestContext.h" 14 | #include "MouseTracker.h" 15 | 16 | #include "Timer.h" 17 | 18 | class UITestCanvas: public InteractiveCanvas { 19 | public: 20 | UITestCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs); 21 | ~UITestCanvas() override; 22 | 23 | private: 24 | void OnPaint(wxPaintEvent& event); 25 | void OnIdle(wxIdleEvent &event); 26 | 27 | void OnMouseMoved(wxMouseEvent& event); 28 | void OnMouseDown(wxMouseEvent& event); 29 | void OnMouseWheelMoved(wxMouseEvent& event); 30 | void OnMouseReleased(wxMouseEvent& event); 31 | void OnMouseEnterWindow(wxMouseEvent& event); 32 | void OnMouseLeftWindow(wxMouseEvent& event); 33 | 34 | UITestContext *glContext; 35 | 36 | wxDECLARE_EVENT_TABLE(); 37 | }; 38 | 39 | -------------------------------------------------------------------------------- /src/ui/UITestContext.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #include "UITestContext.h" 5 | #include "UITestCanvas.h" 6 | #include "ColorTheme.h" 7 | 8 | UITestContext::UITestContext(UITestCanvas *canvas, wxGLContext *sharedContext, wxGLContextAttrs *ctxAttrs) : 9 | PrimaryGLContext(canvas, sharedContext, ctxAttrs), testMeter("TEST",0,100,50) { 10 | 11 | testPanel.setPosition(0.0, 0.0); 12 | testPanel.setSize(1.0, 1.0); 13 | testPanel.setMarginPx(10); 14 | testPanel.setFill(GLPanel::GLPANEL_FILL_SOLID); 15 | testPanel.setFillColor(RGBA4f(0.0,0.0,1.0)); 16 | 17 | testChildPanel.setPosition(0.0, 0.0); 18 | testChildPanel.setMarginPx(5); 19 | testChildPanel.setSize(1.0f, 0.33f); 20 | testChildPanel.setCoordinateSystem(GLPanel::GLPANEL_Y_DOWN_ZERO_ONE); 21 | testChildPanel.setFill(GLPanel::GLPANEL_FILL_GRAD_BAR_X); 22 | testChildPanel.setFillColor(RGBA4f(0.0,0.0,1.0), RGBA4f(0.0,1.0,0.0)); 23 | testChildPanel.setBorderPx(1); 24 | 25 | testChildPanel2.setPosition(0.0f, -0.66f); 26 | testChildPanel2.setSize(1.0f, 0.33f); 27 | testChildPanel2.setMarginPx(5); 28 | testChildPanel2.setFill(GLPanel::GLPANEL_FILL_GRAD_X); 29 | testChildPanel2.setFillColor(RGBA4f(0.0,0.0,1.0), RGBA4f(0.0,1.0,0.0)); 30 | testChildPanel2.setBorderColor(RGBA4f(1.0,0.0,0.0)); 31 | testChildPanel2.setBorderPx(1); 32 | 33 | testChildPanel3.setPosition(0.0f, 0.66f); 34 | testChildPanel3.setSize(1.0f, 0.33f); 35 | testChildPanel3.setMarginPx(5); 36 | testChildPanel3.setFill(GLPanel::GLPANEL_FILL_GRAD_X); 37 | testChildPanel3.setFillColor(RGBA4f(0.0,0.0,1.0), RGBA4f(0.0,1.0,0.0)); 38 | testChildPanel3.setBorderColor(RGBA4f(1.0,0.0,0.0)); 39 | testChildPanel3.setBorderPx(1); 40 | 41 | testText1.setText("Testing 123.."); 42 | testText1.setFill(GLPanel::GLPANEL_FILL_NONE); 43 | testChildPanel2.addChild(&testText1); 44 | 45 | // testPanel.addChild(&testChildPanel); 46 | // testPanel.addChild(&testChildPanel2); 47 | // testPanel.addChild(&testChildPanel3); 48 | testMeter.setSize(0.1f,0.9f); 49 | testPanel.addChild(&testMeter); 50 | } 51 | 52 | void UITestContext::DrawBegin() { 53 | glDisable(GL_CULL_FACE); 54 | glDisable(GL_DEPTH_TEST); 55 | 56 | glClearColor(ThemeMgr::mgr.currentTheme->generalBackground.r, ThemeMgr::mgr.currentTheme->generalBackground.g, ThemeMgr::mgr.currentTheme->generalBackground.b, 1.0); 57 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 58 | 59 | glMatrixMode(GL_MODELVIEW); 60 | glLoadIdentity(); 61 | 62 | glDisable(GL_TEXTURE_2D); 63 | } 64 | 65 | void UITestContext::Draw() { 66 | testPanel.calcTransform(CubicVR::mat4::identity()); 67 | testPanel.draw(); 68 | } 69 | 70 | void UITestContext::DrawEnd() { 71 | // glFlush(); 72 | 73 | // CheckGLError(); 74 | } 75 | 76 | -------------------------------------------------------------------------------- /src/ui/UITestContext.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | 6 | #include "PrimaryGLContext.h" 7 | #include "GLPanel.h" 8 | #include "MeterPanel.h" 9 | 10 | class UITestCanvas; 11 | 12 | class UITestContext: public PrimaryGLContext { 13 | public: 14 | UITestContext(UITestCanvas *canvas, wxGLContext *sharedContext, wxGLContextAttrs *ctxAttrs); 15 | 16 | void DrawBegin(); 17 | void Draw(); 18 | void DrawEnd(); 19 | 20 | private: 21 | GLPanel testPanel; 22 | GLTestPanel testChildPanel; 23 | GLPanel testChildPanel2; 24 | GLPanel testChildPanel3; 25 | GLTextPanel testText1; 26 | MeterPanel testMeter; 27 | }; 28 | -------------------------------------------------------------------------------- /src/util/GLExt.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | 6 | #include "wx/glcanvas.h" 7 | 8 | #ifdef _WIN32 9 | #include 10 | #ifdef __MINGW32__ 11 | #include 12 | #else 13 | #include "wglext.h" 14 | #endif 15 | 16 | extern PFNWGLGETEXTENSIONSSTRINGEXTPROC _wglGetExtensionsStringEXT; 17 | extern PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT; 18 | extern PFNWGLGETSWAPINTERVALEXTPROC wglGetSwapIntervalEXT; 19 | 20 | bool GLExtSupported(const char *extension_name); 21 | 22 | #endif 23 | 24 | extern bool GLExt_initialized; 25 | 26 | void initGLExtensions(); 27 | 28 | -------------------------------------------------------------------------------- /src/util/Gradient.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #include "Gradient.h" 5 | #include 6 | 7 | Gradient::Gradient() = default; 8 | 9 | void Gradient::clear() { 10 | colors.clear(); 11 | } 12 | 13 | void Gradient::addColor(GradientColor c) { 14 | colors.push_back(c); 15 | } 16 | 17 | void Gradient::addColors(const std::vector& color_list) { 18 | 19 | for (auto single_color : color_list) { 20 | 21 | colors.push_back(single_color); 22 | } 23 | } 24 | 25 | std::vector &Gradient::getRed() { 26 | return r_val; 27 | } 28 | 29 | std::vector &Gradient::getGreen() { 30 | return g_val; 31 | } 32 | 33 | std::vector &Gradient::getBlue() { 34 | return b_val; 35 | } 36 | 37 | void Gradient::generate(unsigned int len) { 38 | size_t chunk_size = len / (colors.size() - 1); 39 | 40 | size_t p = 0; 41 | r_val.resize(len); 42 | g_val.resize(len); 43 | b_val.resize(len); 44 | 45 | for (size_t j = 0, jMax = colors.size() - 1; j < jMax; j++) { 46 | if ((chunk_size * (jMax)) < len && (j == jMax - 1)) { 47 | chunk_size += len - chunk_size * (jMax); 48 | } 49 | 50 | for (size_t i = 0; i < chunk_size; i++) { 51 | float idx = (float) (i) / (float) chunk_size; 52 | 53 | float r1 = colors[j].r; 54 | float g1 = colors[j].g; 55 | float b1 = colors[j].b; 56 | 57 | float r2 = colors[j + 1].r; 58 | float g2 = colors[j + 1].g; 59 | float b2 = colors[j + 1].b; 60 | 61 | float r = r1 + (r2 - r1) * idx; 62 | float g = g1 + (g2 - g1) * idx; 63 | float b = b1 + (b2 - b1) * idx; 64 | 65 | if (r < 0.0) 66 | r = 0.0; 67 | if (r > 1.0) 68 | r = 1.0; 69 | if (g < 0.0) 70 | g = 0.0; 71 | if (g > 1.0) 72 | g = 1.0; 73 | if (b < 0.0) 74 | b = 0.0; 75 | if (b > 1.0) 76 | b = 1.0; 77 | 78 | r_val[p] = r; 79 | g_val[p] = g; 80 | b_val[p] = b; 81 | 82 | p++; 83 | } 84 | } 85 | } 86 | 87 | Gradient::~Gradient() = default; 88 | -------------------------------------------------------------------------------- /src/util/Gradient.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | 6 | #include 7 | 8 | class GradientColor { 9 | public: 10 | float r, g, b; 11 | float w; 12 | 13 | //should work with both float and double inputs 14 | GradientColor(double r_in, double g_in, double b_in) : 15 | r((float)r_in), g((float)g_in), b((float)b_in), w(1) { 16 | } 17 | }; 18 | 19 | class Gradient { 20 | public: 21 | Gradient(); 22 | 23 | void addColor(GradientColor c); 24 | 25 | void clear(); 26 | 27 | void addColors(const std::vector& color_list); 28 | 29 | std::vector &getRed(); 30 | std::vector &getGreen(); 31 | std::vector &getBlue(); 32 | 33 | void generate(unsigned int len); 34 | 35 | ~Gradient(); 36 | private: 37 | std::vector colors; 38 | std::vector r_val; 39 | std::vector g_val; 40 | std::vector b_val; 41 | }; 42 | -------------------------------------------------------------------------------- /src/util/MouseTracker.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | 6 | #include "wx/window.h" 7 | #include "cubic_math.h" 8 | 9 | class MouseTracker { 10 | public: 11 | MouseTracker(wxWindow *target); 12 | MouseTracker(); 13 | 14 | void OnMouseMoved(wxMouseEvent& event); 15 | void OnMouseWheelMoved(wxMouseEvent& event); 16 | void OnMouseDown(wxMouseEvent& event); 17 | void OnMouseReleased(wxMouseEvent& event); 18 | void OnMouseRightDown(wxMouseEvent& event); 19 | void OnMouseRightReleased(wxMouseEvent& event); 20 | void OnMouseEnterWindow(wxMouseEvent& event); 21 | void OnMouseLeftWindow(wxMouseEvent& event); 22 | 23 | float getOriginMouseX() const; 24 | float getOriginMouseY() const; 25 | float getOriginDeltaMouseX() const; 26 | float getOriginDeltaMouseY() const; 27 | float getDeltaMouseX() const; 28 | float getDeltaMouseY() const; 29 | float getLastMouseX() const; 30 | float getLastMouseY() const; 31 | CubicVR::vec2 getGLXY() const; 32 | float getMouseX() const; 33 | float getMouseY() const; 34 | 35 | void setVertDragLock(bool dragLock); 36 | void setHorizDragLock(bool dragLock); 37 | bool getVertDragLock() const; 38 | bool getHorizDragLock() const; 39 | bool mouseDown() const; 40 | bool mouseRightDown() const; 41 | bool mouseInView() const; 42 | void setTarget(wxWindow *target_in); 43 | 44 | private: 45 | float mouseX, mouseY; 46 | float lastMouseX, lastMouseY; 47 | float originMouseX, originMouseY; 48 | float deltaMouseX, deltaMouseY; 49 | 50 | bool vertDragLock, horizDragLock; 51 | bool isMouseDown, isMouseRightDown, isMouseInView; 52 | wxWindow *target; 53 | }; 54 | -------------------------------------------------------------------------------- /src/util/SpinMutex.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | #include 6 | 7 | // A non-recursive Mutex implemented as a spin-lock, implementing the Lockable requirement 8 | class SpinMutex { 9 | 10 | public: 11 | SpinMutex() = default; 12 | 13 | SpinMutex(const SpinMutex&) = delete; 14 | 15 | SpinMutex& operator=(const SpinMutex&) = delete; 16 | 17 | ~SpinMutex() { lock_state.clear(std::memory_order_release); } 18 | 19 | void lock() { while (lock_state.test_and_set(std::memory_order_acquire)); } 20 | 21 | bool try_lock() {return !lock_state.test_and_set(std::memory_order_acquire); } 22 | 23 | void unlock() { lock_state.clear(std::memory_order_release); } 24 | 25 | private: 26 | std::atomic_flag lock_state = ATOMIC_FLAG_INIT; 27 | }; 28 | -------------------------------------------------------------------------------- /src/util/ThreadBlockingQueue.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #include -------------------------------------------------------------------------------- /src/visual/GainCanvas.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | 6 | #include "wx/glcanvas.h" 7 | #include "wx/timer.h" 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #include "InteractiveCanvas.h" 14 | #include "MouseTracker.h" 15 | #include "GLPanel.h" 16 | #include "PrimaryGLContext.h" 17 | #include "SDRDeviceInfo.h" 18 | #include "Timer.h" 19 | #include "MeterPanel.h" 20 | 21 | 22 | class GainCanvas: public InteractiveCanvas { 23 | public: 24 | GainCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs); 25 | ~GainCanvas() override; 26 | 27 | void setHelpTip(std::string tip); 28 | void updateGainUI(); 29 | void setThemeColors(); 30 | 31 | private: 32 | 33 | // call this to refresh the gain values only, return true if refresh is needed 34 | bool updateGainValues(); 35 | 36 | void OnPaint(wxPaintEvent& event); 37 | void OnIdle(wxIdleEvent &event); 38 | 39 | void SetLevel(); 40 | 41 | void OnShow(wxShowEvent& event); 42 | void OnMouseMoved(wxMouseEvent& event); 43 | void OnMouseDown(wxMouseEvent& event); 44 | void OnMouseWheelMoved(wxMouseEvent& event); 45 | void OnMouseReleased(wxMouseEvent& event); 46 | void OnMouseEnterWindow(wxMouseEvent& event); 47 | void OnMouseLeftWindow(wxMouseEvent& event); 48 | 49 | PrimaryGLContext *glContext; 50 | std::string helpTip; 51 | std::vector gainPanels; 52 | GLPanel bgPanel; 53 | SDRRangeMap gains; 54 | 55 | float spacing, barWidth, startPos, barHeight, numGains; 56 | int refreshCounter; 57 | wxSize clientSize; 58 | 59 | std::atomic_bool userGainAsChanged; 60 | Timer userGainAsChangedDelayTimer; 61 | // 62 | wxDECLARE_EVENT_TABLE(); 63 | }; 64 | 65 | -------------------------------------------------------------------------------- /src/visual/ImagePanel.cpp: -------------------------------------------------------------------------------- 1 | #include "ImagePanel.h" 2 | 3 | BEGIN_EVENT_TABLE(ImagePanel, wxPanel) 4 | EVT_PAINT(ImagePanel::paintEvent) 5 | END_EVENT_TABLE() 6 | 7 | 8 | ImagePanel::ImagePanel(wxPanel * parent, wxString file, wxBitmapType format) : 9 | wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE) { 10 | image.LoadFile(file, format); 11 | } 12 | 13 | void ImagePanel::paintEvent(wxPaintEvent & /* evt */) { 14 | wxPaintDC dc(this); 15 | render(dc); 16 | } 17 | 18 | 19 | void ImagePanel::paintNow() { 20 | wxClientDC dc(this); 21 | render(dc); 22 | } 23 | 24 | 25 | void ImagePanel::render(wxDC& dc) { 26 | 27 | double imagew = image.GetWidth(); 28 | double imageh = image.GetHeight(); 29 | 30 | wxSize destSize = dc.GetSize(); 31 | 32 | double destw = destSize.GetWidth(); 33 | double desth = destSize.GetHeight(); 34 | 35 | double sf, wf, hf; 36 | 37 | wf = destw / imagew; 38 | hf = desth / imageh; 39 | 40 | sf = (wf < hf)?wf:hf; 41 | 42 | double resulth = imageh * sf; 43 | double resultw = imagew * sf; 44 | 45 | dc.SetUserScale(sf, sf); 46 | dc.DrawBitmap( image, (destw/2 - resultw/2)/sf, (desth/2 - resulth/2)/sf, false ); 47 | } 48 | 49 | 50 | -------------------------------------------------------------------------------- /src/visual/ImagePanel.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | class ImagePanel : public wxPanel { 5 | wxBitmap image; 6 | 7 | public: 8 | ImagePanel(wxPanel* parent, wxString file, wxBitmapType format); 9 | 10 | void paintEvent(wxPaintEvent & evt); 11 | void paintNow(); 12 | 13 | void render(wxDC& dc); 14 | 15 | DECLARE_EVENT_TABLE() 16 | }; 17 | -------------------------------------------------------------------------------- /src/visual/InteractiveCanvas.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | 6 | #include "wx/glcanvas.h" 7 | #include "wx/timer.h" 8 | 9 | #include "MouseTracker.h" 10 | #include 11 | #include 12 | 13 | class InteractiveCanvas: public wxGLCanvas { 14 | public: 15 | InteractiveCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs); 16 | ~InteractiveCanvas() override; 17 | 18 | long long getFrequencyAt(float x); 19 | long long getFrequencyAt(float x, long long iqCenterFreq, long long iqBandwidth); 20 | 21 | virtual void setView(long long center_freq_in, long long bandwidth_in); 22 | virtual void disableView(); 23 | bool getViewState() const; 24 | 25 | void setCenterFrequency(long long center_freq_in); 26 | long long getCenterFrequency() const; 27 | 28 | void setBandwidth(long long bandwidth_in); 29 | long long getBandwidth() const; 30 | 31 | MouseTracker *getMouseTracker(); 32 | bool isMouseInView(); 33 | bool isMouseDown(); 34 | 35 | bool isAltDown() const; 36 | bool isCtrlDown() const; 37 | bool isShiftDown() const; 38 | 39 | protected: 40 | void OnKeyDown(wxKeyEvent& event); 41 | void OnKeyUp(wxKeyEvent& event); 42 | 43 | void OnMouseMoved(wxMouseEvent& event); 44 | void OnMouseWheelMoved(wxMouseEvent& event); 45 | void OnMouseDown(wxMouseEvent& event); 46 | void OnMouseReleased(wxMouseEvent& event); 47 | void OnMouseRightDown(wxMouseEvent& event); 48 | void OnMouseRightReleased(wxMouseEvent& event); 49 | void OnMouseEnterWindow(wxMouseEvent& event); 50 | void OnMouseLeftWindow(wxMouseEvent& event); 51 | 52 | void setStatusText(std::string statusText); 53 | void setStatusText(std::string statusText, int value); 54 | 55 | wxWindow *parent; 56 | MouseTracker mouseTracker; 57 | 58 | bool shiftDown; 59 | bool altDown; 60 | bool ctrlDown; 61 | 62 | long long centerFreq; 63 | long long bandwidth; 64 | long long lastBandwidth; 65 | 66 | bool isView; 67 | }; 68 | 69 | -------------------------------------------------------------------------------- /src/visual/MeterCanvas.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | 6 | #include "wx/glcanvas.h" 7 | #include "wx/timer.h" 8 | 9 | #include 10 | #include 11 | 12 | #include "InteractiveCanvas.h" 13 | #include "MeterContext.h" 14 | #include "MouseTracker.h" 15 | 16 | #include "Timer.h" 17 | 18 | class MeterCanvas: public InteractiveCanvas { 19 | public: 20 | MeterCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs); 21 | ~MeterCanvas() override; 22 | 23 | void setLevel(float level_in); 24 | float getLevel() const; 25 | 26 | void setMax(float max_in); 27 | void setMin(float max_in); 28 | 29 | void setUserInputValue(float slider_in); 30 | void setInputValue(float slider_in); 31 | bool inputChanged() const; 32 | float getInputValue(); 33 | void setShowUserInput(bool showUserInput_in); 34 | 35 | void setHelpTip(std::string tip); 36 | 37 | private: 38 | void OnPaint(wxPaintEvent& event); 39 | void OnIdle(wxIdleEvent &event); 40 | 41 | void OnMouseMoved(wxMouseEvent& event); 42 | void OnMouseDown(wxMouseEvent& event); 43 | void OnMouseReleased(wxMouseEvent& event); 44 | void OnMouseWheelMoved(wxMouseEvent& event); 45 | void OnMouseRightDown(wxMouseEvent& event); 46 | void OnMouseRightReleased(wxMouseEvent& event); 47 | void OnMouseEnterWindow(wxMouseEvent& event); 48 | void OnMouseLeftWindow(wxMouseEvent& event); 49 | 50 | MeterContext *glContext; 51 | 52 | float level; 53 | float level_min, level_max; 54 | 55 | float inputValue; 56 | float userInputValue; 57 | 58 | bool showUserInput; 59 | 60 | std::string helpTip; 61 | // 62 | wxDECLARE_EVENT_TABLE(); 63 | }; 64 | 65 | -------------------------------------------------------------------------------- /src/visual/MeterContext.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #include "MeterContext.h" 5 | #include "MeterCanvas.h" 6 | #include "ColorTheme.h" 7 | 8 | MeterContext::MeterContext(MeterCanvas *canvas, wxGLContext *sharedContext, wxGLContextAttrs *ctxAttrs) : 9 | PrimaryGLContext(canvas, sharedContext, ctxAttrs) { 10 | } 11 | 12 | void MeterContext::DrawBegin() { 13 | glDisable(GL_CULL_FACE); 14 | glDisable(GL_DEPTH_TEST); 15 | 16 | glClearColor(ThemeMgr::mgr.currentTheme->generalBackground.r, ThemeMgr::mgr.currentTheme->generalBackground.g, ThemeMgr::mgr.currentTheme->generalBackground.b, 1.0); 17 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 18 | 19 | glMatrixMode(GL_MODELVIEW); 20 | glLoadIdentity(); 21 | 22 | glDisable(GL_TEXTURE_2D); 23 | } 24 | 25 | void MeterContext::Draw(float r, float g, float b, float a, float level) { 26 | glEnable(GL_BLEND); 27 | glBlendFunc(GL_ONE, GL_ONE); 28 | glBegin(GL_QUADS); 29 | glColor4f(r*0.65,g*0.65,b*0.65,a); 30 | glVertex2f(-1.0, -1.0 + 2.0 * level); 31 | glVertex2f(-1.0, -1.0); 32 | 33 | glColor4f(r,g,b,a); 34 | glVertex2f(0.0, -1.0); 35 | glVertex2f(0.0, -1.0 + 2.0 * level); 36 | 37 | glColor4f(r,g,b,a); 38 | glVertex2f(0.0, -1.0 + 2.0 * level); 39 | glVertex2f(0.0, -1.0); 40 | 41 | glColor4f(r*0.65,g*0.65,b*0.65,a*0.65); 42 | glVertex2f(1.0, -1.0); 43 | glVertex2f(1.0, -1.0 + 2.0 * level); 44 | 45 | glEnd(); 46 | glDisable(GL_BLEND); 47 | } 48 | 49 | void MeterContext::DrawEnd() { 50 | // glFlush(); 51 | 52 | // CheckGLError(); 53 | } 54 | 55 | -------------------------------------------------------------------------------- /src/visual/MeterContext.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | 6 | #include "PrimaryGLContext.h" 7 | #include "Gradient.h" 8 | 9 | class MeterCanvas; 10 | 11 | class MeterContext: public PrimaryGLContext { 12 | public: 13 | MeterContext(MeterCanvas *canvas, wxGLContext *sharedContext, wxGLContextAttrs *ctxAttrs); 14 | 15 | void DrawBegin(); 16 | void Draw(float r, float g, float b, float a, float level); 17 | void DrawEnd(); 18 | 19 | private: 20 | }; 21 | -------------------------------------------------------------------------------- /src/visual/ModeSelectorCanvas.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | 6 | #include "wx/glcanvas.h" 7 | #include "wx/timer.h" 8 | 9 | #include 10 | #include 11 | 12 | #include "InteractiveCanvas.h" 13 | #include "ModeSelectorContext.h" 14 | #include "MouseTracker.h" 15 | 16 | #include "Timer.h" 17 | 18 | class ModeSelectorMode { 19 | public: 20 | int value; 21 | std::string label; 22 | 23 | ModeSelectorMode(int value, std::string label) : value(value), label(label) { 24 | 25 | } 26 | }; 27 | 28 | class ModeSelectorCanvas: public InteractiveCanvas { 29 | public: 30 | ModeSelectorCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs); 31 | ~ModeSelectorCanvas() override; 32 | 33 | int getHoveredSelection(); 34 | void setHelpTip(std::string tip); 35 | 36 | void addChoice(int value, std::string label); 37 | void addChoice(std::string label); 38 | void setSelection(const std::string& label); 39 | std::string getSelectionLabel(); 40 | void setSelection(int value); 41 | int getSelection(); 42 | 43 | void setToggleMode(bool toggleMode_in); 44 | 45 | bool modeChanged() const; 46 | void clearModeChanged(); 47 | 48 | void setPadding(float padX_in, float padY_in); 49 | void setHighlightColor(const RGBA4f& hc); 50 | 51 | private: 52 | void setNumChoices(int numChoices_in); 53 | 54 | void OnPaint(wxPaintEvent& event); 55 | void OnIdle(wxIdleEvent &event); 56 | 57 | void OnMouseMoved(wxMouseEvent& event); 58 | void OnMouseDown(wxMouseEvent& event); 59 | void OnMouseWheelMoved(wxMouseEvent& event); 60 | void OnMouseReleased(wxMouseEvent& event); 61 | void OnMouseEnterWindow(wxMouseEvent& event); 62 | void OnMouseLeftWindow(wxMouseEvent& event); 63 | 64 | ModeSelectorContext *glContext; 65 | 66 | std::string helpTip; 67 | int numChoices; 68 | int currentSelection; 69 | bool toggleMode; 70 | bool inputChanged; 71 | std::vector selections; 72 | float padX, padY; 73 | RGBA4f highlightColor; 74 | bool highlightOverride; 75 | // 76 | wxDECLARE_EVENT_TABLE(); 77 | }; 78 | 79 | -------------------------------------------------------------------------------- /src/visual/ModeSelectorContext.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #include "ModeSelectorContext.h" 5 | #include "ModeSelectorCanvas.h" 6 | #include "ColorTheme.h" 7 | 8 | 9 | ModeSelectorContext::ModeSelectorContext(ModeSelectorCanvas *canvas, wxGLContext *sharedContext, wxGLContextAttrs *ctxAttrs) : 10 | PrimaryGLContext(canvas, sharedContext, ctxAttrs) { 11 | glDisable(GL_CULL_FACE); 12 | glDisable(GL_DEPTH_TEST); 13 | 14 | glMatrixMode(GL_PROJECTION); 15 | glLoadIdentity(); 16 | } 17 | 18 | void ModeSelectorContext::DrawBegin() { 19 | glClearColor(ThemeMgr::mgr.currentTheme->generalBackground.r, ThemeMgr::mgr.currentTheme->generalBackground.g, ThemeMgr::mgr.currentTheme->generalBackground.b,1.0); 20 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 21 | 22 | glMatrixMode(GL_MODELVIEW); 23 | glLoadIdentity(); 24 | 25 | glDisable(GL_TEXTURE_2D); 26 | } 27 | 28 | void ModeSelectorContext::DrawSelector(const std::string& label, int c, int cMax, bool on, float r, float g, float b, float a, float px, float py) { 29 | GLint vp[4]; 30 | glGetIntegerv( GL_VIEWPORT, vp); 31 | 32 | float viewHeight = (float) vp[3]; 33 | float viewWidth = (float) vp[2]; 34 | 35 | int fontSize = 18; 36 | 37 | if (viewWidth < 30 || viewHeight < 200) { 38 | fontSize = 16; 39 | } 40 | 41 | glColor4f(r, g, b, a); 42 | 43 | float y = 1.0 - ((float) (c+1) / (float) cMax * 2.0); 44 | float height = (2.0 / (float) cMax); 45 | float padX = (px / viewWidth); 46 | float padY = (py / viewHeight); 47 | 48 | if (a < 1.0) { 49 | glEnable(GL_BLEND); 50 | } 51 | glBegin(on?GL_QUADS:GL_LINE_LOOP); 52 | glVertex2f(-1.0 + padX, y + padY); 53 | glVertex2f(1.0 - padX, y + padY); 54 | glVertex2f(1.0 - padX, y + height - padY); 55 | glVertex2f(-1.0 + padX, y + height - padY); 56 | glEnd(); 57 | if (a < 1.0) { 58 | glDisable(GL_BLEND); 59 | } 60 | 61 | if (on) { 62 | glColor4f(0, 0, 0, a); 63 | } 64 | 65 | //Do not zoom the selectors 66 | GLFont::getFont(fontSize).drawString(label, 0.0, y + height / 2.0, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER); 67 | } 68 | 69 | void ModeSelectorContext::DrawEnd() { 70 | // glFlush(); 71 | 72 | // CheckGLError(); 73 | } 74 | 75 | -------------------------------------------------------------------------------- /src/visual/ModeSelectorContext.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | 6 | #include "PrimaryGLContext.h" 7 | #include "Gradient.h" 8 | 9 | class ModeSelectorCanvas; 10 | 11 | class ModeSelectorContext: public PrimaryGLContext { 12 | public: 13 | ModeSelectorContext(ModeSelectorCanvas *canvas, wxGLContext *sharedContext, wxGLContextAttrs *ctxAttrs); 14 | 15 | void DrawBegin(); 16 | void DrawSelector(const std::string& label, int c, int cMax, bool on, float r, float g, float b, float a, float padx, float pady); 17 | void DrawEnd(); 18 | }; 19 | -------------------------------------------------------------------------------- /src/visual/PrimaryGLContext.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | 6 | #include "wx/glcanvas.h" 7 | #include "wx/timer.h" 8 | 9 | #include 10 | #include 11 | 12 | #include "CubicSDRDefs.h" 13 | #include "GLFont.h" 14 | #include "DemodulatorMgr.h" 15 | #include "ColorTheme.h" 16 | 17 | class PrimaryGLContext: public wxGLContext { 18 | public: 19 | PrimaryGLContext(wxGLCanvas *canvas, wxGLContext *sharedContext, wxGLContextAttrs* ctxAttrs); 20 | 21 | static wxString glGetwxString(GLenum name); 22 | static void CheckGLError(); 23 | 24 | void BeginDraw(float r, float g, float b); 25 | void EndDraw(); 26 | 27 | void DrawFreqSelector(float uxPos, const RGBA4f& color, float w = 0, long long center_freq = -1, long long srate = 0); 28 | void DrawRangeSelector(float uxPos1, float uxPos2, const RGBA4f& color); 29 | void DrawDemod(const DemodulatorInstancePtr& demod, const RGBA4f& color, long long center_freq = -1, long long srate = 0); 30 | 31 | void DrawDemodInfo(const DemodulatorInstancePtr& demod, const RGBA4f& color, long long center_freq = -1, long long srate = 0, bool centerline = false); 32 | void DrawFreqBwInfo(long long freq, int bw, const RGBA4f& color, long long center_freq = - 1, long long srate = 0, bool stack = false, bool centerline = false); 33 | 34 | void setHoverAlpha(float hoverAlpha_in); 35 | 36 | private: 37 | float hoverAlpha; 38 | void drawSingleDemodLabel(const std::wstring& demodStr, float uxPos, float hPos, float xOfs, float yOfs, GLFont::Align demodAlign); 39 | }; 40 | -------------------------------------------------------------------------------- /src/visual/ScopeCanvas.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | 6 | #include "wx/glcanvas.h" 7 | #include "wx/timer.h" 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #include "ScopeContext.h" 14 | #include "ScopeVisualProcessor.h" 15 | #include "ScopePanel.h" 16 | #include "SpectrumPanel.h" 17 | #include "InteractiveCanvas.h" 18 | 19 | class ScopeCanvas: public InteractiveCanvas { 20 | public: 21 | ScopeCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs); 22 | ~ScopeCanvas(); 23 | 24 | //This is public because it is indeed forwarded from 25 | //AppFrame::OnGlobalKeyDown, because global key handler intercepts 26 | //calls in all windows. 27 | void OnKeyDown(wxKeyEvent& event); 28 | 29 | //This is public because it is indeed forwarded from 30 | //AppFrame::OnGlobalKeyUp, because global key handler intercepts 31 | //calls in all windows. 32 | void OnKeyUp(wxKeyEvent& event); 33 | 34 | void setDeviceName(std::string device_name); 35 | void setPPMMode(bool ppmMode_in); 36 | bool getPPMMode() const; 37 | 38 | void setShowDb(bool showDb); 39 | bool getShowDb() const; 40 | 41 | bool scopeVisible(); 42 | bool spectrumVisible(); 43 | 44 | void setHelpTip(std::string tip); 45 | 46 | ScopeRenderDataQueuePtr getInputQueue(); 47 | 48 | private: 49 | void OnPaint(wxPaintEvent& event); 50 | void OnIdle(wxIdleEvent &event); 51 | void OnMouseMoved(wxMouseEvent& event); 52 | void OnMouseWheelMoved(wxMouseEvent& event); 53 | void OnMouseDown(wxMouseEvent& event); 54 | void OnMouseReleased(wxMouseEvent& event); 55 | void OnMouseEnterWindow(wxMouseEvent& event); 56 | void OnMouseLeftWindow(wxMouseEvent& event); 57 | 58 | ScopeRenderDataQueuePtr inputData = std::make_shared(); 59 | ScopePanel scopePanel; 60 | GLPanel parentPanel; 61 | SpectrumPanel spectrumPanel; 62 | GLPanel bgPanel; 63 | ScopeContext *glContext; 64 | std::string deviceName; 65 | bool ppmMode; 66 | bool showDb; 67 | float panelSpacing; 68 | float ctr; 69 | float ctrTarget; 70 | float dragAccel; 71 | std::string helpTip; 72 | // event table 73 | wxDECLARE_EVENT_TABLE(); 74 | }; 75 | 76 | -------------------------------------------------------------------------------- /src/visual/ScopeContext.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #include "ScopeContext.h" 5 | 6 | #include "ScopeCanvas.h" 7 | #include "ColorTheme.h" 8 | 9 | ScopeContext::ScopeContext(ScopeCanvas *canvas, wxGLContext *sharedContext, wxGLContextAttrs *ctxAttrs) : 10 | PrimaryGLContext(canvas, sharedContext, ctxAttrs) { 11 | glDisable (GL_CULL_FACE); 12 | glDisable (GL_DEPTH_TEST); 13 | 14 | glMatrixMode (GL_PROJECTION); 15 | glLoadIdentity(); 16 | } 17 | 18 | void ScopeContext::DrawBegin(bool clear) { 19 | if (clear) { 20 | glClearColor(ThemeMgr::mgr.currentTheme->scopeBackground.r, ThemeMgr::mgr.currentTheme->scopeBackground.g, 21 | ThemeMgr::mgr.currentTheme->scopeBackground.b, 1.0); 22 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 23 | } 24 | 25 | glMatrixMode (GL_MODELVIEW); 26 | glLoadIdentity(); 27 | 28 | glDisable (GL_TEXTURE_2D); 29 | } 30 | 31 | void ScopeContext::DrawTunerTitles(bool ppmMode) { 32 | glLoadIdentity(); 33 | 34 | GLint vp[4]; 35 | glGetIntegerv(GL_VIEWPORT, vp); 36 | float viewHeight = (float) vp[3]; 37 | float hPos = (float) (13) / viewHeight; 38 | 39 | glColor3f(0.65f, 0.65f, 0.65f); 40 | 41 | GLFont::Drawer refDrawingFont = GLFont::getFont(12, GLFont::getScaleFactor()); 42 | 43 | //better position frequency/bandwidth labels according to font scale 44 | double shiftFactor = GLFont::getScaleFactor()+0.5; 45 | 46 | refDrawingFont.drawString(ppmMode?"Device PPM":"Frequency", -0.66f, -1.0 +hPos*shiftFactor, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER, 0, 0, true); 47 | refDrawingFont.drawString("Bandwidth", 0.0, -1.0 +hPos*shiftFactor, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER, 0, 0, true); 48 | refDrawingFont.drawString("Center Frequency", 0.66f, -1.0 +hPos*shiftFactor, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER, 0, 0, true); 49 | } 50 | 51 | void ScopeContext::DrawDeviceName(const std::string& deviceName) { 52 | GLint vp[4]; 53 | glGetIntegerv(GL_VIEWPORT, vp); 54 | float viewHeight = (float) vp[3]; 55 | float hPos = (float) (viewHeight - 20) / viewHeight; 56 | 57 | glColor3f(0.65f, 0.65f, 0.65f); 58 | 59 | GLFont::getFont(12, GLFont::getScaleFactor()).drawString(deviceName, 1.0, hPos, GLFont::GLFONT_ALIGN_RIGHT, GLFont::GLFONT_ALIGN_CENTER, 0, 0, true); 60 | } 61 | 62 | void ScopeContext::DrawEnd() { 63 | // glFlush(); 64 | 65 | // CheckGLError(); 66 | } 67 | 68 | void ScopeContext::DrawDivider() { 69 | glColor3f(1.0, 1.0, 1.0); 70 | glBegin (GL_LINES); 71 | glVertex2f(0.0, -1.0); 72 | glVertex2f(0.0, 1.0); 73 | glEnd(); 74 | } 75 | -------------------------------------------------------------------------------- /src/visual/ScopeContext.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | 6 | #include "PrimaryGLContext.h" 7 | #include "Gradient.h" 8 | 9 | class ScopeCanvas; 10 | 11 | class ScopeContext: public PrimaryGLContext { 12 | public: 13 | ScopeContext(ScopeCanvas *canvas, wxGLContext *sharedContext, wxGLContextAttrs *ctxAttrs); 14 | 15 | void DrawBegin(bool clear=true); 16 | void DrawTunerTitles(bool ppmMode=false); 17 | void DrawDeviceName(const std::string& deviceName); 18 | void DrawDivider(); 19 | void DrawEnd(); 20 | 21 | private: 22 | }; 23 | -------------------------------------------------------------------------------- /src/visual/SpectrumCanvas.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | #include "InteractiveCanvas.h" 11 | #include "PrimaryGLContext.h" 12 | #include "MouseTracker.h" 13 | #include "SpectrumVisualProcessor.h" 14 | #include "SpectrumPanel.h" 15 | 16 | class WaterfallCanvas; 17 | 18 | class SpectrumCanvas: public InteractiveCanvas { 19 | public: 20 | SpectrumCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs); 21 | ~SpectrumCanvas() override; 22 | 23 | //This is public because it is indeed forwarded from 24 | //AppFrame::OnGlobalKeyDown, because global key handler intercepts 25 | //calls in all windows. 26 | void OnKeyDown(wxKeyEvent& event); 27 | 28 | //This is public because it is indeed forwarded from 29 | //AppFrame::OnGlobalKeyUp, because global key handler intercepts 30 | //calls in all windows. 31 | void OnKeyUp(wxKeyEvent& event); 32 | 33 | void attachWaterfallCanvas(WaterfallCanvas *canvas_in); 34 | void moveCenterFrequency(long long freqChange); 35 | 36 | void setShowDb(bool showDb); 37 | bool getShowDb(); 38 | 39 | void setUseDBOfs(bool showDb); 40 | bool getUseDBOfs(); 41 | 42 | void setView(long long center_freq_in, int bandwidth_in); 43 | void disableView() override; 44 | 45 | void setScaleFactorEnabled(bool en); 46 | void setFFTSize(int fftSize); 47 | 48 | SpectrumVisualDataQueuePtr getVisualDataQueue(); 49 | 50 | // called by Waterfall to forward the update of the vertical scale. 51 | void updateScaleFactorFromYMove(float yDeltaMouseMove); 52 | 53 | private: 54 | void OnPaint(wxPaintEvent& event); 55 | 56 | void OnIdle(wxIdleEvent &event); 57 | 58 | void OnMouseMoved(wxMouseEvent& event); 59 | void OnMouseDown(wxMouseEvent& event); 60 | void OnMouseWheelMoved(wxMouseEvent& event); 61 | void OnMouseReleased(wxMouseEvent& event); 62 | void OnMouseEnterWindow(wxMouseEvent& event); 63 | void OnMouseLeftWindow(wxMouseEvent& event); 64 | void OnMouseRightDown(wxMouseEvent& event); 65 | void OnMouseRightReleased(wxMouseEvent& event); 66 | 67 | void updateScaleFactor(float factor); 68 | 69 | PrimaryGLContext *glContext; 70 | WaterfallCanvas *waterfallCanvas; 71 | SpectrumPanel spectrumPanel; 72 | float scaleFactor; 73 | int bwChange; 74 | bool resetScaleFactor, scaleFactorEnabled; 75 | 76 | SpectrumVisualDataQueuePtr visualDataQueue = std::make_shared(); 77 | 78 | // event table 79 | wxDECLARE_EVENT_TABLE(); 80 | }; 81 | 82 | -------------------------------------------------------------------------------- /src/visual/TuningCanvas.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | 6 | #include "wx/glcanvas.h" 7 | #include "wx/timer.h" 8 | 9 | #include 10 | #include 11 | 12 | #include "InteractiveCanvas.h" 13 | #include "TuningContext.h" 14 | #include "MouseTracker.h" 15 | 16 | #include "Timer.h" 17 | 18 | class TuningCanvas: public InteractiveCanvas { 19 | public: 20 | enum ActiveState { 21 | TUNING_HOVER_NONE, TUNING_HOVER_FREQ, TUNING_HOVER_BW, TUNING_HOVER_PPM, TUNING_HOVER_CENTER 22 | }; 23 | enum TuningDirection { 24 | TUNING_DIRECTION_DOWN, TUNING_DIRECTION_UP 25 | }; 26 | TuningCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs); 27 | ~TuningCanvas() override; 28 | 29 | void setHelpTip(std::string tip); 30 | bool changed(); 31 | 32 | void setHalfBand(bool hb); 33 | void OnKeyDown(wxKeyEvent& event); 34 | void OnKeyUp(wxKeyEvent& event); 35 | 36 | ActiveState getHoverState(); 37 | 38 | private: 39 | void OnPaint(wxPaintEvent& event); 40 | void OnIdle(wxIdleEvent &event); 41 | 42 | void OnMouseMoved(wxMouseEvent& event); 43 | void OnMouseDown(wxMouseEvent& event); 44 | void OnMouseWheelMoved(wxMouseEvent& event); 45 | void OnMouseReleased(wxMouseEvent& event); 46 | void OnMouseEnterWindow(wxMouseEvent& event); 47 | void OnMouseLeftWindow(wxMouseEvent& event); 48 | void OnMouseRightDown(wxMouseEvent& event); 49 | void OnMouseRightReleased(wxMouseEvent& event); 50 | 51 | void StepTuner(ActiveState state, TuningDirection tuningDir, int digit, bool preventCarry = false, bool zeroOut = false); 52 | 53 | TuningContext *glContext; 54 | 55 | std::string helpTip; 56 | float dragAccum; 57 | float uxDown; 58 | ActiveState hoverState; 59 | ActiveState downState; 60 | int hoverIndex; 61 | int downIndex; 62 | bool dragging; 63 | 64 | float freqDP; 65 | float freqW; 66 | 67 | float bwDP; 68 | float bwW; 69 | 70 | float centerDP; 71 | float centerW; 72 | 73 | bool top; 74 | bool bottom; 75 | 76 | int currentPPM; 77 | int lastPPM; 78 | 79 | long long freq, bw, center; 80 | bool halfBand; 81 | // 82 | wxDECLARE_EVENT_TABLE(); 83 | }; 84 | 85 | -------------------------------------------------------------------------------- /src/visual/TuningContext.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Charles J. Cliffe 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | 4 | #pragma once 5 | 6 | #include "PrimaryGLContext.h" 7 | #include "Gradient.h" 8 | 9 | class TuningCanvas; 10 | 11 | class TuningContext: public PrimaryGLContext { 12 | public: 13 | TuningContext(TuningCanvas *canvas, wxGLContext *sharedContext, wxGLContextAttrs *ctxAttrs); 14 | 15 | void DrawBegin(); 16 | void Draw(float r, float g, float b, float a, float p1, float p2); 17 | void DrawTuner(long long freq, int count, float displayPos, float displayWidth); 18 | static void DrawTunerDigitBox(int index, int count, float displayPos, float displayWidth, const RGBA4f& c); 19 | int GetTunerDigitIndex(float mPos, int count, float displayPos, float displayWidth); 20 | void DrawTunerBarIndexed(int start, int end, int count, float displayPos, float displayWidth, const RGBA4f& color, float alpha, bool top, bool bottom); 21 | 22 | void DrawDemodFreqBw(long long freq, unsigned int bw, long long center); 23 | void DrawEnd(); 24 | 25 | private: 26 | std::locale comma_locale; 27 | std::stringstream freqStr; 28 | std::stringstream freqStrFormatted; 29 | }; 30 | --------------------------------------------------------------------------------