├── .github └── workflows │ ├── build.yml │ └── ci.yml ├── .gitignore ├── CMakeLists.txt ├── COPYING ├── LICENSE-CTK ├── MANIFEST.md ├── README.md ├── appimage.sh ├── cmake ├── Modules │ └── FindGnuradio-osmosdr.cmake └── cmake_uninstall.cmake.in ├── dk.gqrx.gqrx.appdata.xml ├── dk.gqrx.gqrx.desktop ├── macos_bundle.sh ├── new_logo ├── PNG │ ├── horizontal color.png │ ├── horizontal white.png │ ├── icon color.png │ ├── icon white.png │ ├── vertical color.png │ └── vertical white.png └── SVG │ ├── horizontal color.svg │ ├── horizontal white.svg │ ├── icon color.svg │ ├── icon white.svg │ ├── vertical color.svg │ └── vertical white.svg ├── resources ├── bandplan.csv ├── gqrx.1 ├── icons.qrc ├── icons │ ├── audio-card.svg │ ├── bookmark-new.svg │ ├── clear.svg │ ├── clock.svg │ ├── close.svg │ ├── document.svg │ ├── flash.svg │ ├── floppy.svg │ ├── folder.svg │ ├── fullscreen.svg │ ├── gqrx.icns │ ├── gqrx.ico │ ├── gqrx.svg │ ├── help.svg │ ├── info.svg │ ├── play.svg │ ├── power-off.svg │ ├── radio.svg │ ├── record.svg │ ├── refresh.svg │ ├── settings.svg │ ├── signal.svg │ ├── tangeo-network-idle.svg │ └── terminal.svg ├── kbd-shortcuts.txt ├── news.txt ├── remote-control.txt ├── screenshots │ └── gqrx-main.png └── textfiles.qrc └── src ├── CMakeLists.txt ├── applications ├── CMakeLists.txt └── gqrx │ ├── file_resources.cpp │ ├── gqrx.h │ ├── main.cpp │ ├── mainwindow.cpp │ ├── mainwindow.h │ ├── mainwindow.ui │ ├── receiver.cpp │ ├── receiver.h │ ├── recentconfig.cpp │ ├── recentconfig.h │ ├── remote_control.cpp │ ├── remote_control.h │ ├── remote_control_settings.cpp │ ├── remote_control_settings.h │ └── remote_control_settings.ui ├── dsp ├── CMakeLists.txt ├── afsk1200 │ ├── cafsk12.cpp │ ├── cafsk12.h │ ├── costabf.c │ └── filter.h ├── agc_impl.cpp ├── agc_impl.h ├── correct_iq_cc.cpp ├── correct_iq_cc.h ├── downconverter.cpp ├── downconverter.h ├── filter │ ├── fir_decim.cpp │ ├── fir_decim.h │ └── fir_decim_coef.h ├── fm_deemph.cpp ├── fm_deemph.h ├── lpf.cpp ├── lpf.h ├── rds │ ├── api.h │ ├── constants.h │ ├── decoder.h │ ├── decoder_impl.cc │ ├── decoder_impl.h │ ├── parser.h │ ├── parser_impl.cc │ ├── parser_impl.h │ └── tmc_events.h ├── resampler_xx.cpp ├── resampler_xx.h ├── rx_agc_xx.cpp ├── rx_agc_xx.h ├── rx_demod_am.cpp ├── rx_demod_am.h ├── rx_demod_fm.cpp ├── rx_demod_fm.h ├── rx_fft.cpp ├── rx_fft.h ├── rx_filter.cpp ├── rx_filter.h ├── rx_meter.cpp ├── rx_meter.h ├── rx_noise_blanker_cc.cpp ├── rx_noise_blanker_cc.h ├── rx_rds.cpp ├── rx_rds.h ├── sniffer_f.cpp ├── sniffer_f.h ├── stereo_demod.cpp └── stereo_demod.h ├── interfaces ├── CMakeLists.txt ├── udp_sink_f.cpp └── udp_sink_f.h ├── osxaudio ├── CMakeLists.txt ├── device_list.cpp └── device_list.h ├── portaudio ├── CMakeLists.txt ├── device_list.cpp ├── device_list.h ├── portaudio_sink.cpp └── portaudio_sink.h ├── pulseaudio ├── CMakeLists.txt ├── pa_device_list.cc ├── pa_device_list.h ├── pa_sink.cc ├── pa_sink.h ├── pa_source.cc └── pa_source.h ├── qtgui ├── CMakeLists.txt ├── afsk1200win.cpp ├── afsk1200win.h ├── afsk1200win.ui ├── agc_options.cpp ├── agc_options.h ├── agc_options.ui ├── audio_options.cpp ├── audio_options.h ├── audio_options.ui ├── bandplan.cpp ├── bandplan.h ├── bookmarks.cpp ├── bookmarks.h ├── bookmarkstablemodel.cpp ├── bookmarkstablemodel.h ├── bookmarkstaglist.cpp ├── bookmarkstaglist.h ├── ctk │ ├── ctkPimpl.h │ ├── ctkRangeSlider.cpp │ └── ctkRangeSlider.h ├── demod_options.cpp ├── demod_options.h ├── demod_options.ui ├── dockaudio.cpp ├── dockaudio.h ├── dockaudio.ui ├── dockbookmarks.cpp ├── dockbookmarks.h ├── dockbookmarks.ui ├── dockfft.cpp ├── dockfft.h ├── dockfft.ui ├── dockinputctl.cpp ├── dockinputctl.h ├── dockinputctl.ui ├── dockrds.cpp ├── dockrds.h ├── dockrds.ui ├── dockrxopt.cpp ├── dockrxopt.h ├── dockrxopt.ui ├── dxc_options.cpp ├── dxc_options.h ├── dxc_options.ui ├── dxc_spots.cpp ├── dxc_spots.h ├── freqctrl.cpp ├── freqctrl.h ├── ioconfig.cpp ├── ioconfig.h ├── ioconfig.ui ├── iq_tool.cpp ├── iq_tool.h ├── iq_tool.ui ├── meter.cpp ├── meter.h ├── nb_options.cpp ├── nb_options.h ├── nb_options.ui ├── plotter.cpp ├── plotter.h ├── qtcolorpicker.cpp └── qtcolorpicker.h └── receivers ├── CMakeLists.txt ├── nbrx.cpp ├── nbrx.h ├── receiver_base.cpp ├── receiver_base.h ├── wfmrx.cpp └── wfmrx.h /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.vscode/ 3 | /build/ 4 | /*.AppImage 5 | /*.dmg 6 | /AppDir/ 7 | /Gqrx.app/ 8 | .idea/ 9 | cmake-build*/ 10 | /CMakeLists.txt.user 11 | -------------------------------------------------------------------------------- /MANIFEST.md: -------------------------------------------------------------------------------- 1 | title: gqrx 2 | brief: SDR receiver implemented using GNU Radio and the Qt GUI toolkit 3 | tags: 4 | - AM 5 | - FM 6 | - SSB 7 | - FFT 8 | author: 9 | - Alexandru Csete 10 | copyright_owner: 11 | - Alexandru Csete 12 | dependencies: 13 | - gnuradio 14 | - gnuradio-osmosdr 15 | - Qt5 16 | repo: https://github.com/gqrx-sdr/gqrx.git 17 | stable_release: HEAD 18 | icon: 19 | --- 20 | 21 | Gqrx is an open source software defined radio (SDR) receiver implemented using GNU Radio and the Qt GUI toolkit. 22 | Currently it works on Linux and Mac with hardware supported by gr-osmosdr, including Funcube Dongle, RTL-SDR, Airspy, HackRF, BladeRF, RFSpace, USRP and SoapySDR. 23 | Gqrx can operate as an AM/FM/SSB receiver with audio output or as an FFT-only instrument. 24 | There are also various hooks for interacting with external application using nertwork sockets. 25 | 26 | Download: 27 | 28 | Gqrx is distributed as source code package and binaries for Linux and Mac. 29 | Alternate Mac support is available through macports and homebrew. 30 | Please see https://gqrx.dk/download for a list of download resources. 31 | 32 | Usage: 33 | 34 | It is strongly recommended to run the "volk_profile" gnuradio utility before running gqrx. 35 | This will detect and enable processor specific optimisations and will in many cases give a significant performance boost. 36 | The first time you start gqrx it will open a device configuration dialog. 37 | Supported devices that are connected to the computer are discovered automatically and you can select any of them in the drop-down list. 38 | If you don't see your device listed in the drop-down list it could be because: 39 | 1. The driver has not been included in a binary distribution 40 | 2. The udev rule has not been properly configured 41 | 3. Linux kernel driver is blocking access to the device 42 | You can test your device using device specific tools, such as rtl_test, airspy_rx, hackrf_transfer, qthid, etc. 43 | Gqrx supports multiple configurations and sessions if you have several devices or if you want to use the same device under different configurations. 44 | You can load a configuration from the GUI or using the -c command line argument. 45 | See "gqrx --help" for a complete list of command line arguments. 46 | Tutorials and howtos are being written and published on the website https://gqrx.dk/ 47 | -------------------------------------------------------------------------------- /cmake/Modules/FindGnuradio-osmosdr.cmake: -------------------------------------------------------------------------------- 1 | if(NOT PKG_CONFIG_FOUND) 2 | INCLUDE(FindPkgConfig) 3 | endif() 4 | PKG_CHECK_MODULES(PC_GNURADIO_OSMOSDR gnuradio-osmosdr) 5 | 6 | FIND_PATH( 7 | GNURADIO_OSMOSDR_INCLUDE_DIRS 8 | NAMES osmosdr/source.h 9 | HINTS $ENV{GNURADIO_OSMOSDR_DIR}/include 10 | ${PC_GNURADIO_OSMOSDR_INCLUDEDIR} 11 | ${CMAKE_INSTALL_PREFIX}/include/osmosdr 12 | PATHS /usr/local/include/osmosdr 13 | /usr/include/osmosdr 14 | ) 15 | 16 | FIND_LIBRARY( 17 | GNURADIO_OSMOSDR_LIBRARIES 18 | NAMES gnuradio-osmosdr 19 | HINTS $ENV{GNURADIO_OSMOSDR_DIR}/lib 20 | ${PC_GNURADIO_OSMOSDR_LIBDIR} 21 | ${CMAKE_INSTALL_PREFIX}/lib 22 | ${CMAKE_INSTALL_PREFIX}/lib64 23 | PATHS /usr/local/lib 24 | /usr/local/lib64 25 | /usr/lib 26 | /usr/lib64 27 | ) 28 | 29 | INCLUDE(FindPackageHandleStandardArgs) 30 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(Gnuradio-osmosdr DEFAULT_MSG GNURADIO_OSMOSDR_LIBRARIES GNURADIO_OSMOSDR_INCLUDE_DIRS) 31 | MARK_AS_ADVANCED(GNURADIO_OSMOSDR_LIBRARIES GNURADIO_OSMOSDR_INCLUDE_DIRS) 32 | -------------------------------------------------------------------------------- /cmake/cmake_uninstall.cmake.in: -------------------------------------------------------------------------------- 1 | # https://cmake.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F 2 | 3 | IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 4 | MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") 5 | ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 6 | 7 | FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) 8 | STRING(REGEX REPLACE "\n" ";" files "${files}") 9 | FOREACH(file ${files}) 10 | MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") 11 | IF(EXISTS "$ENV{DESTDIR}${file}") 12 | EXEC_PROGRAM( 13 | "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 14 | OUTPUT_VARIABLE rm_out 15 | RETURN_VALUE rm_retval 16 | ) 17 | IF(NOT "${rm_retval}" STREQUAL 0) 18 | MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") 19 | ENDIF(NOT "${rm_retval}" STREQUAL 0) 20 | ELSEIF(IS_SYMLINK "$ENV{DESTDIR}${file}") 21 | EXEC_PROGRAM( 22 | "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 23 | OUTPUT_VARIABLE rm_out 24 | RETURN_VALUE rm_retval 25 | ) 26 | IF(NOT "${rm_retval}" STREQUAL 0) 27 | MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") 28 | ENDIF(NOT "${rm_retval}" STREQUAL 0) 29 | ELSE(EXISTS "$ENV{DESTDIR}${file}") 30 | MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") 31 | ENDIF(EXISTS "$ENV{DESTDIR}${file}") 32 | ENDFOREACH(file) 33 | -------------------------------------------------------------------------------- /dk.gqrx.gqrx.appdata.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | dk.gqrx.gqrx 4 | Gqrx 5 | Software defined radio receiver implemented using GNU Radio and the Qt GUI toolkit 6 | Software defined radio ontvanger geïmplementeerd met GNU Radio en de Qt GUI toolkit 7 | Приемник для программно-определенного радио (SDR) использующий GNU Radio и библиотеку Qt 8 | Alexandru Csete 9 | 10 | Alexandru Csete 11 | 12 | 13 |

14 | Gqrx is an open source software defined radio receiver (SDR) powered by the GNU Radio and the Qt graphical toolkit. 15 |

16 |

17 | Gqrx supports many of the SDR hardware available, including Airspy, Funcube Dongles, rtl-sdr, HackRF and USRP devices. 18 |

19 |
20 | CC-BY-3.0 21 | GPL-3.0 22 | https://github.com/gqrx-sdr/gqrx/issues 23 | 24 | 25 | 26 | https://gqrx.dk/ 27 | 28 | dk.gqrx.gqrx.desktop 29 | 30 | 31 | 32 | https://raw.githubusercontent.com/gqrx-sdr/gqrx/master/resources/screenshots/gqrx-main.png 33 | 34 | 35 | 36 | argilo@gmail.com 37 |
38 | -------------------------------------------------------------------------------- /dk.gqrx.gqrx.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Type=Application 3 | Name=Gqrx 4 | GenericName=Software Defined Radio 5 | Comment=Software defined radio receiver implemented using GNU Radio and the Qt GUI toolkit 6 | # FIXME add comments in other languages 7 | GenericName[cs]=Softwarově definované rádio (SDR) 8 | Comment[cs]=Přijímač na bázi softwarově definovaného rádia implementovaný s použitím GNU Radio a Qt 9 | GenericName[ru]=Программно-определённое радио 10 | Comment[ru]=Приемник для программно-определенного радио (SDR) использующий GNU Radio и библиотеку Qt. 11 | GenericName[nl]=Software Defined Radio 12 | Comment[nl]=Software defined radio ontvanger geïmplementeerd met GNU Radio en de Qt GUI toolkit 13 | Comment[de]=Software defined Radio auf Basis von GNU Radio und dem Qt GUI Toolkit 14 | GenericName[zh_CN]=软件无线电 15 | Comment[zh_CN]=使用 GNU Radio 和 Qt GUI 实现的软件无线电接收器 16 | Exec=gqrx 17 | Terminal=false 18 | Icon=gqrx 19 | Categories=AudioVideo;Audio;Qt;HamRadio; 20 | Keywords=SDR;Radio;HAM; 21 | -------------------------------------------------------------------------------- /macos_bundle.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | GQRX_VERSION="$(Gqrx.app/Contents/Info.plist 21 | 22 | 23 | 24 | 25 | NSPrincipalClass 26 | NSApplication 27 | CFBundleExecutable 28 | gqrx 29 | CFBundleIdentifier 30 | dk.gqrx.gqrx 31 | CFBundleName 32 | Gqrx 33 | CFBundleIconFile 34 | gqrx.icns 35 | CFBundleShortVersionString 36 | $GQRX_VERSION 37 | CFBundleInfoDictionaryVersion 38 | 6.0 39 | CFBundlePackageType 40 | APPL 41 | IFMajorVersion 42 | 1 43 | IFMinorVersion 44 | 0 45 | 46 | 47 | EOM 48 | 49 | /bin/cat </tmp/Entitlements.plist 50 | 51 | 52 | 53 | 54 | com.apple.security.cs.allow-unsigned-executable-memory 55 | 56 | 57 | 58 | EOM 59 | 60 | cp build/src/gqrx Gqrx.app/Contents/MacOS 61 | cp resources/icons/gqrx.icns Gqrx.app/Contents/Resources 62 | cp "$CONDA_PREFIX"/lib/SoapySDR/modules*/* Gqrx.app/Contents/soapy-modules 63 | 64 | if [ "$1" = "true" ]; then 65 | "${MACDEPLOYQT6}" Gqrx.app -verbose=1 -no-strip -always-overwrite -sign-for-notarization="${IDENTITY}" -libpath=Gqrx.app/Contents/Frameworks 66 | else 67 | "${MACDEPLOYQT6}" Gqrx.app -verbose=1 -no-strip -always-overwrite -libpath=Gqrx.app/Contents/Frameworks 68 | fi 69 | 70 | for f in Gqrx.app/Contents/Frameworks/*.dylib Gqrx.app/Contents/soapy-modules/* Gqrx.app/Contents/MacOS/gqrx 71 | do 72 | if [ "$1" = "true" ]; then 73 | codesign --force --verify --verbose --timestamp --options runtime --entitlements /tmp/Entitlements.plist --sign "${IDENTITY}" "$f" 74 | else 75 | codesign --remove-signature "$f" 76 | fi 77 | done 78 | -------------------------------------------------------------------------------- /new_logo/PNG/horizontal color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gqrx-sdr/gqrx/1a8ab3a3cc02db3bf4c9058ed4b60ddad06fe9d1/new_logo/PNG/horizontal color.png -------------------------------------------------------------------------------- /new_logo/PNG/horizontal white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gqrx-sdr/gqrx/1a8ab3a3cc02db3bf4c9058ed4b60ddad06fe9d1/new_logo/PNG/horizontal white.png -------------------------------------------------------------------------------- /new_logo/PNG/icon color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gqrx-sdr/gqrx/1a8ab3a3cc02db3bf4c9058ed4b60ddad06fe9d1/new_logo/PNG/icon color.png -------------------------------------------------------------------------------- /new_logo/PNG/icon white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gqrx-sdr/gqrx/1a8ab3a3cc02db3bf4c9058ed4b60ddad06fe9d1/new_logo/PNG/icon white.png -------------------------------------------------------------------------------- /new_logo/PNG/vertical color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gqrx-sdr/gqrx/1a8ab3a3cc02db3bf4c9058ed4b60ddad06fe9d1/new_logo/PNG/vertical color.png -------------------------------------------------------------------------------- /new_logo/PNG/vertical white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gqrx-sdr/gqrx/1a8ab3a3cc02db3bf4c9058ed4b60ddad06fe9d1/new_logo/PNG/vertical white.png -------------------------------------------------------------------------------- /new_logo/SVG/icon color.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 24 | 46 | 48 | 49 | 51 | image/svg+xml 52 | 54 | 55 | 56 | 57 | 58 | 63 | 66 | 71 | 72 | 75 | 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /new_logo/SVG/icon white.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 24 | 46 | 48 | 49 | 51 | image/svg+xml 52 | 54 | 55 | 56 | 57 | 58 | 63 | 67 | 72 | 73 | 77 | 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /resources/gqrx.1: -------------------------------------------------------------------------------- 1 | .TH GQRX "1" "May 27, 2025" "gqrx 2.17.7" "User Commands" 2 | .SH NAME 3 | gqrx \- Software Defined Radio GUI application 4 | .SH DESCRIPTION 5 | Gqrx is a software defined radio (SDR) receiver implemented using GNU Radio and 6 | the Qt GUI toolkit. It works with hardware supported by gr-osmosdr, including 7 | Funcube Dongle, RTL-SDR, Airspy, HackRF, BladeRF, RFSpace, USRP and SoapySDR. 8 | .PP 9 | Gqrx can operate as an AM/FM/SSB receiver with audio output or as an FFT-only 10 | instrument. There are also various hooks for interacting with external 11 | applications using network sockets. 12 | .PP 13 | It is strongly recommended to run the volk_profile utility before 14 | running gqrx. This will detect and enable processor-specific optimisations and 15 | will in many cases give a significant performance boost. 16 | .PP 17 | The first time you start gqrx it will open a device configuration dialog. 18 | Supported devices that are connected to the computer are discovered 19 | automatically and you can select any of them in the drop-down list. 20 | .PP 21 | If you don't see your device listed in the drop-down list it could be because: 22 | .IP \[bu] 23 | The driver has not been included in a binary distribution 24 | .IP \[bu] 25 | The udev rule has not been properly configured 26 | .IP \[bu] 27 | Linux kernel driver is blocking access to the device 28 | .PP 29 | You can test your device using device specific tools, such as rtl_test, 30 | airspy_rx, hackrf_transfer, qthid, etc. 31 | .PP 32 | Gqrx supports multiple configurations and sessions if you have several devices 33 | or if you want to use the same device under different configurations. You can 34 | load a configuration from the GUI or using the -c command line argument. 35 | .SH OPTIONS 36 | .TP 37 | .BR \-h ", " \-\-help 38 | Display the help page 39 | .TP 40 | .BR \-s ", " \-\-style " " \fIstyle\fR 41 | Use the given style (fusion, windows) 42 | .TP 43 | .BR \-l ", " \-\-list 44 | List existing configurations 45 | .TP 46 | .BR \-c ", " \-\-conf " " \fIfile\fR 47 | Start with a specific configuration file 48 | .TP 49 | .BR \-e ", " \-\-edit 50 | Edit the configuration file before using it 51 | .TP 52 | .BR \-r ", " \-\-reset 53 | Reset the configuration file 54 | .SH SEE ALSO 55 | https://gqrx.dk/ 56 | -------------------------------------------------------------------------------- /resources/icons.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | icons/audio-card.svg 4 | icons/bookmark-new.svg 5 | icons/clear.svg 6 | icons/clock.svg 7 | icons/close.svg 8 | icons/document.svg 9 | icons/flash.svg 10 | icons/folder.svg 11 | icons/fullscreen.svg 12 | icons/floppy.svg 13 | icons/gqrx.svg 14 | icons/help.svg 15 | icons/info.svg 16 | icons/play.svg 17 | icons/power-off.svg 18 | icons/record.svg 19 | icons/refresh.svg 20 | icons/settings.svg 21 | icons/signal.svg 22 | icons/tangeo-network-idle.svg 23 | icons/terminal.svg 24 | 25 | 26 | -------------------------------------------------------------------------------- /resources/icons/gqrx.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gqrx-sdr/gqrx/1a8ab3a3cc02db3bf4c9058ed4b60ddad06fe9d1/resources/icons/gqrx.icns -------------------------------------------------------------------------------- /resources/icons/gqrx.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gqrx-sdr/gqrx/1a8ab3a3cc02db3bf4c9058ed4b60ddad06fe9d1/resources/icons/gqrx.ico -------------------------------------------------------------------------------- /resources/kbd-shortcuts.txt: -------------------------------------------------------------------------------- 1 | Keyboard shortcuts 2 | 3 | Main window actions: 4 | 5 | Ctrl+D Start/stop DSP 6 | Ctrl+L Load settings from a file 7 | Ctrl+S Save current settings to a file 8 | Ctrl+Shift+B Bookmark the current frequency and mode 9 | Ctrl+I Open I/Q recorder dialog 10 | Ctrl+W Save waterfall as an image 11 | Ctrl+C Open DX cluster dialog 12 | F11 Toggle full screen mode 13 | F Set focus to the frequency controller 14 | Z Zero frequency offset 15 | Delete Clear waterfall 16 | Ctrl+Q Quit the program 17 | 18 | Receiver modes: 19 | 20 | ! Demod off 21 | I Raw I/Q 22 | A AM 23 | Shift+A AM sync 24 | N NFM 25 | W WFM mono 26 | Shift+W WFM stereo 27 | O WFM oirt 28 | S LSB (memo: lower SSB) 29 | Shift+S USB (memo: upper SSB) 30 | C CW-L (memo: lower CW) 31 | Shift+C CW-U (memo: upper CW) 32 | 33 | Squelch: 34 | 35 | ` Reset squelch 36 | ~ Auto squelch 37 | 38 | Filter width: 39 | 40 | < Narrow 41 | . Normal 42 | > Wide 43 | 44 | Audio functions: 45 | 46 | R Start/stop recording 47 | M Toggle mute 48 | - Decrease gain by 1 dB 49 | + Increase gain by 1 dB 50 | -------------------------------------------------------------------------------- /resources/remote-control.txt: -------------------------------------------------------------------------------- 1 | Remote control protocol. 2 | 3 | Supported commands: 4 | f 5 | Get frequency [Hz] 6 | F 7 | Set frequency [Hz] 8 | m 9 | Get demodulator mode and passband 10 | M [passband] 11 | Set demodulator mode and passband [Hz] 12 | Passing a '?' as the first argument instead of 'mode' will return 13 | a space separated list of radio backend supported modes. 14 | l|L ? 15 | Get a space separated list of settings available for reading (l) or writing (L). 16 | l STRENGTH 17 | Get signal strength [dBFS] 18 | l SQL 19 | Get squelch threshold [dBFS] 20 | L SQL 21 | Set squelch threshold to [dBFS] 22 | l AF 23 | Get audio gain [dB] 24 | L AF 25 | Set audio gain to [dB] 26 | l _GAIN 27 | Get the value of the gain setting with the name 28 | L _GAIN 29 | Set the value of the gain setting with the name to 30 | p RDS_PI 31 | Get the RDS PI code (in hexadecimal). Returns 0000 if not applicable. 32 | p RDS_PS_NAME 33 | Get the RDS Program Service (PS) name 34 | p RDS_RADIOTEXT 35 | Get the RDS RadioText message 36 | u RECORD 37 | Get status of audio recorder 38 | U RECORD 39 | Set status of audio recorder to 40 | u IQRECORD 41 | Get status of IQ recorder 42 | U IQRECORD 43 | Set status of IQ recorder to 44 | u DSP 45 | Get DSP (SDR receiver) status 46 | U DSP 47 | Set DSP (SDR receiver) status to 48 | u RDS 49 | Get RDS decoder status. Only functions in WFM mode. 50 | U RDS 51 | Set RDS decoder to . Only functions in WFM mode. 52 | u MUTE 53 | Get audio mute status 54 | U MUTE 55 | Set audio mute to 56 | q|Q 57 | Close connection 58 | AOS 59 | Acquisition of signal (AOS) event, start audio recording 60 | LOS 61 | Loss of signal (LOS) event, stop audio recording 62 | LNB_LO [frequency] 63 | If frequency [Hz] is specified set the LNB LO frequency used for 64 | display. Otherwise print the current LNB LO frequency [Hz]. 65 | \chk_vfo 66 | Get VFO option status (only usable for hamlib compatibility) 67 | \dump_state 68 | Dump state (only usable for hamlib compatibility) 69 | \get_powerstat 70 | Get power status (only usable for hamlib compatibility) 71 | v 72 | Get 'VFO' (only usable for hamlib compatibility) 73 | V 74 | Set 'VFO' (only usable for hamlib compatibility) 75 | s 76 | Get 'Split' mode (only usable for hamlib compatibility) 77 | S 78 | Set 'Split' mode (only usable for hamlib compatibility) 79 | _ 80 | Get version 81 | 82 | 83 | Reply: 84 | RPRT 0 85 | Command successful 86 | RPRT 1 87 | Command failed 88 | -------------------------------------------------------------------------------- /resources/screenshots/gqrx-main.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gqrx-sdr/gqrx/1a8ab3a3cc02db3bf4c9058ed4b60ddad06fe9d1/resources/screenshots/gqrx-main.png -------------------------------------------------------------------------------- /resources/textfiles.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | news.txt 4 | remote-control.txt 5 | kbd-shortcuts.txt 6 | bandplan.csv 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/applications/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ####################################################################################################################### 2 | # Add the source files to SRCS_LIST 3 | add_source_files(SRCS_LIST 4 | gqrx/gqrx.h 5 | gqrx/main.cpp 6 | gqrx/mainwindow.cpp 7 | gqrx/mainwindow.h 8 | gqrx/receiver.cpp 9 | gqrx/receiver.h 10 | gqrx/remote_control_settings.cpp 11 | gqrx/remote_control_settings.h 12 | gqrx/remote_control.cpp 13 | gqrx/remote_control.h 14 | gqrx/recentconfig.cpp 15 | gqrx/recentconfig.h 16 | gqrx/file_resources.cpp 17 | ) 18 | 19 | ####################################################################################################################### 20 | # Add the UI files to UI_SRCS_LIST 21 | add_source_files(UI_SRCS_LIST 22 | gqrx/mainwindow.ui 23 | gqrx/remote_control_settings.ui 24 | ) 25 | -------------------------------------------------------------------------------- /src/applications/gqrx/file_resources.cpp: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright (c) 2016 Josh Blum 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | 24 | #include "applications/gqrx/receiver.h" 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | std::string receiver::get_zero_file(void) 31 | { 32 | static std::string path; 33 | if (path.empty()) 34 | { 35 | path = "/dev/zero"; 36 | QFileInfo checkFile(QString::fromStdString(path)); 37 | if (!checkFile.exists()) 38 | { 39 | //static temp file persists until process end 40 | static QTemporaryFile temp_file; 41 | temp_file.open(); 42 | path = temp_file.fileName().toStdString(); 43 | { 44 | QDataStream stream(&temp_file); 45 | for (size_t i = 0; i < 1024*8; i++) stream << qint8(0); 46 | } 47 | temp_file.close(); 48 | std::cout << "Created random file " << path << std::endl; 49 | } 50 | } 51 | return path; 52 | } 53 | -------------------------------------------------------------------------------- /src/applications/gqrx/gqrx.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2012 Alexandru Csete OZ9AEC. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | 24 | 25 | #define GQRX_ORG_NAME "gqrx" 26 | #define GQRX_ORG_DOMAIN "gqrx.dk" 27 | #define GQRX_APP_NAME "gqrx" 28 | 29 | #define GQRX_CONFIG_VERSION 2 30 | //#define GQRX_VERSION_MAJOR 2 31 | //#define GQRX_VERSION_MINOR 0 32 | //#define GQRX_VERSION_MICRO 0 33 | -------------------------------------------------------------------------------- /src/applications/gqrx/recentconfig.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2020 Markus Kolb. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #ifndef RECENTCONFIG_H 24 | #define RECENTCONFIG_H 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | #define RECENT_CONFIG_FILENAME "recentconfig.cfg" 31 | 32 | class RecentConfig : public QObject 33 | { 34 | Q_OBJECT 35 | 36 | public: 37 | RecentConfig(const QString &configDir, QMenu *menu); 38 | ~RecentConfig(); 39 | 40 | /** 41 | * @brief Create actions in menu for recent config files 42 | */ 43 | void createMenuActions(); 44 | 45 | signals: 46 | /** 47 | * @brief Connect to loadConfig and load the file 48 | * @param filename 49 | */ 50 | void loadConfig(const QString &filename) const; 51 | 52 | /** 53 | * @brief configSaved emit starts menu update for filename on save 54 | * @param filename 55 | */ 56 | void configSaved(const QString &filename); 57 | 58 | /** 59 | * @brief configLoaded emit starts menu update for filename on load 60 | * @param filename 61 | */ 62 | void configLoaded(const QString &filename); 63 | 64 | protected: 65 | QVector::const_iterator getConfigFiles() const; 66 | QMenu *getMenu(); 67 | bool loadRecentConfig(); 68 | bool saveRecentConfig(); 69 | 70 | protected slots: 71 | void onConfigSaved(const QString &filename); 72 | void onConfigLoaded(const QString &filename); 73 | 74 | private: 75 | QSharedPointer> cfgfiles; 76 | QMenu *menu; 77 | QFileInfo configFile; 78 | inline void updateFiles(const QString &filename); 79 | 80 | private slots: 81 | void onMenuAction(int index) const; 82 | 83 | }; 84 | 85 | #endif // RECENTCONFIG_H 86 | -------------------------------------------------------------------------------- /src/applications/gqrx/remote_control_settings.cpp: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2013 Alexandru Csete OZ9AEC. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #include 24 | #include 25 | 26 | #include "remote_control_settings.h" 27 | #include "ui_remote_control_settings.h" 28 | 29 | RemoteControlSettings::RemoteControlSettings(QWidget *parent) : 30 | QDialog(parent), 31 | ui(new Ui::RemoteControlSettings) 32 | { 33 | ui->setupUi(this); 34 | } 35 | 36 | RemoteControlSettings::~RemoteControlSettings() 37 | { 38 | delete ui; 39 | } 40 | 41 | /*! \brief Set new network port. 42 | * \param port The new network port. 43 | */ 44 | void RemoteControlSettings::setPort(int port) 45 | { 46 | ui->portSpinBox->setValue(port); 47 | } 48 | 49 | /*! \brief Get current value from the port spin box. 50 | * \return The current port value. 51 | */ 52 | int RemoteControlSettings::getPort(void) const 53 | { 54 | return ui->portSpinBox->value(); 55 | } 56 | 57 | /*! \brief Add items to the list of allowed hosts. 58 | * \param hosts A list with the IP addresses of the allowed hosts. 59 | * 60 | * Note that setting the list will clear the current contents of the 61 | * list widget. 62 | */ 63 | void RemoteControlSettings::setHosts(QStringList hosts) 64 | { 65 | ui->hostListWidget->clear(); 66 | ui->hostListWidget->addItems(hosts); 67 | } 68 | 69 | /*! \brief Get list of allowed hosts. */ 70 | QStringList RemoteControlSettings::getHosts(void) const 71 | { 72 | QStringList list; 73 | 74 | for (int i = 0; i < ui->hostListWidget->count(); i++) 75 | { 76 | list << ui->hostListWidget->item(i)->text(); 77 | } 78 | 79 | return list; 80 | } 81 | 82 | 83 | /*! \brief Add a new entry to the list of allowed hosts. 84 | * 85 | * The function inserts a new entry at the end of the list and enables 86 | * editing. 87 | */ 88 | void RemoteControlSettings::on_hostAddButton_clicked(void) 89 | { 90 | ui->hostListWidget->addItem(tr("Enter IP")); 91 | 92 | QListWidgetItem *item = ui->hostListWidget->item(ui->hostListWidget->count()-1); 93 | item->setFlags(item->flags() | Qt::ItemIsEditable); 94 | ui->hostListWidget->setCurrentItem(item, QItemSelectionModel::ClearAndSelect); 95 | ui->hostListWidget->editItem(item); 96 | } 97 | 98 | /*! \brief Delete the selected entries from the list of allowed hosts. */ 99 | void RemoteControlSettings::on_hostDelButton_clicked(void) 100 | { 101 | // wondering WTF? 102 | // see http://stackoverflow.com/questions/7008423/how-do-i-remove-all-the-selected-items-in-a-qlistwidget 103 | qDeleteAll(ui->hostListWidget->selectedItems()); 104 | } 105 | 106 | 107 | -------------------------------------------------------------------------------- /src/applications/gqrx/remote_control_settings.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2013 Alexandru Csete OZ9AEC. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #ifndef REMOTE_CONTROL_SETTINGS_H 24 | #define REMOTE_CONTROL_SETTINGS_H 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | namespace Ui { 31 | class RemoteControlSettings; 32 | } 33 | 34 | /*! \brief Class to configure remote control settiongs. */ 35 | class RemoteControlSettings : public QDialog 36 | { 37 | Q_OBJECT 38 | 39 | public: 40 | explicit RemoteControlSettings(QWidget *parent = 0); 41 | ~RemoteControlSettings(); 42 | 43 | void setPort(int port); 44 | int getPort(void) const; 45 | 46 | void setHosts(QStringList hosts); 47 | QStringList getHosts(void) const; 48 | 49 | private slots: 50 | void on_hostAddButton_clicked(void); 51 | void on_hostDelButton_clicked(void); 52 | 53 | private: 54 | Ui::RemoteControlSettings *ui; 55 | }; 56 | 57 | #endif // REMOTE_CONTROL_SETTINGS_H 58 | -------------------------------------------------------------------------------- /src/dsp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # Add the source files to SRCS_LIST 3 | add_source_files(SRCS_LIST 4 | afsk1200/cafsk12.cpp 5 | afsk1200/cafsk12.h 6 | afsk1200/costabf.c 7 | afsk1200/filter.h 8 | filter/fir_decim.cpp 9 | filter/fir_decim.h 10 | filter/fir_decim_coef.h 11 | rds/api.h 12 | rds/constants.h 13 | rds/decoder_impl.cc 14 | rds/decoder_impl.h 15 | rds/decoder.h 16 | rds/parser_impl.cc 17 | rds/parser_impl.h 18 | rds/parser.h 19 | rds/tmc_events.h 20 | agc_impl.cpp 21 | agc_impl.h 22 | correct_iq_cc.cpp 23 | correct_iq_cc.h 24 | downconverter.cpp 25 | downconverter.h 26 | fm_deemph.cpp 27 | fm_deemph.h 28 | lpf.cpp 29 | lpf.h 30 | resampler_xx.cpp 31 | resampler_xx.h 32 | rx_agc_xx.cpp 33 | rx_agc_xx.h 34 | rx_demod_am.cpp 35 | rx_demod_am.h 36 | rx_demod_fm.cpp 37 | rx_demod_fm.h 38 | rx_fft.cpp 39 | rx_fft.h 40 | rx_filter.cpp 41 | rx_filter.h 42 | rx_meter.cpp 43 | rx_meter.h 44 | rx_noise_blanker_cc.cpp 45 | rx_noise_blanker_cc.h 46 | rx_rds.cpp 47 | rx_rds.h 48 | sniffer_f.cpp 49 | sniffer_f.h 50 | stereo_demod.cpp 51 | stereo_demod.h 52 | ) 53 | -------------------------------------------------------------------------------- /src/dsp/afsk1200/filter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * filter.h -- optimized filter routines 3 | * 4 | * Copyright (C) 1996 5 | * Thomas Sailer (sailer@ife.ee.ethz.ch, hb9jnx@hb9w.che.eu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | /* ---------------------------------------------------------------------- */ 23 | 24 | #ifndef _FILTER_H 25 | #define _FILTER_H 26 | 27 | /* ---------------------------------------------------------------------- */ 28 | 29 | inline float mac(const float *a, const float *b, unsigned int size) 30 | { 31 | float sum = 0; 32 | unsigned int i; 33 | 34 | for (i = 0; i < size; i++) 35 | sum += (*a++) * (*b++); 36 | return sum; 37 | } 38 | 39 | inline float fsqr(float f) 40 | { 41 | return f*f; 42 | } 43 | 44 | /* ---------------------------------------------------------------------- */ 45 | #endif /* _FILTER_H */ 46 | -------------------------------------------------------------------------------- /src/dsp/agc_impl.h: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////// 2 | // agc_impl.h: interface for the CAgc class. 3 | // 4 | // This class implements an automatic gain function. 5 | // 6 | // History: 7 | // 2010-09-15 Initial creation MSW 8 | // 2011-03-27 Initial release 9 | // 2011-09-24 Adapted for gqrx 10 | ////////////////////////////////////////////////////////////////////// 11 | #ifndef AGC_IMPL_H 12 | #define AGC_IMPL_H 13 | 14 | #include 15 | #include 16 | 17 | #define MAX_DELAY_BUF 2048 18 | 19 | /* 20 | typedef struct _dCplx 21 | { 22 | double re; 23 | double im; 24 | } tDComplex; 25 | 26 | #define TYPECPX tDComplex 27 | */ 28 | 29 | #define TYPECPX std::complex 30 | 31 | 32 | class CAgc 33 | { 34 | public: 35 | CAgc(); 36 | virtual ~CAgc(); 37 | void SetParameters(bool AgcOn, bool UseHang, int Threshold, int ManualGain, int Slope, int Decay, float SampleRate); 38 | void ProcessData(int Length, const TYPECPX * pInData, TYPECPX * pOutData); 39 | 40 | private: 41 | bool m_AgcOn; 42 | bool m_UseHang; 43 | int m_Threshold; 44 | int m_ManualGain; 45 | int m_Decay; 46 | 47 | float m_SampleRate; 48 | 49 | float m_SlopeFactor; 50 | float m_ManualAgcGain; 51 | 52 | float m_DecayAve; 53 | float m_AttackAve; 54 | 55 | float m_AttackRiseAlpha; 56 | float m_AttackFallAlpha; 57 | float m_DecayRiseAlpha; 58 | float m_DecayFallAlpha; 59 | 60 | float m_FixedGain; 61 | float m_Knee; 62 | float m_GainSlope; 63 | float m_Peak; 64 | 65 | int m_SigDelayPtr; 66 | int m_MagBufPos; 67 | int m_DelaySamples; 68 | int m_WindowSamples; 69 | int m_HangTime; 70 | int m_HangTimer; 71 | 72 | TYPECPX m_SigDelayBuf[MAX_DELAY_BUF]; 73 | float* m_SigDelayBuf_r; 74 | 75 | float m_MagBuf[MAX_DELAY_BUF]; 76 | std::deque m_MagDeque; 77 | }; 78 | 79 | #endif // AGC_IMPL_H 80 | -------------------------------------------------------------------------------- /src/dsp/correct_iq_cc.cpp: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2012-2013 Alexandru Csete OZ9AEC. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include "dsp/correct_iq_cc.h" 28 | 29 | 30 | dc_corr_cc_sptr make_dc_corr_cc(double sample_rate, double tau) 31 | { 32 | return gnuradio::get_initial_sptr(new dc_corr_cc(sample_rate, tau)); 33 | } 34 | 35 | 36 | /*! \brief Create DC correction object. 37 | * 38 | * Use make_dc_corr_cc() instead. 39 | */ 40 | dc_corr_cc::dc_corr_cc(double sample_rate, double tau) 41 | : gr::hier_block2 ("dc_corr_cc", 42 | gr::io_signature::make(1, 1, sizeof(gr_complex)), 43 | gr::io_signature::make(1, 1, sizeof(gr_complex))) 44 | { 45 | d_sr = sample_rate; 46 | d_tau = tau; 47 | d_alpha = 1.0 / (1.0 + d_tau * sample_rate); 48 | 49 | qDebug() << "IQ DCR alpha:" << d_alpha; 50 | 51 | d_iir = gr::filter::single_pole_iir_filter_cc::make(d_alpha, 1); 52 | d_sub = gr::blocks::sub_cc::make(1); 53 | 54 | connect(self(), 0, d_iir, 0); 55 | connect(self(), 0, d_sub, 0); 56 | connect(d_iir, 0, d_sub, 1); 57 | connect(d_sub, 0, self(), 0); 58 | } 59 | 60 | dc_corr_cc::~dc_corr_cc() 61 | { 62 | 63 | } 64 | 65 | /*! \brief Set new sample rate. */ 66 | void dc_corr_cc::set_sample_rate(double sample_rate) 67 | { 68 | d_sr = sample_rate; 69 | d_alpha = 1.0 / (1.0 + d_tau * sample_rate); 70 | 71 | d_iir->set_taps(d_alpha); 72 | 73 | qDebug() << "IQ DCR samp_rate:" << sample_rate; 74 | qDebug() << "IQ DCR alpha:" << d_alpha; 75 | } 76 | 77 | /*! \brief Set new time constant. */ 78 | void dc_corr_cc::set_tau(double tau) 79 | { 80 | d_tau = tau; 81 | d_alpha = 1.0 / (1.0 + d_tau * d_sr); 82 | 83 | d_iir->set_taps(d_alpha); 84 | 85 | qDebug() << "IQ DCR alpha:" << d_alpha; 86 | } 87 | 88 | 89 | /** I/Q swap **/ 90 | iq_swap_cc_sptr make_iq_swap_cc(bool enabled) 91 | { 92 | return gnuradio::get_initial_sptr(new iq_swap_cc(enabled)); 93 | } 94 | 95 | iq_swap_cc::iq_swap_cc(bool enabled) 96 | : gr::sync_block ("iq_swap_cc", 97 | gr::io_signature::make(1, 1, sizeof(gr_complex)), 98 | gr::io_signature::make(1, 1, sizeof(gr_complex))) 99 | { 100 | d_enabled = enabled; 101 | } 102 | 103 | iq_swap_cc::~iq_swap_cc() 104 | { 105 | 106 | } 107 | 108 | /*! \brief Enabled or disable I/Q swapping. */ 109 | void iq_swap_cc::set_enabled(bool enabled) 110 | { 111 | if (enabled == d_enabled) 112 | return; 113 | 114 | qDebug() << "IQ swap:" << enabled; 115 | 116 | d_enabled = enabled; 117 | } 118 | 119 | int iq_swap_cc::work(int noutput_items, 120 | gr_vector_const_void_star& input_items, 121 | gr_vector_void_star& output_items) 122 | { 123 | const float *in = (const float *)input_items[0]; 124 | float *out = (float *)output_items[0]; 125 | 126 | if (d_enabled) 127 | { 128 | for (int i = 0; i < noutput_items; ++i) 129 | { 130 | out[1] = in[0]; 131 | out[0] = in[1]; 132 | in += 2; 133 | out += 2; 134 | } 135 | } 136 | else 137 | { 138 | memcpy(out, in, noutput_items * sizeof(gr_complex)); 139 | } 140 | return noutput_items; 141 | } 142 | -------------------------------------------------------------------------------- /src/dsp/correct_iq_cc.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2012-2013 Alexandru Csete OZ9AEC. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #ifndef CORRECT_IQ_CC_H 24 | #define CORRECT_IQ_CC_H 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | class dc_corr_cc; 34 | class iq_swap_cc; 35 | 36 | #if GNURADIO_VERSION < 0x030900 37 | typedef boost::shared_ptr dc_corr_cc_sptr; 38 | typedef boost::shared_ptr iq_swap_cc_sptr; 39 | #else 40 | typedef std::shared_ptr dc_corr_cc_sptr; 41 | typedef std::shared_ptr iq_swap_cc_sptr; 42 | #endif 43 | 44 | /*! \brief Return a shared_ptr to a new instance of dc_corr_cc. 45 | * \param sample_rate The sample rate 46 | * \param tau The time constant for the filter 47 | */ 48 | dc_corr_cc_sptr make_dc_corr_cc(double sample_rate, double tau=1.0); 49 | 50 | /*! \brief Single pole IIR filter-based DC offset correction block. 51 | * \ingroup DSP 52 | * 53 | * This block performs automatic DC offset removal using a single pole IIR 54 | * filter 55 | */ 56 | class dc_corr_cc : public gr::hier_block2 57 | { 58 | friend dc_corr_cc_sptr make_dc_corr_cc(double sample_rate, double tau); 59 | 60 | protected: 61 | dc_corr_cc(double sample_rate, double tau); 62 | 63 | public: 64 | ~dc_corr_cc(); 65 | void set_sample_rate(double sample_rate); 66 | void set_tau(double tau); 67 | 68 | private: 69 | gr::filter::single_pole_iir_filter_cc::sptr d_iir; 70 | gr::blocks::sub_cc::sptr d_sub; 71 | 72 | double d_sr; /*!< Sample rate. */ 73 | double d_tau; /*!< Time constant. */ 74 | double d_alpha; /*!< 1/(1+tau/T). */ 75 | }; 76 | 77 | 78 | 79 | /*! \brief Return a shared_ptr to a new instance of iq_swap_cc. */ 80 | iq_swap_cc_sptr make_iq_swap_cc(bool enabled); 81 | 82 | /*! \brief Block to swap I and Q channels. 83 | * \ingroup DSP 84 | */ 85 | class iq_swap_cc : public gr::sync_block 86 | { 87 | friend iq_swap_cc_sptr make_iq_swap_cc(bool enabled); 88 | 89 | protected: 90 | iq_swap_cc(bool enabled); 91 | 92 | public: 93 | ~iq_swap_cc(); 94 | void set_enabled(bool enabled); 95 | int work(int noutput_items, 96 | gr_vector_const_void_star& input_items, 97 | gr_vector_void_star& output_items); 98 | 99 | private: 100 | bool d_enabled; 101 | }; 102 | 103 | #endif /* CORRECT_IQ_CC_H */ 104 | -------------------------------------------------------------------------------- /src/dsp/downconverter.cpp: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2020 Clayton Smith VE3IRR. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #include 24 | #include 25 | #include 26 | 27 | #include "downconverter.h" 28 | 29 | #define LPF_CUTOFF 120e3 30 | 31 | downconverter_cc_sptr make_downconverter_cc(unsigned int decim, double center_freq, double samp_rate) 32 | { 33 | return gnuradio::get_initial_sptr(new downconverter_cc(decim, center_freq, samp_rate)); 34 | } 35 | 36 | downconverter_cc::downconverter_cc(unsigned int decim, double center_freq, double samp_rate) 37 | : gr::hier_block2("downconverter_cc", 38 | gr::io_signature::make(1, 1, sizeof(gr_complex)), 39 | gr::io_signature::make(1, 1, sizeof(gr_complex))), 40 | d_decim(decim), 41 | d_center_freq(center_freq), 42 | d_samp_rate(samp_rate) 43 | { 44 | connect_all(); 45 | update_proto_taps(); 46 | update_phase_inc(); 47 | } 48 | 49 | downconverter_cc::~downconverter_cc() 50 | { 51 | 52 | } 53 | 54 | void downconverter_cc::set_decim_and_samp_rate(unsigned int decim, double samp_rate) 55 | { 56 | d_samp_rate = samp_rate; 57 | d_decim = decim; 58 | 59 | lock(); 60 | disconnect_all(); 61 | connect_all(); 62 | unlock(); 63 | 64 | update_proto_taps(); 65 | update_phase_inc(); 66 | } 67 | 68 | void downconverter_cc::set_center_freq(double center_freq) 69 | { 70 | d_center_freq = center_freq; 71 | update_phase_inc(); 72 | } 73 | 74 | void downconverter_cc::connect_all() 75 | { 76 | if (d_decim > 1) 77 | { 78 | filt = gr::filter::freq_xlating_fir_filter_ccf::make(d_decim, {1}, 0.0, d_samp_rate); 79 | connect(self(), 0, filt, 0); 80 | connect(filt, 0, self(), 0); 81 | } 82 | else 83 | { 84 | rot = gr::blocks::rotator_cc::make(0.0); 85 | connect(self(), 0, rot, 0); 86 | connect(rot, 0, self(), 0); 87 | } 88 | } 89 | 90 | void downconverter_cc::update_proto_taps() 91 | { 92 | if (d_decim > 1) 93 | { 94 | double out_rate = d_samp_rate / d_decim; 95 | filt->set_taps(gr::filter::firdes::low_pass(1.0, d_samp_rate, LPF_CUTOFF, out_rate - 2*LPF_CUTOFF, 96 | #if GNURADIO_VERSION < 0x030900 97 | gr::filter::firdes::WIN_BLACKMAN_HARRIS 98 | #else 99 | gr::fft::window::WIN_BLACKMAN_HARRIS 100 | #endif 101 | )); 102 | } 103 | } 104 | 105 | void downconverter_cc::update_phase_inc() 106 | { 107 | if (d_decim > 1) 108 | filt->set_center_freq(d_center_freq); 109 | else 110 | rot->set_phase_inc(-2.0 * M_PI * d_center_freq / d_samp_rate); 111 | } 112 | -------------------------------------------------------------------------------- /src/dsp/downconverter.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2020 Clayton Smith VE3IRR. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #pragma once 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | class downconverter_cc; 30 | 31 | #if GNURADIO_VERSION < 0x030900 32 | typedef boost::shared_ptr downconverter_cc_sptr; 33 | #else 34 | typedef std::shared_ptr downconverter_cc_sptr; 35 | #endif 36 | downconverter_cc_sptr make_downconverter_cc(unsigned int decim, double center_freq, double samp_rate); 37 | 38 | class downconverter_cc : public gr::hier_block2 39 | { 40 | friend downconverter_cc_sptr make_downconverter_cc(unsigned int decim, double center_freq, double samp_rate); 41 | 42 | public: 43 | downconverter_cc(unsigned int decim, double center_freq, double samp_rate); 44 | ~downconverter_cc(); 45 | void set_decim_and_samp_rate(unsigned int decim, double samp_rate); 46 | void set_center_freq(double center_freq); 47 | 48 | private: 49 | unsigned int d_decim; 50 | double d_center_freq; 51 | double d_samp_rate; 52 | std::vector d_proto_taps; 53 | 54 | void connect_all(); 55 | void update_proto_taps(); 56 | void update_phase_inc(); 57 | 58 | gr::filter::freq_xlating_fir_filter_ccf::sptr filt; 59 | gr::blocks::rotator_cc::sptr rot; 60 | }; 61 | -------------------------------------------------------------------------------- /src/dsp/filter/fir_decim.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2016 Alexandru Csete OZ9AEC. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #pragma once 24 | 25 | #include 26 | #include 27 | 28 | class fir_decim_cc; 29 | 30 | #if GNURADIO_VERSION < 0x030900 31 | typedef boost::shared_ptr fir_decim_cc_sptr; 32 | #else 33 | typedef std::shared_ptr fir_decim_cc_sptr; 34 | #endif 35 | fir_decim_cc_sptr make_fir_decim_cc(unsigned int decim); 36 | 37 | class fir_decim_cc : public gr::hier_block2 38 | { 39 | friend fir_decim_cc_sptr make_fir_decim_cc(unsigned int decim); 40 | 41 | //protected: 42 | public: 43 | fir_decim_cc(unsigned int decim); 44 | 45 | public: 46 | ~fir_decim_cc(); 47 | 48 | private: 49 | gr::filter::fir_filter_ccf::sptr fir1; 50 | gr::filter::fir_filter_ccf::sptr fir2; 51 | gr::filter::fir_filter_ccf::sptr fir3; 52 | }; 53 | -------------------------------------------------------------------------------- /src/dsp/fm_deemph.cpp: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2020 Clayton Smith VE3IRR. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include "dsp/fm_deemph.h" 28 | 29 | 30 | /* Create a new instance of fm_deemph and return a shared_ptr. */ 31 | fm_deemph_sptr make_fm_deemph(float quad_rate, double tau) 32 | { 33 | return gnuradio::get_initial_sptr(new fm_deemph(quad_rate, tau)); 34 | } 35 | 36 | static const int MIN_IN = 1; /* Minimum number of input streams. */ 37 | static const int MAX_IN = 1; /* Maximum number of input streams. */ 38 | static const int MIN_OUT = 1; /* Minimum number of output streams. */ 39 | static const int MAX_OUT = 1; /* Maximum number of output streams. */ 40 | 41 | fm_deemph::fm_deemph(float quad_rate, double tau) 42 | : gr::hier_block2 ("fm_deemph", 43 | gr::io_signature::make (MIN_IN, MAX_IN, sizeof (float)), 44 | gr::io_signature::make (MIN_OUT, MAX_OUT, sizeof (float))), 45 | d_quad_rate(quad_rate) 46 | { 47 | /* de-emphasis */ 48 | d_fftaps.resize(2); 49 | d_fbtaps.resize(2); 50 | calculate_iir_taps(tau); 51 | d_deemph = gr::filter::iir_filter_ffd::make(d_fftaps, d_fbtaps, false); 52 | 53 | connect(self(), 0, d_deemph, 0); 54 | connect(d_deemph, 0, self(), 0); 55 | } 56 | 57 | fm_deemph::~fm_deemph () 58 | { 59 | } 60 | 61 | /*! \brief Set FM de-emphasis time constant. 62 | * \param tau The new time constant. 63 | */ 64 | void fm_deemph::set_tau(double tau) 65 | { 66 | calculate_iir_taps(tau); 67 | d_deemph->set_taps(d_fftaps, d_fbtaps); 68 | } 69 | 70 | /*! \brief Calculate taps for FM de-emph IIR filter. */ 71 | void fm_deemph::calculate_iir_taps(double tau) 72 | { 73 | if (tau > 1.0e-9) 74 | { 75 | // copied from fm_emph.py in gr-analog 76 | double w_c; // Digital corner frequency 77 | double w_ca; // Prewarped analog corner frequency 78 | double k, z1, p1, b0; 79 | double fs = (double)d_quad_rate; 80 | 81 | w_c = 1.0 / tau; 82 | w_ca = 2.0 * fs * tan(w_c / (2.0 * fs)); 83 | 84 | // Resulting digital pole, zero, and gain term from the bilinear 85 | // transformation of H(s) = w_ca / (s + w_ca) to 86 | // H(z) = b0 (1 - z1 z^-1)/(1 - p1 z^-1) 87 | k = -w_ca / (2.0 * fs); 88 | z1 = -1.0; 89 | p1 = (1.0 + k) / (1.0 - k); 90 | b0 = -k / (1.0 - k); 91 | 92 | d_fftaps[0] = b0; 93 | d_fftaps[1] = -z1 * b0; 94 | d_fbtaps[0] = 1.0; 95 | d_fbtaps[1] = -p1; 96 | } 97 | else 98 | { 99 | d_fftaps[0] = 1.0; 100 | d_fftaps[1] = 0.0; 101 | d_fbtaps[0] = 0.0; 102 | d_fbtaps[1] = 0.0; 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /src/dsp/fm_deemph.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2020 Clayton Smith VE3IRR. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #pragma once 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | class fm_deemph; 30 | #if GNURADIO_VERSION < 0x030900 31 | typedef boost::shared_ptr fm_deemph_sptr; 32 | #else 33 | typedef std::shared_ptr fm_deemph_sptr; 34 | #endif 35 | 36 | /*! \brief Return a shared_ptr to a new instance of fm_deemph. 37 | * \param quad_rate The input sample rate. 38 | * \param tau De-emphasis time constant in seconds (75us in US, 50us in EUR, 0.0 disables). 39 | * 40 | * This is effectively the public constructor. To avoid accidental use 41 | * of raw pointers, fm_deemph's constructor is private. 42 | * make_rx_dmod_fm is the public interface for creating new instances. 43 | */ 44 | fm_deemph_sptr make_fm_deemph(float quad_rate, double tau=50.0e-6); 45 | 46 | /*! \brief FM demodulator. 47 | * \ingroup DSP 48 | * 49 | * This class implements the FM demodulator using the gr_quadrature_demod block. 50 | * It also provides de-emphasis with variable time constant (use 0.0 to disable). 51 | * 52 | */ 53 | class fm_deemph : public gr::hier_block2 54 | { 55 | 56 | public: 57 | fm_deemph(float quad_rate, double tau); // FIXME: should be private 58 | ~fm_deemph(); 59 | 60 | void set_tau(double tau); 61 | 62 | private: 63 | /* GR blocks */ 64 | gr::filter::iir_filter_ffd::sptr d_deemph; /*! De-emphasis IIR filter. */ 65 | 66 | /* other parameters */ 67 | float d_quad_rate; /*! Quadrature rate. */ 68 | 69 | /* De-emph IIR filter taps */ 70 | std::vector d_fftaps; /*! Feed forward taps. */ 71 | std::vector d_fbtaps; /*! Feed back taps. */ 72 | 73 | void calculate_iir_taps(double tau); 74 | 75 | }; 76 | -------------------------------------------------------------------------------- /src/dsp/lpf.cpp: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2012 Alexandru Csete OZ9AEC. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #include 24 | #include 25 | #include 26 | #include "dsp/lpf.h" 27 | 28 | static const int MIN_IN = 1; /* Minimum number of input streams. */ 29 | static const int MAX_IN = 1; /* Maximum number of input streams. */ 30 | static const int MIN_OUT = 1; /* Minimum number of output streams. */ 31 | static const int MAX_OUT = 1; /* Maximum number of output streams. */ 32 | 33 | 34 | /* 35 | * Create a new instance of lpf_ff and return 36 | * a shared_ptr. This is effectively the public constructor. 37 | */ 38 | lpf_ff_sptr make_lpf_ff(double sample_rate, double cutoff_freq, 39 | double trans_width, double gain) 40 | { 41 | return gnuradio::get_initial_sptr(new lpf_ff(sample_rate, cutoff_freq, 42 | trans_width, gain)); 43 | } 44 | 45 | 46 | lpf_ff::lpf_ff(double sample_rate, double cutoff_freq, 47 | double trans_width, double gain) 48 | : gr::hier_block2("lpf_ff", 49 | gr::io_signature::make(MIN_IN, MAX_IN, sizeof (float)), 50 | gr::io_signature::make(MIN_OUT, MAX_OUT, sizeof (float))), 51 | d_sample_rate(sample_rate), 52 | d_cutoff_freq(cutoff_freq), 53 | d_trans_width(trans_width), 54 | d_gain(gain) 55 | { 56 | /* generate taps */ 57 | d_taps = gr::filter::firdes::low_pass(d_gain, d_sample_rate, 58 | d_cutoff_freq, d_trans_width); 59 | 60 | /* create low-pass filter (decimation=1) */ 61 | lpf = gr::filter::fir_filter_fff::make(1, d_taps); 62 | 63 | /* connect filter */ 64 | connect(self(), 0, lpf, 0); 65 | connect(lpf, 0, self(), 0); 66 | } 67 | 68 | 69 | lpf_ff::~lpf_ff() 70 | { 71 | 72 | } 73 | 74 | 75 | void lpf_ff::set_param(double cutoff_freq, double trans_width) 76 | { 77 | d_cutoff_freq = cutoff_freq; 78 | d_trans_width = trans_width; 79 | 80 | /* generate new taps */ 81 | d_taps = gr::filter::firdes::low_pass(d_gain, d_sample_rate, 82 | d_cutoff_freq, d_trans_width); 83 | 84 | lpf->set_taps(d_taps); 85 | } 86 | -------------------------------------------------------------------------------- /src/dsp/lpf.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2012 Alexandru Csete OZ9AEC. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #ifndef LPF_H 24 | #define LPF_H 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | 31 | class lpf_ff; 32 | 33 | #if GNURADIO_VERSION < 0x030900 34 | typedef boost::shared_ptr lpf_ff_sptr; 35 | #else 36 | typedef std::shared_ptr lpf_ff_sptr; 37 | #endif 38 | 39 | 40 | /*! \brief Return a shared_ptr to a new instance of lpf. 41 | * \param sample_rate The sample rate (Hz). 42 | * \param cutoff_freq Center of transition band (Hz). 43 | * \param transition_width Width of transition band (Hz). 44 | * \param . 45 | * \param gain Overall gain of filter (typically 1.0). 46 | * 47 | * This is effectively the public constructor. To avoid accidental use 48 | * of raw pointers, lpf's constructor is private. 49 | * make_lpf is the public interface for creating new instances. 50 | */ 51 | lpf_ff_sptr make_lpf_ff(double sample_rate=48000., 52 | double cutoff_freq=5000., 53 | double trans_width=1000., 54 | double gain=1.0); 55 | 56 | /*! \brief low-pass filter (LPF) with float taps. 57 | * \ingroup DSP 58 | * 59 | * This class encapsulates a low-pass FIR filter and the code 60 | * required to generate filter taps. It provides a simple 61 | * interface to set the filter parameters. 62 | * 63 | * The user of this class is expected to provide valid parameters and no checks are 64 | * performed by the accessors (though the taps generator from gr::filter::firdes does perform 65 | * some sanity checks and throws std::out_of_range in case of bad parameter). 66 | */ 67 | class lpf_ff : public gr::hier_block2 68 | { 69 | friend lpf_ff_sptr make_lpf_ff(double sample_rate, double cutoff_freq, 70 | double trans_width, double gain); 71 | protected: 72 | lpf_ff(double sample_rate, double cutoff_freq, 73 | double trans_width, double gain); 74 | 75 | public: 76 | ~lpf_ff(); 77 | 78 | void set_param(double cutoff_freq, double trans_width); 79 | 80 | private: 81 | /* GR blocks */ 82 | gr::filter::fir_filter_fff::sptr lpf; 83 | 84 | /* other parameters */ 85 | std::vector d_taps; 86 | double d_sample_rate; 87 | double d_cutoff_freq; 88 | double d_trans_width; 89 | double d_gain; 90 | }; 91 | 92 | 93 | #endif // LPF_H 94 | -------------------------------------------------------------------------------- /src/dsp/rds/api.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Bastian Bloessl 3 | * 4 | * This file was generated by gr_modtool, a tool from the GNU Radio framework 5 | * This file is a part of gr-rds 6 | * 7 | * SPDX-License-Identifier: GPL-3.0-or-later 8 | * 9 | */ 10 | 11 | #ifndef INCLUDED_RDS_API_H 12 | #define INCLUDED_RDS_API_H 13 | 14 | #include 15 | 16 | #ifdef gnuradio_rds_EXPORTS 17 | #define RDS_API __GR_ATTR_EXPORT 18 | #else 19 | #define RDS_API __GR_ATTR_IMPORT 20 | #endif 21 | 22 | #endif /* INCLUDED_RDS_API_H */ 23 | -------------------------------------------------------------------------------- /src/dsp/rds/decoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 Bastian Bloessl 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifndef INCLUDED_RDS_DECODER_H 18 | #define INCLUDED_RDS_DECODER_H 19 | 20 | #include "dsp/rds/api.h" 21 | #include 22 | 23 | namespace gr { 24 | namespace rds { 25 | 26 | class RDS_API decoder : virtual public gr::sync_block 27 | { 28 | public: 29 | #if GNURADIO_VERSION < 0x030900 30 | typedef boost::shared_ptr sptr; 31 | #else 32 | typedef std::shared_ptr sptr; 33 | #endif 34 | static sptr make(bool log, bool debug); 35 | }; 36 | 37 | } // namespace rds 38 | } // namespace gr 39 | 40 | #endif /* INCLUDED_RDS_DECODER_H */ 41 | -------------------------------------------------------------------------------- /src/dsp/rds/decoder_impl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 Bastian Bloessl 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifndef INCLUDED_RDS_DECODER_IMPL_H 18 | #define INCLUDED_RDS_DECODER_IMPL_H 19 | 20 | #include "dsp/rds/decoder.h" 21 | 22 | namespace gr { 23 | namespace rds { 24 | 25 | class decoder_impl : public decoder 26 | { 27 | public: 28 | decoder_impl(bool log, bool debug); 29 | 30 | private: 31 | ~decoder_impl(); 32 | 33 | int work(int noutput_items, 34 | gr_vector_const_void_star &input_items, 35 | gr_vector_void_star &output_items); 36 | 37 | void enter_no_sync(); 38 | void enter_sync(unsigned int); 39 | unsigned int calc_syndrome(unsigned long, unsigned char); 40 | void decode_group(unsigned int*); 41 | 42 | unsigned long bit_counter; 43 | unsigned long lastseen_offset_counter, reg; 44 | unsigned int block_bit_counter; 45 | unsigned int wrong_blocks_counter; 46 | unsigned int blocks_counter; 47 | unsigned int group_good_blocks_counter; 48 | unsigned int group[4]; 49 | unsigned char offset_chars[4]; // [ABCcDx] (x=error) 50 | bool log; 51 | bool debug; 52 | bool presync; 53 | bool good_block; 54 | bool group_assembly_started; 55 | unsigned char lastseen_offset; 56 | unsigned char block_number; 57 | enum { NO_SYNC, SYNC } d_state; 58 | 59 | }; 60 | 61 | } /* namespace rds */ 62 | } /* namespace gr */ 63 | 64 | #endif /* INCLUDED_RDS_DECODER_IMPL_H */ 65 | -------------------------------------------------------------------------------- /src/dsp/rds/parser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 Bastian Bloessl 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifndef INCLUDED_RDS_PARSER_H 18 | #define INCLUDED_RDS_PARSER_H 19 | 20 | #include "dsp/rds/api.h" 21 | #include 22 | 23 | namespace gr { 24 | namespace rds { 25 | 26 | class RDS_API parser : virtual public gr::block 27 | { 28 | public: 29 | #if GNURADIO_VERSION < 0x030900 30 | typedef boost::shared_ptr sptr; 31 | #else 32 | typedef std::shared_ptr sptr; 33 | #endif 34 | static sptr make(bool log, bool debug, unsigned char pty_locale); 35 | 36 | virtual void reset() = 0; 37 | }; 38 | 39 | } // namespace rds 40 | } // namespace gr 41 | 42 | #endif /* INCLUDED_RDS_PARSER_H */ 43 | 44 | -------------------------------------------------------------------------------- /src/dsp/rds/parser_impl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 Bastian Bloessl 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifndef INCLUDED_RDS_PARSER_IMPL_H 18 | #define INCLUDED_RDS_PARSER_IMPL_H 19 | 20 | #include "dsp/rds/parser.h" 21 | #include 22 | 23 | namespace gr { 24 | namespace rds { 25 | 26 | class parser_impl : public parser 27 | { 28 | public: 29 | parser_impl(bool log, bool debug, unsigned char pty_locale); 30 | 31 | private: 32 | ~parser_impl(); 33 | 34 | void reset(); 35 | void send_message(long, std::string); 36 | void parse(pmt::pmt_t pdu); 37 | void decode_af_pairs(); 38 | int decode_af(unsigned int af_code, bool lf_mf); 39 | void decode_optional_content(int, unsigned long int *); 40 | 41 | void decode_type0( unsigned int* group, bool B); 42 | void decode_type1( unsigned int* group, bool B); 43 | void decode_type2( unsigned int* group, bool B); 44 | void decode_type3( unsigned int* group, bool B); 45 | void decode_type4( unsigned int* group, bool B); 46 | void decode_type5( unsigned int* group, bool B); 47 | void decode_type6( unsigned int* group, bool B); 48 | void decode_type7( unsigned int* group, bool B); 49 | void decode_type8( unsigned int* group, bool B); 50 | void decode_type9( unsigned int* group, bool B); 51 | void decode_type10(unsigned int* group, bool B); 52 | void decode_type11(unsigned int* group, bool B); 53 | void decode_type12(unsigned int* group, bool B); 54 | void decode_type13(unsigned int* group, bool B); 55 | void decode_type14(unsigned int* group, bool B); 56 | void decode_type15(unsigned int* group, bool B); 57 | 58 | unsigned int program_identification; 59 | unsigned char program_type; 60 | unsigned char pi_country_identification; 61 | unsigned char pi_area_coverage; 62 | unsigned char pi_program_reference_number; 63 | char radiotext[64]; 64 | unsigned int radiotext_segment_flags; 65 | char program_service_name[8]; 66 | unsigned int program_service_name_segment_flags; 67 | bool radiotext_AB_flag; 68 | std::vector af_pairs; 69 | bool traffic_program; 70 | bool traffic_announcement; 71 | bool music_speech; 72 | bool mono_stereo; 73 | bool artificial_head; 74 | bool compressed; 75 | bool dynamic_pty; 76 | bool log; 77 | bool debug; 78 | unsigned char pty_locale; 79 | unsigned long int free_format[4]; 80 | int no_groups; 81 | char ps_on[8]; 82 | gr::thread::mutex d_mutex; 83 | }; 84 | 85 | } /* namespace rds */ 86 | } /* namespace gr */ 87 | 88 | #endif /* INCLUDED_RDS_PARSER_IMPL_H */ 89 | -------------------------------------------------------------------------------- /src/dsp/resampler_xx.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2011-2012 Alexandru Csete OZ9AEC. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #ifndef RESAMPLER_XX_H 24 | #define RESAMPLER_XX_H 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | 31 | class resampler_cc; 32 | class resampler_ff; 33 | 34 | #if GNURADIO_VERSION < 0x030900 35 | typedef boost::shared_ptr resampler_cc_sptr; 36 | typedef boost::shared_ptr resampler_ff_sptr; 37 | #else 38 | typedef std::shared_ptr resampler_cc_sptr; 39 | typedef std::shared_ptr resampler_ff_sptr; 40 | #endif 41 | 42 | 43 | /*! \brief Return a shared_ptr to a new instance of resampler_cc. 44 | * \param rate Resampling rate, i.e. output/input. 45 | * 46 | * This is effectively the public constructor. 47 | */ 48 | resampler_cc_sptr make_resampler_cc(float rate); 49 | 50 | /*! \brief Arbitrary rate resampler based on gr_pfb_arb_resampler_ccf 51 | * \ingroup DSP 52 | * 53 | * This block is a convenience wrapper around gr_pfb_arb_resampler_ccf. It takes care 54 | * of generating filter taps that can be used for the filter, as well as calculating 55 | * the other required parameters. 56 | */ 57 | class resampler_cc : public gr::hier_block2 58 | { 59 | 60 | public: 61 | resampler_cc(float rate); // FIXME: should be private 62 | ~resampler_cc(); 63 | 64 | void set_rate(float rate); 65 | 66 | private: 67 | std::vector d_taps; 68 | gr::filter::pfb_arb_resampler_ccf::sptr d_filter; 69 | }; 70 | 71 | 72 | /*! \brief Return a shared_ptr to a new instance of resampler_ff. 73 | * \param rate Resampling rate, i.e. output/input. 74 | * 75 | * This is effectively the public constructor. 76 | */ 77 | resampler_ff_sptr make_resampler_ff(float rate); 78 | 79 | 80 | /*! \brief Arbitrary rate resampler based on gr_pfb_arb_resampler_fff 81 | * \ingroup DSP 82 | * 83 | * This block is a convenience wrapper around gr_pfb_arb_resampler_fff. It takes care 84 | * of generating filter taps that can be used for the filter, as well as calculating 85 | * the other required parameters. 86 | */ 87 | class resampler_ff : public gr::hier_block2 88 | { 89 | 90 | public: 91 | resampler_ff(float rate); // FIXME: should be private 92 | ~resampler_ff(); 93 | 94 | void set_rate(float rate); 95 | 96 | private: 97 | std::vector d_taps; 98 | gr::filter::pfb_arb_resampler_fff::sptr d_filter; 99 | }; 100 | 101 | #endif // RESAMPLER_XX_H 102 | -------------------------------------------------------------------------------- /src/dsp/rx_agc_xx.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2011 Alexandru Csete OZ9AEC. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #ifndef RX_AGC_XX_H 24 | #define RX_AGC_XX_H 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | class rx_agc_cc; 32 | 33 | #if GNURADIO_VERSION < 0x030900 34 | typedef boost::shared_ptr rx_agc_cc_sptr; 35 | #else 36 | typedef std::shared_ptr rx_agc_cc_sptr; 37 | #endif 38 | 39 | 40 | /** 41 | * \brief Return a shared_ptr to a new instance of rx_agc_cc. 42 | * \param sample_rate The sample rate (default = 96000). 43 | * \param agc_on Whether AGC should be ON (default = true). 44 | * \param threshold AGC Knee in dB if AGC is active. Range -160 to 0 dB. 45 | * \param manual_gain Manual gain when AGC is OFF. Range 0 to 100 dB. 46 | * \param slope AGC slope factor. Specifies dB reduction in output at 47 | * knee from maximum output level. Range 0 to 10 dB 48 | * \param decay AGC decay time in milliseconds. Range 20 to 5000. This 49 | * parameter determines whether AGC is fast, slow or medium. 50 | * \param use_hang Whether AGC should "hang" before starting to decay. 51 | * 52 | * This is effectively the public constructor for a new AGC block. 53 | * To avoid accidental use of raw pointers, the rx_agc_cc constructor is private. 54 | * make_rx_agc_cc is the public interface for creating new instances. 55 | */ 56 | rx_agc_cc_sptr make_rx_agc_cc(double sample_rate, bool agc_on, int threshold, 57 | int manual_gain, int slope, int decay, 58 | bool use_hang); 59 | 60 | /** 61 | * \brief Experimental AGC block for analog voice modes (AM, SSB, CW). 62 | * \ingroup DSP 63 | * 64 | * This block performs automatic gain control. 65 | * To be written... 66 | */ 67 | class rx_agc_cc : public gr::sync_block 68 | { 69 | friend rx_agc_cc_sptr make_rx_agc_cc(double sample_rate, bool agc_on, 70 | int threshold, int manual_gain, 71 | int slope, int decay, bool use_hang); 72 | 73 | protected: 74 | rx_agc_cc(double sample_rate, bool agc_on, int threshold, int manual_gain, 75 | int slope, int decay, bool use_hang); 76 | 77 | public: 78 | ~rx_agc_cc(); 79 | 80 | int work(int noutput_items, 81 | gr_vector_const_void_star &input_items, 82 | gr_vector_void_star &output_items); 83 | 84 | void set_agc_on(bool agc_on); 85 | void set_sample_rate(double sample_rate); 86 | void set_threshold(int threshold); 87 | void set_manual_gain(int gain); 88 | void set_slope(int slope); 89 | void set_decay(int decay); 90 | void set_use_hang(bool use_hang); 91 | 92 | private: 93 | CAgc *d_agc; 94 | std::mutex d_mutex; /*! Used to lock internal data while processing or setting parameters. */ 95 | 96 | bool d_agc_on; /*! Current AGC status (true/false). */ 97 | double d_sample_rate; /*! Current sample rate. */ 98 | int d_threshold; /*! Current AGC threshold (-160...0 dB). */ 99 | int d_manual_gain; /*! Current gain when AGC is OFF. */ 100 | int d_slope; /*! Current AGC slope (0...10 dB). */ 101 | int d_decay; /*! Current AGC decay (20...5000 ms). */ 102 | bool d_use_hang; /*! Current AGC hang status (true/false). */ 103 | }; 104 | 105 | #endif /* RX_AGC_XX_H */ 106 | -------------------------------------------------------------------------------- /src/dsp/rx_demod_am.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2011 Alexandru Csete OZ9AEC. 7 | * Copyright 2013 Vesa Solonen OH2JCP. 8 | * 9 | * Gqrx is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 3, or (at your option) 12 | * any later version. 13 | * 14 | * Gqrx is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with Gqrx; see the file COPYING. If not, write to 21 | * the Free Software Foundation, Inc., 51 Franklin Street, 22 | * Boston, MA 02110-1301, USA. 23 | */ 24 | #ifndef RX_DEMOD_AM_H 25 | #define RX_DEMOD_AM_H 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | class rx_demod_am; 35 | class rx_demod_amsync; 36 | 37 | #if GNURADIO_VERSION < 0x030900 38 | typedef boost::shared_ptr rx_demod_am_sptr; 39 | typedef boost::shared_ptr rx_demod_amsync_sptr; 40 | #else 41 | typedef std::shared_ptr rx_demod_am_sptr; 42 | typedef std::shared_ptr rx_demod_amsync_sptr; 43 | #endif 44 | 45 | /*! \brief Return a shared_ptr to a new instance of rx_demod_am. 46 | * \param quad_rate The input sample rate. 47 | * \param dcr Enable DCR 48 | * 49 | * This is effectively the public constructor. 50 | */ 51 | rx_demod_am_sptr make_rx_demod_am(float quad_rate, bool dcr=true); 52 | 53 | /*! \brief AM demodulator. 54 | * \ingroup DSP 55 | * 56 | * This class implements the AM demodulator as envelope detector. 57 | * AM demodulation is simply a conversion from complex to magnitude. 58 | * This block implements an optional IIR DC-removal filter for the demodulated signal. 59 | * 60 | */ 61 | class rx_demod_am : public gr::hier_block2 62 | { 63 | 64 | public: 65 | rx_demod_am(float quad_rate, bool dcr=true); // FIXME: could be private 66 | ~rx_demod_am(); 67 | 68 | void set_dcr(bool dcr); 69 | 70 | private: 71 | /* GR blocks */ 72 | gr::blocks::complex_to_mag::sptr d_demod; /*! AM demodulation (complex to magnitude). */ 73 | gr::filter::iir_filter_ffd::sptr d_dcr; /*! DC removal (IIR high pass). */ 74 | 75 | /* other parameters */ 76 | bool d_dcr_enabled; /*! DC removal flag. */ 77 | 78 | /* IIR DC-removal filter taps */ 79 | std::vector d_fftaps; /*! Feed forward taps. */ 80 | std::vector d_fbtaps; /*! Feed back taps. */ 81 | 82 | }; 83 | 84 | 85 | /*! \brief Return a shared_ptr to a new instance of rx_demod_amsync. 86 | * \param quad_rate The input sample rate. 87 | * \param dcr Enable DCR 88 | * \param pll_bw The new PLL BW. 89 | * 90 | * This is effectively the public constructor. 91 | */ 92 | rx_demod_amsync_sptr make_rx_demod_amsync(float quad_rate, bool dcr=true, float pll_bw=0.001); 93 | 94 | 95 | /*! \brief Synchronous AM demodulator. 96 | * \ingroup DSP 97 | * 98 | * This class implements a synchronous AM demodulator. 99 | * A PLL tracks the carrier frequency and is mixed with the signal, shifting it to 100 | * 0 Hz. 101 | * This block implements an optional IIR DC-removal filter for the demodulated signal. 102 | * 103 | */ 104 | class rx_demod_amsync : public gr::hier_block2 105 | { 106 | 107 | public: 108 | rx_demod_amsync(float quad_rate, bool dcr=true, float pll_bw=0.001); // FIXME: could be private 109 | ~rx_demod_amsync(); 110 | 111 | void set_dcr(bool dcr); 112 | void set_pll_bw(float pll_bw); 113 | 114 | private: 115 | /* GR blocks */ 116 | gr::analog::pll_carriertracking_cc::sptr d_demod1; 117 | gr::blocks::complex_to_real::sptr d_demod2; 118 | gr::filter::iir_filter_ffd::sptr d_dcr; /*! DC removal (IIR high pass). */ 119 | 120 | /* other parameters */ 121 | bool d_dcr_enabled; /*! DC removal flag. */ 122 | 123 | /* IIR DC-removal filter taps */ 124 | std::vector d_fftaps; /*! Feed forward taps. */ 125 | std::vector d_fbtaps; /*! Feed back taps. */ 126 | 127 | }; 128 | 129 | #endif // RX_DEMOD_AM_H 130 | -------------------------------------------------------------------------------- /src/dsp/rx_demod_fm.cpp: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2011 Alexandru Csete OZ9AEC. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #include "dsp/rx_demod_fm.h" 30 | 31 | 32 | /* Create a new instance of rx_demod_fm and return a shared_ptr. */ 33 | rx_demod_fm_sptr make_rx_demod_fm(float quad_rate, float max_dev, double tau) 34 | { 35 | return gnuradio::get_initial_sptr(new rx_demod_fm(quad_rate, max_dev, tau)); 36 | } 37 | 38 | static const int MIN_IN = 1; /* Minimum number of input streams. */ 39 | static const int MAX_IN = 1; /* Maximum number of input streams. */ 40 | static const int MIN_OUT = 1; /* Minimum number of output streams. */ 41 | static const int MAX_OUT = 1; /* Maximum number of output streams. */ 42 | 43 | rx_demod_fm::rx_demod_fm(float quad_rate, float max_dev, double tau) 44 | : gr::hier_block2 ("rx_demod_fm", 45 | gr::io_signature::make (MIN_IN, MAX_IN, sizeof (gr_complex)), 46 | gr::io_signature::make (MIN_OUT, MAX_OUT, sizeof (float))), 47 | d_quad_rate(quad_rate), 48 | d_max_dev(max_dev) 49 | { 50 | float gain; 51 | 52 | /* demodulator gain */ 53 | gain = d_quad_rate / (2 * (float)M_PI * d_max_dev); 54 | 55 | qDebug() << "FM demod gain:" << gain; 56 | 57 | /* demodulator */ 58 | d_quad = gr::analog::quadrature_demod_cf::make(gain); 59 | 60 | /* de-emphasis */ 61 | d_deemph = make_fm_deemph(d_quad_rate, tau); 62 | 63 | /* connect block */ 64 | connect(self(), 0, d_quad, 0); 65 | connect(d_quad, 0, d_deemph, 0); 66 | connect(d_deemph, 0, self(), 0); 67 | 68 | } 69 | 70 | rx_demod_fm::~rx_demod_fm () 71 | { 72 | } 73 | 74 | /*! \brief Set maximum FM deviation. 75 | * \param max_dev The new mximum deviation in Hz 76 | * 77 | * The maximum deviation is related to the gain of the 78 | * quadrature demodulator by: 79 | * 80 | * gain = quad_rate / (2 * PI * max_dev) 81 | */ 82 | void rx_demod_fm::set_max_dev(float max_dev) 83 | { 84 | float gain; 85 | 86 | if ((max_dev < 500.0f) || (max_dev > d_quad_rate/2.0f)) 87 | { 88 | return; 89 | } 90 | 91 | d_max_dev = max_dev; 92 | 93 | gain = d_quad_rate / (2 * (float)M_PI * max_dev); 94 | d_quad->set_gain(gain); 95 | } 96 | 97 | /*! \brief Set FM de-emphasis time constant. 98 | * \param tau The new time constant. 99 | */ 100 | void rx_demod_fm::set_tau(double tau) 101 | { 102 | d_deemph->set_tau(tau); 103 | } 104 | -------------------------------------------------------------------------------- /src/dsp/rx_demod_fm.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2011 Alexandru Csete OZ9AEC. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #pragma once 24 | 25 | #include 26 | #include 27 | #include 28 | #include "dsp/fm_deemph.h" 29 | 30 | class rx_demod_fm; 31 | #if GNURADIO_VERSION < 0x030900 32 | typedef boost::shared_ptr rx_demod_fm_sptr; 33 | #else 34 | typedef std::shared_ptr rx_demod_fm_sptr; 35 | #endif 36 | 37 | /*! \brief Return a shared_ptr to a new instance of rx_demod_fm. 38 | * \param quad_rate The input sample rate. 39 | * \param max_dev Maximum deviation in Hz 40 | * \param tau De-emphasis time constant in seconds (75us in US, 50us in EUR, 0.0 disables). 41 | * 42 | * This is effectively the public constructor. To avoid accidental use 43 | * of raw pointers, rx_demod_fm's constructor is private. 44 | * make_rx_dmod_fm is the public interface for creating new instances. 45 | */ 46 | rx_demod_fm_sptr make_rx_demod_fm(float quad_rate, float max_dev=5000.0, double tau=50.0e-6); 47 | 48 | /*! \brief FM demodulator. 49 | * \ingroup DSP 50 | * 51 | * This class implements the FM demodulator using the gr_quadrature_demod block. 52 | * It also provides de-emphasis with variable time constant (use 0.0 to disable). 53 | * 54 | */ 55 | class rx_demod_fm : public gr::hier_block2 56 | { 57 | 58 | public: 59 | rx_demod_fm(float quad_rate, float max_dev, double tau); // FIXME: should be private 60 | ~rx_demod_fm(); 61 | 62 | void set_max_dev(float max_dev); 63 | void set_tau(double tau); 64 | 65 | private: 66 | /* GR blocks */ 67 | gr::analog::quadrature_demod_cf::sptr d_quad; /*! The quadrature demodulator block. */ 68 | fm_deemph_sptr d_deemph; /*! De-emphasis IIR filter. */ 69 | std::vector d_taps; /*! Taps for the PFB resampler. */ 70 | 71 | /* other parameters */ 72 | float d_quad_rate; /*! Quadrature rate. */ 73 | float d_max_dev; /*! Max deviation. */ 74 | }; 75 | -------------------------------------------------------------------------------- /src/dsp/rx_meter.cpp: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2011 Alexandru Csete OZ9AEC. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | 30 | rx_meter_c_sptr make_rx_meter_c(double quad_rate) 31 | { 32 | return gnuradio::get_initial_sptr(new rx_meter_c(quad_rate)); 33 | } 34 | 35 | rx_meter_c::rx_meter_c(double quad_rate) 36 | : gr::sync_block ("rx_meter_c", 37 | gr::io_signature::make(1, 1, sizeof(gr_complex)), 38 | gr::io_signature::make(0, 0, 0)), 39 | d_quadrate(quad_rate), 40 | d_avgsize(quad_rate * 0.100) 41 | { 42 | /* allocate circular buffer */ 43 | #if GNURADIO_VERSION < 0x031000 44 | d_writer = gr::make_buffer(d_avgsize + d_quadrate, sizeof(gr_complex)); 45 | #else 46 | d_writer = gr::make_buffer(d_avgsize + d_quadrate, sizeof(gr_complex), 1, 1); 47 | #endif 48 | d_reader = gr::buffer_add_reader(d_writer, 0); 49 | 50 | d_lasttime = std::chrono::steady_clock::now(); 51 | } 52 | 53 | rx_meter_c::~rx_meter_c() 54 | { 55 | } 56 | 57 | 58 | int rx_meter_c::work(int noutput_items, 59 | gr_vector_const_void_star &input_items, 60 | gr_vector_void_star &output_items) 61 | { 62 | std::lock_guard lock(d_mutex); 63 | 64 | const gr_complex *in = (const gr_complex *) input_items[0]; 65 | (void) output_items; // unused 66 | 67 | int items_to_copy = std::min(noutput_items, (int)d_writer->bufsize()); 68 | if (items_to_copy < noutput_items) 69 | in += (noutput_items - items_to_copy); 70 | 71 | if (d_writer->space_available() < items_to_copy) 72 | d_reader->update_read_pointer(items_to_copy - d_writer->space_available()); 73 | memcpy(d_writer->write_pointer(), in, sizeof(gr_complex) * items_to_copy); 74 | d_writer->update_write_pointer(items_to_copy); 75 | 76 | return noutput_items; 77 | } 78 | 79 | 80 | float rx_meter_c::get_level_db() 81 | { 82 | std::lock_guard lock(d_mutex); 83 | 84 | if ((unsigned int)d_reader->items_available() < d_avgsize) 85 | return 0; 86 | 87 | std::chrono::time_point now = std::chrono::steady_clock::now(); 88 | std::chrono::duration diff = now - d_lasttime; 89 | d_lasttime = now; 90 | 91 | d_reader->update_read_pointer(std::min((unsigned int)(diff.count() * d_quadrate * 1.001), (unsigned int)d_reader->items_available() - d_avgsize)); 92 | float sum = 0; 93 | volk_32f_x2_dot_prod_32f(&sum, (float *)d_reader->read_pointer(), (float *)d_reader->read_pointer(), d_avgsize * 2); 94 | float power = sum / (float)(d_avgsize); 95 | return 10.f * log10f(power + 1.0e-20f); 96 | } 97 | -------------------------------------------------------------------------------- /src/dsp/rx_meter.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2011 Alexandru Csete OZ9AEC. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #ifndef RX_METER_H 24 | #define RX_METER_H 25 | 26 | #include 27 | #include 28 | #if GNURADIO_VERSION >= 0x031000 29 | #include 30 | #endif 31 | #include 32 | #include 33 | 34 | 35 | class rx_meter_c; 36 | 37 | #if GNURADIO_VERSION < 0x030900 38 | typedef boost::shared_ptr rx_meter_c_sptr; 39 | #else 40 | typedef std::shared_ptr rx_meter_c_sptr; 41 | #endif 42 | 43 | 44 | /*! \brief Return a shared_ptr to a new instance of rx_meter_c. 45 | * 46 | * This is effectively the public constructor. To avoid accidental use 47 | * of raw pointers, the rx_meter_c constructor is private. 48 | * make_rxfilter is the public interface for creating new instances. 49 | */ 50 | rx_meter_c_sptr make_rx_meter_c(double quad_rate); 51 | 52 | 53 | /*! \brief Block for measuring signal strength (complex input). 54 | * \ingroup DSP 55 | * 56 | * This block can be used to measure the received signal strength. 57 | * The get_level_db() method returns the average signal power 58 | * over a 100ms period. 59 | */ 60 | class rx_meter_c : public gr::sync_block 61 | { 62 | friend rx_meter_c_sptr make_rx_meter_c(double quad_rate); 63 | 64 | protected: 65 | rx_meter_c(double quad_rate); 66 | 67 | public: 68 | ~rx_meter_c(); 69 | 70 | int work(int noutput_items, 71 | gr_vector_const_void_star &input_items, 72 | gr_vector_void_star &output_items); 73 | 74 | /*! \brief Get the current signal level in dBFS. */ 75 | float get_level_db(); 76 | 77 | private: 78 | double d_quadrate; 79 | unsigned int d_avgsize; /*! Number of samples to average. */ 80 | 81 | gr::buffer_sptr d_writer; /*! buffer to accumulate samples. */ 82 | gr::buffer_reader_sptr d_reader; 83 | std::chrono::time_point d_lasttime; 84 | 85 | std::mutex d_mutex; /*! Used to lock FFT output buffer. */ 86 | }; 87 | 88 | 89 | #endif /* RX_METER_H */ 90 | -------------------------------------------------------------------------------- /src/dsp/rx_noise_blanker_cc.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2012 Alexandru Csete OZ9AEC. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #ifndef RX_NB_CC_H 24 | #define RX_NB_CC_H 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | class rx_nb_cc; 31 | 32 | #if GNURADIO_VERSION < 0x030900 33 | typedef boost::shared_ptr rx_nb_cc_sptr; 34 | #else 35 | typedef std::shared_ptr rx_nb_cc_sptr; 36 | #endif 37 | 38 | 39 | /*! \brief Return a shared_ptr to a new instance of rx_nb_cc. 40 | * \param sample_rate The sample rate (default = 96000). 41 | * \param threshold Noise blanker threshold. Range 0.0 to 1.0 (TBC) 42 | * 43 | * This is effectively the public constructor for a new noise blanker block. 44 | * To avoid accidental use of raw pointers, the rx_nb_cc constructor is private. 45 | * make_rx_nb_cc is the public interface for creating new instances. 46 | */ 47 | rx_nb_cc_sptr make_rx_nb_cc(double sample_rate=96000.0, float thld1=3.3, float thld2=2.5); 48 | 49 | 50 | /*! \brief Noise blanker block. 51 | * \ingroup DSP 52 | * 53 | * This block implements noise blanking filters based on the noise blanker code 54 | * from DTTSP. 55 | 56 | * 57 | */ 58 | class rx_nb_cc : public gr::sync_block 59 | { 60 | friend rx_nb_cc_sptr make_rx_nb_cc(double sample_rate, float thld1, float thld2); 61 | 62 | protected: 63 | rx_nb_cc(double sample_rate, float thld1, float thld2); 64 | 65 | public: 66 | ~rx_nb_cc(); 67 | 68 | int work(int noutput_items, 69 | gr_vector_const_void_star &input_items, 70 | gr_vector_void_star &output_items); 71 | 72 | void set_sample_rate(double sample_rate) { d_sample_rate = sample_rate; } 73 | void set_nb1_on(bool nb1_on) { d_nb1_on = nb1_on; } 74 | void set_nb2_on(bool nb2_on) { d_nb2_on = nb2_on; } 75 | bool get_nb1_on() { return d_nb1_on; } 76 | bool get_nb2_on() { return d_nb2_on; } 77 | void set_threshold1(float threshold); 78 | void set_threshold2(float threshold); 79 | 80 | private: 81 | void process_nb1(gr_complex *buf, int num); 82 | void process_nb2(gr_complex *buf, int num); 83 | 84 | private: 85 | std::mutex d_mutex; /*! Used to lock internal data while processing or setting parameters. */ 86 | 87 | bool d_nb1_on; /*! Current NB1 status (true/false). */ 88 | bool d_nb2_on; /*! Current NB2 status (true/false). */ 89 | double d_sample_rate; /*! Current sample rate. */ 90 | float d_thld_nb1; /*! Current threshold for noise blanker 1 (1.0 to 20.0 TBC). */ 91 | float d_thld_nb2; /*! Current threshold for noise blanker 2 (0.0 to 15.0 TBC). */ 92 | float d_avgmag_nb1; /*! Average magnitude. */ 93 | float d_avgmag_nb2; /*! Average magnitude. */ 94 | gr_complex d_avgsig, d_delay[8]; 95 | int d_delidx, d_sigidx, d_hangtime; // FIXME: need longer buffer for higher sample rates? 96 | 97 | }; 98 | 99 | 100 | #endif /* RX_NB_CC_H */ 101 | -------------------------------------------------------------------------------- /src/dsp/rx_rds.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2015 Alexandru Csete OZ9AEC. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #ifndef RX_RDS_H 24 | #define RX_RDS_H 25 | 26 | #include 27 | #include 28 | 29 | #if GNURADIO_VERSION < 0x030900 30 | #include 31 | #else 32 | #include 33 | #endif 34 | 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include "dsp/rds/decoder.h" 46 | #include "dsp/rds/parser.h" 47 | 48 | class rx_rds; 49 | class rx_rds_store; 50 | 51 | #if GNURADIO_VERSION < 0x030900 52 | typedef boost::shared_ptr rx_rds_sptr; 53 | typedef boost::shared_ptr rx_rds_store_sptr; 54 | #else 55 | typedef std::shared_ptr rx_rds_sptr; 56 | typedef std::shared_ptr rx_rds_store_sptr; 57 | #endif 58 | 59 | 60 | rx_rds_sptr make_rx_rds(double sample_rate); 61 | 62 | rx_rds_store_sptr make_rx_rds_store(); 63 | 64 | class rx_rds_store : public gr::block 65 | { 66 | public: 67 | rx_rds_store(); 68 | ~rx_rds_store(); 69 | 70 | void get_message(std::string &out, int &type); 71 | 72 | private: 73 | void store(pmt::pmt_t msg); 74 | 75 | std::mutex d_mutex; 76 | std::queue d_messages; 77 | 78 | }; 79 | 80 | class rx_rds : public gr::hier_block2 81 | { 82 | 83 | public: 84 | rx_rds(double sample_rate=240000.0); 85 | ~rx_rds(); 86 | 87 | void set_param(double low, double high, double trans_width); 88 | 89 | private: 90 | std::vector d_fxff_tap; 91 | std::vector d_rsmp_tap; 92 | gr::filter::fir_filter_ccf::sptr d_bpf; 93 | gr::filter::freq_xlating_fir_filter_fcf::sptr d_fxff; 94 | 95 | #if GNURADIO_VERSION < 0x030900 96 | gr::filter::rational_resampler_base_ccf::sptr d_rsmp; 97 | #else 98 | gr::filter::rational_resampler_ccf::sptr d_rsmp; 99 | #endif 100 | 101 | std::vector d_rrcf; 102 | std::vector d_rrcf_manchester; 103 | gr::analog::agc_cc::sptr d_agc; 104 | gr::digital::symbol_sync_cc::sptr d_sync; 105 | gr::digital::constellation_receiver_cb::sptr d_mpsk; 106 | gr::digital::diff_decoder_bb::sptr d_ddbb; 107 | 108 | double d_sample_rate; 109 | }; 110 | 111 | 112 | #endif // RX_RDS_H 113 | -------------------------------------------------------------------------------- /src/dsp/sniffer_f.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2011 Alexandru Csete OZ9AEC. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #ifndef SNIFFER_F_H 24 | #define SNIFFER_F_H 25 | 26 | #include 27 | #include 28 | #include 29 | #if GNURADIO_VERSION >= 0x031000 30 | #include 31 | #endif 32 | 33 | 34 | class sniffer_f; 35 | 36 | #if GNURADIO_VERSION < 0x030900 37 | typedef boost::shared_ptr sniffer_f_sptr; 38 | #else 39 | typedef std::shared_ptr sniffer_f_sptr; 40 | #endif 41 | 42 | 43 | /*! \brief Return a shared_ptr to a new instance of sniffer_f. 44 | * \param buffsize The size of the buffer 45 | * 46 | * This is effectively the public constructor. To avoid accidental use 47 | * of raw pointers, the constructor is private. This function is the public 48 | * interface for creating new instances. 49 | * 50 | */ 51 | sniffer_f_sptr make_sniffer_f(int buffsize=48000); 52 | 53 | 54 | /*! \brief Simple sink to allow accessing data in the flow graph. 55 | * \ingroup DSP 56 | * 57 | * This block can be used by external objects to access the data stream in the 58 | * flow graph. For example, a sniffer can be connected to the output of the demodulator 59 | * and used by data decoders. 60 | * 61 | * The class uses a circular buffer for internal storage and if the received samples 62 | * exceed the buffer size, old samples will be overwritten. The collected samples 63 | * can be accessed via the get_samples() method. 64 | */ 65 | class sniffer_f : public gr::sync_block 66 | { 67 | friend sniffer_f_sptr make_sniffer_f(int buffsize); 68 | 69 | protected: 70 | sniffer_f(int buffsize); 71 | 72 | public: 73 | ~sniffer_f(); 74 | 75 | int work(int noutput_items, 76 | gr_vector_const_void_star &input_items, 77 | gr_vector_void_star &output_items); 78 | 79 | int samples_available(); 80 | void get_samples(float * buffer, unsigned int &num); 81 | 82 | void set_buffer_size(int newsize); 83 | int buffer_size(); 84 | 85 | void set_min_samples(unsigned int num) {d_minsamp = num;} 86 | int min_samples() {return d_minsamp;} 87 | 88 | private: 89 | 90 | std::mutex d_mutex; /*! Used to prevent concurrent access to buffer. */ 91 | gr::buffer_sptr d_writer; 92 | gr::buffer_reader_sptr d_reader; 93 | int d_buffsize; 94 | unsigned int d_minsamp; /*! smallest number of samples we want to return. */ 95 | 96 | }; 97 | 98 | 99 | #endif /* SNIFFER_F_H */ 100 | -------------------------------------------------------------------------------- /src/interfaces/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ####################################################################################################################### 2 | # Add the source files to SRCS_LIST 3 | add_source_files(SRCS_LIST 4 | udp_sink_f.cpp 5 | udp_sink_f.h 6 | ) 7 | -------------------------------------------------------------------------------- /src/interfaces/udp_sink_f.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2013 Alexandru Csete OZ9AEC. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #ifndef UDP_SINK_F_H 24 | #define UDP_SINK_F_H 25 | 26 | #if GNURADIO_VERSION < 0x031000 27 | #include 28 | #else 29 | #include 30 | #endif 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | 38 | class udp_sink_f; 39 | 40 | #if GNURADIO_VERSION < 0x030900 41 | typedef boost::shared_ptr udp_sink_f_sptr; 42 | #else 43 | typedef std::shared_ptr udp_sink_f_sptr; 44 | #endif 45 | 46 | udp_sink_f_sptr make_udp_sink_f(void); 47 | 48 | class udp_sink_f : public gr::hier_block2 49 | { 50 | public: 51 | udp_sink_f(void); 52 | ~udp_sink_f(); 53 | 54 | void start_streaming(const std::string host, int port, bool stereo); 55 | void stop_streaming(void); 56 | 57 | private: 58 | #if GNURADIO_VERSION < 0x031000 59 | gr::blocks::udp_sink::sptr d_sink; /*!< The gnuradio UDP sink. */ 60 | #else 61 | gr::network::udp_sink::sptr d_sink; /*!< The gnuradio UDP sink. */ 62 | #endif 63 | gr::blocks::float_to_short::sptr d_f2s; /*!< Converts float to short. */ 64 | gr::blocks::interleave::sptr d_inter; /*!< Stereo interleaver. */ 65 | gr::blocks::null_sink::sptr d_null0; /*!< Null sink for mono. */ 66 | gr::blocks::null_sink::sptr d_null1; /*!< Null sink for mono. */ 67 | 68 | }; 69 | 70 | 71 | #endif // UDP_SINK_F_H 72 | -------------------------------------------------------------------------------- /src/osxaudio/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ####################################################################################################################### 2 | # Add the source files to SRCS_LIST 3 | add_source_files(SRCS_LIST 4 | device_list.cpp 5 | device_list.h 6 | ) 7 | -------------------------------------------------------------------------------- /src/osxaudio/device_list.cpp: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2014 Alexandru Csete OZ9AEC. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include "device_list.h" 28 | 29 | 30 | osxaudio_device::osxaudio_device(unsigned int idx, string name, string desc) : 31 | d_index(idx), d_name(name), d_description(desc) 32 | { 33 | } 34 | 35 | osxaudio_device::~osxaudio_device() 36 | { 37 | } 38 | 39 | 40 | osxaudio_device_list::osxaudio_device_list() 41 | { 42 | populate_device_list(); 43 | } 44 | 45 | osxaudio_device_list::~osxaudio_device_list() 46 | { 47 | d_sources.clear(); 48 | d_sinks.clear(); 49 | } 50 | 51 | /** \brief Populate osx audio device list. 52 | * 53 | * This method iterates through all the input and output decives 54 | * and stores them for later retrieval using getInputDevices() and 55 | * getOutputDevices(). 56 | */ 57 | int osxaudio_device_list::populate_device_list() 58 | { 59 | std::vector device_ids; 60 | std::vector device_names; 61 | 62 | int i, num_dev, err; 63 | 64 | // Get input devices 65 | gr::audio::osx::find_audio_devices("", true, &device_ids, &device_names); 66 | num_dev = device_ids.size(); 67 | 68 | if (num_dev < 0) 69 | { 70 | std::cerr << "ERROR: gr::audio::find_audio_devices() returned " << num_dev << std::endl; 71 | err = num_dev; 72 | goto error; 73 | } 74 | std::cout << "Number of audio input devices: " << num_dev << std::endl; 75 | 76 | for (i = 0; i < num_dev; i++) 77 | { 78 | add_source(i, device_names.at(i), device_names.at(i)); 79 | } 80 | device_ids.clear(); 81 | device_names.clear(); 82 | 83 | // Get output devices 84 | gr::audio::osx::find_audio_devices("", false, &device_ids, &device_names); 85 | num_dev = device_ids.size(); 86 | 87 | if (num_dev < 0) 88 | { 89 | std::cerr << "ERROR: gr::audio::find_audio_devices() returned " << num_dev << std::endl; 90 | err = num_dev; 91 | goto error; 92 | } 93 | std::cout << "Number of audio output devices: " << num_dev << std::endl; 94 | 95 | for (i = 0; i < num_dev; i++) 96 | { 97 | add_sink(i, device_names.at(i), device_names.at(i)); 98 | } 99 | device_ids.clear(); 100 | device_names.clear(); 101 | 102 | return 0; 103 | 104 | error: 105 | std::cerr << "An error occurred while using OSX audio" << std::endl; 106 | std::cerr << "Error number: " << err << std::endl; 107 | return err; 108 | } 109 | 110 | 111 | void osxaudio_device_list::add_sink(unsigned int idx, string name, string desc) 112 | { 113 | d_sinks.push_back(osxaudio_device(idx, name, desc)); 114 | } 115 | 116 | 117 | void osxaudio_device_list::add_source(unsigned int idx, string name, string desc) 118 | { 119 | d_sources.push_back(osxaudio_device(idx, name, desc)); 120 | } 121 | -------------------------------------------------------------------------------- /src/osxaudio/device_list.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2014 Alexandru Csete OZ9AEC. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #ifndef OSXAUDIO_DEVICE_LIST_H 24 | #define OSXAUDIO_DEVICE_LIST_H 25 | #include 26 | #include 27 | 28 | using namespace std; 29 | 30 | /*! \brief Simple class to represent OSX audio devices. 31 | * 32 | * This class represents an OSX audio device. The device can be either source 33 | * or sink, this class does not differentiate between them. 34 | */ 35 | class osxaudio_device 36 | { 37 | public: 38 | osxaudio_device(unsigned int idx=0, string name="", string desc=""); 39 | ~osxaudio_device(); 40 | 41 | void set_index(unsigned int idx) { d_index = idx; } 42 | void set_name(string name) { d_name = name; } 43 | void set_description(string desc) { d_description = desc; } 44 | 45 | unsigned int get_index() { return d_index; } 46 | string get_name() { return d_name; } 47 | string get_description() { return d_description; } 48 | 49 | private: 50 | unsigned int d_index; /*! The index of the audio device (unique for each source/sink). */ 51 | string d_name; /*! The name of the audio device. Used when creating sources/sinks. */ 52 | string d_description; /*! The description of the audio device. */ 53 | }; 54 | 55 | 56 | /*! \brief Class for storing and retrieving a list of osx audio sinks and sources. */ 57 | class osxaudio_device_list 58 | { 59 | public: 60 | osxaudio_device_list(); 61 | ~osxaudio_device_list(); 62 | 63 | vector get_input_devices() { return d_sources; } 64 | vector get_output_devices() {return d_sinks; } 65 | 66 | private: 67 | vector d_sources; /*! List of pulseaudio sources. */ 68 | vector d_sinks; /*! List of pulseaudio sinks. */ 69 | 70 | int populate_device_list(); 71 | void add_sink(unsigned int idx, string name, string desc); 72 | void add_source(unsigned int idx, string name, string desc); 73 | }; 74 | 75 | #endif // OSXAUDIO_DEVICE_LIST_H 76 | -------------------------------------------------------------------------------- /src/portaudio/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Add the source files to SRCS_LIST 2 | add_source_files(SRCS_LIST 3 | device_list.cpp 4 | device_list.h 5 | portaudio_sink.cpp 6 | portaudio_sink.h 7 | ) 8 | -------------------------------------------------------------------------------- /src/portaudio/device_list.cpp: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2013 Alexandru Csete OZ9AEC. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #include "device_list.h" 29 | 30 | using namespace std; 31 | 32 | portaudio_device::portaudio_device(unsigned int idx, string name, string desc) : 33 | d_index(idx), d_name(name), d_description(desc) 34 | { 35 | } 36 | 37 | portaudio_device::~portaudio_device() 38 | { 39 | } 40 | 41 | 42 | portaudio_device_list::portaudio_device_list() 43 | { 44 | populate_device_list(); 45 | } 46 | 47 | portaudio_device_list::~portaudio_device_list() 48 | { 49 | d_sources.clear(); 50 | d_sinks.clear(); 51 | } 52 | 53 | /** \brief Populate portaudioaudio device list. 54 | * 55 | * This method iterates through all the input and output decives 56 | * and stores them for later retrieval using getInputDevices() and 57 | * getOutputDevices(). 58 | */ 59 | int portaudio_device_list::populate_device_list() 60 | { 61 | int i, num_dev; 62 | const PaDeviceInfo *dev_info; 63 | PaError err; 64 | 65 | std::cout << Pa_GetVersionText() << " (version " << Pa_GetVersion() << ")" << std::endl; 66 | 67 | num_dev = Pa_GetDeviceCount(); 68 | if (num_dev < 0) 69 | { 70 | std::cerr << "ERROR: Pa_GetDeviceCount returned " << num_dev << std::endl; 71 | err = num_dev; 72 | goto error; 73 | } 74 | 75 | std::cout << "Number of audio devices: " << num_dev << std::endl; 76 | 77 | for (i = 0; i < num_dev; i++) 78 | { 79 | dev_info = Pa_GetDeviceInfo(i); 80 | 81 | std::cout << " " << i << ": " << dev_info->name 82 | << " I:" << dev_info->maxInputChannels 83 | << " O:" << dev_info->maxOutputChannels 84 | << std::endl; 85 | 86 | if (dev_info->maxInputChannels > 0) 87 | { 88 | add_source(i, dev_info->name, dev_info->name); 89 | } 90 | 91 | if (dev_info->maxOutputChannels > 0) 92 | { 93 | add_sink(i, dev_info->name, dev_info->name); 94 | } 95 | } 96 | 97 | return 0; 98 | 99 | error: 100 | std::cerr << "An error occurred while using the portaudio stream" << std::endl; 101 | std::cerr << "Error number: " << err << std::endl; 102 | std::cerr << "Error message: " << Pa_GetErrorText(err) << std::endl; 103 | return err; 104 | } 105 | 106 | 107 | void portaudio_device_list::add_sink(unsigned int idx, string name, string desc) 108 | { 109 | d_sinks.push_back(portaudio_device(idx, name, desc)); 110 | } 111 | 112 | 113 | void portaudio_device_list::add_source(unsigned int idx, string name, string desc) 114 | { 115 | d_sources.push_back(portaudio_device(idx, name, desc)); 116 | } 117 | 118 | PaDeviceIndex portaudio_device_list::get_output_device_index(const string name) const 119 | { 120 | vector::const_iterator it; 121 | 122 | if (name.empty()) 123 | return -1; 124 | 125 | for (it = d_sinks.begin(); it < d_sinks.end(); it++) 126 | { 127 | if (it->get_name() == name) 128 | return it->get_index(); 129 | } 130 | 131 | return -1; 132 | } 133 | -------------------------------------------------------------------------------- /src/portaudio/device_list.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2013 Alexandru Csete OZ9AEC. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #pragma once 24 | #include 25 | #include 26 | #include 27 | 28 | using namespace std; 29 | 30 | /*! \brief Simple class to represent portaudio devices. 31 | * 32 | * This class represents a portaudio device. The device can be either source 33 | * or sink, this class does not differentiate between them. 34 | */ 35 | class portaudio_device 36 | { 37 | public: 38 | portaudio_device(unsigned int idx=0, string name="", string desc=""); 39 | ~portaudio_device(); 40 | 41 | void set_index(unsigned int idx) { d_index = idx; } 42 | void set_name(string name) { d_name = name; } 43 | void set_description(string desc) { d_description = desc; } 44 | 45 | unsigned int get_index() const { return d_index; } 46 | string get_name() const { return d_name; } 47 | string get_description() const { return d_description; } 48 | 49 | private: 50 | unsigned int d_index; /*! The index of the audio device (unique for each source/sink). */ 51 | string d_name; /*! The name of the audio device. Used when creating sources/sinks. */ 52 | string d_description; /*! The description of the audio device. */ 53 | }; 54 | 55 | 56 | /*! \brief Class for storing and retrieving a list of portaudio sinks and sources. */ 57 | class portaudio_device_list 58 | { 59 | public: 60 | portaudio_device_list(); 61 | ~portaudio_device_list(); 62 | 63 | vector get_input_devices() { return d_sources; } 64 | vector get_output_devices() {return d_sinks; } 65 | 66 | /** Get output device index. Returns -1 if not found */ 67 | PaDeviceIndex get_output_device_index(const string name) const; 68 | 69 | private: 70 | vector d_sources; /*! List of pulseaudio sources. */ 71 | vector d_sinks; /*! List of pulseaudio sinks. */ 72 | 73 | int populate_device_list(); 74 | void add_sink(unsigned int idx, string name, string desc); 75 | void add_source(unsigned int idx, string name, string desc); 76 | }; 77 | -------------------------------------------------------------------------------- /src/portaudio/portaudio_sink.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2016 Alexandru Csete OZ9AEC. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #pragma once 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | using namespace std; 30 | 31 | class portaudio_sink; 32 | 33 | #if GNURADIO_VERSION < 0x030900 34 | typedef boost::shared_ptr portaudio_sink_sptr; 35 | #else 36 | typedef std::shared_ptr portaudio_sink_sptr; 37 | #endif 38 | 39 | portaudio_sink_sptr make_portaudio_sink(const string device_name, int audio_rate, 40 | const string app_name, 41 | const string stream_name); 42 | 43 | /** Two-channel portaudio sink */ 44 | class portaudio_sink : public gr::sync_block 45 | { 46 | friend portaudio_sink_sptr make_portaudio_sink(const string device_name, 47 | int audio_rate, 48 | const string app_name, 49 | const string stream_name); 50 | 51 | public: 52 | portaudio_sink(const string device_name, int audio_rate, 53 | const string app_name, const string stream_name); 54 | ~portaudio_sink(); 55 | 56 | int work (int noutput_items, 57 | gr_vector_const_void_star &input_items, 58 | gr_vector_void_star &output_items); 59 | 60 | bool start(); 61 | bool stop(); 62 | 63 | void select_device(string device_name); 64 | 65 | private: 66 | PaStream *d_stream; 67 | PaStreamParameters d_out_params; 68 | string d_stream_name; // Descriptive name of the stream. 69 | string d_app_name; // Descriptive name of the application. 70 | int d_audio_rate; 71 | }; 72 | -------------------------------------------------------------------------------- /src/pulseaudio/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Add the source files to SRCS_LIST 2 | add_source_files(SRCS_LIST 3 | pa_device_list.cc 4 | pa_device_list.h 5 | pa_sink.cc 6 | pa_sink.h 7 | pa_source.cc 8 | pa_source.h 9 | ) 10 | -------------------------------------------------------------------------------- /src/pulseaudio/pa_device_list.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2011 Alexandru Csete OZ9AEC. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #ifndef PA_DEVICE_LIST_H 24 | #define PA_DEVICE_LIST_H 25 | #include 26 | #include 27 | #include 28 | 29 | using namespace std; 30 | 31 | /*! \brief Simple class to represent pulseaudio devices. 32 | * 33 | * This class represents a pulseaudio device. The device can be either source 34 | * or sink, this class does not differentiate between them. 35 | */ 36 | class pa_device 37 | { 38 | public: 39 | pa_device(unsigned int idx=0, string name="", string desc=""); 40 | ~pa_device(); 41 | 42 | void set_index(unsigned int idx) { d_index = idx; } 43 | void set_name(string name) { d_name = name; } 44 | void set_description(string desc) { d_description = desc; } 45 | 46 | unsigned int get_index() { return d_index; } 47 | string get_name() { return d_name; } 48 | string get_description() { return d_description; } 49 | 50 | private: 51 | unsigned int d_index; /*! The index of the audio device (unique for each source/sink). */ 52 | string d_name; /*! The name of the audio device. Used when creating sources/sinks. */ 53 | string d_description; /*! The description of the audio device. */ 54 | }; 55 | 56 | 57 | /*! \brief Class for storing and retrieving a list of pulseaudio sinks and sources. */ 58 | class pa_device_list 59 | { 60 | public: 61 | pa_device_list(); 62 | ~pa_device_list(); 63 | 64 | vector get_input_devices() { return d_sources; } 65 | vector get_output_devices() {return d_sinks; } 66 | 67 | private: 68 | vector d_sources; /*! List of pulseaudio sources. */ 69 | vector d_sinks; /*! List of pulseaudio sinks. */ 70 | 71 | int populate_device_list(); 72 | 73 | // pulseaudio callbacks 74 | static void pa_state_cb(pa_context *c, void *userdata); 75 | static void pa_sinklist_cb(pa_context *ctx, const pa_sink_info *info, int eol, void *userdata); 76 | static void pa_sourcelist_cb(pa_context *ctx, const pa_source_info *info, int eol, void *userdata); 77 | }; 78 | 79 | #endif // PA_DEVICE_LIST_H 80 | -------------------------------------------------------------------------------- /src/pulseaudio/pa_sink.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2011-2012 Alexandru Csete OZ9AEC. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #ifndef PA_SINK_H 24 | #define PA_SINK_H 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | using namespace std; 31 | 32 | class pa_sink; 33 | 34 | #if GNURADIO_VERSION < 0x030900 35 | typedef boost::shared_ptr pa_sink_sptr; 36 | #else 37 | typedef std::shared_ptr pa_sink_sptr; 38 | #endif 39 | 40 | pa_sink_sptr make_pa_sink(const string device_name, int audio_rate, 41 | const string app_name, 42 | const string stream_name); 43 | 44 | 45 | /*! \brief Pulseaudio sink 46 | * \ingroup IO 47 | * 48 | * This block implements a two-channel pulseaudio sink using the Pulseaudio simple API. 49 | * 50 | */ 51 | class pa_sink : public gr::sync_block 52 | { 53 | friend pa_sink_sptr make_pa_sink(const string device_name, int audio_rate, 54 | const string app_name, const string stream_name); 55 | 56 | public: 57 | pa_sink(const string device_name, int audio_rate, 58 | const string app_name, const string stream_name); 59 | ~pa_sink(); 60 | 61 | int work (int noutput_items, 62 | gr_vector_const_void_star &input_items, 63 | gr_vector_void_star &output_items); 64 | 65 | bool start(); 66 | bool stop(); 67 | 68 | void select_device(string device_name); 69 | 70 | private: 71 | pa_simple *d_pasink; /*! The pulseaudio object. */ 72 | string d_stream_name; /*! Descriptive name of the stream. */ 73 | string d_app_name; /*! Descriptive name of the application. */ 74 | pa_sample_spec d_ss; /*! pulseaudio sample specification. */ 75 | }; 76 | 77 | #endif /* PA_SINK_H */ 78 | -------------------------------------------------------------------------------- /src/pulseaudio/pa_source.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2012 Alexandru Csete OZ9AEC. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #ifndef PA_SOURCE_H 24 | #define PA_SOURCE_H 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | using namespace std; 31 | 32 | class pa_source; 33 | 34 | #if GNURADIO_VERSION < 0x030900 35 | typedef boost::shared_ptr pa_source_sptr; 36 | #else 37 | typedef std::shared_ptr pa_source_sptr; 38 | #endif 39 | 40 | pa_source_sptr make_pa_source(const string device_name, 41 | int sample_rate, 42 | int num_chan, 43 | const string app_name, 44 | const string stream_name); 45 | 46 | 47 | /*! \brief Pulseaudio source. 48 | * \ingroup IO 49 | * 50 | */ 51 | class pa_source : public gr::sync_block 52 | { 53 | friend pa_source_sptr make_pa_source(const string device_name, int sample_rate, int num_chan, 54 | const string app_name, const string stream_name); 55 | 56 | public: 57 | pa_source(const string device_name, int sample_rate, int num_chan, 58 | const string app_name, const string stream_name); 59 | ~pa_source(); 60 | 61 | int work (int noutput_items, 62 | gr_vector_const_void_star &input_items, 63 | gr_vector_void_star &output_items); 64 | 65 | void select_device(string device_name); 66 | 67 | private: 68 | pa_sample_spec d_ss; /*! Sample specification. */ 69 | string d_stream_name; /*! Descriptive name of the stream. */ 70 | string d_app_name; /*! Descriptive name of the application. */ 71 | pa_simple *d_pasrc; /*! The pulseaudio object. */ 72 | 73 | }; 74 | 75 | #endif /* PA_SOURCE_H */ 76 | -------------------------------------------------------------------------------- /src/qtgui/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ####################################################################################################################### 2 | # Add the source files to SRCS_LIST 3 | add_source_files(SRCS_LIST 4 | afsk1200win.cpp 5 | afsk1200win.h 6 | agc_options.cpp 7 | agc_options.h 8 | audio_options.cpp 9 | audio_options.h 10 | bandplan.cpp 11 | bandplan.h 12 | bookmarks.cpp 13 | bookmarks.h 14 | bookmarkstablemodel.cpp 15 | bookmarkstablemodel.h 16 | bookmarkstaglist.cpp 17 | bookmarkstaglist.h 18 | ctk/ctkPimpl.h 19 | ctk/ctkRangeSlider.cpp 20 | ctk/ctkRangeSlider.h 21 | demod_options.cpp 22 | demod_options.h 23 | dockaudio.cpp 24 | dockaudio.h 25 | dockbookmarks.cpp 26 | dockbookmarks.h 27 | dockfft.cpp 28 | dockfft.h 29 | dockinputctl.cpp 30 | dockinputctl.h 31 | dockrds.cpp 32 | dockrds.h 33 | dockrxopt.cpp 34 | dockrxopt.h 35 | dxc_options.cpp 36 | dxc_options.h 37 | dxc_spots.cpp 38 | dxc_spots.h 39 | freqctrl.cpp 40 | freqctrl.h 41 | ioconfig.cpp 42 | ioconfig.h 43 | iq_tool.cpp 44 | iq_tool.h 45 | meter.cpp 46 | meter.h 47 | nb_options.cpp 48 | nb_options.h 49 | plotter.cpp 50 | plotter.h 51 | qtcolorpicker.cpp 52 | qtcolorpicker.h 53 | ) 54 | 55 | ####################################################################################################################### 56 | # Add the source files to UI_SRCS_LIST 57 | add_source_files(UI_SRCS_LIST 58 | afsk1200win.ui 59 | agc_options.ui 60 | audio_options.ui 61 | demod_options.ui 62 | dockaudio.ui 63 | dockbookmarks.ui 64 | dockfft.ui 65 | dockinputctl.ui 66 | dockrds.ui 67 | dockrxopt.ui 68 | dxc_options.ui 69 | ioconfig.ui 70 | iq_tool.ui 71 | nb_options.ui 72 | ) 73 | -------------------------------------------------------------------------------- /src/qtgui/afsk1200win.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2011 Alexandru Csete OZ9AEC. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #ifndef AFSK1200WIN_H 24 | #define AFSK1200WIN_H 25 | 26 | #include 27 | #include 28 | #include "dsp/afsk1200/cafsk12.h" 29 | 30 | 31 | namespace Ui { 32 | class Afsk1200Win; 33 | } 34 | 35 | 36 | /*! \brief AFSK1200 decoder window. */ 37 | class Afsk1200Win : public QMainWindow 38 | { 39 | Q_OBJECT 40 | 41 | public: 42 | explicit Afsk1200Win(QWidget *parent = 0); 43 | ~Afsk1200Win(); 44 | void process_samples(float *buffer, int length); 45 | 46 | protected: 47 | void closeEvent(QCloseEvent *ev); 48 | 49 | signals: 50 | void windowClosed(); /*! Signal we emit when window is closed. */ 51 | 52 | private slots: 53 | void on_actionClear_triggered(); 54 | void on_actionSave_triggered(); 55 | void on_actionInfo_triggered(); 56 | 57 | private: 58 | Ui::Afsk1200Win *ui; /*! Qt Designer form. */ 59 | 60 | CAfsk12 *decoder; /*! The AFSK1200 decoder object. */ 61 | 62 | std::vector tmpbuf; /*! Needed to remember "overlap" samples. */ 63 | }; 64 | 65 | #endif // AFSK1200WIN_H 66 | -------------------------------------------------------------------------------- /src/qtgui/agc_options.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2012-2013 Alexandru Csete OZ9AEC. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #ifndef AGC_OPTIONS_H 24 | #define AGC_OPTIONS_H 25 | 26 | #include 27 | #include 28 | 29 | namespace Ui { 30 | class CAgcOptions; 31 | } 32 | 33 | /*! \brief Dialog windows with advanced AGC controls. 34 | * \ingroup UI 35 | * 36 | * By default the user is presented with a combo box and a small tool button. 37 | * The combo box contains the most common AGC presets (fast, medium, slow, user) 38 | * plus an option to switch AGC OFF. The controls for the individual AGC parameters 39 | * are inside this dialog and can be shown using the small tool button next to 40 | * the combo box containing the presets. 41 | * 42 | * \todo A graph that shows the current AGC profile updated in real time. 43 | */ 44 | 45 | class CAgcOptions : public QDialog 46 | { 47 | Q_OBJECT 48 | 49 | public: 50 | explicit CAgcOptions(QWidget *parent = 0); 51 | ~CAgcOptions(); 52 | 53 | void closeEvent(QCloseEvent *event); 54 | 55 | int gain(); 56 | void setGain(int value); 57 | void enableGain(bool enabled); 58 | 59 | int threshold(); 60 | void setThreshold(int value); 61 | 62 | int slope(); 63 | void setSlope(int value); 64 | void enableSlope(bool enabled); 65 | 66 | int decay(); 67 | void setDecay(int value); 68 | void enableDecay(bool enabled); 69 | 70 | bool hang(); 71 | void setHang(bool checked); 72 | 73 | enum agc_preset_e 74 | { 75 | AGC_FAST = 0, /*! decay = 500 ms, slope = 2 */ 76 | AGC_MEDIUM = 1, /*! decay = 1500 ms, slope = 2 */ 77 | AGC_SLOW = 2, /*! decay = 3000 ms, slope = 2 */ 78 | AGC_USER = 3, 79 | AGC_OFF = 4 80 | }; 81 | 82 | void setPreset(agc_preset_e preset); 83 | 84 | signals: 85 | void gainChanged(int gain); 86 | void thresholdChanged(int threshold); 87 | void slopeChanged(int slope); 88 | void decayChanged(int decay); 89 | void hangChanged(bool on); 90 | 91 | private slots: 92 | void on_gainSlider_valueChanged(int gain); 93 | void on_thresholdSlider_valueChanged(int threshold); 94 | void on_slopeSlider_valueChanged(int slope); 95 | void on_decaySlider_valueChanged(int decay); 96 | void on_hangButton_toggled(bool checked); 97 | 98 | private: 99 | Ui::CAgcOptions *ui; 100 | }; 101 | 102 | #endif // AGC_OPTIONS_H 103 | -------------------------------------------------------------------------------- /src/qtgui/audio_options.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2013-2016 Alexandru Csete OZ9AEC. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #ifndef AUDIO_OPTIONS_H 24 | #define AUDIO_OPTIONS_H 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | namespace Ui { 32 | class CAudioOptions; 33 | } 34 | 35 | /*! \brief GUI widget for configuring audio options. */ 36 | class CAudioOptions : public QDialog 37 | { 38 | Q_OBJECT 39 | 40 | public: 41 | explicit CAudioOptions(QWidget *parent = 0); 42 | ~CAudioOptions(); 43 | 44 | void closeEvent(QCloseEvent *event); 45 | 46 | void setRecDir(const QString &dir); 47 | void setUdpHost(const QString &host); 48 | void setUdpPort(int port); 49 | void setUdpStereo(bool stereo); 50 | 51 | void setFftSplit(int pct_2d); 52 | int getFftSplit(void) const; 53 | 54 | void setPandapterRange(int min, int max); 55 | void getPandapterRange(int * min, int * max) const; 56 | 57 | void setWaterfallRange(int min, int max); 58 | void getWaterfallRange(int * min, int * max) const; 59 | 60 | void setLockButtonState(bool checked); 61 | bool getLockButtonState(void) const; 62 | 63 | public slots: 64 | void setPandapterSliderValues(float min, float max); 65 | 66 | signals: 67 | void newFftSplit(int pct_2d); 68 | void newPandapterRange(int min, int max); 69 | void newWaterfallRange(int min, int max); 70 | 71 | /*! \brief Signal emitted when a new valid directory has been selected. */ 72 | void newRecDirSelected(const QString &dir); 73 | 74 | void newUdpHost(const QString text); 75 | void newUdpPort(int port); 76 | void newUdpStereo(bool enabled); 77 | 78 | private slots: 79 | void on_fftSplitSlider_valueChanged(int value); 80 | void on_pandRangeSlider_valuesChanged(int min, int max); 81 | void on_wfRangeSlider_valuesChanged(int min, int max); 82 | void on_audioLockButton_toggled(bool checked); 83 | void on_recDirEdit_textChanged(const QString &text); 84 | void on_recDirButton_clicked(); 85 | void on_udpHost_textChanged(const QString &text); 86 | void on_udpPort_valueChanged(int port); 87 | void on_udpStereo_stateChanged(int state); 88 | 89 | private: 90 | Ui::CAudioOptions *ui; /*!< The user interface widget. */ 91 | QDir *work_dir; /*!< Used for validating chosen directory. */ 92 | QPalette *error_palette; /*!< Palette used to indicate an error. */ 93 | bool m_pand_last_modified; /*!< Flag to indicate which slider was changed last */ 94 | }; 95 | 96 | #endif // AUDIO_OPTIONS_H 97 | -------------------------------------------------------------------------------- /src/qtgui/bandplan.cpp: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2020 Dallas Epperson. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include "bandplan.h" 33 | 34 | BandPlan* BandPlan::m_pThis = 0; 35 | 36 | BandPlan::BandPlan() 37 | { 38 | 39 | } 40 | 41 | void BandPlan::create() 42 | { 43 | m_pThis = new BandPlan; 44 | } 45 | 46 | BandPlan& BandPlan::Get() 47 | { 48 | return *m_pThis; 49 | } 50 | 51 | void BandPlan::setConfigDir(const QString& cfg_dir) 52 | { 53 | m_bandPlanFile = cfg_dir + "/bandplan.csv"; 54 | std::cout << "BandPlanFile is " << m_bandPlanFile.toStdString() << std::endl; 55 | 56 | if (!QFile::exists(m_bandPlanFile)) 57 | { 58 | QResource resource(":/textfiles/bandplan.csv"); 59 | QFile::copy(resource.absoluteFilePath(), m_bandPlanFile); 60 | QFile::setPermissions(m_bandPlanFile, QFile::permissions(m_bandPlanFile) | QFile::WriteOwner); 61 | } 62 | } 63 | 64 | bool BandPlan::load() 65 | { 66 | QFile file(m_bandPlanFile); 67 | if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) return false; 68 | 69 | m_BandInfoList.clear(); 70 | 71 | while (!file.atEnd()) 72 | { 73 | QString line = QString::fromUtf8(file.readLine().trimmed()); 74 | if(line.isEmpty() || line.startsWith("#")) 75 | continue; 76 | 77 | QStringList strings = line.split(","); 78 | 79 | if (strings.count() < 6) { 80 | std::cout << "BandPlan: Ignoring Line:" << std::endl; 81 | std::cout << " " << line.toStdString() << std::endl; 82 | } else { 83 | BandInfo info; 84 | info.minFrequency = strings[0].toLongLong(); 85 | info.maxFrequency = strings[1].toLongLong(); 86 | info.modulation = strings[2].trimmed(); 87 | info.step = strings[3].toInt(); 88 | info.color = QColor(strings[4].trimmed()); 89 | info.name = strings[5].trimmed(); 90 | 91 | m_BandInfoList.append(info); 92 | } 93 | } 94 | file.close(); 95 | 96 | emit BandPlanChanged(); 97 | return true; 98 | } 99 | 100 | QList BandPlan::getBandsInRange(qint64 low, qint64 high) 101 | { 102 | QList found; 103 | for (int i = 0; i < m_BandInfoList.size(); i++) { 104 | if(m_BandInfoList[i].maxFrequency < low) continue; 105 | if(m_BandInfoList[i].minFrequency > high) continue; 106 | found.append(m_BandInfoList[i]); 107 | } 108 | return found; 109 | } 110 | 111 | QList BandPlan::getBandsEncompassing(qint64 freq) 112 | { 113 | QList found; 114 | for (int i = 0; i < m_BandInfoList.size(); i++) { 115 | if(m_BandInfoList[i].maxFrequency < freq) continue; 116 | if(m_BandInfoList[i].minFrequency > freq) continue; 117 | found.append(m_BandInfoList[i]); 118 | } 119 | return found; 120 | } 121 | -------------------------------------------------------------------------------- /src/qtgui/bandplan.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2020 Dallas Epperson. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #ifndef BANDPLAN_H 24 | #define BANDPLAN_H 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | struct BandInfo 35 | { 36 | qint64 minFrequency; 37 | qint64 maxFrequency; 38 | QString name; 39 | QString modulation; 40 | qint64 step; 41 | QColor color; 42 | 43 | BandInfo() 44 | { 45 | this->minFrequency = 0; 46 | this->maxFrequency = 0; 47 | this->step = 1; 48 | } 49 | 50 | bool operator<(const BandInfo &other) const 51 | { 52 | return minFrequency < other.minFrequency; 53 | } 54 | }; 55 | 56 | class BandPlan : public QObject 57 | { 58 | Q_OBJECT 59 | public: 60 | // This is a Singleton Class now because you can not send qt-signals from static functions. 61 | static void create(); 62 | static BandPlan& Get(); 63 | bool load(); 64 | int size() { return m_BandInfoList.size(); } 65 | BandInfo& getBand(int i) { return m_BandInfoList[i]; } 66 | QList getBandsInRange(qint64 low, qint64 high); 67 | QList getBandsEncompassing(qint64 freq); 68 | 69 | void setConfigDir(const QString&); 70 | 71 | private: 72 | BandPlan(); // Singleton Constructor is private. 73 | QList m_BandInfoList; 74 | QString m_bandPlanFile; 75 | static BandPlan* m_pThis; 76 | 77 | signals: 78 | void BandPlanChanged(void); 79 | }; 80 | 81 | #endif // BANDPLAN_H 82 | -------------------------------------------------------------------------------- /src/qtgui/bookmarks.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2013 Christian Lindner DL2VCL, Stefano Leucci. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #ifndef BOOKMARKS_H 24 | #define BOOKMARKS_H 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | struct TagInfo 36 | { 37 | using sptr = std::shared_ptr; 38 | QString name; 39 | QColor color; 40 | bool active; 41 | 42 | static const QColor DefaultColor; 43 | static const QString strUntagged; 44 | 45 | TagInfo(QString name) 46 | { 47 | active=true; 48 | this->color=DefaultColor; 49 | this->name = name; 50 | } 51 | static sptr make(QString name = "") 52 | { 53 | return std::make_shared(name); 54 | } 55 | bool operator<(const TagInfo &other) const 56 | { 57 | return name < other.name; 58 | } 59 | }; 60 | 61 | struct BookmarkInfo 62 | { 63 | qint64 frequency; 64 | QString name; 65 | QString modulation; 66 | qint64 bandwidth; 67 | QList tags; 68 | 69 | BookmarkInfo() 70 | { 71 | this->frequency = 0; 72 | this->bandwidth = 0; 73 | } 74 | 75 | /* BookmarkInfo( qint64 frequency, QString name, qint64 bandwidth, QString modulation ) 76 | { 77 | this->frequency = frequency; 78 | this->name = name; 79 | this->modulation = modulation; 80 | this->bandwidth = bandwidth; 81 | } 82 | */ 83 | bool operator<(const BookmarkInfo &other) const 84 | { 85 | return frequency < other.frequency; 86 | } 87 | /* 88 | void setTags(QString tagString); 89 | QString getTagString(); 90 | bool hasTags(QString _tags); 91 | bool hasTags(QStringList _tags); 92 | */ 93 | 94 | const QColor GetColor() const; 95 | bool IsActive() const; 96 | }; 97 | 98 | class Bookmarks : public QObject 99 | { 100 | Q_OBJECT 101 | public: 102 | // This is a Singleton Class now because you can not send qt-signals from static functions. 103 | static void create(); 104 | static Bookmarks& Get(); 105 | 106 | void add(BookmarkInfo& info); 107 | void remove(int index); 108 | bool load(); 109 | bool save(); 110 | int size() { return m_BookmarkList.size(); } 111 | BookmarkInfo& getBookmark(int i) { return m_BookmarkList[i]; } 112 | QList getBookmarksInRange(qint64 low, qint64 high); 113 | //int lowerBound(qint64 low); 114 | //int upperBound(qint64 high); 115 | 116 | QList getTagList() { return QList(m_TagList); } 117 | TagInfo::sptr findOrAddTag(QString tagName); 118 | int getTagIndex(QString tagName); 119 | bool removeTag(QString tagName); 120 | bool setTagChecked(QString tagName, bool bChecked); 121 | 122 | void setConfigDir(const QString&); 123 | 124 | private: 125 | Bookmarks(); // Singleton Constructor is private. 126 | QList m_BookmarkList; 127 | QList m_TagList; 128 | QString m_bookmarksFile; 129 | static Bookmarks* m_pThis; 130 | 131 | signals: 132 | void BookmarksChanged(void); 133 | void TagListChanged(void); 134 | }; 135 | 136 | #endif // BOOKMARKS_H 137 | -------------------------------------------------------------------------------- /src/qtgui/bookmarkstablemodel.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2013 Christian Lindner DL2VCL, Stefano Leucci. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #ifndef BOOKMARKSTABLEMODEL_H 24 | #define BOOKMARKSTABLEMODEL_H 25 | 26 | #include 27 | #include 28 | 29 | #include "bookmarks.h" 30 | 31 | 32 | class BookmarksTableModel : public QAbstractTableModel 33 | { 34 | Q_OBJECT 35 | 36 | public: 37 | enum EColumns 38 | { 39 | COL_FREQUENCY, 40 | COL_NAME, 41 | COL_MODULATION, 42 | COL_BANDWIDTH, 43 | COL_TAGS 44 | }; 45 | 46 | explicit BookmarksTableModel(QObject *parent = 0); 47 | 48 | int rowCount ( const QModelIndex & parent = QModelIndex() ) const; 49 | int columnCount ( const QModelIndex & parent = QModelIndex() ) const; 50 | QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; 51 | QVariant data ( const QModelIndex & index, int role = Qt::DisplayRole ) const; 52 | bool setData ( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole ); 53 | Qt::ItemFlags flags ( const QModelIndex & index ) const; 54 | 55 | BookmarkInfo* getBookmarkAtRow(int row); 56 | int GetBookmarksIndexForRow(int iRow); 57 | 58 | private: 59 | QList m_Bookmarks; 60 | QMap m_mapRowToBookmarksIndex; 61 | 62 | signals: 63 | public slots: 64 | void update(); 65 | 66 | }; 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /src/qtgui/bookmarkstaglist.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2014 Stefano Leucci, Christian Lindner DL2VCL. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #ifndef BOOKMARKSTAGLIST_H 24 | #define BOOKMARKSTAGLIST_H 25 | 26 | #include 27 | #include "bookmarks.h" 28 | 29 | /// A QWidget containing the List of Bookmark-Tags. 30 | class BookmarksTagList : public QTableWidget 31 | { 32 | Q_OBJECT 33 | public: 34 | explicit BookmarksTagList(QWidget *parent = 0, bool bShowUntagged = true); 35 | QStringList getSelectedTags(); 36 | void setSelectedTagsAsString(const QString& strTags); 37 | void setSelectedTags(QList& tags); 38 | bool m_bUpdating; 39 | 40 | private: 41 | bool m_bShowUntagged; 42 | 43 | signals: 44 | 45 | public slots: 46 | void updateTags(); 47 | void on_cellClicked(int row, int column); 48 | void changeColor(int row, int column); 49 | void toggleCheckedState(int row, int column); 50 | void ShowContextMenu(const QPoint& pos); 51 | //bool RenameSelectedTag(); 52 | void AddNewTag(); 53 | void AddTag(QString name, Qt::CheckState checkstate = Qt::Checked, QColor color = TagInfo::DefaultColor); 54 | void DeleteSelectedTag(); 55 | void DeleteTag(const QString& name); 56 | void SelectAll(); 57 | void DeselectAll(); 58 | }; 59 | 60 | #endif // BOOKMARKSTAGLIST_H 61 | -------------------------------------------------------------------------------- /src/qtgui/demod_options.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2011-2013 Alexandru Csete OZ9AEC. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #ifndef DEMOD_OPTIONS_H 24 | #define DEMOD_OPTIONS_H 25 | 26 | #include 27 | #include 28 | 29 | namespace Ui { 30 | class CDemodOptions; 31 | } 32 | 33 | 34 | /*! \brief Widget for adjusting demodulator options. 35 | * 36 | */ 37 | class CDemodOptions : public QDialog 38 | { 39 | Q_OBJECT 40 | 41 | public: 42 | 43 | /*! \brief Index in the QStackedWidget. */ 44 | enum page { 45 | PAGE_NO_OPT = 0, 46 | PAGE_FM_OPT = 1, 47 | PAGE_AM_OPT = 2, 48 | PAGE_CW_OPT = 3, 49 | PAGE_AMSYNC_OPT = 4, 50 | PAGE_NUM = 5 51 | }; 52 | 53 | explicit CDemodOptions(QWidget *parent = 0); 54 | ~CDemodOptions(); 55 | 56 | void closeEvent(QCloseEvent *event); 57 | 58 | void setCurrentPage(int index); 59 | int currentPage() const; 60 | 61 | void setCwOffset(int offset); 62 | int getCwOffset(void) const; 63 | 64 | void setMaxDev(float max_dev); 65 | float getMaxDev(void) const; 66 | 67 | void setEmph(double tau); 68 | double getEmph(void) const; 69 | 70 | void setPllBw(float pll_bw); 71 | float getPllBw(void) const; 72 | 73 | void setDcr(bool enabled); 74 | bool getDcr(void) const; 75 | 76 | void setSyncDcr(bool enabled); 77 | bool getSyncDcr(void) const; 78 | 79 | signals: 80 | /*! \brief Signal emitted when new FM deviation is selected. */ 81 | void fmMaxdevSelected(float max_dev); 82 | 83 | /*! \brief Signal emitted when new FM de-emphasis constant is selected. */ 84 | void fmEmphSelected(double tau); 85 | 86 | /*! \brief Signal emitted when AM DCR is toggled. */ 87 | void amDcrToggled(bool enabled); 88 | 89 | /*! \brief CW offset changed. */ 90 | void cwOffsetChanged(int offset); 91 | 92 | /*! \brief Signal emitted when AM-Sync DCR is toggled. */ 93 | void amSyncDcrToggled(bool enabled); 94 | 95 | /*! \brief Signal emitted when new PLL BW is selected. */ 96 | void amSyncPllBwSelected(float pll_bw); 97 | 98 | private slots: 99 | void on_maxdevSelector_activated(int index); 100 | void on_emphSelector_activated(int index); 101 | void on_dcrCheckBox_clicked(bool checked); 102 | void on_cwOffsetSpin_valueChanged(int value); 103 | void on_syncdcrCheckBox_clicked(bool checked); 104 | void on_pllBwSelector_activated(int index); 105 | 106 | private: 107 | Ui::CDemodOptions *ui; 108 | }; 109 | 110 | #endif // DEMOD_OPTIONS_H 111 | -------------------------------------------------------------------------------- /src/qtgui/dockbookmarks.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2013 Christian Lindner DL2VCL, Stefano Leucci. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #pragma once 24 | 25 | #include 26 | #include 27 | #include "qtgui/bookmarkstablemodel.h" 28 | #include 29 | 30 | namespace Ui { 31 | class DockBookmarks; 32 | } 33 | 34 | class ComboBoxDelegateModulation : public QItemDelegate 35 | { 36 | Q_OBJECT 37 | public: 38 | ComboBoxDelegateModulation(QObject *parent = 0); 39 | QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const; 40 | void setEditorData(QWidget *editor, const QModelIndex &index) const; 41 | void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const; 42 | }; 43 | 44 | class DockBookmarks : public QDockWidget 45 | { 46 | Q_OBJECT 47 | 48 | private: 49 | Ui::DockBookmarks *ui; 50 | QMenu* contextmenu; 51 | qint64 m_currentFrequency; 52 | bool m_updating; 53 | BookmarksTableModel *bookmarksTableModel; 54 | 55 | bool eventFilter(QObject* object, QEvent* event); 56 | 57 | public: 58 | explicit DockBookmarks(QWidget *parent = 0); 59 | ~DockBookmarks(); 60 | 61 | // ui->tableViewFrequencyList 62 | // ui->tableWidgetTagList 63 | QAction* actionAddBookmark; 64 | 65 | void updateTags(); 66 | void updateBookmarks(); 67 | void changeBookmarkTags(int row, int /*column*/); 68 | 69 | signals: 70 | void newBookmarkActivated(qint64, QString, int); 71 | 72 | public slots: 73 | void setNewFrequency(qint64 rx_freq); 74 | 75 | private slots: 76 | void activated(const QModelIndex & index ); 77 | void onDataChanged (const QModelIndex & topLeft, const QModelIndex & bottomRight); 78 | //void on_addButton_clicked(); 79 | //void on_delButton_clicked(); 80 | void on_tableWidgetTagList_itemChanged(QTableWidgetItem* item); 81 | void ShowContextMenu(const QPoint&pos); 82 | bool DeleteSelectedBookmark(); 83 | void doubleClicked(const QModelIndex & index); 84 | }; 85 | -------------------------------------------------------------------------------- /src/qtgui/dockbookmarks.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | DockBookmarks 4 | 5 | 6 | 7 | 0 8 | 0 9 | 585 10 | 248 11 | 12 | 13 | 14 | 15 | 200 16 | 0 17 | 18 | 19 | 20 | 21 | 322 22 | 117 23 | 24 | 25 | 26 | Qt::AllDockWidgetAreas 27 | 28 | 29 | Bookmarks 30 | 31 | 32 | 33 | 34 | 35 | 36 | Qt::Horizontal 37 | 38 | 39 | 40 | 41 | 1 42 | 0 43 | 44 | 45 | 46 | 47 | 100 48 | 10 49 | 50 | 51 | 52 | QAbstractItemView::AnyKeyPressed|QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked 53 | 54 | 55 | true 56 | 57 | 58 | false 59 | 60 | 61 | 62 | 63 | 64 | 0 65 | 0 66 | 67 | 68 | 69 | 70 | 100 71 | 0 72 | 73 | 74 | 75 | 76 | 16777215 77 | 16777215 78 | 79 | 80 | 81 | 82 | 0 83 | 0 84 | 85 | 86 | 87 | QAbstractItemView::EditKeyPressed 88 | 89 | 90 | true 91 | 92 | 93 | QAbstractItemView::SingleSelection 94 | 95 | 96 | QAbstractItemView::SelectRows 97 | 98 | 99 | 2 100 | 101 | 102 | false 103 | 104 | 105 | 30 106 | 107 | 108 | 18 109 | 110 | 111 | true 112 | 113 | 114 | false 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | BookmarksTagList 127 | QTableWidget 128 |
qtgui/bookmarkstaglist.h
129 |
130 |
131 | 132 | 133 |
134 | -------------------------------------------------------------------------------- /src/qtgui/dockrds.h: -------------------------------------------------------------------------------- 1 | #ifndef DOCKRDS_H 2 | #define DOCKRDS_H 3 | #include 4 | #include 5 | 6 | namespace Ui { 7 | class DockRDS; 8 | } 9 | 10 | 11 | class DockRDS : public QDockWidget 12 | { 13 | Q_OBJECT 14 | 15 | public: 16 | explicit DockRDS(QWidget *parent = 0); 17 | ~DockRDS(); 18 | 19 | public slots: 20 | void updateRDS(QString text, int type); 21 | void showEnabled(); 22 | void showDisabled(); 23 | void setEnabled(); 24 | void setDisabled(); 25 | void setRDSmode(bool cmd); 26 | 27 | private: 28 | void ClearTextFields(); 29 | 30 | signals: 31 | void rdsDecoderToggled(bool); 32 | void rdsPI(QString text); 33 | void stationChanged(QString); 34 | void radiotextChanged(QString); 35 | 36 | private slots: 37 | void on_rdsCheckbox_toggled(bool checked); 38 | 39 | private: 40 | Ui::DockRDS *ui; /*! The Qt designer UI file. */ 41 | }; 42 | 43 | #endif // DOCKRDS_H 44 | -------------------------------------------------------------------------------- /src/qtgui/dxc_options.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2020 Oliver Grossmann. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #ifndef DXC_OPTIONS_H 24 | #define DXC_OPTIONS_H 25 | 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | #include 33 | 34 | namespace Ui { 35 | class DXCOptions; 36 | } 37 | 38 | class DXCOptions : public QDialog 39 | { 40 | Q_OBJECT 41 | 42 | public: 43 | explicit DXCOptions(QWidget *parent = 0); 44 | ~DXCOptions(); 45 | 46 | void closeEvent(QCloseEvent *event); 47 | void showEvent(QShowEvent * event); 48 | void saveSettings(QSettings *settings); 49 | void readSettings(QSettings *settings); 50 | 51 | private slots: 52 | 53 | void on_pushButton_DXCConnect_clicked(); 54 | void on_pushButton_DXCDisconnect_clicked(); 55 | void connected(); 56 | void disconnected(); 57 | void readyToRead(); 58 | 59 | private: 60 | Ui::DXCOptions *ui; 61 | QTcpSocket *m_socket; 62 | }; 63 | 64 | #endif // DXC_OPTIONS_H 65 | -------------------------------------------------------------------------------- /src/qtgui/dxc_spots.cpp: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2020 Oliver Grossmann. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include "dxc_spots.h" 32 | #include 33 | #include 34 | 35 | DXCSpots* DXCSpots::m_pThis = 0; 36 | 37 | DXCSpots::DXCSpots() 38 | { 39 | } 40 | 41 | void DXCSpots::create() 42 | { 43 | m_pThis = new DXCSpots; 44 | } 45 | 46 | DXCSpots& DXCSpots::Get() 47 | { 48 | return *m_pThis; 49 | } 50 | 51 | void DXCSpots::add(DXCSpotInfo &info) 52 | { 53 | info.time = std::chrono::steady_clock::now(); 54 | // check only callsign, so if present remove and re-append 55 | // if check also frequency we can only change the time 56 | if (m_DXCSpotList.contains(info)) 57 | m_DXCSpotList.removeAt(m_DXCSpotList.indexOf(info)); 58 | m_DXCSpotList.append(info); 59 | std::stable_sort(m_DXCSpotList.begin(),m_DXCSpotList.end()); 60 | emit( dxcSpotsUpdated() ); 61 | QTimer::singleShot(m_DXCSpotTimeout, this, SLOT(checkSpotTimeout())); 62 | } 63 | 64 | void DXCSpots::checkSpotTimeout() 65 | { 66 | auto now = std::chrono::steady_clock::now(); 67 | for (int i = 0; i < m_DXCSpotList.size(); i++) 68 | { 69 | auto diff = std::chrono::duration_cast(now - m_DXCSpotList[i].time); 70 | if ( m_DXCSpotTimeout <= diff) 71 | { 72 | m_DXCSpotList.removeAt(i); 73 | } 74 | } 75 | std::stable_sort(m_DXCSpotList.begin(),m_DXCSpotList.end()); 76 | emit( dxcSpotsUpdated() ); 77 | } 78 | 79 | QList DXCSpots::getDXCSpotsInRange(qint64 low, qint64 high) 80 | { 81 | DXCSpotInfo info; 82 | info.frequency=low; 83 | QList::const_iterator lb = std::lower_bound(m_DXCSpotList.begin(), m_DXCSpotList.end(), info); 84 | info.frequency=high; 85 | QList::const_iterator ub = std::upper_bound(m_DXCSpotList.begin(), m_DXCSpotList.end(), info); 86 | 87 | QList found; 88 | 89 | while (lb != ub) 90 | { 91 | const DXCSpotInfo& info = *lb; 92 | found.append(info); 93 | lb++; 94 | } 95 | 96 | return found; 97 | } 98 | 99 | const QColor DXCSpotInfo::GetColor() const 100 | { 101 | return DXCSpotInfo::color; 102 | } 103 | -------------------------------------------------------------------------------- /src/qtgui/dxc_spots.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2020 Oliver Grossmann. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #ifndef DXC_SPOTS_H 24 | #define DXC_SPOTS_H 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | struct DXCSpotInfo 36 | { 37 | qint64 frequency; 38 | QString name; 39 | std::chrono::time_point time; 40 | QColor color; 41 | 42 | DXCSpotInfo() 43 | { 44 | this->frequency = 0; 45 | this->time = std::chrono::steady_clock::now(); 46 | this->color = Qt::lightGray; 47 | } 48 | 49 | bool operator<(const DXCSpotInfo &other) const 50 | { 51 | return frequency < other.frequency; 52 | } 53 | 54 | bool operator==(const DXCSpotInfo &other) const 55 | { 56 | // we check only the name because frequency can change a bit 57 | // not good for multi-operator with the case callsign 58 | return name == other.name; 59 | } 60 | 61 | const QColor GetColor() const; 62 | }; 63 | 64 | class DXCSpots : public QObject 65 | { 66 | Q_OBJECT 67 | public: 68 | // This is a Singleton Class now because you can not send qt-signals from static functions. 69 | static void create(); 70 | static DXCSpots& Get(); 71 | 72 | void add(DXCSpotInfo& info); 73 | void setSpotTimeout(int i) { m_DXCSpotTimeout = std::chrono::seconds(i * 60); } 74 | DXCSpotInfo& getDXCSpot(int i) { return m_DXCSpotList[i]; } 75 | QList getDXCSpotsInRange(qint64 low, qint64 high); 76 | 77 | private: 78 | DXCSpots(); // Singleton Constructor is private. 79 | QList m_DXCSpotList; 80 | std::chrono::seconds m_DXCSpotTimeout; 81 | static DXCSpots* m_pThis; 82 | 83 | private slots: 84 | void checkSpotTimeout(void); 85 | 86 | signals: 87 | void dxcSpotsUpdated(void); 88 | }; 89 | 90 | #endif // DXC_SPOTS_H 91 | -------------------------------------------------------------------------------- /src/qtgui/freqctrl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Frequency controller widget (originally from CuteSDR) 3 | */ 4 | #pragma once 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | enum FctlUnit { 11 | FCTL_UNIT_NONE, // Freq displayed without unit: 14.236.000 12 | FCTL_UNIT_HZ, 13 | FCTL_UNIT_KHZ, 14 | FCTL_UNIT_MHZ, 15 | FCTL_UNIT_GHZ, 16 | FCTL_UNIT_SEC, 17 | FCTL_UNIT_MSEC, 18 | FCTL_UNIT_USEC, 19 | FCTL_UNIT_NSEC 20 | }; 21 | 22 | #define FCTL_MAX_DIGITS 12 23 | #define FCTL_MIN_DIGITS 4 24 | 25 | class CFreqCtrl : public QFrame 26 | { 27 | Q_OBJECT 28 | 29 | public: 30 | explicit CFreqCtrl(QWidget *parent = 0); 31 | ~CFreqCtrl(); 32 | 33 | QSize minimumSizeHint() const; 34 | QSize sizeHint() const; 35 | 36 | // Use NumDigits=0 for auto 37 | void setup(int NumDigits, qint64 Minf, qint64 Maxf, int MinStep, 38 | FctlUnit unit); 39 | void setUnit(FctlUnit unit); 40 | void setDigitColor(QColor col); 41 | void setBgColor(QColor col); 42 | void setUnitsColor(QColor col); 43 | void setHighlightColor(QColor col); 44 | qint64 getFrequency() const 45 | { 46 | return m_freq; 47 | } 48 | 49 | void setResetLowerDigits(bool reset) 50 | { 51 | m_ResetLowerDigits = reset; 52 | } 53 | 54 | void setInvertScrolling(bool invert) 55 | { 56 | m_InvertScrolling = invert; 57 | } 58 | 59 | signals: 60 | void newFrequency(qint64 freq); // emitted when frequency has changed 61 | 62 | public slots: 63 | void setFrequency(qint64 freq); 64 | void setFrequencyFocus(); 65 | 66 | protected: 67 | void paintEvent(QPaintEvent *); 68 | void mouseMoveEvent(QMouseEvent *); 69 | void mousePressEvent(QMouseEvent *); 70 | void wheelEvent(QWheelEvent *); 71 | void leaveEvent(QEvent *); 72 | void keyPressEvent(QKeyEvent *); 73 | 74 | private: 75 | void drawBkGround(QPainter &Painter); 76 | void drawDigits(QPainter &Painter); 77 | void incDigit(); 78 | void decDigit(); 79 | void incFreq(); 80 | void decFreq(); 81 | void clearFreq(); 82 | void cursorHome(); 83 | void cursorEnd(); 84 | void moveCursorLeft(); 85 | void moveCursorRight(); 86 | bool inRect(QRect &rect, QPointF &point); 87 | void setActiveDigit(int idx); 88 | 89 | bool m_LRMouseFreqSel; /* Use left/right mouse buttons. If FALSE click area determines up/down. */ 90 | 91 | bool m_ResetLowerDigits; /* If TRUE digits below the active one will be reset to 0 92 | * when the active digit is incremented or decremented. */ 93 | bool m_InvertScrolling; 94 | 95 | int m_FirstEditableDigit; 96 | int m_LastLeadZeroPos; 97 | int m_LeadZeroPos; 98 | int m_NumDigits; 99 | int m_NumDigitsForUnit; // number of digits allocated for unit (kHz, MHz, ...) 100 | int m_DigStart; 101 | int m_ActiveEditDigit; 102 | int m_DecPos; 103 | int m_NumSeps; 104 | int m_CumWheelDelta; 105 | 106 | qint64 m_MinStep; 107 | qint64 m_freq; 108 | qint64 m_Oldfreq; 109 | qint64 m_MinFreq; 110 | qint64 m_MaxFreq; 111 | 112 | QColor m_DigitColor; 113 | QColor m_BkColor; 114 | QColor m_InactiveColor; 115 | QColor m_UnitsColor; 116 | QColor m_HighlightColor; 117 | 118 | FctlUnit m_Unit; 119 | 120 | QRect m_UnitsRect; // rectangle where Units text goes 121 | QRect m_SepRect[FCTL_MAX_DIGITS]; // separation rectangles for commas, decimal point, etc. 122 | 123 | QString m_UnitString; 124 | 125 | QFont m_DigitFont; 126 | QFont m_UnitsFont; 127 | 128 | struct DigStuct { 129 | qint64 weight; // decimal weight of this digit 130 | qint64 incval; // value this digit increments or decrements 131 | QRect dQRect; // Digit bounding rectangle 132 | int val; // value of this digit(0-9) 133 | } m_DigitInfo[FCTL_MAX_DIGITS]; 134 | }; 135 | -------------------------------------------------------------------------------- /src/qtgui/ioconfig.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2011-2014 Alexandru Csete OZ9AEC. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #ifndef IOCONFIG_H 24 | #define IOCONFIG_H 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | #ifdef WITH_PULSEAUDIO 31 | #include "pulseaudio/pa_device_list.h" 32 | #elif WITH_PORTAUDIO 33 | #include "portaudio/device_list.h" 34 | #elif defined(Q_OS_DARWIN) 35 | #include "osxaudio/device_list.h" 36 | #endif 37 | 38 | 39 | namespace Ui { 40 | class CIoConfig; 41 | } 42 | 43 | /** @brief Input/output device configurator. */ 44 | class CIoConfig : public QDialog 45 | { 46 | Q_OBJECT 47 | 48 | public: 49 | explicit CIoConfig(QSettings *settings, std::map &devList, QWidget *parent = 0); 50 | virtual ~CIoConfig(); 51 | static void getDeviceList(std::map &devList); 52 | 53 | private slots: 54 | void saveConfig(); 55 | void inputDeviceSelected(int index); 56 | void inputDevstrChanged(const QString &text); 57 | void inputRateChanged(const QString &text); 58 | void decimationChanged(int index); 59 | void onScanButtonClicked(); 60 | 61 | private: 62 | void updateInputSampleRates(int rate); 63 | void updateDecimations(void); 64 | void updateInDev(const QSettings *settings, const std::map &devList); 65 | void updateOutDev(); 66 | int idx2decim(int idx) const; 67 | int decim2idx(int decim) const; 68 | static std::string escapeDevstr(std::string devstr); 69 | 70 | private: 71 | Ui::CIoConfig *ui; 72 | QSettings *m_settings; 73 | QPushButton *m_scanButton; 74 | std::map *m_devList; // will point to devList from constructor 75 | 76 | #ifdef WITH_PULSEAUDIO 77 | vector outDevList; 78 | #elif WITH_PORTAUDIO 79 | vector outDevList; 80 | #elif defined(Q_OS_DARWIN) 81 | vector outDevList; 82 | #endif 83 | 84 | }; 85 | 86 | #endif // IOCONFIG_H 87 | -------------------------------------------------------------------------------- /src/qtgui/iq_tool.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2014 Alexandru Csete OZ9AEC. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #ifndef IQ_TOOL_H 24 | #define IQ_TOOL_H 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | namespace Ui { 36 | class CIqTool; 37 | } 38 | 39 | 40 | struct iqt_cplx 41 | { 42 | float re; 43 | float im; 44 | }; 45 | 46 | 47 | /*! \brief User interface for I/Q recording and playback. */ 48 | class CIqTool : public QDialog 49 | { 50 | Q_OBJECT 51 | 52 | public: 53 | explicit CIqTool(QWidget *parent = 0); 54 | ~CIqTool(); 55 | 56 | void setSampleRate(qint64 sr); 57 | 58 | void closeEvent(QCloseEvent *event); 59 | void showEvent(QShowEvent * event); 60 | 61 | void saveSettings(QSettings *settings); 62 | void readSettings(QSettings *settings); 63 | 64 | signals: 65 | void startRecording(const QString recdir, const QString format); 66 | void stopRecording(); 67 | void startPlayback(const QString filename, float samprate, qint64 center_freq); 68 | void stopPlayback(); 69 | void seek(qint64 seek_pos); 70 | 71 | public slots: 72 | void cancelRecording(); 73 | void cancelPlayback(); 74 | void startIqRecorder(void); /*!< Used if IQ Recorder is started e.g. from remote control */ 75 | void stopIqRecorder(void); /*!< Used if IQ Recorder is stopped e.g. from remote control */ 76 | 77 | private slots: 78 | void on_recDirEdit_textChanged(const QString &text); 79 | void on_recDirButton_clicked(); 80 | void on_recButton_clicked(bool checked); 81 | void on_playButton_clicked(bool checked); 82 | void on_slider_valueChanged(int value); 83 | void on_listWidget_currentTextChanged(const QString ¤tText); 84 | void timeoutFunction(void); 85 | 86 | private: 87 | void refreshDir(void); 88 | void refreshTimeWidgets(void); 89 | void parseFileName(const QString &filename); 90 | 91 | private: 92 | Ui::CIqTool *ui; 93 | 94 | QDir *recdir; 95 | QTimer *timer; 96 | QPalette *error_palette; /*!< Palette used to indicate an error. */ 97 | 98 | QString current_file; /*!< Selected file in file browser. */ 99 | 100 | bool is_recording; 101 | bool is_playing; 102 | int bytes_per_sample; /*!< Bytes per sample (fc = 4) */ 103 | int sample_rate; /*!< Current sample rate. */ 104 | qint64 center_freq; /*!< Center frequency. */ 105 | int rec_len; /*!< Length of a recording in seconds */ 106 | }; 107 | 108 | #endif // IQ_TOOL_H 109 | -------------------------------------------------------------------------------- /src/qtgui/meter.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* + + + This Software is released under the "Simplified BSD License" + + + 3 | * 4 | * Copyright 2010 Moe Wheatley. All rights reserved. 5 | * Copyright 2011-2013 Alexandru Csete OZ9AEC. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY Moe Wheatley ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 20 | * EVENT SHALL Moe Wheatley OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 23 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 24 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 25 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 26 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | * The views and conclusions contained in the software and documentation are 29 | * those of the authors and should not be interpreted as representing official 30 | * policies, either expressed or implied, of Moe Wheatley. 31 | */ 32 | #pragma once 33 | 34 | #include 35 | #include 36 | 37 | class CMeter : public QFrame 38 | { 39 | Q_OBJECT 40 | 41 | public: 42 | explicit CMeter(QWidget *parent = 0); 43 | ~CMeter(); 44 | 45 | QSize minimumSizeHint() const; 46 | QSize sizeHint() const; 47 | 48 | public slots: 49 | void setLevel(float dbfs); 50 | void setSqlLevel(float dbfs); 51 | 52 | protected: 53 | void paintEvent(QPaintEvent *event); 54 | 55 | private: 56 | void draw(QPainter &painter); 57 | void drawOverlay(QPainter &painter); 58 | 59 | float m_dBFS; 60 | float m_Sql; 61 | QFont m_font; 62 | }; 63 | -------------------------------------------------------------------------------- /src/qtgui/nb_options.cpp: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2013 Alexandru Csete OZ9AEC. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #include "nb_options.h" 24 | #include "ui_nb_options.h" 25 | 26 | CNbOptions::CNbOptions(QWidget *parent) : 27 | QDialog(parent), 28 | ui(new Ui::CNbOptions) 29 | { 30 | ui->setupUi(this); 31 | } 32 | 33 | CNbOptions::~CNbOptions() 34 | { 35 | delete ui; 36 | } 37 | 38 | /*! \brief Catch window close events. 39 | * 40 | * This method is called when the user closes the dialog window using the 41 | * window close icon. We catch the event and hide the dialog but keep it 42 | * around for later use. 43 | */ 44 | void CNbOptions::closeEvent(QCloseEvent *event) 45 | { 46 | hide(); 47 | event->ignore(); 48 | } 49 | 50 | double CNbOptions::nbThreshold(int nbid) 51 | { 52 | if (nbid == 1) 53 | return ui->nb1Threshold->value(); 54 | else 55 | return ui->nb2Threshold->value(); 56 | } 57 | 58 | void CNbOptions::on_nb1Threshold_valueChanged(double val) 59 | { 60 | emit thresholdChanged(1, val); 61 | } 62 | 63 | void CNbOptions::on_nb2Threshold_valueChanged(double val) 64 | { 65 | emit thresholdChanged(2, val); 66 | } 67 | -------------------------------------------------------------------------------- /src/qtgui/nb_options.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2013 Alexandru Csete OZ9AEC. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #ifndef NB_OPTIONS_H 24 | #define NB_OPTIONS_H 25 | 26 | #include 27 | #include 28 | 29 | namespace Ui { 30 | class CNbOptions; 31 | } 32 | 33 | class CNbOptions : public QDialog 34 | { 35 | Q_OBJECT 36 | 37 | public: 38 | explicit CNbOptions(QWidget *parent = 0); 39 | ~CNbOptions(); 40 | 41 | void closeEvent(QCloseEvent *event); 42 | 43 | double nbThreshold(int nbid); 44 | 45 | signals: 46 | void thresholdChanged(int nb, double val); 47 | 48 | private slots: 49 | void on_nb1Threshold_valueChanged(double val); 50 | void on_nb2Threshold_valueChanged(double val); 51 | 52 | private: 53 | Ui::CNbOptions *ui; 54 | }; 55 | 56 | #endif // NB_OPTIONS_H 57 | -------------------------------------------------------------------------------- /src/qtgui/nb_options.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | CNbOptions 4 | 5 | 6 | 7 | 0 8 | 0 9 | 176 10 | 105 11 | 12 | 13 | 14 | Noise blanker options 15 | 16 | 17 | 18 | :/icons/icons/signal.svg:/icons/icons/signal.svg 19 | 20 | 21 | 22 | 23 | 24 | 1 25 | 26 | 27 | 1.000000000000000 28 | 29 | 30 | 20.000000000000000 31 | 32 | 33 | 0.100000000000000 34 | 35 | 36 | 3.300000000000000 37 | 38 | 39 | 40 | 41 | 42 | 43 | 1 44 | 45 | 46 | 15.000000000000000 47 | 48 | 49 | 0.100000000000000 50 | 51 | 52 | 2.500000000000000 53 | 54 | 55 | 56 | 57 | 58 | 59 | NB1 threshold 60 | 61 | 62 | Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter 63 | 64 | 65 | 66 | 67 | 68 | 69 | NB2 threshold 70 | 71 | 72 | Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /src/qtgui/qtcolorpicker.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** This file is part of a Qt Solutions component. 4 | ** 5 | ** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 6 | ** 7 | ** Contact: Qt Software Information (qt-info@nokia.com) 8 | ** 9 | ** Commercial Usage 10 | ** Licensees holding valid Qt Commercial licenses may use this file in 11 | ** accordance with the Qt Solutions Commercial License Agreement provided 12 | ** with the Software or, alternatively, in accordance with the terms 13 | ** contained in a written agreement between you and Nokia. 14 | ** 15 | ** GNU Lesser General Public License Usage 16 | ** Alternatively, this file may be used under the terms of the GNU Lesser 17 | ** General Public License version 2.1 as published by the Free Software 18 | ** Foundation and appearing in the file LICENSE.LGPL included in the 19 | ** packaging of this file. Please review the following information to 20 | ** ensure the GNU Lesser General Public License version 2.1 requirements 21 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 | ** 23 | ** In addition, as a special exception, Nokia gives you certain 24 | ** additional rights. These rights are described in the Nokia Qt LGPL 25 | ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 | ** package. 27 | ** 28 | ** GNU General Public License Usage 29 | ** Alternatively, this file may be used under the terms of the GNU 30 | ** General Public License version 3.0 as published by the Free Software 31 | ** Foundation and appearing in the file LICENSE.GPL included in the 32 | ** packaging of this file. Please review the following information to 33 | ** ensure the GNU General Public License version 3.0 requirements will be 34 | ** met: http://www.gnu.org/copyleft/gpl.html. 35 | ** 36 | ** Please note Third Party Software included with Qt Solutions may impose 37 | ** additional restrictions and it is the user's responsibility to ensure 38 | ** that they have met the licensing requirements of the GPL, LGPL, or Qt 39 | ** Solutions Commercial license and the relevant license of the Third 40 | ** Party Software they are using. 41 | ** 42 | ** If you are unsure which license is appropriate for your use, please 43 | ** contact the sales department at qt-sales@nokia.com. 44 | ** 45 | ****************************************************************************/ 46 | 47 | #ifndef QTCOLORPICKER_H 48 | #define QTCOLORPICKER_H 49 | #include 50 | #include 51 | #include 52 | 53 | #include 54 | #include 55 | #include 56 | 57 | #if defined(Q_WS_WIN) 58 | # if !defined(QT_QTCOLORPICKER_EXPORT) && !defined(QT_QTCOLORPICKER_IMPORT) 59 | # define QT_QTCOLORPICKER_EXPORT 60 | # elif defined(QT_QTCOLORPICKER_IMPORT) 61 | # if defined(QT_QTCOLORPICKER_EXPORT) 62 | # undef QT_QTCOLORPICKER_EXPORT 63 | # endif 64 | # define QT_QTCOLORPICKER_EXPORT __declspec(dllimport) 65 | # elif defined(QT_QTCOLORPICKER_EXPORT) 66 | # undef QT_QTCOLORPICKER_EXPORT 67 | # define QT_QTCOLORPICKER_EXPORT __declspec(dllexport) 68 | # endif 69 | #else 70 | # define QT_QTCOLORPICKER_EXPORT 71 | #endif 72 | 73 | class ColorPickerPopup; 74 | 75 | class QT_QTCOLORPICKER_EXPORT QtColorPicker : public QPushButton 76 | { 77 | Q_OBJECT 78 | 79 | Q_PROPERTY(bool colorDialog READ colorDialogEnabled WRITE setColorDialogEnabled) 80 | 81 | public: 82 | QtColorPicker(QWidget *parent = 0, 83 | int columns = -1, bool enableColorDialog = true); 84 | 85 | ~QtColorPicker(); 86 | 87 | void insertColor(const QColor &color, const QString &text = QString(), int index = -1); 88 | 89 | QColor currentColor() const; 90 | 91 | QColor color(int index) const; 92 | 93 | void setColorDialogEnabled(bool enabled); 94 | bool colorDialogEnabled() const; 95 | 96 | void setStandardColors(); 97 | 98 | static QColor getColor(const QPoint &pos, bool allowCustomColors = true); 99 | 100 | public slots: 101 | void setCurrentColor(const QColor &col); 102 | 103 | signals: 104 | void colorChanged(const QColor &); 105 | 106 | protected: 107 | void paintEvent(QPaintEvent *e); 108 | 109 | private slots: 110 | void buttonPressed(bool toggled); 111 | void popupClosed(); 112 | 113 | private: 114 | ColorPickerPopup *popup; 115 | QColor col; 116 | bool withColorDialog; 117 | bool dirty; 118 | bool firstInserted; 119 | }; 120 | 121 | #endif 122 | -------------------------------------------------------------------------------- /src/receivers/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ####################################################################################################################### 2 | # Add the source files to SRCS_LIST 3 | add_source_files(SRCS_LIST 4 | nbrx.cpp 5 | nbrx.h 6 | receiver_base.cpp 7 | receiver_base.h 8 | wfmrx.cpp 9 | wfmrx.h 10 | ) 11 | -------------------------------------------------------------------------------- /src/receivers/receiver_base.cpp: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2012 Alexandru Csete OZ9AEC. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #include 24 | #include "receivers/receiver_base.h" 25 | 26 | 27 | static const int MIN_IN = 1; /* Minimum number of input streams. */ 28 | static const int MAX_IN = 1; /* Maximum number of input streams. */ 29 | static const int MIN_OUT = 2; /* Minimum number of output streams. */ 30 | static const int MAX_OUT = 2; /* Maximum number of output streams. */ 31 | 32 | receiver_base_cf::receiver_base_cf(std::string src_name) 33 | : gr::hier_block2 (src_name, 34 | gr::io_signature::make (MIN_IN, MAX_IN, sizeof(gr_complex)), 35 | gr::io_signature::make (MIN_OUT, MAX_OUT, sizeof(float))) 36 | { 37 | 38 | } 39 | 40 | receiver_base_cf::~receiver_base_cf() 41 | { 42 | 43 | } 44 | 45 | bool receiver_base_cf::has_nb() 46 | { 47 | return false; 48 | } 49 | 50 | void receiver_base_cf::set_nb_on(int nbid, bool on) 51 | { 52 | (void) nbid; 53 | (void) on; 54 | } 55 | 56 | void receiver_base_cf::set_nb_threshold(int nbid, float threshold) 57 | { 58 | (void) nbid; 59 | (void) threshold; 60 | } 61 | 62 | bool receiver_base_cf::has_sql() 63 | { 64 | return false; 65 | } 66 | 67 | void receiver_base_cf::set_sql_level(double level_db) 68 | { 69 | (void) level_db; 70 | } 71 | 72 | void receiver_base_cf::set_sql_alpha(double alpha) 73 | { 74 | (void) alpha; 75 | } 76 | 77 | bool receiver_base_cf::has_agc() 78 | { 79 | return false; 80 | } 81 | 82 | void receiver_base_cf::set_agc_on(bool agc_on) 83 | { 84 | (void) agc_on; 85 | } 86 | 87 | void receiver_base_cf::set_agc_hang(bool use_hang) 88 | { 89 | (void) use_hang; 90 | } 91 | 92 | void receiver_base_cf::set_agc_threshold(int threshold) 93 | { 94 | (void) threshold; 95 | } 96 | 97 | void receiver_base_cf::set_agc_slope(int slope) 98 | { 99 | (void) slope; 100 | } 101 | 102 | void receiver_base_cf::set_agc_decay(int decay_ms) 103 | { 104 | (void) decay_ms; 105 | } 106 | 107 | void receiver_base_cf::set_agc_manual_gain(int gain) 108 | { 109 | (void) gain; 110 | } 111 | 112 | bool receiver_base_cf::has_fm() 113 | { 114 | return false; 115 | } 116 | 117 | void receiver_base_cf::set_fm_maxdev(float maxdev_hz) 118 | { 119 | (void) maxdev_hz; 120 | } 121 | 122 | void receiver_base_cf::set_fm_deemph(double tau) 123 | { 124 | (void) tau; 125 | } 126 | 127 | bool receiver_base_cf::has_am() 128 | { 129 | return false; 130 | } 131 | 132 | void receiver_base_cf::set_am_dcr(bool enabled) 133 | { 134 | (void) enabled; 135 | } 136 | 137 | bool receiver_base_cf::has_amsync() 138 | { 139 | return false; 140 | } 141 | 142 | void receiver_base_cf::set_amsync_dcr(bool enabled) 143 | { 144 | (void) enabled; 145 | } 146 | 147 | void receiver_base_cf::set_amsync_pll_bw(float pll_bw) 148 | { 149 | (void) pll_bw; 150 | } 151 | 152 | void receiver_base_cf::get_rds_data(std::string &outbuff, int &num) 153 | { 154 | (void) outbuff; 155 | (void) num; 156 | } 157 | 158 | void receiver_base_cf::start_rds_decoder() 159 | { 160 | } 161 | 162 | void receiver_base_cf::stop_rds_decoder() 163 | { 164 | } 165 | 166 | void receiver_base_cf::reset_rds_parser() 167 | { 168 | } 169 | 170 | bool receiver_base_cf::is_rds_decoder_active() 171 | { 172 | return false; 173 | } 174 | -------------------------------------------------------------------------------- /src/receivers/receiver_base.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 | * https://gqrx.dk/ 5 | * 6 | * Copyright 2012-2013 Alexandru Csete OZ9AEC. 7 | * 8 | * Gqrx is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3, or (at your option) 11 | * any later version. 12 | * 13 | * Gqrx is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Gqrx; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | #ifndef RECEIVER_BASE_H 24 | #define RECEIVER_BASE_H 25 | 26 | #include 27 | 28 | 29 | class receiver_base_cf; 30 | 31 | #if GNURADIO_VERSION < 0x030900 32 | typedef boost::shared_ptr receiver_base_cf_sptr; 33 | #else 34 | typedef std::shared_ptr receiver_base_cf_sptr; 35 | #endif 36 | 37 | 38 | /*! \brief Base class for receivers that output audio. 39 | * \ingroup RX 40 | * 41 | * This block provides a base class and common interface for receivers that 42 | * output audio (or other kind of float data). 43 | * 44 | */ 45 | class receiver_base_cf : public gr::hier_block2 46 | { 47 | 48 | public: 49 | /*! \brief Public constructor. 50 | * \param src_name Descriptive name used in the constructor of gr::hier_block2 51 | */ 52 | receiver_base_cf(std::string src_name); 53 | virtual ~receiver_base_cf(); 54 | 55 | virtual bool start() = 0; 56 | virtual bool stop() = 0; 57 | 58 | virtual void set_quad_rate(float quad_rate) = 0; 59 | 60 | virtual void set_filter(double low, double high, double tw) = 0; 61 | virtual void set_cw_offset(double offset) = 0; 62 | 63 | virtual float get_signal_level() = 0; 64 | 65 | virtual void set_demod(int demod) = 0; 66 | 67 | /* the rest is optional */ 68 | 69 | /* Noise blanker */ 70 | virtual bool has_nb(); 71 | virtual void set_nb_on(int nbid, bool on); 72 | virtual void set_nb_threshold(int nbid, float threshold); 73 | 74 | /* Squelch parameter */ 75 | virtual bool has_sql(); 76 | virtual void set_sql_level(double level_db); 77 | virtual void set_sql_alpha(double alpha); 78 | 79 | /* AGC */ 80 | virtual bool has_agc(); 81 | virtual void set_agc_on(bool agc_on); 82 | virtual void set_agc_hang(bool use_hang); 83 | virtual void set_agc_threshold(int threshold); 84 | virtual void set_agc_slope(int slope); 85 | virtual void set_agc_decay(int decay_ms); 86 | virtual void set_agc_manual_gain(int gain); 87 | 88 | /* FM parameters */ 89 | virtual bool has_fm(); 90 | virtual void set_fm_maxdev(float maxdev_hz); 91 | virtual void set_fm_deemph(double tau); 92 | 93 | /* AM parameters */ 94 | virtual bool has_am(); 95 | virtual void set_am_dcr(bool enabled); 96 | 97 | /* AM-Sync parameters */ 98 | virtual bool has_amsync(); 99 | virtual void set_amsync_dcr(bool enabled); 100 | virtual void set_amsync_pll_bw(float pll_bw); 101 | 102 | virtual void get_rds_data(std::string &outbuff, int &num); 103 | virtual void start_rds_decoder(); 104 | virtual void stop_rds_decoder(); 105 | virtual void reset_rds_parser(); 106 | virtual bool is_rds_decoder_active(); 107 | 108 | }; 109 | 110 | #endif // RECEIVER_BASE_H 111 | --------------------------------------------------------------------------------