1
0
mirror of https://github.com/JvanKatwijk/dabradio synced 2025-10-05 15:52:42 +02:00

first commit

This commit is contained in:
JvanKatwijk
2018-03-06 20:05:31 +01:00
commit ea6f006b3e
228 changed files with 51365 additions and 0 deletions

74
.travis.yml Normal file
View File

@@ -0,0 +1,74 @@
language: c++
compiler: gcc
sudo: require
dist: trusty
before_install:
- sudo add-apt-repository ppa:beineri/opt-qt532-trusty -y
- sudo apt-get update -qq
install:
- sudo apt-get install qt4-qmake build-essential g++
- sudo apt-get install libsndfile1-dev qt4-default libfftw3-dev portaudio19-dev
- sudo apt-get install libfaad-dev zlib1g-dev libusb-1.0-0-dev mesa-common-dev
- sudo apt-get install libgl1-mesa-dev libqt4-opengl-dev libsamplerate-dev libqwt-dev
- cp CMakeLists.txt-qt4 CMakeLists.txt
script:
- # sed -i -e 's|CONFIG.*sdrplay||g' qt-dab.pro
- # sed -i -e 's|CONFIG.*airspy||g' qt-dab.pro
- # sed -i -e 's|CONFIG.*spectrum||g' qt-dab.pro
- cmake . -DDABSTICK=ON -DAIRSPY=ON -DSDRPLAY=ON -DSPECTRUM=ON -DCMAKE_INSTALL_PREFIX=/usr
- make -j4
- # sudo make DESTIDR=appdir install ; sudo chown -R $USER appdir ; find appdir/
- ls -lh .
- mkdir -p appdir/usr/bin
- cp qt-dab-1.0-alpha appdir/usr/bin/qt-dab
- mkdir -p appdir/usr/lib
- mkdir -p appdir/usr/share/applications ; cp qt-dab.desktop appdir/usr/share/applications
- cp screenshot_qt-dab.png appdir/qt-dab.png
- touch appdir/qt-dab.png # Dear upstream developers, please provide an application icon
- wget http://sm5bsz.com/linuxdsp/hware/rtlsdr/rtl-sdr-linrad4.tbz
- tar xvfj rtl-sdr-linrad4.tbz
- cd rtl-sdr-linrad4
- mkdir build
- cd build
- cmake .. -DDETACH_KERNEL_DRIVER=ON -DCMAKE_INSTALL_PREFIX=../../appdir/usr
- make
- make install
- cd ..
- cd ..
- sudo apt-get install build-essential cmake libusb-1.0-0-dev pkg-config
- wget https://github.com/airspy/host/archive/master.zip
- unzip master.zip
- cd airspyone_host-master
- mkdir build
- cd build
# udev rules are installed separately
- cmake ../ -DCMAKE_INSTALL_PREFIX=../../appdir/usr
- make
- make install
- cd ..
- cd ..
- ls -l appdir/usr/lib
after_success:
- wget -c "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage"
- chmod a+x linuxdeployqt*.AppImage
- unset QTDIR; unset QT_PLUGIN_PATH ; unset LD_LIBRARY_PATH
- ./linuxdeployqt*.AppImage ./appdir/usr/share/applications/* -bundle-non-qt-libs
- # Workaround for https://github.com/probonopd/linuxdeployqt/issues/31#issuecomment-289267637
- ./linuxdeployqt*.AppImage --appimage-extract
- find appdir/usr/plugins/ -type f -exec squashfs-root/usr/bin/patchelf --set-rpath '$ORIGIN/../../lib' {} \;
- ./linuxdeployqt*.AppImage ./appdir/usr/share/applications/* -bundle-non-qt-libs
- # Workaround for https://github.com/JvanKatwijk/qt-dab/issues/34
- # find /usr/lib/ -type f -name librtlsdr.so* -exec cp {} appdir/usr/lib/librtlsdr.so \;
- chmod a+x appimage/* ; rm appdir/AppRun ; cp appimage/* appdir/
- export PATH=squashfs-root/usr/bin/:$PATH # Make it pick up our private patched mksquashfs; https://github.com/plougher/squashfs-tools/pull/13/files
- squashfs-root/usr/bin/appimagetool $(readlink -f ./appdir/)
- find ./appdir -executable -type f -exec ldd {} \; | grep " => /usr" | cut -d " " -f 2-3 | sort | uniq
- curl --upload-file ./Qt_DAB*.AppImage https://transfer.sh/Qt_DAB-git.$(git rev-parse --short HEAD)-x86_64.AppImage
- wget -c https://github.com/probonopd/uploadtool/raw/master/upload.sh
- bash ./upload.sh ./Qt_DAB*.AppImage

15
AUTHORS Normal file
View File

@@ -0,0 +1,15 @@
Qt-DAB is written and maintained by
Jan van Katwijk
Lazy Chair Computing
with many thanks to
Stefan Pöschel
probonopd
and especially to
Andreas Mikula
and
Athanasios Oikonomou
for continuous and valuable input.

539
CMakeLists.txt Normal file
View File

@@ -0,0 +1,539 @@
cmake_minimum_required( VERSION 2.8.11 )
set (objectName dabradio)
set (CMAKE_CXX_FLAGS "${CMAKE_XCC_FLAGS} -Wall -std=c++11 -flto")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -flto")
set(CMAKE_AUTORCC ON)
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set (CMAKE_INSTALL_PREFIX "/usr/local/bin" CACHE PATH "default install path" FORCE )
endif()
#set (CMAKE_INSTALL_PREFIX /usr/local/bin)
# modify if you want
if(MINGW)
add_definitions ( -municode)
endif()
IF(EXISTS (".git") AND IS_DIRECTORY (".git"))
execute_process (
COMMAND git rev-parse --short HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif ()
if(GIT_COMMIT_HASH)
add_definitions("-DGITHASH=\"${GIT_COMMIT_HASH}\"")
else ()
add_definitions ("-DGITHASH=\" \"")
endif()
########################################################################
# select the release build type by default to get optimization flags
########################################################################
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
message(STATUS "Build type not specified: defaulting to release.")
endif(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "")
### make sure our local CMake Modules path comes first
list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake/Modules)
######################################################################
#
#####################################################################
#
# default value
set(USE_PORTAUDIO true)
if(DEFINED AIRSPY)
set(AIRSPY true)
endif ()
if(DEFINED SDRPLAY)
set(SDRPLAY true)
endif ()
if(DEFINED RTLSDR)
set(RTLSDR true)
endif ()
if(DEFINED RTLTCP)
set(RTLTCP true)
endif ()
#add_definitions (-DTHREADED_DECODING) # uncomment for use for an RPI
#
########################################################################
find_package (PkgConfig)
find_package (LSBId)
find_package (Qt5Core REQUIRED)
find_package (Qt5Widgets REQUIRED)
find_package (Qt5Network REQUIRED)
include_directories (
${Qt5Network_INCLUDE_DIRS}
)
find_package(FFTW3f)
if (NOT FFTW3F_FOUND)
message(FATAL_ERROR "please install FFTW3")
endif ()
find_package(Faad)
if (NOT FAAD_FOUND )
message(FATAL_ERROR "please install libfaad")
endif ()
find_package(zlib)
if (NOT ZLIB_FOUND)
message(FATAL_ERROR "please install libz")
endif ()
list(APPEND extraLibs ${ZLIB_LIBRARY})
find_package(LibSndFile)
if (NOT LIBSNDFILE_FOUND)
message(FATAL_ERROR "please install libsndfile")
endif ()
list(APPEND extraLibs ${LIBSNDFILE_LIBRARY})
find_package(LibSampleRate)
if (NOT LIBSAMPLERATE_FOUND)
message(FATAL_ERROR "please install libsamplerate")
endif ()
list(APPEND extraLibs ${LIBSAMPLERATE_LIBRARY})
find_library (PTHREADS pthread)
if (NOT(PTHREADS))
message (FATAL_ERROR "please install libpthread")
else (NOT(PTHREADS))
set (extraLibs ${extraLibs} ${PTHREADS})
endif (NOT(PTHREADS))
#######################################################################
#
# Here we really start
include_directories (
${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}
${QT5Widgets_INCLUDES}
${QT_QTCORE_INCLUDE_DIR}
${QT_QTGUI_INCLUDE_DIR}
.
./
./includes
./dab-scope
./includes/ofdm
./includes/backend
./includes/backend/viterbi_768
./includes/backend/audio
./includes/backend/data
./includes/backend/data/journaline
./includes/various
./includes/output
./includes/scopes-qwt6
./devices
./devices/rawfiles
./devices/wavfiles
/usr/include/
)
set (${objectName}_HDRS
./dab-processor.h
./dab-scope/spectrum-handler.h
./includes/ofdm/sample-reader.h
./includes/dab-constants.h
./includes/ofdm/phasereference.h
./includes/ofdm/phasetable.h
./includes/ofdm/freq-interleaver.h
./includes/backend/viterbi_768/viterbi-768.h
./includes/backend/protection.h
./includes/backend/uep-protection.h
./includes/backend/eep-protection.h
./includes/backend/firecode-checker.h
./includes/backend/frame-processor.h
./includes/backend/charsets.h
./includes/backend/galois.h
./incluces/backend/reed-solomon.h
./includes/backend/msc-handler.h
./includes/backend/virtual-backend.h
./includes/backend/audio-backend.h
./includes/backend/data-backend.h
./includes/backend/audio/faad-decoder.h
./includes/backend/audio/mp4processor.h
./includes/backend/audio/mp2processor.h
./includes/backend/data/mot-databuilder.h
./includes/backend/data/virtual-datahandler.h
./includes/backend/data/pad-handler.h
./includes/backend/data/mot-data.h
./includes/backend/data/data-processor.h
./devices/virtual-input.h
./devices/rawfiles/rawfiles.h
./devices/wavfiles/wavfiles.h
./includes/output/fir-filters.h
./includes/output/audio-base.h
./includes/output/newconverter.h
./includes/various/fft-handler.h
./includes/various/ringbuffer.h
./includes/various/Xtan2.h
./includes/various/dab-params.h
./includes/various/band-handler.h
./includes/various/text-mapper.h
)
set (${objectName}_SRCS
${${objectName}_SRCS}
./main.cpp
./dab-processor.cpp
./dab-scope/spectrum-handler.cpp
./src/ofdm/sample-reader.cpp
./src/ofdm/ofdm-decoder.cpp
./src/ofdm/phasereference.cpp
./src/ofdm/phasetable.cpp
./src/ofdm/freq-interleaver.cpp
./src/backend/viterbi_768/viterbi-768.cpp
./src/backend/viterbi_768/spiral-no-sse.c
./src/backend/fic-handler.cpp
./src/backend/protection.cpp
./src/backend/eep-protection.cpp
./src/backend/uep-protection.cpp
./src/backend/fib-processor.cpp
./src/backend/firecode-checker.cpp
./src/backend/frame-processor.cpp
./src/backend/protTables.cpp
./src/backend/charsets.cpp
./src/backend/galois.cpp
./src/backend/reed-solomon.cpp
./src/backend/msc-handler.cpp
./src/backend/virtual-backend.cpp
./src/backend/audio-backend.cpp
./src/backend/data-backend.cpp
./src/backend/audio/faad-decoder.cpp
./src/backend/audio/mp4processor.cpp
./src/backend/audio/mp2processor.cpp
./src/backend/data/mot-databuilder.cpp
./src/backend/data/virtual-datahandler.cpp
./src/backend/data/pad-handler.cpp
./src/backend/data/mot-data.cpp
./src/backend/data/data-processor.cpp
./devices/virtual-input.cpp
./devices/rawfiles/rawfiles.cpp
./devices/wavfiles/wavfiles.cpp
./src/output/audio-base.cpp
./src/output/newconverter.cpp
./src/output/fir-filters.cpp
./src/various/fft-handler.cpp
./src/various/Xtan2.cpp
./src/various/dab-params.cpp
./src/various/band-handler.cpp
./src/various/text-mapper.cpp
)
set (${objectName}_MOCS
./dab-processor.h
./includes/output/audio-base.h
./includes/ofdm/sample-reader.h
./includes/ofdm/ofdm-decoder.h
./includes/ofdm/phasereference.h
./includes/backend/fic-handler.h
./includes/backend/fib-processor.h
./includes/backend/data-backend.h
./includes/backend/audio/faad-decoder.h
./includes/backend/audio/mp2processor.h
./includes/backend/audio/mp4processor.h
./includes/backend/data/virtual-datahandler.h
./includes/backend/data/pad-handler.h
./includes/backend/data/mot-data.h
./includes/backend/data/mot-databuilder.h
./includes/backend/data/data-processor.h
./devices/rawfiles/rawfiles.h
./devices/wavfiles/wavfiles.h
)
set (${objectName}_UIS
${${objectName}_UIS} ./forms/dabradio.ui ./forms/technical_data.ui)
set (${objectName}_MOCS
${${objectName}_MOCS} ./radio.h)
set ($(objectName)_HDRS
${${objectName}_HDRS} ./radio.h)
set (${objectName}_SRCS
${${objectName}_SRCS} ./radio.cpp)
##########################################################################
# The devices
#
if (SDRPLAY)
# find_path (SDRPLAYLIB_INCLUDE_DIR
# NAMES mirsdrapi-rsp.h
# PATHS
# /usr/local/include/
# )
# include_directories (${SDRPLAYLIB_INCLUDE_DIR})
set (${objectName}_UIS
${${objectName}_UIS}
./devices/sdrplay-handler/sdrplay-widget.ui
)
set (${objectName}_MOCS
${${objectName}_MOCS}
./devices/sdrplay-handler/sdrplay-handler.h
./devices/sdrplay-handler/sdrplayselect.h
)
include_directories (
./devices/sdrplay-handler
)
set ($(objectName)_HDRS
${${objectName}_HDRS}
./devices/sdrplay-handler/sdrplay-handler.h
./devices/sdrplay-handler/sdrplayselect.h
./devices/sdrplay-handler/mirsdrapi-rsp.h
)
set (${objectName}_SRCS
${${objectName}_SRCS}
./devices/sdrplay-handler/sdrplay-handler.cpp
./devices/sdrplay-handler/sdrplayselect.cpp
)
add_definitions (-DHAVE_SDRPLAY)
endif (SDRPLAY)
if (AIRSPY)
# find_package(LibAIRSPY)
# if (NOT LIBAIRSPY_FOUND)
# message(FATAL_ERROR "please install airspy library")
# endif ()
# ## include_directories (${AIRSPYLIB_INCLUDE_DIR})
set (${objectName}_UIS
${${objectName}_UIS}
./devices/airspy-handler/airspy-widget.ui
)
set (${objectName}_MOCS
${${objectName}_MOCS}
./devices/airspy-handler/airspy-handler.h
)
include_directories (
./devices/airspy-handler
./devices/airspy-handler/libairspy
)
set ($(objectName)_HDRS
${${objectName}_HDRS}
./devices/airspy-handler/airspy-handler.h
./devices/airspy-handler/airspyfilter.h
./devices/airspy-handler/libairspy/airspy.h
)
set (${objectName}_SRCS
${${objectName}_SRCS}
./devices/airspy-handler/airspy-handler.cpp
./devices/airspy-handler/airspyfilter.cpp
)
add_definitions (-DHAVE_AIRSPY)
endif (AIRSPY)
#
if (RTLSDR)
find_package(LibRTLSDR)
if (NOT LIBRTLSDR_FOUND)
message(FATAL_ERROR "please install librtlsdr")
endif ()
###include_directories (${RTLSDR_INCLUDE_DIR})
set (${objectName}_UIS
${${objectName}_UIS}
./devices/rtlsdr-handler/rtlsdr-widget.ui
)
set (${objectName}_MOCS
${${objectName}_MOCS}
./devices/rtlsdr-handler/rtl-dongleselect.h
./devices/rtlsdr-handler/rtlsdr-handler.h
)
include_directories (
./devices/rtlsdr-handler/
)
set (${objectName}_HDRS
${${objectName}_HDRS}
./devices/rtlsdr-handler/rtlsdr-handler.h
./devices/rtlsdr-handler/rtl-dongleselect.h
)
set (${objectName}_SRCS
${${objectName}_SRCS}
./devices/rtlsdr-handler/rtlsdr-handler.cpp
./devices/rtlsdr-handler/rtl-dongleselect.cpp
)
add_definitions (-DHAVE_RTLSDR)
endif()
#
if (TCP_STREAMER)
add_definitions (-DTCP_STREAMER)
find_package (Qt5Network REQUIRED)
set (${objectName}_MOCS
${${objectName}_MOCS}
./includes/output/tcp-streamer.h
)
set (${objectName}_HDRS
${${objectName}_HDRS}
./includes/output/tcp-streamer.h
)
set (${objectName}_SRCS
${${objectName}_SRCS}
./src/output/tcp-streamer.cpp
)
endif (TCP_STREAMER)
if (QT_AUDIO)
add_definitions (-DQT_AUDIO)
find_package (Qt5Multimedia REQUIRED)
include_directories (
${Qt5Multimedia_INCLUDE_DIRS}
)
set (${objectName}_MOCS
${${objectName}_MOCS}
./includes/output/Qt-audio.h
./includes/output/Qt-audiodevice.h
)
set (${objectName}_HDRS
${${objectName}_HDRS}
./includes/output/Qt-audio.h
./includes/output/Qt-audiodevice.h
)
set (${objectName}_SRCS
${${objectName}_SRCS}
./src/output/Qt-audio.cpp
./src/output/Qt-audiodevice.cpp
)
endif (QT_AUDIO)
if (RTLTCP)
find_package (Qt5Network REQUIRED)
set (${objectName}_UIS
${${objectName}_UIS}
./devices/rtl_tcp/rtl_tcp-widget.ui
)
set (${objectName}_MOCS
${${objectName}_MOCS}
./devices/rtl_tcp/rtl_tcp_client.h
)
include_directories (
./devices/rtl_tcp
${Qt5Network_INCLUDE_DIRS}
)
set ($(objectName)_HDRS
${${objectName}_HDRS}
./devices/rtl_tcp/rtl_tcp_client.h
)
set (${objectName}_SRCS
${${objectName}_SRCS}
./devices/rtl_tcp/rtl_tcp_client.cpp
)
set (RTLTCP_lib Qt5::Network)
add_definitions (-DHAVE_RTL_TCP)
endif (RTLTCP)
find_package(Qwt)
if (NOT QWT_FOUND)
message(FATAL_ERROR "please install qwt library")
endif ()
include_directories ( ${QWT_INCLUDE_DIRS})
list(APPEND extraLibs ${QWT_LIBRARIES})
if (USE_PORTAUDIO)
find_package(Portaudio)
if (NOT PORTAUDIO_FOUND)
message(FATAL_ERROR "please install portaudio V19")
endif ()
list(APPEND extraLibs ${PORTAUDIO_LIBRARIES})
set (${objectName}_HDRS
${${objectName}_HDRS}
./includes/output/audiosink.h
)
set (${objectName}_MOCS
${${objectName}_MOCS}
./includes/output/audiosink.h
)
set (${objectName}_SRCS
${${objectName}_SRCS}
./src/output/audiosink.cpp
)
endif (USE_PORTAUDIO)
QT5_WRAP_UI (UIS ${${objectName}_UIS}
./devices/filereader-widget.ui)
include_directories (
${SDRPLAY_INCLUDES}
${QT5Widgets_INCLUDES}
${QT_QTCORE_INCLUDE_DIR}
${QT_QTGUI_INCLUDE_DIR}
${FFTW_INCLUDE_DIRS}
${PORTAUDIO_INCLUDE_DIRS}
${FAAD_INCLUDE_DIRS}
${SNDFILES_INCLUDE_DIRS}
)
QT5_WRAP_CPP (MOCS ${${objectName}_MOCS})
add_executable (${objectName}
${${objectName}_SRCS}
${UIS}
${RSCS}
${TRS}
${MOCS}
resources.qrc
)
target_link_libraries (${objectName}
Qt5::Widgets
Qt5::Network
${RTLTCP_lib}
${FFTW3F_LIBRARIES}
${extraLibs}
${FAAD_LIBRARIES}
${CMAKE_DL_LIBS}
)
INSTALL (TARGETS ${objectName} DESTINATION ${CMAKE_INSTALL_PREFIX})
# INSTALL (TARGETS ${objectName} DESTINATION ./linux-bin)
########################################################################
# Create uninstall target
########################################################################
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)

474
CMakeLists.txt-qt4 Normal file
View File

@@ -0,0 +1,474 @@
cmake_minimum_required( VERSION 2.8.11 )
set (objectName dabradio-1.0)
set (CMAKE_CXX_FLAGS "${CMAKE_XCC_FLAGS} -Wall -std=c++11 -flto")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -flto")
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set (CMAKE_INSTALL_PREFIX "/usr/local/bin" CACHE PATH "default install path" FORCE )
endif()
#set (CMAKE_INSTALL_PREFIX /usr/local/bin)
# modify if you want
if(MINGW)
add_definitions ( -municode)
endif()
IF(EXISTS (".git") AND IS_DIRECTORY (".git"))
execute_process (
COMMAND git rev-parse --short HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif ()
if(GIT_COMMIT_HASH)
add_definitions("-DGITHASH=\"${GIT_COMMIT_HASH}\"")
else ()
add_definitions ("-DGITHASH=\" \"")
endif()
########################################################################
# select the release build type by default to get optimization flags
########################################################################
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
message(STATUS "Build type not specified: defaulting to release.")
endif(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "")
### make sure our local CMake Modules path comes first
list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake/Modules)
######################################################################
#
#####################################################################
if(DEFINED AIRSPY)
set(AIRSPY true)
endif ()
if(DEFINED SDRPLAY)
set(SDRPLAY true)
endif ()
if(DEFINED DABSTICK)
set(DABSTICK true)
endif ()
if(DEFINED RTLTCP)
set(RTLTCP true)
endif ()
add_definitions (-DTHREADED_DECODING) # uncomment for use for an RPI
########################################################################
find_package (PkgConfig)
find_package (LSBId)
# set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
find_package(Qt4 REQUIRED COMPONENTS QtCore QtNetwork)
include(${QT_USE_FILE})
find_package(QWT REQUIRED)
find_package(FFTW3f)
if (NOT FFTW3F_FOUND)
message(FATAL_ERROR "please install FFTW3")
endif ()
find_package(Portaudio)
if (NOT PORTAUDIO_FOUND)
message(FATAL_ERROR "please install portaudio V19")
endif ()
list(APPEND extraLibs ${PORTAUDIO_LIBRARIES})
find_package(Faad)
if (NOT FAAD_FOUND )
message(FATAL_ERROR "please install libfaad")
endif ()
find_package(zlib)
if (NOT ZLIB_FOUND)
message(FATAL_ERROR "please install libz")
endif ()
list(APPEND extraLibs ${ZLIB_LIBRARY})
find_package(LibSndFile)
if (NOT LIBSNDFILE_FOUND)
message(FATAL_ERROR "please install libsndfile")
endif ()
list(APPEND extraLibs ${LIBSNDFILE_LIBRARY})
find_package(LibSampleRate)
if (NOT LIBSAMPLERATE_FOUND)
message(FATAL_ERROR "please install libsamplerate")
endif ()
list(APPEND extraLibs ${LIBSAMPLERATE_LIBRARY})
find_library (PTHREADS pthread)
if (NOT(PTHREADS))
message (FATAL_ERROR "please install libpthread")
else (NOT(PTHREADS))
set (extraLibs ${extraLibs} ${PTHREADS})
endif (NOT(PTHREADS))
#######################################################################
#
# Here we really start
include_directories (
${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}
${QT5Widgets_INCLUDES}
${QT_QTCORE_INCLUDE_DIR}
${QT_QTGUI_INCLUDE_DIR}
.
./
./includes
./dab-scopes
./includes/ofdm
./includes/backend
./includes/backend/viterbi_768
./includes/backend/audio
./includes/backend/data
./includes/backend/data/journaline
./includes/various
./includes/output
./includes/scopes-qwt6
./devices
./devices/rawfiles
./devices/wavfiles
/usr/include/
)
set (${objectName}_HDRS
./dab-processor.h
./dab-scope/spectrum-handler.h
./includes/ofdm/sample-reader.h
./includes/dab-constants.h
./includes/ofdm/phasereference.h
./includes/ofdm/phasetable.h
./includes/ofdm/freq-interleaver.h
./includes/backend/viterbi_768/viterbi-768.h
./includes/backend/protection.h
./includes/backend/uep-protection.h
./includes/backend/eep-protection.h
./includes/backend/firecode-checker.h
./includes/backend/frame-processor.h
./includes/backend/charsets.h
./includes/backend/galois.h
./incluces/backend/reed-solomon.h
./includes/backend/msc-handler.h
./includes/backend/virtual-backend.h
./includes/backend/audio-backend.h
./includes/backend/databackend.h
./includes/backend/audio/faad-decoder.h
./includes/backend/audio/mp4processor.h
./includes/backend/audio/mp2processor.h
./includes/backend/data/mot-databuilder.h
./includes/backend/data/virtual-datahandler.h
./includes/backend/data/pad-handler.h
./includes/backend/data/mot-data.h
./includes/backend/data/data-processor.h
./devices/virtual-input.h
./devices/rawfiles/rawfiles.h
./devices/wavfiles/wavfiles.h
./includes/output/fir-filters.h
./includes/output/audio-base.h
./includes/output/audiosink.h
./includes/output/newconverter.h
./includes/various/fft-handler.h
./includes/various/ringbuffer.h
./includes/various/Xtan2.h
./includes/various/dab-params.h
./includes/various/band-handler.h
./includes/various/text-mapper.h
)
set (${objectName}_SRCS
${${objectName}_SRCS}
./main.cpp
./dab-processor.cpp
./dab-scope/spectrum-handler.cpp
./src/ofdm/sample-reader.cpp
./src/ofdm/ofdm-decoder.cpp
./src/ofdm/phasereference.cpp
./src/ofdm/phasetable.cpp
./src/ofdm/freq-interleaver.cpp
./src/backend/viterbi_768/viterbi-768.cpp
./src/backend/viterbi_768/spiral-no-sse.c
./src/backend/fic-handler.cpp
./src/backend/protection.cpp
./src/backend/eep-protection.cpp
./src/backend/uep-protection.cpp
./src/backend/fib-processor.cpp
./src/backend/firecode-checker.cpp
./src/backend/frame-processor.cpp
./src/backend/protTables.cpp
./src/backend/charsets.cpp
./src/backend/galois.cpp
./src/backend/reed-solomon.cpp
./src/backend/msc-handler.cpp
./src/backend/virtual-backend.cpp
./src/backend/audio-backend.cpp
./src/backend/data-backend.cpp
./src/backend/audio/faad-decoder.cpp
./src/backend/audio/mp4processor.cpp
./src/backend/audio/mp2processor.cpp
./src/backend/data/mot-databuilder.cpp
./src/backend/data/virtual-datahandler.cpp
./src/backend/data/pad-handler.cpp
./src/backend/data/mot-data.cpp
./src/backend/data/data-processor.cpp
./devices/virtual-input.cpp
./devices/rawfiles/rawfiles.cpp
./devices/wavfiles/wavfiles.cpp
./src/output/audio-base.cpp
./src/output/audiosink.cpp
./src/output/newconverter.cpp
./src/output/fir-filters.cpp
./src/various/fft-handler.cpp
./src/various/Xtan2.cpp
./src/various/dab-params.cpp
./src/various/band-handler.cpp
./src/various/text-mapper.cpp
)
set (${objectName}_MOCS
./dab-processor.h
./includes/output/audio-base.h
./includes/ofdm/sample-reader.h
./includes/ofdm/ofdm-decoder.h
./includes/ofdm/phasereference.h
./includes/backend/fic-handler.h
./includes/backend/fib-processor.h
./includes/backend/data-backend.h
./includes/backend/audio/faad-decoder.h
./includes/backend/audio/mp2processor.h
./includes/backend/audio/mp4processor.h
./includes/backend/data/virtual-datahandler.h
./includes/backend/data/pad-handler.h
./includes/backend/data/mot-data.h
./includes/backend/data/mot-databuilder.h
./includes/backend/data/data-processor.h
./devices/rawfiles/rawfiles.h
./devices/wavfiles/wavfiles.h
)
set (${objectName}_UIS
${${objectName}_UIS} ./forms/dabradio.ui ./forms/technical_data.ui)
set (${objectName}_MOCS
${${objectName}_MOCS} ./radio.h)
set ($(objectName)_HDRS
${${objectName}_HDRS} ./radio.h)
set (${objectName}_SRCS
${${objectName}_SRCS} ./radio.cpp)
##########################################################################
# The devices
#
if (SDRPLAY)
# find_path (SDRPLAYLIB_INCLUDE_DIR
# NAMES mirsdrapi-rsp.h
# PATHS
# /usr/local/include/
# )
# include_directories (${SDRPLAYLIB_INCLUDE_DIR})
set (${objectName}_UIS
${${objectName}_UIS}
./devices/sdrplay-handler/sdrplay-widget.ui
)
set (${objectName}_MOCS
${${objectName}_MOCS}
./devices/sdrplay-handler/sdrplay-handler.h
./devices/sdrplay-handler/sdrplayselect.h
)
include_directories (
./devices/sdrplay-handler
)
set ($(objectName)_HDRS
${${objectName}_HDRS}
./devices/sdrplay-handler/rtl-sdr.h
./devices/sdrplay-handler/sdrplay-handler.h
./devices/sdrplay-handler/sdrplayselect.h
./devices/sdrplay-handler/mirsdrapi-rsp.h
)
set (${objectName}_SRCS
${${objectName}_SRCS}
./devices/sdrplay-handler/sdrplay-handler.cpp
./devices/sdrplay-handler/sdrplayselect.cpp
)
add_definitions (-DHAVE_SDRPLAY)
endif (SDRPLAY)
if (AIRSPY)
# find_package(LibAIRSPY)
# if (NOT LIBAIRSPY_FOUND)
# message(FATAL_ERROR "please install airspy library")
# endif ()
# ## include_directories (${AIRSPYLIB_INCLUDE_DIR})
set (${objectName}_UIS
${${objectName}_UIS}
./devices/airspy-handler/airspy-widget.ui
)
set (${objectName}_MOCS
${${objectName}_MOCS}
./devices/airspy-handler/airspy-handler.h
)
include_directories (
./devices/airspy-handler
./devices/airspy-handler/libairspy
)
set ($(objectName)_HDRS
${${objectName}_HDRS}
./devices/airspy-handler/airspy-handler.h
./devices/airspy-handler/airspyfilter.h
./devices/airspy-handler/libairspy/airspy.h
)
set (${objectName}_SRCS
${${objectName}_SRCS}
./devices/airspy-handler/airspy-handler.cpp
./devices/airspy-handler/airspyfilter.cpp
)
add_definitions (-DHAVE_AIRSPY)
endif (AIRSPY)
#
if (DABSTICK)
# find_package(LibRTLSDR)
# if (NOT LIBRTLSDR_FOUND)
# message(FATAL_ERROR "please install librtlsdr")
# endif ()
# ###include_directories (${RTLSDR_INCLUDE_DIR})
set (${objectName}_UIS
${${objectName}_UIS}
./devices/rtlsdr-handler/rtlsdr-widget.ui
)
set (${objectName}_MOCS
${${objectName}_MOCS}
./devices/rtlsdr-handler/rtl-dongleselect.h
./devices/rtlsdr-handler/rtlsdr-handler.h
)
include_directories (
./devices/rtlsdr-handler/
)
set (${objectName}_HDRS
${${objectName}_HDRS}
./devices/rtlsdr-handler/rtlsdr-handler.h
./devices/rtlsdr-handler/rtl-dongleselect.h
)
set (${objectName}_SRCS
${${objectName}_SRCS}
./devices/rtlsdr-handler/rtlsdr-handler.cpp
./devices/rtlsdr-handler/rtl-dongleselect.cpp
)
add_definitions (-DHAVE_RTLSDR)
endif()
#
#
# if (RTLTCP)
# find_package (Qt5Network REQUIRED)
# set (${objectName}_UIS
# ${${objectName}_UIS}
# ./devices/rtl_tcp/rtl_tcp-widget.ui
# )
#
# set (${objectName}_MOCS
# ${${objectName}_MOCS}
# ./devices/rtl_tcp/rtl_tcp_client.h
# )
#
# include_directories (
# ./devices/rtl_tcp
# ${Qt5Network_INCLUDE_DIRS}
# )
#
# set ($(objectName)_HDRS
# ${${objectName}_HDRS}
# ./devices/rtl_tcp/rtl_tcp_client.h
# )
#
# set (${objectName}_SRCS
# ${${objectName}_SRCS}
# ./devices/rtl_tcp/rtl_tcp_client.cpp
# )
#
# set (RTLTCP_lib Qt5::Network)
# add_definitions (-DHAVE_RTL_TCP)
# endif (RTLTCP)
find_package(Qwt)
if (NOT QWT_FOUND)
message(FATAL_ERROR "please install qwt library")
endif ()
include_directories ( ${QWT_INCLUDE_DIRS})
list(APPEND extraLibs ${QWT_LIBRARIES})
QT4_WRAP_UI (UIS ${${objectName}_UIS}
./devices/filereader-widget.ui)
include_directories (
${SDRPLAY_INCLUDES}
${QT5Widgets_INCLUDES}
${QT_QTCORE_INCLUDE_DIR}
${QT_QTGUI_INCLUDE_DIR}
${FFTW_INCLUDE_DIRS}
${PORTAUDIO_INCLUDE_DIRS}
${FAAD_INCLUDE_DIRS}
${SNDFILES_INCLUDE_DIRS}
)
QT4_WRAP_CPP (MOCS ${${objectName}_MOCS})
add_executable (${objectName}
${${objectName}_SRCS}
${UIS}
${RSCS}
${TRS}
${MOCS}
)
target_link_libraries (${objectName}
Qt4::QtGui
Qt4::QtNetwork
${RTLTCP_lib}
${FFTW3F_LIBRARIES}
${extraLibs}
${FAAD_LIBRARIES}
${CMAKE_DL_LIBS}
)
INSTALL (TARGETS ${objectName} DESTINATION ${CMAKE_INSTALL_PREFIX})
# INSTALL (TARGETS ${objectName} DESTINATION ./linux-bin)
########################################################################
# Create uninstall target
########################################################################
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)

539
CMakeLists.txt-qt5 Normal file
View File

@@ -0,0 +1,539 @@
cmake_minimum_required( VERSION 2.8.11 )
set (objectName dabradio)
set (CMAKE_CXX_FLAGS "${CMAKE_XCC_FLAGS} -Wall -std=c++11 -flto")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -flto")
set(CMAKE_AUTORCC ON)
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set (CMAKE_INSTALL_PREFIX "/usr/local/bin" CACHE PATH "default install path" FORCE )
endif()
#set (CMAKE_INSTALL_PREFIX /usr/local/bin)
# modify if you want
if(MINGW)
add_definitions ( -municode)
endif()
IF(EXISTS (".git") AND IS_DIRECTORY (".git"))
execute_process (
COMMAND git rev-parse --short HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif ()
if(GIT_COMMIT_HASH)
add_definitions("-DGITHASH=\"${GIT_COMMIT_HASH}\"")
else ()
add_definitions ("-DGITHASH=\" \"")
endif()
########################################################################
# select the release build type by default to get optimization flags
########################################################################
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
message(STATUS "Build type not specified: defaulting to release.")
endif(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "")
### make sure our local CMake Modules path comes first
list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake/Modules)
######################################################################
#
#####################################################################
#
# default value
set(USE_PORTAUDIO true)
if(DEFINED AIRSPY)
set(AIRSPY true)
endif ()
if(DEFINED SDRPLAY)
set(SDRPLAY true)
endif ()
if(DEFINED RTLSDR)
set(RTLSDR true)
endif ()
if(DEFINED RTLTCP)
set(RTLTCP true)
endif ()
#add_definitions (-DTHREADED_DECODING) # uncomment for use for an RPI
#
########################################################################
find_package (PkgConfig)
find_package (LSBId)
find_package (Qt5Core REQUIRED)
find_package (Qt5Widgets REQUIRED)
find_package (Qt5Network REQUIRED)
include_directories (
${Qt5Network_INCLUDE_DIRS}
)
find_package(FFTW3f)
if (NOT FFTW3F_FOUND)
message(FATAL_ERROR "please install FFTW3")
endif ()
find_package(Faad)
if (NOT FAAD_FOUND )
message(FATAL_ERROR "please install libfaad")
endif ()
find_package(zlib)
if (NOT ZLIB_FOUND)
message(FATAL_ERROR "please install libz")
endif ()
list(APPEND extraLibs ${ZLIB_LIBRARY})
find_package(LibSndFile)
if (NOT LIBSNDFILE_FOUND)
message(FATAL_ERROR "please install libsndfile")
endif ()
list(APPEND extraLibs ${LIBSNDFILE_LIBRARY})
find_package(LibSampleRate)
if (NOT LIBSAMPLERATE_FOUND)
message(FATAL_ERROR "please install libsamplerate")
endif ()
list(APPEND extraLibs ${LIBSAMPLERATE_LIBRARY})
find_library (PTHREADS pthread)
if (NOT(PTHREADS))
message (FATAL_ERROR "please install libpthread")
else (NOT(PTHREADS))
set (extraLibs ${extraLibs} ${PTHREADS})
endif (NOT(PTHREADS))
#######################################################################
#
# Here we really start
include_directories (
${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}
${QT5Widgets_INCLUDES}
${QT_QTCORE_INCLUDE_DIR}
${QT_QTGUI_INCLUDE_DIR}
.
./
./includes
./dab-scope
./includes/ofdm
./includes/backend
./includes/backend/viterbi_768
./includes/backend/audio
./includes/backend/data
./includes/backend/data/journaline
./includes/various
./includes/output
./includes/scopes-qwt6
./devices
./devices/rawfiles
./devices/wavfiles
/usr/include/
)
set (${objectName}_HDRS
./dab-processor.h
./dab-scope/spectrum-handler.h
./includes/ofdm/sample-reader.h
./includes/dab-constants.h
./includes/ofdm/phasereference.h
./includes/ofdm/phasetable.h
./includes/ofdm/freq-interleaver.h
./includes/backend/viterbi_768/viterbi-768.h
./includes/backend/protection.h
./includes/backend/uep-protection.h
./includes/backend/eep-protection.h
./includes/backend/firecode-checker.h
./includes/backend/frame-processor.h
./includes/backend/charsets.h
./includes/backend/galois.h
./incluces/backend/reed-solomon.h
./includes/backend/msc-handler.h
./includes/backend/virtual-backend.h
./includes/backend/audio-backend.h
./includes/backend/data-backend.h
./includes/backend/audio/faad-decoder.h
./includes/backend/audio/mp4processor.h
./includes/backend/audio/mp2processor.h
./includes/backend/data/mot-databuilder.h
./includes/backend/data/virtual-datahandler.h
./includes/backend/data/pad-handler.h
./includes/backend/data/mot-data.h
./includes/backend/data/data-processor.h
./devices/virtual-input.h
./devices/rawfiles/rawfiles.h
./devices/wavfiles/wavfiles.h
./includes/output/fir-filters.h
./includes/output/audio-base.h
./includes/output/newconverter.h
./includes/various/fft-handler.h
./includes/various/ringbuffer.h
./includes/various/Xtan2.h
./includes/various/dab-params.h
./includes/various/band-handler.h
./includes/various/text-mapper.h
)
set (${objectName}_SRCS
${${objectName}_SRCS}
./main.cpp
./dab-processor.cpp
./dab-scope/spectrum-handler.cpp
./src/ofdm/sample-reader.cpp
./src/ofdm/ofdm-decoder.cpp
./src/ofdm/phasereference.cpp
./src/ofdm/phasetable.cpp
./src/ofdm/freq-interleaver.cpp
./src/backend/viterbi_768/viterbi-768.cpp
./src/backend/viterbi_768/spiral-no-sse.c
./src/backend/fic-handler.cpp
./src/backend/protection.cpp
./src/backend/eep-protection.cpp
./src/backend/uep-protection.cpp
./src/backend/fib-processor.cpp
./src/backend/firecode-checker.cpp
./src/backend/frame-processor.cpp
./src/backend/protTables.cpp
./src/backend/charsets.cpp
./src/backend/galois.cpp
./src/backend/reed-solomon.cpp
./src/backend/msc-handler.cpp
./src/backend/virtual-backend.cpp
./src/backend/audio-backend.cpp
./src/backend/data-backend.cpp
./src/backend/audio/faad-decoder.cpp
./src/backend/audio/mp4processor.cpp
./src/backend/audio/mp2processor.cpp
./src/backend/data/mot-databuilder.cpp
./src/backend/data/virtual-datahandler.cpp
./src/backend/data/pad-handler.cpp
./src/backend/data/mot-data.cpp
./src/backend/data/data-processor.cpp
./devices/virtual-input.cpp
./devices/rawfiles/rawfiles.cpp
./devices/wavfiles/wavfiles.cpp
./src/output/audio-base.cpp
./src/output/newconverter.cpp
./src/output/fir-filters.cpp
./src/various/fft-handler.cpp
./src/various/Xtan2.cpp
./src/various/dab-params.cpp
./src/various/band-handler.cpp
./src/various/text-mapper.cpp
)
set (${objectName}_MOCS
./dab-processor.h
./includes/output/audio-base.h
./includes/ofdm/sample-reader.h
./includes/ofdm/ofdm-decoder.h
./includes/ofdm/phasereference.h
./includes/backend/fic-handler.h
./includes/backend/fib-processor.h
./includes/backend/data-backend.h
./includes/backend/audio/faad-decoder.h
./includes/backend/audio/mp2processor.h
./includes/backend/audio/mp4processor.h
./includes/backend/data/virtual-datahandler.h
./includes/backend/data/pad-handler.h
./includes/backend/data/mot-data.h
./includes/backend/data/mot-databuilder.h
./includes/backend/data/data-processor.h
./devices/rawfiles/rawfiles.h
./devices/wavfiles/wavfiles.h
)
set (${objectName}_UIS
${${objectName}_UIS} ./forms/dabradio.ui ./forms/technical_data.ui)
set (${objectName}_MOCS
${${objectName}_MOCS} ./radio.h)
set ($(objectName)_HDRS
${${objectName}_HDRS} ./radio.h)
set (${objectName}_SRCS
${${objectName}_SRCS} ./radio.cpp)
##########################################################################
# The devices
#
if (SDRPLAY)
# find_path (SDRPLAYLIB_INCLUDE_DIR
# NAMES mirsdrapi-rsp.h
# PATHS
# /usr/local/include/
# )
# include_directories (${SDRPLAYLIB_INCLUDE_DIR})
set (${objectName}_UIS
${${objectName}_UIS}
./devices/sdrplay-handler/sdrplay-widget.ui
)
set (${objectName}_MOCS
${${objectName}_MOCS}
./devices/sdrplay-handler/sdrplay-handler.h
./devices/sdrplay-handler/sdrplayselect.h
)
include_directories (
./devices/sdrplay-handler
)
set ($(objectName)_HDRS
${${objectName}_HDRS}
./devices/sdrplay-handler/sdrplay-handler.h
./devices/sdrplay-handler/sdrplayselect.h
./devices/sdrplay-handler/mirsdrapi-rsp.h
)
set (${objectName}_SRCS
${${objectName}_SRCS}
./devices/sdrplay-handler/sdrplay-handler.cpp
./devices/sdrplay-handler/sdrplayselect.cpp
)
add_definitions (-DHAVE_SDRPLAY)
endif (SDRPLAY)
if (AIRSPY)
# find_package(LibAIRSPY)
# if (NOT LIBAIRSPY_FOUND)
# message(FATAL_ERROR "please install airspy library")
# endif ()
# ## include_directories (${AIRSPYLIB_INCLUDE_DIR})
set (${objectName}_UIS
${${objectName}_UIS}
./devices/airspy-handler/airspy-widget.ui
)
set (${objectName}_MOCS
${${objectName}_MOCS}
./devices/airspy-handler/airspy-handler.h
)
include_directories (
./devices/airspy-handler
./devices/airspy-handler/libairspy
)
set ($(objectName)_HDRS
${${objectName}_HDRS}
./devices/airspy-handler/airspy-handler.h
./devices/airspy-handler/airspyfilter.h
./devices/airspy-handler/libairspy/airspy.h
)
set (${objectName}_SRCS
${${objectName}_SRCS}
./devices/airspy-handler/airspy-handler.cpp
./devices/airspy-handler/airspyfilter.cpp
)
add_definitions (-DHAVE_AIRSPY)
endif (AIRSPY)
#
if (RTLSDR)
find_package(LibRTLSDR)
if (NOT LIBRTLSDR_FOUND)
message(FATAL_ERROR "please install librtlsdr")
endif ()
###include_directories (${RTLSDR_INCLUDE_DIR})
set (${objectName}_UIS
${${objectName}_UIS}
./devices/rtlsdr-handler/rtlsdr-widget.ui
)
set (${objectName}_MOCS
${${objectName}_MOCS}
./devices/rtlsdr-handler/rtl-dongleselect.h
./devices/rtlsdr-handler/rtlsdr-handler.h
)
include_directories (
./devices/rtlsdr-handler/
)
set (${objectName}_HDRS
${${objectName}_HDRS}
./devices/rtlsdr-handler/rtlsdr-handler.h
./devices/rtlsdr-handler/rtl-dongleselect.h
)
set (${objectName}_SRCS
${${objectName}_SRCS}
./devices/rtlsdr-handler/rtlsdr-handler.cpp
./devices/rtlsdr-handler/rtl-dongleselect.cpp
)
add_definitions (-DHAVE_RTLSDR)
endif()
#
if (TCP_STREAMER)
add_definitions (-DTCP_STREAMER)
find_package (Qt5Network REQUIRED)
set (${objectName}_MOCS
${${objectName}_MOCS}
./includes/output/tcp-streamer.h
)
set (${objectName}_HDRS
${${objectName}_HDRS}
./includes/output/tcp-streamer.h
)
set (${objectName}_SRCS
${${objectName}_SRCS}
./src/output/tcp-streamer.cpp
)
endif (TCP_STREAMER)
if (QT_AUDIO)
add_definitions (-DQT_AUDIO)
find_package (Qt5Multimedia REQUIRED)
include_directories (
${Qt5Multimedia_INCLUDE_DIRS}
)
set (${objectName}_MOCS
${${objectName}_MOCS}
./includes/output/Qt-audio.h
./includes/output/Qt-audiodevice.h
)
set (${objectName}_HDRS
${${objectName}_HDRS}
./includes/output/Qt-audio.h
./includes/output/Qt-audiodevice.h
)
set (${objectName}_SRCS
${${objectName}_SRCS}
./src/output/Qt-audio.cpp
./src/output/Qt-audiodevice.cpp
)
endif (QT_AUDIO)
if (RTLTCP)
find_package (Qt5Network REQUIRED)
set (${objectName}_UIS
${${objectName}_UIS}
./devices/rtl_tcp/rtl_tcp-widget.ui
)
set (${objectName}_MOCS
${${objectName}_MOCS}
./devices/rtl_tcp/rtl_tcp_client.h
)
include_directories (
./devices/rtl_tcp
${Qt5Network_INCLUDE_DIRS}
)
set ($(objectName)_HDRS
${${objectName}_HDRS}
./devices/rtl_tcp/rtl_tcp_client.h
)
set (${objectName}_SRCS
${${objectName}_SRCS}
./devices/rtl_tcp/rtl_tcp_client.cpp
)
set (RTLTCP_lib Qt5::Network)
add_definitions (-DHAVE_RTL_TCP)
endif (RTLTCP)
find_package(Qwt)
if (NOT QWT_FOUND)
message(FATAL_ERROR "please install qwt library")
endif ()
include_directories ( ${QWT_INCLUDE_DIRS})
list(APPEND extraLibs ${QWT_LIBRARIES})
if (USE_PORTAUDIO)
find_package(Portaudio)
if (NOT PORTAUDIO_FOUND)
message(FATAL_ERROR "please install portaudio V19")
endif ()
list(APPEND extraLibs ${PORTAUDIO_LIBRARIES})
set (${objectName}_HDRS
${${objectName}_HDRS}
./includes/output/audiosink.h
)
set (${objectName}_MOCS
${${objectName}_MOCS}
./includes/output/audiosink.h
)
set (${objectName}_SRCS
${${objectName}_SRCS}
./src/output/audiosink.cpp
)
endif (USE_PORTAUDIO)
QT5_WRAP_UI (UIS ${${objectName}_UIS}
./devices/filereader-widget.ui)
include_directories (
${SDRPLAY_INCLUDES}
${QT5Widgets_INCLUDES}
${QT_QTCORE_INCLUDE_DIR}
${QT_QTGUI_INCLUDE_DIR}
${FFTW_INCLUDE_DIRS}
${PORTAUDIO_INCLUDE_DIRS}
${FAAD_INCLUDE_DIRS}
${SNDFILES_INCLUDE_DIRS}
)
QT5_WRAP_CPP (MOCS ${${objectName}_MOCS})
add_executable (${objectName}
${${objectName}_SRCS}
${UIS}
${RSCS}
${TRS}
${MOCS}
resources.qrc
)
target_link_libraries (${objectName}
Qt5::Widgets
Qt5::Network
${RTLTCP_lib}
${FFTW3F_LIBRARIES}
${extraLibs}
${FAAD_LIBRARIES}
${CMAKE_DL_LIBS}
)
INSTALL (TARGETS ${objectName} DESTINATION ${CMAKE_INSTALL_PREFIX})
# INSTALL (TARGETS ${objectName} DESTINATION ./linux-bin)
########################################################################
# Create uninstall target
########################################################################
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)

126
COPYING Normal file
View File

@@ -0,0 +1,126 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too.
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.
Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.
You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.
In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.
7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.
10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License.

367
LICENSE Normal file
View File

@@ -0,0 +1,367 @@
Copyright (c) 2013 .. 2017
Jan van Katwijk
Lazy Chair Computing
J.vanKatwijk@gmail.com
The Qt-DAB software - as well as its predecessors DAB-rpi and sdr-j-dab
and derivatives - are made available under GPL license Version 2.
Many of the ideas as implemented in Qt-DAB are derived from
other work, made available through the GNU general Public License.
All copyrights of the original authors are acknowledged.
Qt-DAB is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2,
as published by the Free Software Foundation.
Qt-DAB is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
Any non-GPL usage of this software or parts of this software is strictly
forbidden. Commercial non-GPL licensing of this software is possible.
For more info contact the author, named above.
===========================================================================
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

7636
Makefile Normal file

File diff suppressed because it is too large Load Diff

340
README.md Normal file
View File

@@ -0,0 +1,340 @@
# dabradio [![Build Status](https://travis-ci.org/JvanKatwijk/qt-dab.svg?branch=master)](https://travis-ci.org/JvanKatwijk/dabradio)
dabradio is a Software for Windows, Linux and Raspberry Pi for listening to terrestrial Digital Audio Broadcasting (DAB and DAB+). It is the smaller brother of Qt-DAB, the successor of both DAB-rpi and sdr-j-DAB, two former programs by the same author.
------------------------------------------------------------------
Table of Contents
------------------------------------------------------------------
* [Introduction](#introduction)
* [Features](#features)
* [Installation](#features)
* [Windows](#windows)
* [Ubuntu Linux](#ubuntu-linux)
- [Configuring using the dabradio.pro file](#configuring-using-the-dabradio-file)
- [Configuring using CMake](#configuring-using-cmake)
- [Qt](#qt)
* [Raspberry PI](#raspberry-pi)
* [appImage for x64 Linux systems](#appimage-for-x64-linux-systems)
* [Comment on some settings](#comment-on-some-settings)
* [A note on intermittent sound](#a-note-on-intermittent-sound)
* [Copyright](#copyright)
------------------------------------------------------------------
Features
------------------------------------------------------------------
* DAB (mp2) and DAB+ (HE-AAC v1, HE-AAC v2 and LC-AAC) decoding
* MOT SlideShow (SLS)
* Dynamic Label (DLS)
* Both DAB bands supported:
* VHF Band III
* L-Band (only used in Czech Republic and Vatican)
* Scanning function (scanning over all channels in a given band and collecting
all services)
* Detailed information for selected service (SNR, bitrate, frequency, ensemble name, ensemble ID, subchannel ID, used CUs, protection level, CPU usage, program type, language, 4 quality bars)
* Supports various inputs from
- SDRplay (both RSP I and RSP II),
- Airspy, including Airspy mini,
- SDR DAB sticks (RTL2838U or similar), and
- prerecorded dump (*.sdr, and *.iq)
Not implemented:
* DMB (Audio and Video)
* TPEG;
* EPG;
* Journaline;
* Other bands than used for terrestrial broadcasting in Europe (like DAB over cable)
* HackRF
------------------------------------------------------------------
Introduction
------------------------------------------------------------------
![dabradio with input](/screenshot_dabradio.png?raw=true)
**dabradio** is the little brother of Qt-DAB. The latter is kind of a research vehicle, with lost of options, used by only a few. The need arose to have
a smaller brother, just for listening to DAB services.
dabradio and Qt-DAB share a lot of functionality, obviously, nevertheless
to avoid even more "ifdef"s in the code, it was decided to
maintain a GitHub repository for both of them.
The Qt-free version, the "command line only" version, is named dab-cmdline, and is built around a library that does the DAB decoding. It has its own repository on Github.
Next to these C++ based versions, a version in Java is being developed, it has its own repository on Github.
dabradio dynamically selects the input device. If an input device (one of
SDRplay, AIRspy or RTLSDR stick) is attached, the software will find and
use that device (if more than one device is connected, the software
will select one of them). If no external device is selected, the software
will present a menu to select a file for file input.
For further information please visit http://www.sdr-j.tk
Some settings are preserved between program invocations, they are stored in a file `.dabradio.ini`, to be found in the home directory. See [Comment on some settings](#comment-on-some-settings) for more details.
------------------------------------------------------------------
Windows
------------------------------------------------------------------
Windows releases can be found at https://github.com/JvanKatwijk/dabradio/releases . Please copy them into the same directory you've unzipped http://www.sdr-j.tk/windows-bin.zip as it uses the same libraries.
If you want to compile it by yourself, please install Qt through its online installer, see https://www.qt.io/
------------------------------------------------------------------
Ubuntu Linux
------------------------------------------------------------------
If you are not familar with compiling then please continue reading by jumping to chapter [appImage](#appimage-for-x64-linux-systems) which is much easier for Linux beginners.
Ubuntu 16.04 (and on) have good support for Qt5 and qwt (compiled for Qt5).
For generating an executable under Ubuntu (16.04 or newer), you can put the following commands into a script.
(For Ubuntu 14.04 look into the package manager for Qt4 packages)
1. Fetch the required components
```
sudo apt-get update
sudo apt-get install qt5-qmake build-essential g++
sudo apt-get install libsndfile1-dev qt5-default libfftw3-dev portaudio19-dev
sudo apt-get install libfaad-dev zlib1g-dev rtl-sdr libusb-1.0-0-dev mesa-common-dev
sudo apt-get install libgl1-mesa-dev libqt5opengl5-dev libsamplerate0-dev libqwt-qt5-dev
sudo apt-get install qtbase5-dev
```
2. Fetch the required libraries
a) Assuming you want to use a dabstick (also known as rtlsdr) as device, fetch a version of the library for the dabstick
```
wget http://sm5bsz.com/linuxdsp/hware/rtlsdr/rtl-sdr-linrad4.tbz
tar xvfj rtl-sdr-linrad4.tbz
cd rtl-sdr-linrad4
sudo autoconf
sudo autoreconf -i
./configure --enable-driver-detach
make
sudo make install
sudo ldconfig
cd
```
b) Assuming you want to use an Airspy as device, fetch a version of the library for the Airspy
```
sudo apt-get install build-essential cmake libusb-1.0-0-dev pkg-config
wget https://github.com/airspy/host/archive/master.zip
unzip master.zip
cd airspyone_host-master
mkdir build
cd build
cmake ../ -DINSTALL_UDEV_RULES=ON
make
sudo make install
sudo ldconfig
```
Clean CMake temporary files/dirs:
```
cd host-master/build
rm -rf *
```
3. Get a copy of the dabradio sources
```
git clone https://github.com/JvanKatwijk/dabradio.git
cd dabradio
```
4. Edit the `dabradio.pro` file for configuring the supported devices and other options. Comment the respective lines out if you don't own an Airspy (mini) or an SDRplay.
5. If DAB spectrum and the constellation diagram should be displayed, check the installation path to qwt. If you were downloading it from http://qwt.sourceforge.net/qwtinstall.html please mention the correct path in `dabradio.pro` file (for other installation change it accordingly):
```
INCLUDEPATH += /usr/local/include /usr/local/qwt-6.1.3
```
6. Build and make
```
qmake dabradio.pro
make
```
You could also use QtCreator, load the `dabradio.pro` file and build the executable.
Remark: The executable file can be found in the sub-directory linux-bin. A make install command is not implemented.
------------------------------------------------------------------
Configuring using the dabradio.pro file
------------------------------------------------------------------
Options in the configuration are:
a) select or unselect devices
Adding or removing from the configuration is in all cases by commenting or uncommenting a line in the configuration file.
Comment the lines out by prefixing the line with a `#` in the `qt-dab.pro` file (section "unix") for the device(s) you want to exclude in the configuration. In the example below, rtl_tcp (i.e. the connection to the rtlsdr server) won't be used.
```
CONFIG += dabstick
CONFIG += sdrplay
#CONFIG += rtl_tcp
CONFIG += airspy
```
Remark: Input from pre-recorded files (8 bit unsigned `*.raw` and `*.iq' as well as 16-bit "wav" `*.sdr` files) is configured by default.
Audio samples are - by default - sent to an audio device using the portaudio
library.
------------------------------------------------------------------
Configuring using CMake
------------------------------------------------------------------
The `CMakeLists.txt` file has all devices and the spectrum switched off as default. You can select a device (or more devices) without altering the `CMakeLists.txt` file, but by passing on definitions to the command line.
An example:
```
cmake .. -DSDRPLAY=ON -DRTLTCP=ON -DSPECTRUM=ON
```
will generate a makefile with support for a) the SDRplay device, b) for the remote dabstick (using the rtl_tcp connection) and c) for the spectrum in the configuration.
Other devices that can be selected (beside dabstick and rtl_tcp) are sdrplay and airspy. Use `-DRTLSDR=ON`, or `-DAIRSPY=ON` after the `cmake` command if you want to configure them.
The default location for installation depends on your system, mostly `/usr/local/bin` or something like that. Set your own location by adding
```
-DCMAKE_INSTALL_PREFIX=your installation prefix
```
For other options, see the `CMakeLists.txt` file.
Important: Note that CMakeLists.txt file expects the appropriate Qt version (and - if configured - the qwt library) to be installed.
-----------------------------------------------------------------
SDRplay
-----------------------------------------------------------------
The current set of sources provides support for the RSP-I and the RSP-II and
the new RSP-1a, it is assumed that at least library version 2.09 is installed.
------------------------------------------------------------------
Qt
------------------------------------------------------------------
The software uses the Qt library and - for the spectrum and the constellation diagram - the qwt library.
The `CMakeLists.txt` assumes Qt5, if you want to use Qt4, and you want to have the spectrum in the configuration, be aware of the binding of the qwt library (i.e. Qt4 and a qwt that uses Qt5 does not work well).
-----------------------------------------------------------------
Raspberry PI
------------------------------------------------------------------
The dabradio software runs pretty well on the author's RPI-2. The average load on the 4 cores is somewhere between 50 and 60 percent.
One remark: getting "sound" is not always easy. Be certain that you have installed the alsa-utils, and that you are - as non-root user - able to see devices with `aplay -L`
In arch, it was essential to add the username to the group "audio".
The most recent distribution of Raspbian Stretch (i.e. august 2017) supports both Qt5 and a qwt compiled against Qt5.
IMPORTANT NOTE:
Since I was studying the (potential) difference in behaviour between a version with and a version without concurrency in the front end, there is a setting in the ".pro" file for selecting this.
Use for the dabradio the concurrency option.
For the ".pro" file uncomment
#DEFINES += __THREADED_DECODING.
For the CMakeLists.txt file, uncomment
#add_definitions (-D__THREADED_DECODING) #uncomment for the RPI
---------------------------------------------------------------------------
appImage for x64 Linux systems
---------------------------------------------------------------------------
https://github.com/JvanKatwijk/dabradio/releases contains a generated appImage which is created on Ubuntu 14.04 (Trusty), and uses Qt4 (so it basically should run on any x-64 based linux system that isn't too old.). It assumes that you have installed a device, either a dabstick (i.e. rtlsdr), an Airspy or a SDRplay. All further dependencies are included. There is only one file which you have to make executable in order to run.
Note that on start up the appImage will try to set the udev settings for the airspy and dabstick right. Libraries for the dabstick (i.e. rtlsdr) and airspy are part of the appImage. Note that while the SDRplay is selectable, the library for the device should be installed from the supplier, i.e. "www.sdrplay.com".
All further dependencies are included
For more information see http://appimage.org/
--------------------------------------------------------------------------------
Comment on some settings
-------------------------------------------------------------------------------
Some values of settings are maintained between program invocations. This is done in the (hidden) file `.dabradio.ini` in the user's home directory.
Some settings are not influenced by buttons or sliders of the GUI, they will only change by editing the .ini file.
Typical examples are
`saveSlides=1`
when set to 0 the slides that are attached to audio programs will not be saved. If set to 1 the slides will be saved in a directory `/tmp/qt-pictures` (Linux) or in `%tmp%\qt-pictures` (Windows).
`picturesPath`
defines the directory where the slides (MOT slideshow) should be stored. Default is the home directory.
`showSlides=1`
when set to 0 the slides will not be shown.
`has-presetName=1`
when set the name of the selected service - that is selected when closing down the program - is kept and at the next invocation of the program, an attempt is made to start that particular service. The name of the service is kept as `presetname=xxxx`
The background colors of the spectrum can be changed by setting
```
displaycolor=blue
gridcolor=red
```
The Qt-DAB program now searches - if available - for TII (transmitter identification information) data in the FIC. If TII data is available, the small label at the bottom of the Technical Details widget will color green, and the main ID if the transmitters is shown. Also the list of geographical positions of the transmitters of the FSN is printed on the terminal. If the identification of the transmitter received can be decoded, it will be shown at the bottom line of the Technical Data Widget.
The periodicity of the search for the data defining the position of the transmitter received can be set by adding a line to the `.qt-dab.ini` file
```
tii_delay=xxx
```
where xxx is the number of seconds. Default of the delay is 20 seconds.
--------------------------------------------------------------------------------
A note on intermittent sound
-------------------------------------------------------------------------------
In some cases, in some periods of listening, the sound is (or at least seems)
interrupted. There are two different causes for this
First of all the incoming signal is weak and audio packages do not pass the
many controls that are executed. This shows in the widget
"technical data", not all the colored bars at the bottom are 100 percent green.
An audio package represents 24 milliseconds of audio, loss of a few packages
leads to an interruption of the sound.
A second reason has to do with system parameters. Too small a buffersize
in the audio driver causes too high a frequency of calls to a callback
function. In Linux this shows by an underrun reported by the alsa sound system.
The buffer size can be set (in multiples of 256 audio samples)
by the value of "latency" in the ".ini" file. The default value is 1.
On my RPI 2 - with Stretch - latency=2 works best.
# Copyright
Copyright (C) 2013, 2014, 2015, 2016, 2017
Jan van Katwijk (J.vanKatwijk@gmail.com)
Lazy Chair Computing
The Qt-DAB software is made available under the GPL-2.0.
The SDR-J software, of which the Qt-DAB software is a part,
is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

7
appimage/AppRun Normal file
View File

@@ -0,0 +1,7 @@
#!/bin/bash
HERE="$(dirname "$(readlink -f "${0}")")"
cp "${HERE}/udev-rules-helper" /tmp/
# Try to run using sudo, if this does not work ask the user for password
sudo -n -E -- "/tmp/udev-rules-helper" || pkexec "/tmp/udev-rules-helper"
rm "/tmp/udev-rules-helper"
exec "${HERE}/usr/bin/dabradio" "$@"

View File

@@ -0,0 +1,27 @@
#!/bin/bash
HERE="$(dirname "$(readlink -f "${0}")")"
rmmod dvb_usb_rtl28xxu || true
cat > /tmp/10-rtl-sdr.rules <<\EOF
SUBSYSTEM=="usb", ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="2838", MODE="0666", SYMLINK+="rtl_sdr"
EOF
mv /tmp/10-rtl-sdr.rules /etc/udev/rules.d/10-rtl-sdr.rules
cat > /tmp/52-airspy.rules <<\EOF
ATTR{idVendor}=="1d50", ATTR{idProduct}=="60a1", SYMLINK+="airspy-%k", MODE="660", GROUP="plugdev"
EOF
mv /tmp/52-airspy.rules /etc/udev/rules.d/52-airspy.rules
cat > /tmp/66-mirics.rules <<\EOF
SUBSYSTEM=="usb",ENV{DEVTYPE}=="usb_device",ATTRS{idVendor}=="1df7",ATTRS{idProduct}=="2500",MODE:="0666"
SUBSYSTEM=="usb",ENV{DEVTYPE}=="usb_device",ATTRS{idVendor}=="1df7",ATTRS{idProduct}=="3010",MODE:="0666"
EOF
mv /tmp/66-mirics.rules /etc/udev/rules.d/66-mirics.rules
udevadm control --reload-rules
udevadm trigger --attr-match=subsystem=usb

View File

@@ -0,0 +1,41 @@
# http://tim.klingt.org/code/projects/supernova/repository/revisions/d336dd6f400e381bcfd720e96139656de0c53b6a/entry/cmake_modules/FindFFTW3f.cmake
# Modified to use pkg config and use standard var names
# Find single-precision (float) version of FFTW3
INCLUDE(FindPkgConfig)
PKG_CHECK_MODULES(PC_FFTW3F "fftw3f >= 3.0")
FIND_PATH(
FFTW3F_INCLUDE_DIRS
NAMES fftw3.h
HINTS $ENV{FFTW3_DIR}/include
${PC_FFTW3F_INCLUDE_DIR}
PATHS /usr/local/include
/usr/include
)
FIND_LIBRARY(
FFTW3F_LIBRARIES
NAMES fftw3f libfftw3f
HINTS $ENV{FFTW3_DIR}/lib
${PC_FFTW3F_LIBDIR}
PATHS /usr/local/lib
/usr/lib
/usr/lib64
)
FIND_LIBRARY(
FFTW3F_THREADS_LIBRARIES
NAMES fftw3f_threads libfftw3f_threads
HINTS $ENV{FFTW3_DIR}/lib
${PC_FFTW3F_LIBDIR}
PATHS /usr/local/lib
/usr/lib
/usr/lib64
)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(FFTW3F DEFAULT_MSG FFTW3F_LIBRARIES FFTW3F_INCLUDE_DIRS)
MARK_AS_ADVANCED(FFTW3F_LIBRARIES FFTW3F_INCLUDE_DIRS FFTW3F_THREADS_LIBRARIES)

View File

@@ -0,0 +1,34 @@
# Try to find FAAD library and include path.
# Once done this will define
#
# FAAD_INCLUDE_DIRS - where to find faad.h, etc.
# FAAD_LIBRARIES - List of libraries when using libfaad.
# FAAD_FOUND - True if libfaad found.
find_path(FAAD_INCLUDE_DIR faad.h DOC "The directory where faad.h resides")
find_library(FAAD_LIBRARY NAMES faad DOC "The libfaad library")
if(FAAD_INCLUDE_DIR AND FAAD_LIBRARY)
set(FAAD_FOUND 1)
set(FAAD_LIBRARIES ${FAAD_LIBRARY})
set(FAAD_INCLUDE_DIRS ${FAAD_INCLUDE_DIR})
else(FAAD_INCLUDE_DIR AND FAAD_LIBRARY)
set(FAAD_FOUND 0)
set(FAAD_LIBRARIES)
set(FAAD_INCLUDE_DIRS)
endif(FAAD_INCLUDE_DIR AND FAAD_LIBRARY)
mark_as_advanced(FAAD_INCLUDE_DIR)
mark_as_advanced(FAAD_LIBRARY)
mark_as_advanced(FAAD_FOUND)
if(NOT FAAD_FOUND)
set(FAAD_DIR_MESSAGE "libfaad was not found. Make sure FAAD_LIBRARY and FAAD_INCLUDE_DIR are set.")
if(NOT FAAD_FIND_QUIETLY)
message(STATUS "${FAAD_DIR_MESSAGE}")
else(NOT FAAD_FIND_QUIETLY)
if(FAAD_FIND_REQUIRED)
message(FATAL_ERROR "${FAAD_DIR_MESSAGE}")
endif(FAAD_FIND_REQUIRED)
endif(NOT FAAD_FIND_QUIETLY)
endif(NOT FAAD_FOUND)

View File

@@ -0,0 +1,16 @@
# Set a variable to determine which Linux distribution is being used.
# Debian packages things differently to Fedora (which is standard).
#
# This module sets the variable:
#
# LSB_ID_SHORT the short name of the Linux distribution or unknown.
set(LSB_ID_SHORT "unknown")
find_program(LSB_RELEASE lsb_release)
if(LSB_RELEASE)
execute_process(COMMAND ${LSB_RELEASE} -is
OUTPUT_VARIABLE LSB_ID_SHORT
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif()

View File

@@ -0,0 +1,28 @@
if(NOT LIBAIRSPY_FOUND)
pkg_check_modules (LIBAIRSPY_PKG libairspy)
find_path(LIBAIRSPY_INCLUDE_DIR NAMES libairspy/airspy.h
PATHS
${LIBAIRSPY_PKG_INCLUDE_DIRS}
/usr/include
/usr/local/include
)
find_library(LIBAIRSPY_LIBRARIES NAMES airspy
PATHS
${LIBAIRSPY_PKG_LIBRARY_DIRS}
/usr/lib
/usr/local/lib
)
if(LIBAIRSPY_INCLUDE_DIR AND LIBAIRSPY_LIBRARIES)
set(LIBAIRSPY_FOUND TRUE CACHE INTERNAL "libairspy found")
message(STATUS "Found libairspy: ${LIBAIRSPY_INCLUDE_DIR}, ${LIBAIRSPY_LIBRARIES}")
else(LIBAIRSPY_INCLUDE_DIR AND LIBAIRSPY_LIBRARIES)
set(LIBAIRSPY_FOUND FALSE CACHE INTERNAL "libairspy found")
message(STATUS "libairspy not found.")
endif(LIBAIRSPY_INCLUDE_DIR AND LIBAIRSPY_LIBRARIES)
mark_as_advanced(LIBAIRSPY_INCLUDE_DIR LIBAIRSPY_LIBRARIES)
endif(NOT LIBAIRSPY_FOUND)

View File

@@ -0,0 +1,28 @@
if(NOT LIBRTLSDR_FOUND)
pkg_check_modules (LIBRTLSDR_PKG librtlsdr)
find_path(LIBRTLSDR_INCLUDE_DIR NAMES rtl-sdr.h
PATHS
${LIBRTLSDR_PKG_INCLUDE_DIRS}
/usr/include
/usr/local/include
)
find_library(LIBRTLSDR_LIBRARIES NAMES rtlsdr
PATHS
${LIBRTLSDR_PKG_LIBRARY_DIRS}
/usr/lib
/usr/local/lib
)
if(LIBRTLSDR_INCLUDE_DIR AND LIBRTLSDR_LIBRARIES)
set(LIBRTLSDR_FOUND TRUE CACHE INTERNAL "librtlsdr found")
message(STATUS "Found librtlsdr: ${LIBRTLSDR_INCLUDE_DIR}, ${LIBRTLSDR_LIBRARIES}")
else(LIBRTLSDR_INCLUDE_DIR AND LIBRTLSDR_LIBRARIES)
set(LIBRTLSDR_FOUND FALSE CACHE INTERNAL "librtlsdr found")
message(STATUS "librtlsdr not found.")
endif(LIBRTLSDR_INCLUDE_DIR AND LIBRTLSDR_LIBRARIES)
mark_as_advanced(LIBRTLSDR_INCLUDE_DIR LIBRTLSDR_LIBRARIES)
endif(NOT LIBRTLSDR_FOUND)

View File

@@ -0,0 +1,20 @@
# Find libsamplerate
FIND_PATH(LIBSAMPLERATE_INCLUDE_DIR samplerate.h)
SET(LIBSAMPLERATE_NAMES ${LIBSAMPLERATE_NAMES} samplerate libsamplerate)
FIND_LIBRARY(LIBSAMPLERATE_LIBRARY NAMES ${LIBSAMPLERATE_NAMES} PATH)
IF (LIBSAMPLERATE_INCLUDE_DIR AND LIBSAMPLERATE_LIBRARY)
SET(LIBSAMPLERATE_FOUND TRUE)
ENDIF (LIBSAMPLERATE_INCLUDE_DIR AND LIBSAMPLERATE_LIBRARY)
IF (LIBSAMPLERATE_FOUND)
IF (NOT LibSampleRate_FIND_QUIETLY)
MESSAGE (STATUS "Found LibSampleRate: ${LIBSNDFILE_LIBRARY}")
ENDIF (NOT LibSampleRate_FIND_QUIETLY)
ELSE (LIBSAMPLERATE_FOUND)
IF (LibSampleRate_FIND_REQUIRED)
MESSAGE (FATAL_ERROR "Could not find samplerate")
ENDIF (LibSampleRate_FIND_REQUIRED)
ENDIF (LIBSAMPLERATE_FOUND)

View File

@@ -0,0 +1,20 @@
# Find libsndfile
FIND_PATH(LIBSNDFILE_INCLUDE_DIR sndfile.h)
SET(LIBSNDFILE_NAMES ${LIBSNDFILE_NAMES} sndfile libsndfile)
FIND_LIBRARY(LIBSNDFILE_LIBRARY NAMES ${LIBSNDFILE_NAMES} PATH)
IF (LIBSNDFILE_INCLUDE_DIR AND LIBSNDFILE_LIBRARY)
SET(LIBSNDFILE_FOUND TRUE)
ENDIF (LIBSNDFILE_INCLUDE_DIR AND LIBSNDFILE_LIBRARY)
IF (LIBSNDFILE_FOUND)
IF (NOT LibSndFile_FIND_QUIETLY)
MESSAGE (STATUS "Found LibSndFile: ${LIBSNDFILE_LIBRARY}")
ENDIF (NOT LibSndFile_FIND_QUIETLY)
ELSE (LIBSNDFILE_FOUND)
IF (LibSndFile_FIND_REQUIRED)
MESSAGE (FATAL_ERROR "Could not find sndfile")
ENDIF (LibSndFile_FIND_REQUIRED)
ENDIF (LIBSNDFILE_FOUND)

View File

@@ -0,0 +1,52 @@
# - Try to find Portaudio
# Once done this will define
#
# PORTAUDIO_FOUND - system has Portaudio
# PORTAUDIO_INCLUDE_DIRS - the Portaudio include directory
# PORTAUDIO_LIBRARIES - Link these to use Portaudio
include(FindPkgConfig)
pkg_check_modules(PC_PORTAUDIO portaudio-2.0)
find_path(PORTAUDIO_INCLUDE_DIRS
NAMES
portaudio.h
PATHS
/usr/local/include
/usr/include
HINTS
${PC_PORTAUDIO_INCLUDEDIR}
)
find_library(PORTAUDIO_LIBRARIES
NAMES
portaudio
PATHS
/usr/local/lib
/usr/lib
/usr/lib64
HINTS
${PC_PORTAUDIO_LIBDIR}
)
mark_as_advanced(PORTAUDIO_INCLUDE_DIRS PORTAUDIO_LIBRARIES)
# Found PORTAUDIO, but it may be version 18 which is not acceptable.
if(EXISTS ${PORTAUDIO_INCLUDE_DIRS}/portaudio.h)
include(CheckCXXSourceCompiles)
set(CMAKE_REQUIRED_INCLUDES_SAVED ${CMAKE_REQUIRED_INCLUDES})
set(CMAKE_REQUIRED_INCLUDES ${PORTAUDIO_INCLUDE_DIRS})
CHECK_CXX_SOURCE_COMPILES(
"#include <portaudio.h>\nPaDeviceIndex pa_find_device_by_name(const char *name); int main () {return 0;}"
PORTAUDIO2_FOUND)
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVED})
unset(CMAKE_REQUIRED_INCLUDES_SAVED)
if(PORTAUDIO2_FOUND)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PORTAUDIO DEFAULT_MSG PORTAUDIO_INCLUDE_DIRS PORTAUDIO_LIBRARIES)
else(PORTAUDIO2_FOUND)
message(STATUS
" portaudio.h not compatible (requires API 2.0)")
set(PORTAUDIO_FOUND FALSE)
endif(PORTAUDIO2_FOUND)
endif()

View File

@@ -0,0 +1,65 @@
# - try to find Qwt libraries and include files
# QWT_INCLUDE_DIR where to find qwt_global.h, etc.
# QWT_LIBRARIES libraries to link against
# QWT_FOUND If false, do not try to use Qwt
# qwt_global.h holds a string with the QWT version;
# test to make sure it's at least 5.2
find_path(QWT_INCLUDE_DIRS
NAMES qwt_global.h
HINTS
${CMAKE_INSTALL_PREFIX}/include/qwt
PATHS
/usr/local/include/qwt-qt4
/usr/local/include/qwt
/usr/include/qwt6
/usr/include/qwt-qt4
/usr/include/qwt-qt4
/usr/include/qwt
/usr/include/qwt5
/usr/include/qwt6-qt5
/usr/include/qt5/qwt
/opt/local/include/qwt
/sw/include/qwt
/usr/local/lib/qwt.framework/Headers
)
find_library (QWT_LIBRARIES
NAMES qwt6 qwt6-qt5 qwt-qt5 qwt6-qt4 qwt qwt-qt4
HINTS
${CMAKE_INSTALL_PREFIX}/lib
${CMAKE_INSTALL_PREFIX}/lib64
PATHS
/usr/local/lib
/usr/lib
/opt/local/lib
/sw/lib
/usr/local/lib/qwt.framework
)
set(QWT_FOUND FALSE)
if(QWT_INCLUDE_DIRS)
file(STRINGS "${QWT_INCLUDE_DIRS}/qwt_global.h"
QWT_STRING_VERSION REGEX "QWT_VERSION_STR")
set(QWT_WRONG_VERSION True)
set(QWT_VERSION "No Version")
string(REGEX MATCH "[0-9]+.[0-9]+.[0-9]+" QWT_VERSION ${QWT_STRING_VERSION})
string(COMPARE LESS ${QWT_VERSION} "5.2.0" QWT_WRONG_VERSION)
string(COMPARE GREATER ${QWT_VERSION} "6.2.0" QWT_WRONG_VERSION)
message(STATUS "QWT Version: ${QWT_VERSION}")
if(NOT QWT_WRONG_VERSION)
set(QWT_FOUND TRUE)
else(NOT QWT_WRONG_VERSION)
message(STATUS "QWT Version must be >= 5.2 and <= 6.2.0, Found ${QWT_VERSION}")
endif(NOT QWT_WRONG_VERSION)
endif(QWT_INCLUDE_DIRS)
if(QWT_FOUND)
# handle the QUIETLY and REQUIRED arguments and set QWT_FOUND to TRUE if
# all listed variables are TRUE
include ( FindPackageHandleStandardArgs )
find_package_handle_standard_args( Qwt DEFAULT_MSG QWT_LIBRARIES QWT_INCLUDE_DIRS )
MARK_AS_ADVANCED(QWT_LIBRARIES QWT_INCLUDE_DIRS)
endif(QWT_FOUND)

View File

@@ -0,0 +1,65 @@
# - try to find Qwt libraries and include files
# QWT_INCLUDE_DIR where to find qwt_global.h, etc.
# QWT_LIBRARIES libraries to link against
# QWT_FOUND If false, do not try to use Qwt
# qwt_global.h holds a string with the QWT version;
# test to make sure it's at least 5.2
find_path(QWT_INCLUDE_DIRS
NAMES qwt_global.h
HINTS
${CMAKE_INSTALL_PREFIX}/include/qwt
PATHS
/usr/local/include/qwt-qt4
/usr/local/include/qwt
/usr/include/qwt6
/usr/include/qwt-qt4
/usr/include/qwt-qt4
/usr/include/qwt
/usr/include/qwt5
/usr/include/qwt6-qt5
/usr/include/qt5/qwt
/opt/local/include/qwt
/sw/include/qwt
/usr/local/lib/qwt.framework/Headers
)
find_library (QWT_LIBRARIES
NAMES qwt6 qwt6-qt5 qwt-qt5 qwt6-qt4 qwt qwt-qt4
HINTS
${CMAKE_INSTALL_PREFIX}/lib
${CMAKE_INSTALL_PREFIX}/lib64
PATHS
/usr/local/lib
/usr/lib
/opt/local/lib
/sw/lib
/usr/local/lib/qwt.framework
)
set(QWT_FOUND FALSE)
if(QWT_INCLUDE_DIRS)
file(STRINGS "${QWT_INCLUDE_DIRS}/qwt_global.h"
QWT_STRING_VERSION REGEX "QWT_VERSION_STR")
set(QWT_WRONG_VERSION True)
set(QWT_VERSION "No Version")
string(REGEX MATCH "[0-9]+.[0-9]+.[0-9]+" QWT_VERSION ${QWT_STRING_VERSION})
string(COMPARE LESS ${QWT_VERSION} "5.2.0" QWT_WRONG_VERSION)
string(COMPARE GREATER ${QWT_VERSION} "6.2.0" QWT_WRONG_VERSION)
message(STATUS "QWT Version: ${QWT_VERSION}")
if(NOT QWT_WRONG_VERSION)
set(QWT_FOUND TRUE)
else(NOT QWT_WRONG_VERSION)
message(STATUS "QWT Version must be >= 5.2 and <= 6.2.0, Found ${QWT_VERSION}")
endif(NOT QWT_WRONG_VERSION)
endif(QWT_INCLUDE_DIRS)
if(QWT_FOUND)
# handle the QUIETLY and REQUIRED arguments and set QWT_FOUND to TRUE if
# all listed variables are TRUE
include ( FindPackageHandleStandardArgs )
find_package_handle_standard_args( Qwt DEFAULT_MSG QWT_LIBRARIES QWT_INCLUDE_DIRS )
MARK_AS_ADVANCED(QWT_LIBRARIES QWT_INCLUDE_DIRS)
endif(QWT_FOUND)

View File

@@ -0,0 +1,20 @@
# Find zlib
FIND_PATH(ZLIB_INCLUDE_DIR zlib.h)
SET(ZLIB_NAMES ${ZLIB_NAMES} libz z)
FIND_LIBRARY(ZLIB_LIBRARY NAMES ${ZLIB_NAMES} PATH)
IF (ZLIB_INCLUDE_DIR AND ZLIB_LIBRARY)
SET(ZLIB_FOUND TRUE)
ENDIF (ZLIB_INCLUDE_DIR AND ZLIB_LIBRARY)
IF (ZLIB_FOUND)
IF (NOT zlib_FIND_QUIETLY)
MESSAGE (STATUS "Found zlib: ${ZLIBFILE_LIBRARY}")
ENDIF (NOT zlib_FIND_QUIETLY)
ELSE (ZLIB_FOUND)
IF (zlib_FIND_REQUIRED)
MESSAGE (FATAL_ERROR "Could not find zlib")
ENDIF (zlib_FIND_REQUIRED)
ENDIF (ZLIB_FOUND)

View File

@@ -0,0 +1,21 @@
if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
string(REGEX REPLACE "\n" ";" files "${files}")
foreach(file ${files})
message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
exec_program(
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
)
if(NOT "${rm_retval}" STREQUAL 0)
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
endif(NOT "${rm_retval}" STREQUAL 0)
else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
endforeach(file)

433
dab-processor.cpp Normal file
View File

@@ -0,0 +1,433 @@
#
/*
* Copyright (C) 2014 .. 2017
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of the Qt-DAB program
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Qt-DAB if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "dab-processor.h"
#include "fic-handler.h"
#include "msc-handler.h"
#include "radio.h"
#include "dab-params.h"
//
/**
* \brief dabProcessor
* The dabProcessor class is the driver of the processing
* of the samplestream.
* It is the main interface to the qt-dab program,
* local are classes ofdmDecoder, ficHandler and mschandler.
*/
#define C_LEVEL_SIZE 50
dabProcessor::dabProcessor (RadioInterface *mr,
virtualInput *theRig,
uint8_t dabMode,
int16_t threshold,
int16_t diff_length,
QString picturesPath,
RingBuffer<std::complex<float>> *spectrumBuffer
):
params (dabMode),
myReader (mr,
theRig,
spectrumBuffer
),
my_ficHandler (mr, dabMode),
my_mscHandler (mr, dabMode,
picturesPath),
phaseSynchronizer (mr,
dabMode,
threshold,
diff_length),
my_ofdmDecoder (mr,
dabMode,
theRig -> bitDepth (),
&my_ficHandler,
&my_mscHandler) {
int32_t i;
this -> myRadioInterface = mr;
this -> theRig = theRig;
this -> T_null = params. get_T_null ();
this -> T_s = params. get_T_s ();
this -> T_u = params. get_T_u ();
this -> T_F = params. get_T_F ();
this -> nrBlocks = params. get_L ();
this -> carriers = params. get_carriers ();
this -> carrierDiff = params. get_carrierDiff ();
ofdmBuffer. resize (2 * T_s);
ofdmBufferIndex = 0;
ofdmSymbolCount = 0;
tokenCount = 0;
fineCorrector = 0;
f2Correction = true;
attempts = 0;
scanMode = false;
connect (this, SIGNAL (setSynced (char)),
myRadioInterface, SLOT (setSynced (char)));
connect (this, SIGNAL (No_Signal_Found (void)),
myRadioInterface, SLOT (No_Signal_Found(void)));
connect (this, SIGNAL (setSyncLost (void)),
myRadioInterface, SLOT (setSyncLost (void)));
myReader. setRunning (false);
// the thread will be started from somewhere else
}
dabProcessor::~dabProcessor (void) {
if (isRunning ()) {
myReader. setRunning (false);
// exception to be raised
// through the getSample(s) functions.
msleep (100);
while (isRunning ()) {
usleep (100);
}
}
}
/***
* \brief run
* The main thread, reading samples,
* time synchronization and frequency synchronization
* Identifying blocks in the DAB frame
* and sending them to the ofdmDecoder who will transfer the results
* Finally, estimating the small freqency error
*/
void dabProcessor::run (void) {
int32_t startIndex;
int32_t i;
std::complex<float> FreqCorr;
int32_t counter;
float cLevel;
int32_t syncBufferIndex = 0;
const
int32_t syncBufferSize = 32768;
const
int32_t syncBufferMask = syncBufferSize - 1;
float envBuffer [syncBufferSize];
fineCorrector = 0;
f2Correction = true;
syncBufferIndex = 0;
attempts = 0;
theRig -> resetBuffer ();
coarseOffset = theRig -> getOffset ();
myReader. setRunning (true);
my_ofdmDecoder. start ();
//
// to get some idea of the signal strength
try {
for (i = 0; i < T_F / 5; i ++) {
myReader. getSample (0);
}
Initing:
notSynced:
syncBufferIndex = 0;
cLevel = 0;
for (i = 0; i < C_LEVEL_SIZE; i ++) {
std::complex<float> sample = myReader. getSample (0);
envBuffer [syncBufferIndex] = jan_abs (sample);
cLevel += envBuffer [syncBufferIndex];
syncBufferIndex ++;
}
/**
* We now have initial values for cLevel (i.e. the sum
* over the last C_LEVEL_SIZE samples) and sLevel, the long term average.
*/
SyncOnNull:
/**
* here we start looking for the null level, i.e. a dip
*/
counter = 0;
setSynced (false);
while (cLevel / C_LEVEL_SIZE > 0.40 * myReader. get_sLevel ()) {
std::complex<float> sample =
myReader. getSample (coarseOffset + fineCorrector);
envBuffer [syncBufferIndex] = jan_abs (sample);
// update the levels
cLevel += envBuffer [syncBufferIndex] -
envBuffer [(syncBufferIndex - C_LEVEL_SIZE) & syncBufferMask];
syncBufferIndex = (syncBufferIndex + 1) & syncBufferMask;
counter ++;
if (counter > T_F) { // hopeless
if (scanMode && (++ attempts >= 5)) {
emit (No_Signal_Found ());
attempts = 0;
}
goto notSynced;
}
}
/**
* It seemed we found a dip that started app 65/100 * 50 samples earlier.
* We now start looking for the end of the null period.
*/
counter = 0;
SyncOnEndNull:
while (cLevel / C_LEVEL_SIZE < 0.75 * myReader. get_sLevel ()) {
std::complex<float> sample =
myReader. getSample (coarseOffset + fineCorrector);
envBuffer [syncBufferIndex] = jan_abs (sample);
// update the levels
cLevel += envBuffer [syncBufferIndex] -
envBuffer [(syncBufferIndex - C_LEVEL_SIZE) & syncBufferMask];
syncBufferIndex = (syncBufferIndex + 1) & syncBufferMask;
counter ++;
//
if (counter > T_null + 50) { // hopeless
goto notSynced;
}
}
/**
* The end of the null period is identified, the actual end
* is probably about 40 samples earlier.
*/
SyncOnPhase:
/**
* We now have to find the exact first sample of the non-null period.
* We use a correlation that will find the first sample after the
* cyclic prefix.
* When in "sync", i.e. pretty sure that we know were we are,
* we skip the "dip" identification and come here right away.
*
* now read in Tu samples. The precise number is not really important
* as long as we can be sure that the first sample to be identified
* is part of the samples read.
*/
myReader. getSamples (ofdmBuffer. data (),
T_u, coarseOffset + fineCorrector);
//
// and then, call upon the phase synchronizer to verify/compute
// the real "first" sample
startIndex = phaseSynchronizer. findIndex (ofdmBuffer);
if (startIndex < 0) { // no sync, try again
if (!f2Correction) {
setSyncLost ();
}
goto notSynced;
}
/**
* Once here, we are synchronized, we need to copy the data we
* used for synchronization for block 0
*/
memmove (ofdmBuffer. data (),
&((ofdmBuffer. data ()) [startIndex]),
(T_u - startIndex) * sizeof (std::complex<float>));
ofdmBufferIndex = T_u - startIndex;
Block_0:
/**
* Block 0 is special in that it is used for fine time synchronization,
* for coarse frequency synchronization
* and its content is used as a reference for decoding the
* first datablock.
* We read the missing samples in the ofdm buffer
*/
setSynced (true);
myReader. getSamples (&((ofdmBuffer. data ()) [ofdmBufferIndex]),
T_u - ofdmBufferIndex,
coarseOffset + fineCorrector);
my_ofdmDecoder. processBlock_0 (ofdmBuffer);
// Here we look only at the block_0 when we need a coarse
// frequency synchronization.
f2Correction = !my_ficHandler. syncReached ();
if (f2Correction) {
int correction =
phaseSynchronizer. estimate_CarrierOffset (ofdmBuffer);
if (correction != 100) {
coarseOffset += correction * carrierDiff;
if (abs (coarseOffset) > Khz (35))
coarseOffset = 0;
}
}
/**
* after block 0, we will just read in the other (params -> L - 1) blocks
*/
Data_blocks:
/**
* The first ones are the FIC blocks. We immediately
* start with building up an average of the phase difference
* between the samples in the cyclic prefix and the
* corresponding samples in the datapart.
*/
FreqCorr = std::complex<float> (0, 0);
for (ofdmSymbolCount = 1;
ofdmSymbolCount < 4; ofdmSymbolCount ++) {
myReader. getSamples (ofdmBuffer. data (),
T_s, coarseOffset + fineCorrector);
for (i = (int)T_u; i < (int)T_s; i ++)
FreqCorr += ofdmBuffer [i] * conj (ofdmBuffer [i - T_u]);
my_ofdmDecoder. decodeFICblock (ofdmBuffer, ofdmSymbolCount);
}
/// and similar for the (params -> L - 4) MSC blocks
for (ofdmSymbolCount = 4;
ofdmSymbolCount < (uint16_t)nrBlocks;
ofdmSymbolCount ++) {
myReader. getSamples (ofdmBuffer. data (),
T_s, coarseOffset + fineCorrector);
for (i = (int32_t)T_u; i < (int32_t)T_s; i ++)
FreqCorr += ofdmBuffer [i] * conj (ofdmBuffer [i - T_u]);
my_ofdmDecoder. decodeMscblock (ofdmBuffer, ofdmSymbolCount);
}
NewOffset:
/// we integrate the newly found frequency error with the
/// existing frequency error.
fineCorrector += 0.1 * arg (FreqCorr) / (2 * M_PI) * carrierDiff;
//
/**
* OK, here we are at the end of the frame
* Assume everything went well and skip T_null samples
*/
syncBufferIndex = 0;
cLevel = 0;
myReader. getSamples (ofdmBuffer. data (),
T_null, coarseOffset);
/**
* The first sample to be found for the next frame should be T_g
* samples ahead. Before going for the next frame, we
* we just check the fineCorrector
*/
if (fineCorrector > carrierDiff / 2) {
coarseOffset += carrierDiff;
fineCorrector -= carrierDiff;
}
else
if (fineCorrector < -carrierDiff / 2) {
coarseOffset -= carrierDiff;
fineCorrector += carrierDiff;
}
ReadyForNewFrame:
/// and off we go, up to the next frame
counter = 0;
goto SyncOnPhase;
}
catch (int e) {
fprintf (stderr, "dabProcessor is stopping\n");
;
}
my_ofdmDecoder. stop ();
my_mscHandler. stop ();
my_ficHandler. stop ();
}
void dabProcessor:: reset (void) {
myReader. setRunning (false);
while (isRunning ())
wait ();
usleep (10000);
my_ofdmDecoder. stop ();
my_mscHandler. reset ();
my_ficHandler. reset ();
start ();
}
void dabProcessor::stop (void) {
myReader. setRunning (false);
while (isRunning ())
wait ();
usleep (10000);
my_ofdmDecoder. stop ();
my_mscHandler. reset ();
my_ficHandler. reset ();
}
void dabProcessor::coarseCorrectorOn (void) {
f2Correction = true;
coarseOffset = 0;
}
void dabProcessor::coarseCorrectorOff (void) {
f2Correction = false;
theRig -> setOffset (coarseOffset);
}
void dabProcessor::set_scanMode (bool b) {
scanMode = b;
attempts = 0;
}
// we could have derive the dab processor from fic and msc handlers,
// however, from a logical point of view they are more delegates than
// parents.
uint8_t dabProcessor::kindofService (QString &s) {
return my_ficHandler. kindofService (s);
}
void dabProcessor::dataforAudioService (int16_t c, audiodata *dd) {
my_ficHandler. dataforAudioService (c, dd);
}
void dabProcessor::dataforAudioService (QString &s,audiodata *dd) {
my_ficHandler. dataforAudioService (s, dd, 0);
}
void dabProcessor::dataforAudioService (QString &s,
audiodata *d, int16_t c) {
my_ficHandler. dataforAudioService (s, d, c);
}
void dabProcessor::dataforDataService (int16_t c, packetdata *dd) {
my_ficHandler. dataforDataService (c, dd);
}
void dabProcessor::dataforDataService (QString &s, packetdata *dd) {
my_ficHandler. dataforDataService (s, dd, 0);
}
void dabProcessor::dataforDataService (QString &s,
packetdata *d, int16_t c) {
my_ficHandler. dataforDataService (s, d, c);
}
void dabProcessor::reset_msc (void) {
my_mscHandler. reset ();
}
void dabProcessor::set_audioChannel (audiodata *d,
RingBuffer<int16_t> *b) {
my_mscHandler. set_audioChannel (d, b);
}
void dabProcessor::set_dataChannel (packetdata *d,
RingBuffer<uint8_t> *b) {
my_mscHandler. set_dataChannel (d, b);
}
int32_t dabProcessor::get_ensembleId (void) {
return my_ficHandler. get_ensembleId ();
}
QString dabProcessor::get_ensembleName (void) {
return my_ficHandler. get_ensembleName ();
}
void dabProcessor::clearEnsemble (void) {
my_ficHandler. clearEnsemble ();
}

127
dab-processor.h Normal file
View File

@@ -0,0 +1,127 @@
#
/*
* Copyright (C) 2013 .. 2017
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of the Qt-DAB program
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#
#ifndef __DAB_PROCESSOR__
#define __DAB_PROCESSOR__
/*
* dabProcessor is the embodying of all functionality related
* to the actal DAB processing.
*/
#include "dab-constants.h"
#include <QThread>
#include <QObject>
#include <vector>
#include "stdint.h"
#include <sndfile.h>
#include "sample-reader.h"
#include "phasereference.h"
#include "ofdm-decoder.h"
#include "fic-handler.h"
#include "msc-handler.h"
#include "virtual-input.h"
#include "ringbuffer.h"
//
class RadioInterface;
class dabParams;
class dabProcessor: public QThread {
Q_OBJECT
public:
dabProcessor (RadioInterface *,
virtualInput *,
uint8_t,
int16_t,
int16_t,
QString,
RingBuffer<std::complex<float>> *);
~dabProcessor (void);
void reset (void);
void stop (void);
void setOffset (int32_t);
void coarseCorrectorOn (void);
void coarseCorrectorOff (void);
void startDumping (SNDFILE *);
void stopDumping (void);
void set_scanMode (bool);
//
// inheriting from our delegates
void setSelectedService (QString &);
uint8_t kindofService (QString &);
void dataforAudioService (int16_t, audiodata *);
void dataforAudioService (QString &, audiodata *);
void dataforAudioService (QString &,
audiodata *, int16_t);
void dataforDataService (int16_t, packetdata *);
void dataforDataService (QString &, packetdata *);
void dataforDataService (QString &,
packetdata *, int16_t);
void reset_msc (void);
void set_audioChannel (audiodata *,
RingBuffer<int16_t> *);
void set_dataChannel (packetdata *,
RingBuffer<uint8_t> *);
int32_t get_ensembleId (void);
QString get_ensembleName (void);
void clearEnsemble (void);
private:
virtualInput *theRig;
dabParams params;
sampleReader myReader;
RadioInterface *myRadioInterface;
ficHandler my_ficHandler;
mscHandler my_mscHandler;
int16_t attempts;
bool scanMode;
int32_t T_null;
int32_t T_u;
int32_t T_s;
int32_t T_g;
int32_t T_F;
int32_t nrBlocks;
int32_t carriers;
int32_t carrierDiff;
std::vector<std::complex<float> > dataBuffer;
int16_t fineCorrector;
int32_t coarseOffset;
bool f2Correction;
int32_t tokenCount;
std::vector<std::complex<float> >ofdmBuffer;
uint32_t ofdmBufferIndex;
uint32_t ofdmSymbolCount;
phaseReference phaseSynchronizer;
ofdmDecoder my_ofdmDecoder;
bool wasSecond (int16_t, dabParams *);
virtual void run (void);
bool isReset;
signals:
void setSynced (char);
void No_Signal_Found (void);
void setSyncLost (void);
void showCoordinates (int, int);
// void showCoordinates (float, float);
void show_Spectrum (int);
};
#endif

113
dab-scope/scopewidget.ui Normal file
View File

@@ -0,0 +1,113 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>scopeWidget</class>
<widget class="QWidget" name="scopeWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>713</width>
<height>208</height>
</rect>
</property>
<property name="windowTitle">
<string>DAB signal</string>
</property>
<widget class="QwtPlot" name="dabScope">
<property name="geometry">
<rect>
<x>50</x>
<y>20</y>
<width>461</width>
<height>161</height>
</rect>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Spectrum display, shows the frequency spectrum from the channel currently being received.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QSlider" name="scopeAmplification">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>20</width>
<height>171</height>
</rect>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Zoom in/out&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="value">
<number>50</number>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
<widget class="QwtPlot" name="iqDisplay">
<property name="geometry">
<rect>
<x>510</x>
<y>20</y>
<width>181</width>
<height>111</height>
</rect>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Constellation diagram, obtained from the first data block in a DAB frame. What is shown are the constellations of the carriers in the decoded OFDM symbol. &lt;/p&gt;&lt;p&gt;In DAB the bits are encoded as (1, 1), (1, -1), (-1, -1) and (1,1), so ideally there are 4 points, one in each corner. The quality of the signal is inverse to the clouds that are visible. The number indicated below this &amp;quot;cloud picture&amp;quot; shows the standard deviation of the dots on the cloud(s).&lt;/p&gt;&lt;p&gt;Hint: Lots of clouds mean poor signal.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QSlider" name="scopeSlider">
<property name="geometry">
<rect>
<x>530</x>
<y>140</y>
<width>171</width>
<height>24</height>
</rect>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Zoom in/out&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="value">
<number>20</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
<widget class="QLCDNumber" name="quality_display">
<property name="geometry">
<rect>
<x>620</x>
<y>170</y>
<width>81</width>
<height>23</height>
</rect>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Quality indicator (experimental). The number shows the standard phase deviation of the decoded signal.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="digitCount">
<number>7</number>
</property>
<property name="segmentStyle">
<enum>QLCDNumber::Flat</enum>
</property>
</widget>
</widget>
<customwidgets>
<customwidget>
<class>QwtPlot</class>
<extends>QFrame</extends>
<header>qwt_plot.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,198 @@
#
/*
* Copyright (C) 2014 .. 2017
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of dabradio
* dabradio is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* dabradio is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with dabradio; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "spectrum-handler.h"
#include <QColor>
spectrumhandler::spectrumhandler (QwtPlot *dabScope,
int32_t displaySize,
RingBuffer<std::complex<float>> *sbuffer) {
int16_t i;
QString colorString = "black";
QColor displayColor;
QColor gridColor;
QColor curveColor;
this -> plotgrid = dabScope;
this -> displaySize = displaySize;
this -> scopeBuffer = sbuffer;
colorString = "black";
displayColor = QColor (colorString);
colorString = "white";
curveColor = QColor (colorString);
displayBuffer. resize (displaySize);
memset (displayBuffer. data (), 0, displaySize * sizeof (double));
this -> spectrumSize = 4 * displaySize;
spectrum = (std::complex<float> *)fftwf_malloc (sizeof (fftwf_complex) * spectrumSize);
plan = fftwf_plan_dft_1d (spectrumSize,
reinterpret_cast <fftwf_complex *>(spectrum),
reinterpret_cast <fftwf_complex *>(spectrum),
FFTW_FORWARD, FFTW_ESTIMATE);
plotgrid -> setCanvasBackground (displayColor);
grid = new QwtPlotGrid;
#if defined QWT_VERSION && ((QWT_VERSION >> 8) < 0x0601)
grid -> setMajPen (QPen(gridColor, 0, Qt::DotLine));
#else
grid -> setMajorPen (QPen(gridColor, 0, Qt::DotLine));
#endif
grid -> enableXMin (true);
grid -> enableYMin (true);
#if defined QWT_VERSION && ((QWT_VERSION >> 8) < 0x0601)
grid -> setMinPen (QPen(gridColor, 0, Qt::DotLine));
#else
grid -> setMinorPen (QPen(gridColor, 0, Qt::DotLine));
#endif
grid -> attach (plotgrid);
spectrumCurve = new QwtPlotCurve ("");
spectrumCurve -> setPen (QPen(Qt::white));
spectrumCurve -> setOrientation (Qt::Horizontal);
spectrumCurve -> setBaseline (get_db (0));
ourBrush = new QBrush (Qt::white);
ourBrush -> setStyle (Qt::Dense3Pattern);
spectrumCurve -> setBrush (*ourBrush);
spectrumCurve -> attach (plotgrid);
Marker = new QwtPlotMarker ();
Marker -> setLineStyle (QwtPlotMarker::VLine);
Marker -> setLinePen (QPen (Qt::red));
Marker -> attach (plotgrid);
plotgrid -> enableAxis (QwtPlot::yLeft);
Window. resize (spectrumSize);
for (i = 0; i < spectrumSize; i ++)
Window [i] =
0.42 - 0.5 * cos ((2.0 * M_PI * i) / (spectrumSize - 1)) +
0.08 * cos ((4.0 * M_PI * i) / (spectrumSize - 1));
setBitDepth (12);
}
spectrumhandler::~spectrumhandler (void) {
fftwf_destroy_plan (plan);
fftwf_free (spectrum);
delete Marker;
delete ourBrush;
delete spectrumCurve;
delete grid;
}
void spectrumhandler::showSpectrum (int32_t amount, int32_t vfoFrequency) {
double X_axis [displaySize];
double Y_values [displaySize];
int16_t i, j;
double temp = (double)INPUT_RATE / 2 / displaySize;
int16_t averageCount = 5;
(void)amount;
if (scopeBuffer -> GetRingBufferReadAvailable () < spectrumSize)
return;
// first X axis labels
for (i = 0; i < displaySize; i ++)
X_axis [i] =
((double)vfoFrequency - (double)(INPUT_RATE / 2) +
(double)((i) * (double) 2 * temp)) / ((double)1000000);
//
// get the buffer data
scopeBuffer -> getDataFromBuffer (spectrum, spectrumSize);
scopeBuffer -> FlushRingBuffer ();
// and window it
for (i = 0; i < spectrumSize; i ++)
spectrum [i] = cmul (spectrum [i], Window [i]);
fftwf_execute (plan);
//
// and map the spectrumSize values onto displaySize elements
for (i = 0; i < displaySize / 2; i ++) {
double f = 0;
for (j = 0; j < spectrumSize / displaySize; j ++)
f += abs (spectrum [spectrumSize / displaySize * i + j]);
Y_values [displaySize / 2 + i] =
f / (spectrumSize / displaySize);
f = 0;
for (j = 0; j < spectrumSize / displaySize; j ++)
f += abs (spectrum [spectrumSize / 2 +
spectrumSize / displaySize * i + j]);
Y_values [i] = f / (spectrumSize / displaySize);
}
//
// average the image a little.
for (i = 0; i < displaySize; i ++) {
if (std::isnan (Y_values [i]) || std::isinf (Y_values [i]))
continue;
displayBuffer [i] =
(double)(averageCount - 1) /averageCount * displayBuffer [i] +
1.0f / averageCount * Y_values [i];
}
memcpy (Y_values,
displayBuffer. data (), displaySize * sizeof (double));
ViewSpectrum (X_axis, Y_values,
50,
vfoFrequency / 1000);
}
void spectrumhandler::ViewSpectrum (double *X_axis,
double *Y1_value,
double amp,
int32_t marker) {
uint16_t i;
amp = amp / 50.0 * (-get_db (0));
plotgrid -> setAxisScale (QwtPlot::xBottom,
(double)X_axis [0],
X_axis [displaySize - 1]);
plotgrid -> enableAxis (QwtPlot::xBottom);
plotgrid -> setAxisScale (QwtPlot::yLeft,
get_db (0), get_db (0) + amp);
// get_db (0), 0);
for (i = 0; i < displaySize; i ++)
Y1_value [i] = get_db (amp * Y1_value [i]);
spectrumCurve -> setBaseline (get_db (0));
Y1_value [0] = get_db (0);
Y1_value [displaySize - 1] = get_db (0);
spectrumCurve -> setSamples (X_axis, Y1_value, displaySize);
Marker -> setXValue (marker);
plotgrid -> replot();
}
float spectrumhandler::get_db (float x) {
return 20 * log10 ((x + 1) / (float)(normalizer));
}
void spectrumhandler::setBitDepth (int16_t d) {
if (d < 0 || d > 32)
d = 24;
normalizer = 1;
while (-- d > 0)
normalizer <<= 1;
}

View File

@@ -0,0 +1,68 @@
#
/*
* Copyright (C) 2014 .. 2017
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of the Qt-DAB.
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//
//
#ifndef __SPECTRUM_HANDLER__
#define __SPECTRUM_HANDLER__
#include "dab-constants.h"
#include <QObject>
#include <fftw3.h>
#include "ringbuffer.h"
#include <qwt.h>
#include <qwt_plot.h>
#include <qwt_plot_marker.h>
#include <qwt_plot_grid.h>
#include <qwt_plot_curve.h>
#include <qwt_plot_marker.h>
class spectrumhandler {
public:
spectrumhandler (QwtPlot *,
int32_t ,
RingBuffer<std::complex<float>> *);
~spectrumhandler (void);
void showSpectrum (int32_t, int32_t);
void setBitDepth (int16_t);
private:
RingBuffer<std::complex<float>> *scopeBuffer;
int16_t displaySize;
int16_t spectrumSize;
std::complex<float> *spectrum;
std::vector<double> displayBuffer;
std::vector<float> Window;
fftwf_plan plan;
QwtPlotMarker *Marker;
QwtPlot *plotgrid;
QwtPlotGrid *grid;
QwtPlotCurve *spectrumCurve;
QBrush *ourBrush;
int32_t indexforMarker;
void ViewSpectrum (double *, double *, double, int);
float get_db (float);
int32_t normalizer;
};
#endif

7
dabradio.desktop Normal file
View File

@@ -0,0 +1,7 @@
[Desktop Entry]
Name=dabradio
Exec=dabradio
Icon=dabradio
Type=Application
Categories=AudioVideo;
Comment=A DAB/DAB+ decoder using Qt and C++

BIN
dabradio.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 KiB

BIN
dabradio.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

354
dabradio.pro Normal file
View File

@@ -0,0 +1,354 @@
######################################################################
# Automatically generated by qmake (2.01a) Tue Oct 6 19:48:14 2009
# but modified by me to accomodate for the includes for qwt, hamlib and
# portaudio
######################################################################
TEMPLATE = app
TARGET = dabradio-1.0
QT += widgets
CONFIG += console
QMAKE_CXXFLAGS += -std=c++11
#QMAKE_CFLAGS += -flto -ffast-math
#QMAKE_CXXFLAGS += -flto -ffast-math
#QMAKE_LFLAGS += -flto
QMAKE_CFLAGS += -g
QMAKE_CXXFLAGS += -g
QMAKE_LFLAGS += -g
QMAKE_CXXFLAGS += -isystem $$[QT_INSTALL_HEADERS]
RC_ICONS = qt-dab.ico
RESOURCES += resources.qrc
TRANSLATIONS = i18n/de_DE.ts i18n/it_IT.ts i18n/hu_HU.ts
DEPENDPATH += . \
./src \
./dab-scope \
./includes \
./src/ofdm \
./src/backend \
./src/backend/viterbi_768 \
./src/backend/audio \
./src/backend/data \
./src/output \
./src/various \
./devices \
./devices/rawfiles \
./devices/wavfiles \
./includes/ofdm \
./includes/backend \
./includes/backend/audio \
./includes/backend/data \
./includes/output \
./includes/various
INCLUDEPATH += . \
./ \
./src \
./dab-scope \
./includes \
./includes/ofdm \
./includes/backend \
./includes/backend/viterbi_768 \
./includes/backend/audio \
./includes/backend/data \
./includes/output \
./includes/various \
./devices \
./devices/rawfiles \
./devices/wavfiles
# Input
HEADERS += ./radio.h \
./dab-processor.h \
./dab-scope/spectrum-handler.h \
./includes/dab-constants.h \
./includes/country-codes.h \
./includes/ofdm/sample-reader.h \
./includes/ofdm/ofdm-decoder.h \
./includes/ofdm/phasereference.h \
./includes/ofdm/phasetable.h \
./includes/ofdm/freq-interleaver.h \
# ./includes/backend/viterbi.h \
./includes/backend/viterbi_768/viterbi-768.h \
./includes/backend/fic-handler.h \
./includes/backend/msc-handler.h \
./includes/backend/fib-processor.h \
./includes/backend/galois.h \
./includes/backend/reed-solomon.h \
./includes/backend/rscodec.h \
./includes/backend/charsets.h \
./includes/backend/firecode-checker.h \
./includes/backend/frame-processor.h \
./includes/backend/virtual-backend.h \
./includes/backend/audio-backend.h \
./includes/backend/data-backend.h \
./includes/backend/audio/mp2processor.h \
./includes/backend/audio/mp4processor.h \
./includes/backend/audio/faad-decoder.h \
./includes/backend/data/data-processor.h \
./includes/backend/data/pad-handler.h \
./includes/backend/data/virtual-datahandler.h \
./includes/backend/data/mot-databuilder.h \
./includes/backend/data/mot-data.h \
./includes/backend/protection.h \
./includes/backend/eep-protection.h \
./includes/backend/uep-protection.h \
# ./includes/output/fir-filters.h \
./includes/output/audio-base.h \
./includes/output/newconverter.h \
./includes/output/audiosink.h \
./includes/various/fft-handler.h \
./includes/various/ringbuffer.h \
./includes/various/Xtan2.h \
./includes/various/dab-params.h \
./includes/various/band-handler.h \
./includes/various/text-mapper.h \
./devices/virtual-input.h \
./devices/rawfiles/rawfiles.h \
./devices/wavfiles/wavfiles.h
FORMS += ./devices/filereader-widget.ui
FORMS += ./forms/technical_data.ui
SOURCES += ./main.cpp \
./radio.cpp \
./dab-processor.cpp \
./dab-scope/spectrum-handler.cpp \
./src/ofdm/sample-reader.cpp \
./src/ofdm/ofdm-decoder.cpp \
./src/ofdm/phasereference.cpp \
./src/ofdm/phasetable.cpp \
./src/ofdm/freq-interleaver.cpp \
# ./src/backend/viterbi.cpp \
./src/backend/viterbi_768/viterbi-768.cpp \
./src/backend/fic-handler.cpp \
./src/backend/msc-handler.cpp \
./src/backend/protection.cpp \
./src/backend/eep-protection.cpp \
./src/backend/uep-protection.cpp \
./src/backend/fib-processor.cpp \
./src/backend/galois.cpp \
./src/backend/reed-solomon.cpp \
./src/backend/rscodec.cpp \
./src/backend/charsets.cpp \
./src/backend/firecode-checker.cpp \
./src/backend/frame-processor.cpp \
./src/backend/protTables.cpp \
./src/backend/virtual-backend.cpp \
./src/backend/audio-backend.cpp \
./src/backend/data-backend.cpp \
./src/backend/audio/mp2processor.cpp \
./src/backend/audio/mp4processor.cpp \
./src/backend/audio/faad-decoder.cpp \
./src/backend/data/pad-handler.cpp \
./src/backend/data/data-processor.cpp \
./src/backend/data/virtual-datahandler.cpp \
./src/backend/data/mot-databuilder.cpp \
./src/backend/data/mot-data.cpp \
# ./src/output/fir-filters.cpp \
./src/output/audio-base.cpp \
./src/output/newconverter.cpp \
./src/output/audiosink.cpp \
./src/various/fft-handler.cpp \
./src/various/Xtan2.cpp \
./src/various/dab-params.cpp \
./src/various/band-handler.cpp \
./src/various/text-mapper.cpp \
./devices/virtual-input.cpp \
./devices/rawfiles/rawfiles.cpp \
./devices/wavfiles/wavfiles.cpp
#
# for unix systems this is about it. Adapt when needed for naming
# and locating libraries. If you do not need a device as
# listed, just comment the line out.
#
unix {
DESTDIR = ./linux-bin
exists ("./.git") {
GITHASHSTRING = $$system(git rev-parse --short HEAD)
!isEmpty(GITHASHSTRING) {
message("Current git hash = $$GITHASHSTRING")
DEFINES += GITHASH=\\\"$$GITHASHSTRING\\\"
}
}
isEmpty(GITHASHSTRING) {
DEFINES += GITHASH=\\\"------\\\"
}
FORMS += ./forms/dabradio.ui
INCLUDEPATH += /usr/local/include
INCLUDEPATH += /usr/local/include /usr/include/qt4/qwt /usr/include/qt5/qwt /usr/include/qt4/qwt /usr/include/qwt /usr/local/qwt-6.1.4-svn/
LIBS += -lfftw3f -lusb-1.0 -ldl #
LIBS += -lportaudio
LIBS += -lz
LIBS += -lsndfile
LIBS += -lsamplerate
LIBS += -lfaad
LIBS += -lqwt-qt5
#
# comment or uncomment for the devices you want to have support for
# (you obviously have libraries installed for the selected ones)
CONFIG += dabstick
CONFIG += sdrplay
CONFIG += airspy
#if you want to listen remote, uncomment
#CONFIG += tcp-streamer # use for remote listening
#otherwise, if you want to use the default qt way of soud out
#CONFIG += qt-audio
#comment both out if you just want to use the "normal" way
#for the raspberry you definitely want this one
#when this one is enabled, load is spread over different threads
DEFINES += __THREADED_BACKEND
#DEFINES += __THREADED_DECODING
#and this one is experimental
DEFINES += PRESET_NAME
#and these one is just experimental,
#CONFIG += NEON
CONFIG += SSE
}
#
# an attempt to have it run under W32 through cross compilation
win32 {
#DESTDIR = ../../../dab-win
DESTDIR = ../../windows-bin
# includes in mingw differ from the includes in fedora linux
exists ("./.git") {
GITHASHSTRING = $$system(git rev-parse --short HEAD)
!isEmpty(GITHASHSTRING) {
message("Current git hash = $$GITHASHSTRING")
DEFINES += GITHASH=\\\"$$GITHASHSTRING\\\"
}
}
isEmpty(GITHASHSTRING) {
DEFINES += GITHASH=\\\"------\\\"
}
INCLUDEPATH += /usr/i686-w64-mingw32/sys-root/mingw/include
INCLUDEPATH += /mingw32/include
INCLUDEPATH += /mingw32/include/qwt
LIBS += -L/usr/i686-w64-mingw32/sys-root/mingw/lib
LIBS += -lfftw3f
LIBS += -lportaudio
LIBS += -lsndfile
LIBS += -lsamplerate
LIBS += -lole32
LIBS += -lwinpthread
LIBS += -lwinmm
LIBS += -lstdc++
LIBS += -lws2_32
LIBS += -lfaad
LIBS += -lusb-1.0
LIBS += -lz
FORMS += ./forms/dabradio.ui
FORMS += ./forms/technical_data.ui
CONFIG += extio
CONFIG += airspy
CONFIG += rtl_tcp
CONFIG += dabstick
CONFIG += sdrplay
CONFIG += NO_SSE
#for the raspberry you definitely want this one
#when this one is enabled, load is spread over different threads
DEFINES += __THREADED_BACKEND
#DEFINES += __THREADED_DECODING
#and this one is experimental
DEFINES += PRESET_NAME
}
# devices
#
# dabstick
dabstick {
DEFINES += HAVE_RTLSDR
DEPENDPATH += ./devices/rtlsdr-handler
INCLUDEPATH += ./devices/rtlsdr-handler
HEADERS += ./devices/rtlsdr-handler/rtlsdr-handler.h \
./devices/rtlsdr-handler/rtl-dongleselect.h
SOURCES += ./devices/rtlsdr-handler/rtlsdr-handler.cpp \
./devices/rtlsdr-handler/rtl-dongleselect.cpp
FORMS += ./devices/rtlsdr-handler/rtlsdr-widget.ui
}
#
# the SDRplay
#
sdrplay {
DEFINES += HAVE_SDRPLAY
DEPENDPATH += ./devices/sdrplay-handler
INCLUDEPATH += ./devices/sdrplay-handler
HEADERS += ./devices/sdrplay-handler/sdrplay-handler.h \
./devices/sdrplay-handler/sdrplayselect.h
SOURCES += ./devices/sdrplay-handler/sdrplay-handler.cpp \
./devices/sdrplay-handler/sdrplayselect.cpp
FORMS += ./devices/sdrplay-handler/sdrplay-widget.ui
}
#
#
# airspy support
#
airspy {
DEFINES += HAVE_AIRSPY
DEPENDPATH += ./devices/airspy
INCLUDEPATH += ./devices/airspy-handler \
./devices/airspy-handler/libairspy
HEADERS += ./devices/airspy-handler/airspy-handler.h \
./devices/airspy-handler/airspyfilter.h \
./devices/airspy-handler/libairspy/airspy.h
SOURCES += ./devices/airspy-handler/airspy-handler.cpp \
./devices/airspy-handler/airspyfilter.cpp
FORMS += ./devices/airspy-handler/airspy-widget.ui
}
#
rtl_tcp {
DEFINES += HAVE_RTL_TCP
QT += network
INCLUDEPATH += ./devices/rtl_tcp
HEADERS += ./devices/rtl_tcp/rtl_tcp_client.h
SOURCES += ./devices/rtl_tcp/rtl_tcp_client.cpp
FORMS += ./devices/rtl_tcp/rtl_tcp-widget.ui
}
qt-audio {
DEFINES += QT_AUDIO
QT += multimedia
HEADERS += ./includes/output/Qt-audio.h \
./includes/output/Qt-audiodevice.h
SOURCES += ./src/output/Qt-audio.cpp \
./src/output/Qt-audiodevice.cpp
}
NEON {
DEFINES += NEON_AVAILABLE
QMAKE_CFLAGS += -mfpu=neon-vfpv4
QMAKE_CXXFLAGS += -mfpu=neon-vfpv4
HEADERS += ./src/backend/viterbi_768/spiral-neon.h
SOURCES += ./src/backend/viterbi_768/spiral-neon.c
}
SSE {
DEFINES += SSE_AVAILABLE
HEADERS += ./src/backend/viterbi_768/spiral-sse.h
SOURCES += ./src/backend/viterbi_768/spiral-sse.c
}
NO_SSE {
HEADERS += ./src/backend/viterbi_768/spiral-no-sse.h
SOURCES += ./src/backend/viterbi_768/spiral-no-sse.c
}

View File

@@ -0,0 +1,766 @@
/**
* IW0HDV Extio
*
* Copyright 2015 by Andrea Montefusco IW0HDV
*
* Licensed under GNU General Public License 3.0 or later.
* Some rights reserved. See COPYING, AUTHORS.
*
* @license GPL-3.0+ <http://spdx.org/licenses/GPL-3.0+>
*
* recoding, taking parts and extending for the airspyHandler interface
* for the Qt-DAB program
* jan van Katwijk
* Lazy Chair Computing
*/
#ifdef __MINGW32__
#define GETPROCADDRESS GetProcAddress
#else
#define GETPROCADDRESS dlsym
#endif
#include "airspy-handler.h"
#include "airspyfilter.h"
static
const int EXTIO_NS = 8192;
static
const int EXTIO_BASE_TYPE_SIZE = sizeof (float);
airspyHandler::airspyHandler (QSettings *s) {
int result, i;
int distance = 10000000;
std::vector <uint32_t> sampleRates;
uint32_t samplerateCount;
this -> airspySettings = s;
this -> myFrame = new QFrame (NULL);
setupUi (this -> myFrame);
this -> myFrame -> show ();
filter = NULL;
airspySettings -> beginGroup ("airspyHandler");
int16_t temp = airspySettings -> value ("linearity", 10).
toInt ();
linearitySlider -> setValue (temp);
linearityDisplay -> display (temp);
temp = airspySettings -> value ("sensitivity", 10).
toInt ();
sensitivitySlider -> setValue (temp);
sensitivityDisplay -> display (temp);
vgaGain = airspySettings -> value ("vga", 5).toInt ();
vgaSlider -> setValue (vgaGain);
vgaDisplay -> display (vgaGain);
mixerGain = airspySettings -> value ("mixer", 10). toInt ();
mixerSlider -> setValue (mixerGain);
mixerDisplay -> display (mixerGain);
mixer_agc = false;
lnaGain = airspySettings -> value ("lna", 5). toInt ();
lnaSlider -> setValue (lnaGain);
lnaDisplay -> display (lnaGain);
mixer_agc = false;
lna_agc = false;
rf_bias = false;
coarseOffset = airspySettings -> value ("airspyOffset", 0). toInt ();
airspySettings -> endGroup ();
device = 0;
serialNumber = 0;
theBuffer = NULL;
#ifdef __MINGW32__
const char *libraryString = "airspy.dll";
Handle = LoadLibrary ((wchar_t *)L"airspy.dll");
#else
const char *libraryString = "libairspy.so";
Handle = dlopen ("libairspy.so", RTLD_LAZY);
#endif
if (Handle == NULL) {
fprintf (stderr, "failed to open %s\n", libraryString);
#ifndef __MINGW32__
fprintf (stderr, "Error = %s\n", dlerror ());
#endif
delete myFrame;
throw (20);
}
libraryLoaded = true;
if (!load_airspyFunctions ()) {
fprintf (stderr, "problem in loading functions\n");
#ifdef __MINGW32__
FreeLibrary (Handle);
#else
dlclose (Handle);
#endif
delete myFrame;
}
//
strcpy (serial,"");
result = this -> my_airspy_init ();
if (result != AIRSPY_SUCCESS) {
printf ("my_airspy_init () failed: %s (%d)\n",
my_airspy_error_name((airspy_error)result), result);
#ifdef __MINGW32__
FreeLibrary (Handle);
#else
dlclose (Handle);
#endif
delete myFrame;
throw (21);
}
result = my_airspy_open (&device);
if (result != AIRSPY_SUCCESS) {
printf ("my_airpsy_open () failed: %s (%d)\n",
my_airspy_error_name ((airspy_error)result), result);
#ifdef __MINGW32__
FreeLibrary (Handle);
#else
dlclose (Handle);
#endif
delete myFrame;
throw (22);
}
(void) my_airspy_set_sample_type (device, AIRSPY_SAMPLE_INT16_IQ);
(void) my_airspy_get_samplerates (device, &samplerateCount, 0);
fprintf (stderr, "%d samplerates are supported\n", samplerateCount);
sampleRates. resize (samplerateCount);
my_airspy_get_samplerates (device,
sampleRates. data (), samplerateCount);
selectedRate = 0;
for (i = 0; i < (int)samplerateCount; i ++) {
fprintf (stderr, "%d \n", sampleRates [i]);
if (abs ((int)sampleRates [i] - 2048000) < distance) {
distance = abs ((int)sampleRates [i] - 2048000);
selectedRate = sampleRates [i];
}
}
if (selectedRate == 0) {
fprintf (stderr, "Sorry. cannot help you\n");
#ifdef __MINGW32__
FreeLibrary (Handle);
#else
dlclose (Handle);
#endif
delete myFrame;
throw (23);
}
else
fprintf (stderr, "selected samplerate = %d\n", selectedRate);
result = my_airspy_set_samplerate (device, selectedRate);
if (result != AIRSPY_SUCCESS) {
printf("airspy_set_samplerate() failed: %s (%d)\n",
my_airspy_error_name ((enum airspy_error)result), result);
#ifdef __MINGW32__
FreeLibrary (Handle);
#else
dlclose (Handle);
#endif
delete myFrame;
throw (24);
}
airspySettings -> beginGroup ("airspyHandler");
filtering = airspySettings -> value ("filtering", 0). toInt ();
int filterDegree = airspySettings -> value ("filterdegree", 9). toInt ();
filterDegree = (filterDegree & ~01) + 1;
//
// if we apply filtering it is using a symmetric lowpass filter
filter = new airspyFilter (filterDegree,
1024000, selectedRate);
airspySettings -> endGroup ();
// The sizes of the mapTables follow from the input and output rate
// (selectedRate / 1000) vs (2048000 / 1000)
// so we end up with buffers with 1 msec content
convBufferSize = selectedRate / 1000;
for (i = 0; i < 2048; i ++) {
float inVal = float (selectedRate / 1000);
mapTable_int [i] = int (floor (i * (inVal / 2048.0)));
mapTable_float [i] = i * (inVal / 2048.0) - mapTable_int [i];
}
convIndex = 0;
convBuffer. resize (convBufferSize + 1);
theBuffer = new RingBuffer<std::complex<float>>
(256 * 1024);
tabWidget -> setCurrentIndex (0);
connect (linearitySlider, SIGNAL (valueChanged (int)),
this, SLOT (set_linearity (int)));
connect (sensitivitySlider, SIGNAL (valueChanged (int)),
this, SLOT (set_sensitivity (int)));
connect (lnaSlider, SIGNAL (valueChanged (int)),
this, SLOT (set_lna_gain (int)));
connect (vgaSlider, SIGNAL (valueChanged (int)),
this, SLOT (set_vga_gain (int)));
connect (mixerSlider, SIGNAL (valueChanged (int)),
this, SLOT (set_mixer_gain (int)));
connect (lnaButton, SIGNAL (clicked (void)),
this, SLOT (set_lna_agc (void)));
connect (mixerButton, SIGNAL (clicked (void)),
this, SLOT (set_mixer_agc (void)));
connect (biasButton, SIGNAL (clicked (void)),
this, SLOT (set_rf_bias (void)));
connect (tabWidget, SIGNAL (currentChanged (int)),
this, SLOT (show_tab (int)));
displaySerial -> setText (getSerial ());
running. store (false);
show_tab (0); // will set currentTab
}
airspyHandler::~airspyHandler (void) {
airspySettings -> beginGroup ("airspyHandler");
airspySettings -> setValue ("linearity", linearitySlider -> value ());
airspySettings -> setValue ("sensitivity", sensitivitySlider -> value ());
airspySettings -> setValue ("vga", vgaGain);
airspySettings -> setValue ("mixer", mixerGain);
airspySettings -> setValue ("lna", lnaGain);
airspySettings -> setValue ("airspyOffset", coarseOffset);
airspySettings -> endGroup ();
if (device != NULL) {
int result = my_airspy_stop_rx (device);
if (result != AIRSPY_SUCCESS) {
printf ("my_airspy_stop_rx () failed: %s (%d)\n",
my_airspy_error_name((airspy_error)result), result);
}
result = my_airspy_close (device);
if (result != AIRSPY_SUCCESS) {
printf ("airspy_close () failed: %s (%d)\n",
my_airspy_error_name((airspy_error)result), result);
}
}
if (filter != NULL)
delete filter;
delete myFrame;
if (Handle == NULL) {
return; // nothing achieved earlier
}
my_airspy_exit ();
#ifdef __MINGW32__
FreeLibrary (Handle);
#else
dlclose (Handle);
#endif
err:
if (theBuffer != NULL)
delete theBuffer;
}
void airspyHandler::setVFOFrequency (int32_t nf) {
int result = my_airspy_set_freq (device, lastFrequency = nf);
if (result != AIRSPY_SUCCESS) {
printf ("my_airspy_set_freq() failed: %s (%d)\n",
my_airspy_error_name((airspy_error)result), result);
}
}
int32_t airspyHandler::getVFOFrequency (void) {
return lastFrequency;
}
int32_t airspyHandler::defaultFrequency (void) {
return Khz (94700);
}
bool airspyHandler::restartReader (void) {
int result;
int32_t bufSize = EXTIO_NS * EXTIO_BASE_TYPE_SIZE * 2;
if (running. load ())
return true;
theBuffer -> FlushRingBuffer ();
result = my_airspy_set_sample_type (device, AIRSPY_SAMPLE_INT16_IQ);
// result = my_airspy_set_sample_type (device, AIRSPY_SAMPLE_FLOAT32_IQ);
if (result != AIRSPY_SUCCESS) {
printf ("my_airspy_set_sample_type () failed: %s (%d)\n",
my_airspy_error_name ((airspy_error)result), result);
return false;
}
if (currentTab == 0)
set_sensitivity (sensitivitySlider -> value ());
else
if (currentTab == 1)
set_linearity (linearitySlider -> value ());
else {
set_vga_gain (vgaGain);
set_mixer_gain (mixerGain);
set_lna_gain (lnaGain);
}
result = my_airspy_start_rx (device,
(airspy_sample_block_cb_fn)callback, this);
if (result != AIRSPY_SUCCESS) {
printf ("my_airspy_start_rx () failed: %s (%d)\n",
my_airspy_error_name((airspy_error)result), result);
return false;
}
//
running. store (true);
return true;
}
void airspyHandler::stopReader (void) {
int result;
if (!running. load ())
return;
result = my_airspy_stop_rx (device);
if (result != AIRSPY_SUCCESS )
printf ("my_airspy_stop_rx() failed: %s (%d)\n",
my_airspy_error_name ((airspy_error)result), result);
running. store (false);
}
//
// Directly copied from the airspy extio dll from Andrea Montefusco
int airspyHandler::callback (airspy_transfer* transfer) {
airspyHandler *p;
if (!transfer)
return 0; // should not happen
p = static_cast<airspyHandler *> (transfer -> ctx);
// we read AIRSPY_SAMPLE_INT16_IQ:
int32_t bytes_to_write = transfer -> sample_count * sizeof (int16_t) * 2;
uint8_t *pt_rx_buffer = (uint8_t *)transfer->samples;
p -> data_available (pt_rx_buffer, bytes_to_write);
return 0;
}
// called from AIRSPY data callback
// 2*2 = 4 bytes for sample, as per AirSpy USB data stream format
// we do the rate conversion here, read in groups of 2 * xxx samples
// and transform them into groups of 2 * 512 samples
int airspyHandler::data_available (void *buf, int buf_size) {
int16_t *sbuf = (int16_t *)buf;
int nSamples = buf_size / (sizeof (int16_t) * 2);
std::complex<float> temp [2048];
int32_t i, j;
if (filtering) {
for (i = 0; i < nSamples; i ++) {
convBuffer [convIndex ++] = filter -> Pass (
sbuf [2 * i] / (float)2048,
sbuf [2 * i + 1] / (float)2048);
if (convIndex > convBufferSize) {
for (j = 0; j < 2048; j ++) {
int16_t inpBase = mapTable_int [j];
float inpRatio = mapTable_float [j];
temp [j] = cmul (convBuffer [inpBase + 1], inpRatio) +
cmul (convBuffer [inpBase], 1 - inpRatio);
}
theBuffer -> putDataIntoBuffer (temp, 2048);
//
// shift the sample at the end to the beginning, it is needed
// as the starting sample for the next time
convBuffer [0] = convBuffer [convBufferSize];
convIndex = 1;
}
}
}
else
for (i = 0; i < nSamples; i ++) {
convBuffer [convIndex ++] = std::complex<float> (
sbuf [2 * i] / (float)2048,
sbuf [2 * i + 1] / (float)2048);
if (convIndex > convBufferSize) {
for (j = 0; j < 2048; j ++) {
int16_t inpBase = mapTable_int [j];
float inpRatio = mapTable_float [j];
temp [j] = cmul (convBuffer [inpBase + 1], inpRatio) +
cmul (convBuffer [inpBase], 1 - inpRatio);
}
theBuffer -> putDataIntoBuffer (temp, 2048);
//
// shift the sample at the end to the beginning, it is needed
// as the starting sample for the next time
convBuffer [0] = convBuffer [convBufferSize];
convIndex = 1;
}
}
return 0;
}
//
const char *airspyHandler::getSerial (void) {
airspy_read_partid_serialno_t read_partid_serialno;
int result = my_airspy_board_partid_serialno_read (device,
&read_partid_serialno);
if (result != AIRSPY_SUCCESS) {
printf ("failed: %s (%d)\n",
my_airspy_error_name ((airspy_error)result), result);
return "UNKNOWN";
} else {
snprintf (serial, sizeof(serial), "%08X%08X",
read_partid_serialno. serial_no [2],
read_partid_serialno. serial_no [3]);
}
return serial;
}
//
// not used here
int airspyHandler::open (void) {
int result = my_airspy_open (&device);
if (result != AIRSPY_SUCCESS) {
printf ("airspy_open() failed: %s (%d)\n",
my_airspy_error_name((airspy_error)result), result);
return -1;
} else {
return 0;
}
}
//
// These functions are added for the SDR-J interface
void airspyHandler::resetBuffer (void) {
theBuffer -> FlushRingBuffer ();
}
int16_t airspyHandler::bitDepth (void) {
return 13;
}
int32_t airspyHandler::getSamples (std::complex<float> *v, int32_t size) {
return theBuffer -> getDataFromBuffer (v, size);
}
int32_t airspyHandler::Samples (void) {
return theBuffer -> GetRingBufferReadAvailable ();
}
//
#define GAIN_COUNT (22)
uint8_t airspy_linearity_vga_gains[GAIN_COUNT] = { 13, 12, 11, 11, 11, 11, 11, 10, 10, 10, 10, 10, 10, 10, 10, 10, 9, 8, 7, 6, 5, 4 };
uint8_t airspy_linearity_mixer_gains[GAIN_COUNT] = { 12, 12, 11, 9, 8, 7, 6, 6, 5, 0, 0, 1, 0, 0, 2, 2, 1, 1, 1, 1, 0, 0 };
uint8_t airspy_linearity_lna_gains[GAIN_COUNT] = { 14, 14, 14, 13, 12, 10, 9, 9, 8, 9, 8, 6, 5, 3, 1, 0, 0, 0, 0, 0, 0, 0 };
uint8_t airspy_sensitivity_vga_gains[GAIN_COUNT] = { 13, 12, 11, 10, 9, 8, 7, 6, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4 };
uint8_t airspy_sensitivity_mixer_gains[GAIN_COUNT] = { 12, 12, 12, 12, 11, 10, 10, 9, 9, 8, 7, 4, 4, 4, 3, 2, 2, 1, 0, 0, 0, 0 };
uint8_t airspy_sensitivity_lna_gains[GAIN_COUNT] = { 14, 14, 14, 14, 14, 14, 14, 14, 14, 13, 12, 12, 9, 9, 8, 7, 6, 5, 3, 2, 1, 0 };
void airspyHandler::set_linearity (int value) {
int result = my_airspy_set_linearity_gain (device, value);
int temp;
if (result != AIRSPY_SUCCESS) {
printf ("airspy_set_lna_gain () failed: %s (%d)\n",
my_airspy_error_name ((airspy_error)result), result);
return;
}
linearityDisplay -> display (value);
temp = airspy_linearity_lna_gains [GAIN_COUNT - 1 - value];
linearity_lnaDisplay -> display (temp);
temp = airspy_linearity_mixer_gains [GAIN_COUNT - 1 - value];
linearity_mixerDisplay -> display (temp);
temp = airspy_linearity_vga_gains [GAIN_COUNT - 1 - value];
linearity_vgaDisplay -> display (temp);
}
void airspyHandler::set_sensitivity (int value) {
int result = my_airspy_set_sensitivity_gain (device, value);
int temp;
if (result != AIRSPY_SUCCESS) {
printf ("airspy_set_mixer_gain() failed: %s (%d)\n",
my_airspy_error_name ((airspy_error)result), result);
return;
}
sensitivityDisplay -> display (value);
temp = airspy_sensitivity_lna_gains [GAIN_COUNT - 1 - value];
sensitivity_lnaDisplay -> display (temp);
temp = airspy_sensitivity_mixer_gains [GAIN_COUNT - 1 - value];
sensitivity_mixerDisplay -> display (temp);
temp = airspy_sensitivity_vga_gains [GAIN_COUNT - 1 - value];
sensitivity_vgaDisplay -> display (temp);
}
//
// Original functions from the airspy extio dll
/* Parameter value shall be between 0 and 15 */
void airspyHandler::set_lna_gain (int value) {
int result = my_airspy_set_lna_gain (device, lnaGain = value);
if (result != AIRSPY_SUCCESS) {
printf ("airspy_set_lna_gain () failed: %s (%d)\n",
my_airspy_error_name ((airspy_error)result), result);
}
else
lnaDisplay -> display (value);
}
/* Parameter value shall be between 0 and 15 */
void airspyHandler::set_mixer_gain (int value) {
int result = my_airspy_set_mixer_gain (device, mixerGain = value);
if (result != AIRSPY_SUCCESS) {
printf ("airspy_set_mixer_gain() failed: %s (%d)\n",
my_airspy_error_name ((airspy_error)result), result);
}
else
mixerDisplay -> display (value);
}
/* Parameter value shall be between 0 and 15 */
void airspyHandler::set_vga_gain (int value) {
int result = my_airspy_set_vga_gain (device, vgaGain = value);
if (result != AIRSPY_SUCCESS) {
printf ("airspy_set_vga_gain () failed: %s (%d)\n",
my_airspy_error_name ((airspy_error)result), result);
}
else
vgaDisplay -> display (value);
}
//
// agc's
/* Parameter value:
0=Disable LNA Automatic Gain Control
1=Enable LNA Automatic Gain Control
*/
void airspyHandler::set_lna_agc (void) {
lna_agc = !lna_agc;
int result = my_airspy_set_lna_agc (device, lna_agc ? 1 : 0);
if (result != AIRSPY_SUCCESS) {
printf ("airspy_set_lna_agc() failed: %s (%d)\n",
my_airspy_error_name ((airspy_error)result), result);
}
if (lna_agc)
lnaButton -> setText ("lna agc on");
else
lnaButton -> setText ("lna agc");
}
/* Parameter value:
0=Disable MIXER Automatic Gain Control
1=Enable MIXER Automatic Gain Control
*/
void airspyHandler::set_mixer_agc (void) {
mixer_agc = !mixer_agc;
int result = my_airspy_set_mixer_agc (device, mixer_agc ? 1 : 0);
if (result != AIRSPY_SUCCESS) {
printf ("airspy_set_mixer_agc () failed: %s (%d)\n",
my_airspy_error_name ((airspy_error)result), result);
}
if (mixer_agc)
mixerButton -> setText ("mixer agc on");
else
mixerButton -> setText ("mixer agc");
}
/* Parameter value shall be 0=Disable BiasT or 1=Enable BiasT */
void airspyHandler::set_rf_bias (void) {
rf_bias = !rf_bias;
int result = my_airspy_set_rf_bias (device, rf_bias ? 1 : 0);
if (result != AIRSPY_SUCCESS) {
printf("airspy_set_rf_bias() failed: %s (%d)\n",
my_airspy_error_name ((airspy_error)result), result);
}
}
const char* airspyHandler::board_id_name (void) {
uint8_t bid;
if (my_airspy_board_id_read (device, &bid) == AIRSPY_SUCCESS)
return my_airspy_board_id_name ((airspy_board_id)bid);
else
return "UNKNOWN";
}
//
//
bool airspyHandler::load_airspyFunctions (void) {
//
// link the required procedures
my_airspy_init = (pfn_airspy_init)
GETPROCADDRESS (Handle, "airspy_init");
if (my_airspy_init == NULL) {
fprintf (stderr, "Could not find airspy_init\n");
return false;
}
my_airspy_exit = (pfn_airspy_exit)
GETPROCADDRESS (Handle, "airspy_exit");
if (my_airspy_exit == NULL) {
fprintf (stderr, "Could not find airspy_exit\n");
return false;
}
my_airspy_open = (pfn_airspy_open)
GETPROCADDRESS (Handle, "airspy_open");
if (my_airspy_open == NULL) {
fprintf (stderr, "Could not find airspy_open\n");
return false;
}
my_airspy_close = (pfn_airspy_close)
GETPROCADDRESS (Handle, "airspy_close");
if (my_airspy_close == NULL) {
fprintf (stderr, "Could not find airspy_close\n");
return false;
}
my_airspy_get_samplerates = (pfn_airspy_get_samplerates)
GETPROCADDRESS (Handle, "airspy_get_samplerates");
if (my_airspy_get_samplerates == NULL) {
fprintf (stderr, "Could not find airspy_get_samplerates\n");
return false;
}
my_airspy_set_samplerate = (pfn_airspy_set_samplerate)
GETPROCADDRESS (Handle, "airspy_set_samplerate");
if (my_airspy_set_samplerate == NULL) {
fprintf (stderr, "Could not find airspy_set_samplerate\n");
return false;
}
my_airspy_start_rx = (pfn_airspy_start_rx)
GETPROCADDRESS (Handle, "airspy_start_rx");
if (my_airspy_start_rx == NULL) {
fprintf (stderr, "Could not find airspy_start_rx\n");
return false;
}
my_airspy_stop_rx = (pfn_airspy_stop_rx)
GETPROCADDRESS (Handle, "airspy_stop_rx");
if (my_airspy_stop_rx == NULL) {
fprintf (stderr, "Could not find airspy_stop_rx\n");
return false;
}
my_airspy_set_sample_type = (pfn_airspy_set_sample_type)
GETPROCADDRESS (Handle, "airspy_set_sample_type");
if (my_airspy_set_sample_type == NULL) {
fprintf (stderr, "Could not find airspy_set_sample_type\n");
return false;
}
my_airspy_set_freq = (pfn_airspy_set_freq)
GETPROCADDRESS (Handle, "airspy_set_freq");
if (my_airspy_set_freq == NULL) {
fprintf (stderr, "Could not find airspy_set_freq\n");
return false;
}
my_airspy_set_lna_gain = (pfn_airspy_set_lna_gain)
GETPROCADDRESS (Handle, "airspy_set_lna_gain");
if (my_airspy_set_lna_gain == NULL) {
fprintf (stderr, "Could not find airspy_set_lna_gain\n");
return false;
}
my_airspy_set_mixer_gain = (pfn_airspy_set_mixer_gain)
GETPROCADDRESS (Handle, "airspy_set_mixer_gain");
if (my_airspy_set_mixer_gain == NULL) {
fprintf (stderr, "Could not find airspy_set_mixer_gain\n");
return false;
}
my_airspy_set_vga_gain = (pfn_airspy_set_vga_gain)
GETPROCADDRESS (Handle, "airspy_set_vga_gain");
if (my_airspy_set_vga_gain == NULL) {
fprintf (stderr, "Could not find airspy_set_vga_gain\n");
return false;
}
my_airspy_set_linearity_gain = (pfn_airspy_set_linearity_gain)
GETPROCADDRESS (Handle, "airspy_set_linearity_gain");
if (my_airspy_set_linearity_gain == NULL) {
fprintf (stderr, "Could not find airspy_set_linearity_gain\n");
fprintf (stderr, "You probably did install an old library\n");
return false;
}
my_airspy_set_sensitivity_gain = (pfn_airspy_set_sensitivity_gain)
GETPROCADDRESS (Handle, "airspy_set_sensitivity_gain");
if (my_airspy_set_sensitivity_gain == NULL) {
fprintf (stderr, "Could not find airspy_set_sensitivity_gain\n");
fprintf (stderr, "You probably did install an old library\n");
return false;
}
my_airspy_set_lna_agc = (pfn_airspy_set_lna_agc)
GETPROCADDRESS (Handle, "airspy_set_lna_agc");
if (my_airspy_set_lna_agc == NULL) {
fprintf (stderr, "Could not find airspy_set_lna_agc\n");
return false;
}
my_airspy_set_mixer_agc = (pfn_airspy_set_mixer_agc)
GETPROCADDRESS (Handle, "airspy_set_mixer_agc");
if (my_airspy_set_mixer_agc == NULL) {
fprintf (stderr, "Could not find airspy_set_mixer_agc\n");
return false;
}
my_airspy_set_rf_bias = (pfn_airspy_set_rf_bias)
GETPROCADDRESS (Handle, "airspy_set_rf_bias");
if (my_airspy_set_rf_bias == NULL) {
fprintf (stderr, "Could not find airspy_set_rf_bias\n");
return false;
}
my_airspy_error_name = (pfn_airspy_error_name)
GETPROCADDRESS (Handle, "airspy_error_name");
if (my_airspy_error_name == NULL) {
fprintf (stderr, "Could not find airspy_error_name\n");
return false;
}
my_airspy_board_id_read = (pfn_airspy_board_id_read)
GETPROCADDRESS (Handle, "airspy_board_id_read");
if (my_airspy_board_id_read == NULL) {
fprintf (stderr, "Could not find airspy_board_id_read\n");
return false;
}
my_airspy_board_id_name = (pfn_airspy_board_id_name)
GETPROCADDRESS (Handle, "airspy_board_id_name");
if (my_airspy_board_id_name == NULL) {
fprintf (stderr, "Could not find airspy_board_id_name\n");
return false;
}
my_airspy_board_partid_serialno_read =
(pfn_airspy_board_partid_serialno_read)
GETPROCADDRESS (Handle, "airspy_board_partid_serialno_read");
if (my_airspy_board_partid_serialno_read == NULL) {
fprintf (stderr, "Could not find airspy_board_partid_serialno_read\n");
return false;
}
return true;
}
void airspyHandler::show_tab (int t) {
if (t == 0) // sensitivity
set_sensitivity (sensitivitySlider -> value ());
else
if (t == 1) // linearity
set_linearity (linearitySlider -> value ());
else { // classic view
set_vga_gain (vgaGain);
set_mixer_gain (mixerGain);
set_lna_gain (lnaGain);
}
currentTab = t;
}

View File

@@ -0,0 +1,172 @@
/**
* IW0HDV Extio
*
* Copyright 2015 by Andrea Montefusco IW0HDV
*
* Licensed under GNU General Public License 3.0 or later.
* Some rights reserved. See COPYING, AUTHORS.
*
* @license GPL-3.0+ <http://spdx.org/licenses/GPL-3.0+>
*
* recoding and taking parts for the airspyRadio interface
* for the Qt-DAB program
* jan van Katwijk
* Lazy Chair Computing
*/
#ifndef __AIRSPY_HANDLER__
#define __AIRSPY_HANDLER__
#include <QObject>
#include <QSettings>
#include <QFrame>
#include <vector>
#include <atomic>
#include "dab-constants.h"
#include "ringbuffer.h"
#include "virtual-input.h"
#include "ui_airspy-widget.h"
#ifndef __MINGW32__
#include "libairspy/airspy.h"
#else
#include "libairspy/airspy.h"
#endif
class airspyFilter;
extern "C" {
typedef int (*pfn_airspy_init) (void);
typedef int (*pfn_airspy_exit) (void);
typedef int (*pfn_airspy_open) (struct airspy_device**);
typedef int (*pfn_airspy_close) (struct airspy_device*);
typedef int (*pfn_airspy_get_samplerates) (struct airspy_device* device,
uint32_t* buffer,
const uint32_t len);
typedef int (*pfn_airspy_set_samplerate) (struct airspy_device* device,
uint32_t samplerate);
typedef int (*pfn_airspy_start_rx) (struct airspy_device* device,
airspy_sample_block_cb_fn callback,
void* rx_ctx);
typedef int (*pfn_airspy_stop_rx) (struct airspy_device* device);
typedef int (*pfn_airspy_set_sample_type) (struct airspy_device *,
airspy_sample_type);
typedef int (*pfn_airspy_set_freq) (struct airspy_device* device,
const uint32_t freq_hz);
typedef int (*pfn_airspy_set_lna_gain) (struct airspy_device* device,
uint8_t value);
typedef int (*pfn_airspy_set_mixer_gain) (struct airspy_device* device,
uint8_t value);
typedef int (*pfn_airspy_set_vga_gain) (struct airspy_device*
device, uint8_t
value);
typedef int (*pfn_airspy_set_lna_agc) (struct airspy_device* device,
uint8_t value);
typedef int (*pfn_airspy_set_mixer_agc) (struct airspy_device* device,
uint8_t value);
typedef int (*pfn_airspy_set_rf_bias) (struct airspy_device* dev,
uint8_t value);
typedef const char* (*pfn_airspy_error_name) (enum airspy_error errcode);
typedef int (*pfn_airspy_board_id_read) (struct airspy_device *,
uint8_t *);
typedef const char* (*pfn_airspy_board_id_name) (enum airspy_board_id board_id);
typedef int (*pfn_airspy_board_partid_serialno_read)(struct airspy_device* device, airspy_read_partid_serialno_t* read_partid_serialno);
typedef int (*pfn_airspy_set_linearity_gain) (struct airspy_device* device, uint8_t value);
typedef int (*pfn_airspy_set_sensitivity_gain)(struct airspy_device* device, uint8_t value);
}
class airspyHandler: public virtualInput, public Ui_airspyWidget {
Q_OBJECT
public:
airspyHandler (QSettings *);
~airspyHandler (void);
void setVFOFrequency (int32_t nf);
int32_t getVFOFrequency (void);
int32_t defaultFrequency (void);
bool restartReader (void);
void stopReader (void);
int32_t getSamples (std::complex<float> *v,
int32_t size);
int32_t Samples (void);
void resetBuffer (void);
int16_t bitDepth (void);
int16_t currentTab;
private slots:
void set_linearity (int value);
void set_sensitivity (int value);
void set_lna_gain (int value);
void set_mixer_gain (int value);
void set_vga_gain (int value);
void set_lna_agc (void);
void set_mixer_agc (void);
void set_rf_bias (void);
void show_tab (int);
private:
bool load_airspyFunctions (void);
// The functions to be extracted from the dll/.so file
pfn_airspy_init my_airspy_init;
pfn_airspy_exit my_airspy_exit;
pfn_airspy_error_name my_airspy_error_name;
pfn_airspy_open my_airspy_open;
pfn_airspy_close my_airspy_close;
pfn_airspy_get_samplerates my_airspy_get_samplerates;
pfn_airspy_set_samplerate my_airspy_set_samplerate;
pfn_airspy_start_rx my_airspy_start_rx;
pfn_airspy_stop_rx my_airspy_stop_rx;
pfn_airspy_set_sample_type my_airspy_set_sample_type;
pfn_airspy_set_freq my_airspy_set_freq;
pfn_airspy_set_lna_gain my_airspy_set_lna_gain;
pfn_airspy_set_mixer_gain my_airspy_set_mixer_gain;
pfn_airspy_set_vga_gain my_airspy_set_vga_gain;
pfn_airspy_set_linearity_gain my_airspy_set_linearity_gain;
pfn_airspy_set_sensitivity_gain my_airspy_set_sensitivity_gain;
pfn_airspy_set_lna_agc my_airspy_set_lna_agc;
pfn_airspy_set_mixer_agc my_airspy_set_mixer_agc;
pfn_airspy_set_rf_bias my_airspy_set_rf_bias;
pfn_airspy_board_id_read my_airspy_board_id_read;
pfn_airspy_board_id_name my_airspy_board_id_name;
pfn_airspy_board_partid_serialno_read
my_airspy_board_partid_serialno_read;
//
HINSTANCE Handle_usb;
HINSTANCE Handle;
bool libraryLoaded;
QFrame *myFrame;
bool success;
std::atomic<bool> running;
bool lna_agc;
bool mixer_agc;
bool rf_bias;
const char* board_id_name (void);
int16_t vgaGain;
int16_t mixerGain;
int16_t lnaGain;
int32_t selectedRate;
int16_t convBufferSize;
int16_t convIndex;
std::vector <complex<float> > convBuffer;
int16_t mapTable_int [4 * 512];
float mapTable_float [4 * 512];
QSettings *airspySettings;
RingBuffer<std::complex<float>> *theBuffer;
int32_t inputRate;
airspyFilter *filter;
bool filtering;
struct airspy_device* device;
uint64_t serialNumber;
char serial[128];
static
int callback(airspy_transfer_t *);
int data_available (void *buf, int buf_size);
const char * getSerial (void);
int open (void);
};
#endif

View File

@@ -0,0 +1,518 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>airspyWidget</class>
<widget class="QWidget" name="airspyWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>384</width>
<height>302</height>
</rect>
</property>
<property name="windowTitle">
<string>airspy</string>
</property>
<widget class="QTabWidget" name="tabWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>90</y>
<width>351</width>
<height>191</height>
</rect>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab_1">
<attribute name="title">
<string>sensitivity</string>
</attribute>
<widget class="QSlider" name="sensitivitySlider">
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>251</width>
<height>20</height>
</rect>
</property>
<property name="maximum">
<number>21</number>
</property>
<property name="value">
<number>10</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
<widget class="QLCDNumber" name="sensitivity_lnaDisplay">
<property name="geometry">
<rect>
<x>220</x>
<y>60</y>
<width>64</width>
<height>23</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="digitCount">
<number>2</number>
</property>
<property name="segmentStyle">
<enum>QLCDNumber::Flat</enum>
</property>
</widget>
<widget class="QLCDNumber" name="sensitivity_mixerDisplay">
<property name="geometry">
<rect>
<x>220</x>
<y>80</y>
<width>64</width>
<height>23</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="digitCount">
<number>2</number>
</property>
<property name="segmentStyle">
<enum>QLCDNumber::Flat</enum>
</property>
</widget>
<widget class="QLCDNumber" name="sensitivity_vgaDisplay">
<property name="geometry">
<rect>
<x>220</x>
<y>100</y>
<width>64</width>
<height>23</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="digitCount">
<number>2</number>
</property>
<property name="segmentStyle">
<enum>QLCDNumber::Flat</enum>
</property>
</widget>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>100</x>
<y>60</y>
<width>101</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>lna gain</string>
</property>
</widget>
<widget class="QLabel" name="label_6">
<property name="geometry">
<rect>
<x>100</x>
<y>80</y>
<width>91</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>mixer gain</string>
</property>
</widget>
<widget class="QLabel" name="label_7">
<property name="geometry">
<rect>
<x>100</x>
<y>100</y>
<width>81</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>vga gain</string>
</property>
</widget>
<widget class="QLCDNumber" name="sensitivityDisplay">
<property name="geometry">
<rect>
<x>280</x>
<y>20</y>
<width>41</width>
<height>23</height>
</rect>
</property>
<property name="digitCount">
<number>2</number>
</property>
<property name="segmentStyle">
<enum>QLCDNumber::Flat</enum>
</property>
</widget>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>linearity</string>
</attribute>
<widget class="QSlider" name="linearitySlider">
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>251</width>
<height>20</height>
</rect>
</property>
<property name="maximum">
<number>21</number>
</property>
<property name="value">
<number>10</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
<widget class="QLCDNumber" name="linearityDisplay">
<property name="geometry">
<rect>
<x>270</x>
<y>20</y>
<width>51</width>
<height>23</height>
</rect>
</property>
<property name="digitCount">
<number>2</number>
</property>
<property name="segmentStyle">
<enum>QLCDNumber::Flat</enum>
</property>
</widget>
<widget class="QLCDNumber" name="linearity_lnaDisplay">
<property name="geometry">
<rect>
<x>220</x>
<y>60</y>
<width>64</width>
<height>23</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="digitCount">
<number>2</number>
</property>
<property name="segmentStyle">
<enum>QLCDNumber::Flat</enum>
</property>
</widget>
<widget class="QLCDNumber" name="linearity_mixerDisplay">
<property name="geometry">
<rect>
<x>220</x>
<y>80</y>
<width>64</width>
<height>23</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="digitCount">
<number>2</number>
</property>
<property name="segmentStyle">
<enum>QLCDNumber::Flat</enum>
</property>
</widget>
<widget class="QLCDNumber" name="linearity_vgaDisplay">
<property name="geometry">
<rect>
<x>220</x>
<y>100</y>
<width>64</width>
<height>23</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="digitCount">
<number>2</number>
</property>
<property name="segmentStyle">
<enum>QLCDNumber::Flat</enum>
</property>
</widget>
<widget class="QLabel" name="label_8">
<property name="geometry">
<rect>
<x>100</x>
<y>60</y>
<width>91</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>lna gain</string>
</property>
</widget>
<widget class="QLabel" name="label_9">
<property name="geometry">
<rect>
<x>100</x>
<y>80</y>
<width>101</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>mixer gain</string>
</property>
</widget>
<widget class="QLabel" name="label_10">
<property name="geometry">
<rect>
<x>100</x>
<y>100</y>
<width>71</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>vga gain</string>
</property>
</widget>
</widget>
<widget class="QWidget" name="tab_3">
<attribute name="title">
<string>classic view</string>
</attribute>
<widget class="QSlider" name="lnaSlider">
<property name="geometry">
<rect>
<x>80</x>
<y>10</y>
<width>201</width>
<height>20</height>
</rect>
</property>
<property name="maximum">
<number>15</number>
</property>
<property name="value">
<number>10</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>66</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>lna</string>
</property>
</widget>
<widget class="QLCDNumber" name="lnaDisplay">
<property name="geometry">
<rect>
<x>290</x>
<y>10</y>
<width>51</width>
<height>23</height>
</rect>
</property>
<property name="digitCount">
<number>2</number>
</property>
<property name="segmentStyle">
<enum>QLCDNumber::Flat</enum>
</property>
</widget>
<widget class="QSlider" name="mixerSlider">
<property name="geometry">
<rect>
<x>80</x>
<y>40</y>
<width>201</width>
<height>20</height>
</rect>
</property>
<property name="maximum">
<number>15</number>
</property>
<property name="value">
<number>10</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
<widget class="QLCDNumber" name="mixerDisplay">
<property name="geometry">
<rect>
<x>290</x>
<y>40</y>
<width>51</width>
<height>23</height>
</rect>
</property>
<property name="digitCount">
<number>2</number>
</property>
<property name="segmentStyle">
<enum>QLCDNumber::Flat</enum>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>10</x>
<y>40</y>
<width>66</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>mixer</string>
</property>
</widget>
<widget class="QSlider" name="vgaSlider">
<property name="geometry">
<rect>
<x>80</x>
<y>70</y>
<width>201</width>
<height>20</height>
</rect>
</property>
<property name="maximum">
<number>15</number>
</property>
<property name="value">
<number>10</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>10</x>
<y>70</y>
<width>66</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>vga</string>
</property>
</widget>
<widget class="QLCDNumber" name="vgaDisplay">
<property name="geometry">
<rect>
<x>290</x>
<y>70</y>
<width>51</width>
<height>23</height>
</rect>
</property>
<property name="digitCount">
<number>2</number>
</property>
<property name="segmentStyle">
<enum>QLCDNumber::Flat</enum>
</property>
</widget>
<widget class="QPushButton" name="lnaButton">
<property name="geometry">
<rect>
<x>20</x>
<y>110</y>
<width>81</width>
<height>32</height>
</rect>
</property>
<property name="text">
<string>lna</string>
</property>
</widget>
<widget class="QPushButton" name="mixerButton">
<property name="geometry">
<rect>
<x>110</x>
<y>110</y>
<width>101</width>
<height>32</height>
</rect>
</property>
<property name="text">
<string>mixer </string>
</property>
</widget>
<widget class="QPushButton" name="biasButton">
<property name="geometry">
<rect>
<x>220</x>
<y>110</y>
<width>101</width>
<height>32</height>
</rect>
</property>
<property name="text">
<string>bias</string>
</property>
</widget>
</widget>
</widget>
<widget class="QLabel" name="displaySerial">
<property name="geometry">
<rect>
<x>100</x>
<y>60</y>
<width>241</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>50</x>
<y>20</y>
<width>211</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>A I R S P Y handler</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,221 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>airspyWidget</class>
<widget class="QWidget" name="airspyWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>423</width>
<height>212</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QFrame" name="contents">
<property name="geometry">
<rect>
<x>10</x>
<y>0</y>
<width>411</width>
<height>201</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>10</x>
<y>170</y>
<width>101</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>airspy</string>
</property>
</widget>
<widget class="QSlider" name="linearitySlider">
<property name="geometry">
<rect>
<x>90</x>
<y>10</y>
<width>251</width>
<height>20</height>
</rect>
</property>
<property name="maximum">
<number>21</number>
</property>
<property name="value">
<number>10</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>71</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>linearity</string>
</property>
</widget>
<widget class="QSlider" name="sensitivitySlider">
<property name="geometry">
<rect>
<x>90</x>
<y>40</y>
<width>251</width>
<height>20</height>
</rect>
</property>
<property name="maximum">
<number>21</number>
</property>
<property name="value">
<number>10</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>10</x>
<y>40</y>
<width>71</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>sensitivity</string>
</property>
</widget>
<widget class="QPushButton" name="lnaButton">
<property name="geometry">
<rect>
<x>270</x>
<y>130</y>
<width>121</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>lna-agc </string>
</property>
</widget>
<widget class="QPushButton" name="mixerButton">
<property name="geometry">
<rect>
<x>270</x>
<y>100</y>
<width>121</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>mixer-agc</string>
</property>
</widget>
<widget class="QLabel" name="displaySerial">
<property name="geometry">
<rect>
<x>20</x>
<y>150</y>
<width>241</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="biasButton">
<property name="geometry">
<rect>
<x>270</x>
<y>160</y>
<width>121</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>bias</string>
</property>
</widget>
<widget class="QLCDNumber" name="lnaDisplay">
<property name="geometry">
<rect>
<x>340</x>
<y>10</y>
<width>64</width>
<height>23</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="digitCount">
<number>2</number>
</property>
<property name="segmentStyle">
<enum>QLCDNumber::Flat</enum>
</property>
</widget>
<widget class="QLCDNumber" name="mixerDisplay">
<property name="geometry">
<rect>
<x>340</x>
<y>40</y>
<width>64</width>
<height>23</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="digitCount">
<number>2</number>
</property>
<property name="segmentStyle">
<enum>QLCDNumber::Flat</enum>
</property>
</widget>
<widget class="QLCDNumber" name="vgaDisplay">
<property name="geometry">
<rect>
<x>340</x>
<y>70</y>
<width>64</width>
<height>23</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="digitCount">
<number>2</number>
</property>
<property name="segmentStyle">
<enum>QLCDNumber::Flat</enum>
</property>
</widget>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,89 @@
#
/*
* Copyright (C) 2008, 2009, 2010
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of qt-dab
*
* qt-dab is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation as version 2 of the License.
*
* qt-dab is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with qt-dab; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "airspyfilter.h"
#include <math.h>
#ifndef M_PI
# define M_PI 3.14159265358979323846 /* pi */
#endif
airspyFilter::airspyFilter (int16_t firSize,
int32_t cutoffFreq,
int32_t sampleRate) {
float tmp [firSize];
float lo = (float)(cutoffFreq) / sampleRate;
float sum = 0.0;
int16_t i;
this -> buffer_re = new float [firSize];
this -> buffer_im = new float [firSize];
this -> kernel = new float [firSize];
this -> firSize = firSize;
ip = 0;
//
// create a low pass filter for lo;
for (i = 0; i < firSize; i ++) {
if (i == firSize / 2)
tmp [i] = 2 * M_PI * lo;
else
tmp [i] = sin (2 * M_PI * lo * (i - firSize /2)) / (i - firSize/2);
//
// windowing with Blackman
tmp [i] *= (0.42 -
0.5 * cos (2 * M_PI * (float)i / (float)firSize) +
0.08 * cos (4 * M_PI * (float)i / (float)firSize));
sum += tmp [i];
}
//
// and the kernel
for (i = 0; i < firSize; i ++)
kernel [i] = tmp [i] / sum;
}
airspyFilter::~airspyFilter (void) {
delete [] kernel;
delete [] buffer_re;
delete [] buffer_im;
}
// we process the samples backwards rather than reversing
// the kernel
std::complex<float> airspyFilter::Pass (float re, float im) {
int16_t i;
float tmp_1 = 0;
float tmp_2 = 0;
buffer_re [ip] = re;
buffer_im [ip] = im;
for (i = 0; i < firSize; i ++) {
int16_t index = ip - i;
if (index < 0)
index += firSize;
tmp_1 += buffer_re [index] * kernel [i];
tmp_2 += buffer_im [index] * kernel [i];
}
ip = (ip + 1) % firSize;
return std::complex<float> (tmp_1, tmp_2);;
}

View File

@@ -0,0 +1,44 @@
#
/*
* Copyright (C) 2010, 2011, 2012
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of qt-dab
*
* qt-dab is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* qt-dab is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with qt-dab; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __AIRSPY_FILTER__
#define __AIRSPY_FILTER__
#include <stdlib.h>
#include <math.h>
#include <complex>
class airspyFilter {
public:
airspyFilter (int16_t, int32_t, int32_t);
~airspyFilter (void);
std::complex<float> Pass (float re, float im);
int16_t firSize;
float *kernel;
float *buffer_re;
float *buffer_im;
int16_t ip;
int32_t sampleRate;
};
#endif

View File

@@ -0,0 +1,219 @@
/*
Copyright (c) 2012, Jared Boone <jared@sharebrained.com>
Copyright (c) 2013, Michael Ossmann <mike@ossmann.com>
Copyright (c) 2013-2016, Benjamin Vernoux <bvernoux@airspy.com>
Copyright (C) 2013-2016, Youssef Touil <youssef@airspy.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Neither the name of AirSpy nor the names of its contributors may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __AIRSPY_H__
#define __AIRSPY_H__
#include <stdint.h>
#include "airspy_commands.h"
#define AIRSPY_VERSION "1.0.9"
#define AIRSPY_VER_MAJOR 1
#define AIRSPY_VER_MINOR 0
#define AIRSPY_VER_REVISION 9
#ifdef _WIN32
#define ADD_EXPORTS
/* You should define ADD_EXPORTS *only* when building the DLL. */
#ifdef ADD_EXPORTS
#define ADDAPI __declspec(dllexport)
#else
#define ADDAPI __declspec(dllimport)
#endif
/* Define calling convention in one place, for convenience. */
#define ADDCALL __cdecl
#else /* _WIN32 not defined. */
/* Define with no value on non-Windows OSes. */
#define ADDAPI
#define ADDCALL
#endif
#ifdef __cplusplus
extern "C"
{
#endif
enum airspy_error
{
AIRSPY_SUCCESS = 0,
AIRSPY_TRUE = 1,
AIRSPY_ERROR_INVALID_PARAM = -2,
AIRSPY_ERROR_NOT_FOUND = -5,
AIRSPY_ERROR_BUSY = -6,
AIRSPY_ERROR_NO_MEM = -11,
AIRSPY_ERROR_LIBUSB = -1000,
AIRSPY_ERROR_THREAD = -1001,
AIRSPY_ERROR_STREAMING_THREAD_ERR = -1002,
AIRSPY_ERROR_STREAMING_STOPPED = -1003,
AIRSPY_ERROR_OTHER = -9999,
};
enum airspy_board_id
{
AIRSPY_BOARD_ID_PROTO_AIRSPY = 0,
AIRSPY_BOARD_ID_INVALID = 0xFF,
};
enum airspy_sample_type
{
AIRSPY_SAMPLE_FLOAT32_IQ = 0, /* 2 * 32bit float per sample */
AIRSPY_SAMPLE_FLOAT32_REAL = 1, /* 1 * 32bit float per sample */
AIRSPY_SAMPLE_INT16_IQ = 2, /* 2 * 16bit int per sample */
AIRSPY_SAMPLE_INT16_REAL = 3, /* 1 * 16bit int per sample */
AIRSPY_SAMPLE_UINT16_REAL = 4, /* 1 * 16bit unsigned int per sample */
AIRSPY_SAMPLE_RAW = 5, /* Raw packed samples from the device */
AIRSPY_SAMPLE_END = 6 /* Number of supported sample types */
};
#define MAX_CONFIG_PAGE_SIZE (0x10000)
struct airspy_device;
typedef struct {
struct airspy_device* device;
void* ctx;
void* samples;
int sample_count;
uint64_t dropped_samples;
enum airspy_sample_type sample_type;
} airspy_transfer_t, airspy_transfer;
typedef struct {
uint32_t part_id[2];
uint32_t serial_no[4];
} airspy_read_partid_serialno_t;
typedef struct {
uint32_t major_version;
uint32_t minor_version;
uint32_t revision;
} airspy_lib_version_t;
typedef int (*airspy_sample_block_cb_fn)(airspy_transfer* transfer);
extern ADDAPI void ADDCALL airspy_lib_version(airspy_lib_version_t* lib_version);
/* airspy_init() deprecated */
extern ADDAPI int ADDCALL airspy_init(void);
/* airspy_exit() deprecated */
extern ADDAPI int ADDCALL airspy_exit(void);
extern ADDAPI int ADDCALL airspy_open_sn(struct airspy_device** device, uint64_t serial_number);
extern ADDAPI int ADDCALL airspy_open(struct airspy_device** device);
extern ADDAPI int ADDCALL airspy_close(struct airspy_device* device);
extern ADDAPI int ADDCALL airspy_get_samplerates(struct airspy_device* device, uint32_t* buffer, const uint32_t len);
/* Parameter samplerate can be either the index of a samplerate or directly its value in Hz within the list returned by airspy_get_samplerates() */
extern ADDAPI int ADDCALL airspy_set_samplerate(struct airspy_device* device, uint32_t samplerate);
extern ADDAPI int ADDCALL airspy_set_conversion_filter_float32(struct airspy_device* device, const float *kernel, const uint32_t len);
extern ADDAPI int ADDCALL airspy_set_conversion_filter_int16(struct airspy_device* device, const int16_t *kernel, const uint32_t len);
extern ADDAPI int ADDCALL airspy_start_rx(struct airspy_device* device, airspy_sample_block_cb_fn callback, void* rx_ctx);
extern ADDAPI int ADDCALL airspy_stop_rx(struct airspy_device* device);
/* return AIRSPY_TRUE if success */
extern ADDAPI int ADDCALL airspy_is_streaming(struct airspy_device* device);
extern ADDAPI int ADDCALL airspy_si5351c_write(struct airspy_device* device, uint8_t register_number, uint8_t value);
extern ADDAPI int ADDCALL airspy_si5351c_read(struct airspy_device* device, uint8_t register_number, uint8_t* value);
extern ADDAPI int ADDCALL airspy_config_write(struct airspy_device* device, const uint8_t page_index, const uint16_t length, unsigned char *data);
extern ADDAPI int ADDCALL airspy_config_read(struct airspy_device* device, const uint8_t page_index, const uint16_t length, unsigned char *data);
extern ADDAPI int ADDCALL airspy_r820t_write(struct airspy_device* device, uint8_t register_number, uint8_t value);
extern ADDAPI int ADDCALL airspy_r820t_read(struct airspy_device* device, uint8_t register_number, uint8_t* value);
/* Parameter value shall be 0=clear GPIO or 1=set GPIO */
extern ADDAPI int ADDCALL airspy_gpio_write(struct airspy_device* device, airspy_gpio_port_t port, airspy_gpio_pin_t pin, uint8_t value);
/* Parameter value corresponds to GPIO state 0 or 1 */
extern ADDAPI int ADDCALL airspy_gpio_read(struct airspy_device* device, airspy_gpio_port_t port, airspy_gpio_pin_t pin, uint8_t* value);
/* Parameter value shall be 0=GPIO Input direction or 1=GPIO Output direction */
extern ADDAPI int ADDCALL airspy_gpiodir_write(struct airspy_device* device, airspy_gpio_port_t port, airspy_gpio_pin_t pin, uint8_t value);
extern ADDAPI int ADDCALL airspy_gpiodir_read(struct airspy_device* device, airspy_gpio_port_t port, airspy_gpio_pin_t pin, uint8_t* value);
extern ADDAPI int ADDCALL airspy_spiflash_erase(struct airspy_device* device);
extern ADDAPI int ADDCALL airspy_spiflash_write(struct airspy_device* device, const uint32_t address, const uint16_t length, unsigned char* const data);
extern ADDAPI int ADDCALL airspy_spiflash_read(struct airspy_device* device, const uint32_t address, const uint16_t length, unsigned char* data);
extern ADDAPI int ADDCALL airspy_board_id_read(struct airspy_device* device, uint8_t* value);
/* Parameter length shall be at least 128bytes */
extern ADDAPI int ADDCALL airspy_version_string_read(struct airspy_device* device, char* version, uint8_t length);
extern ADDAPI int ADDCALL airspy_board_partid_serialno_read(struct airspy_device* device, airspy_read_partid_serialno_t* read_partid_serialno);
extern ADDAPI int ADDCALL airspy_set_sample_type(struct airspy_device* device, enum airspy_sample_type sample_type);
/* Parameter freq_hz shall be between 24000000(24MHz) and 1750000000(1.75GHz) */
extern ADDAPI int ADDCALL airspy_set_freq(struct airspy_device* device, const uint32_t freq_hz);
/* Parameter value shall be between 0 and 15 */
extern ADDAPI int ADDCALL airspy_set_lna_gain(struct airspy_device* device, uint8_t value);
/* Parameter value shall be between 0 and 15 */
extern ADDAPI int ADDCALL airspy_set_mixer_gain(struct airspy_device* device, uint8_t value);
/* Parameter value shall be between 0 and 15 */
extern ADDAPI int ADDCALL airspy_set_vga_gain(struct airspy_device* device, uint8_t value);
/* Parameter value:
0=Disable LNA Automatic Gain Control
1=Enable LNA Automatic Gain Control
*/
extern ADDAPI int ADDCALL airspy_set_lna_agc(struct airspy_device* device, uint8_t value);
/* Parameter value:
0=Disable MIXER Automatic Gain Control
1=Enable MIXER Automatic Gain Control
*/
extern ADDAPI int ADDCALL airspy_set_mixer_agc(struct airspy_device* device, uint8_t value);
/* Parameter value: 0..21 */
extern ADDAPI int ADDCALL airspy_set_linearity_gain(struct airspy_device* device, uint8_t value);
/* Parameter value: 0..21 */
extern ADDAPI int ADDCALL airspy_set_sensitivity_gain(struct airspy_device* device, uint8_t value);
/* Parameter value shall be 0=Disable BiasT or 1=Enable BiasT */
extern ADDAPI int ADDCALL airspy_set_rf_bias(struct airspy_device* dev, uint8_t value);
/* Parameter value shall be 0=Disable Packing or 1=Enable Packing */
extern ADDAPI int ADDCALL airspy_set_packing(struct airspy_device* device, uint8_t value);
extern ADDAPI const char* ADDCALL airspy_error_name(enum airspy_error errcode);
extern ADDAPI const char* ADDCALL airspy_board_id_name(enum airspy_board_id board_id);
/* Parameter sector_num shall be between 2 & 13 (sector 0 & 1 are reserved) */
extern ADDAPI int ADDCALL airspy_spiflash_erase_sector(struct airspy_device* device, const uint16_t sector_num);
#ifdef __cplusplus
} // __cplusplus defined.
#endif
#endif//__AIRSPY_H__

View File

@@ -0,0 +1,145 @@
/*
Copyright (c) 2013-2016, Benjamin Vernoux <bvernoux@airspy.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Neither the name of AirSpy nor the names of its contributors may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __AIRSPY_COMMANDS_H__
#define __AIRSPY_COMMANDS_H__
#include <stdint.h>
#ifdef __cplusplus
extern "C"
{
#endif
typedef enum
{
RECEIVER_MODE_OFF = 0,
RECEIVER_MODE_RX = 1
} receiver_mode_t;
/*
Note: airspy_samplerate_t is now obsolete and left for backward compatibility.
The list of supported sample rates should be retrieved at run time by calling airspy_get_samplerates().
Refer to the Airspy Tools for illustrations.
*/
typedef enum
{
AIRSPY_SAMPLERATE_10MSPS = 0, /* 12bits 10MHz IQ */
AIRSPY_SAMPLERATE_2_5MSPS = 1, /* 12bits 2.5MHz IQ */
AIRSPY_SAMPLERATE_END = 2 /* End index for sample rate (corresponds to number of samplerate) */
} airspy_samplerate_t;
#define AIRSPY_CONF_CMD_SHIFT_BIT (3) // Up to 3bits=8 samplerates (airspy_samplerate_t enum shall not exceed 7)
// Commands (usb vendor request) shared between Firmware and Host.
#define AIRSPY_CMD_MAX (27)
typedef enum
{
AIRSPY_INVALID = 0 ,
AIRSPY_RECEIVER_MODE = 1 ,
AIRSPY_SI5351C_WRITE = 2 ,
AIRSPY_SI5351C_READ = 3 ,
AIRSPY_R820T_WRITE = 4 ,
AIRSPY_R820T_READ = 5 ,
AIRSPY_SPIFLASH_ERASE = 6 ,
AIRSPY_SPIFLASH_WRITE = 7 ,
AIRSPY_SPIFLASH_READ = 8 ,
AIRSPY_BOARD_ID_READ = 9 ,
AIRSPY_VERSION_STRING_READ = 10,
AIRSPY_BOARD_PARTID_SERIALNO_READ = 11,
AIRSPY_SET_SAMPLERATE = 12,
AIRSPY_SET_FREQ = 13,
AIRSPY_SET_LNA_GAIN = 14,
AIRSPY_SET_MIXER_GAIN = 15,
AIRSPY_SET_VGA_GAIN = 16,
AIRSPY_SET_LNA_AGC = 17,
AIRSPY_SET_MIXER_AGC = 18,
AIRSPY_MS_VENDOR_CMD = 19,
AIRSPY_SET_RF_BIAS_CMD = 20,
AIRSPY_GPIO_WRITE = 21,
AIRSPY_GPIO_READ = 22,
AIRSPY_GPIODIR_WRITE = 23,
AIRSPY_GPIODIR_READ = 24,
AIRSPY_GET_SAMPLERATES = 25,
AIRSPY_SET_PACKING = 26,
AIRSPY_SPIFLASH_ERASE_SECTOR = AIRSPY_CMD_MAX
} airspy_vendor_request;
typedef enum
{
CONFIG_CALIBRATION = 0,
//CONFIG_META = 1,
} airspy_common_config_pages_t;
typedef enum
{
GPIO_PORT0 = 0,
GPIO_PORT1 = 1,
GPIO_PORT2 = 2,
GPIO_PORT3 = 3,
GPIO_PORT4 = 4,
GPIO_PORT5 = 5,
GPIO_PORT6 = 6,
GPIO_PORT7 = 7
} airspy_gpio_port_t;
typedef enum
{
GPIO_PIN0 = 0,
GPIO_PIN1 = 1,
GPIO_PIN2 = 2,
GPIO_PIN3 = 3,
GPIO_PIN4 = 4,
GPIO_PIN5 = 5,
GPIO_PIN6 = 6,
GPIO_PIN7 = 7,
GPIO_PIN8 = 8,
GPIO_PIN9 = 9,
GPIO_PIN10 = 10,
GPIO_PIN11 = 11,
GPIO_PIN12 = 12,
GPIO_PIN13 = 13,
GPIO_PIN14 = 14,
GPIO_PIN15 = 15,
GPIO_PIN16 = 16,
GPIO_PIN17 = 17,
GPIO_PIN18 = 18,
GPIO_PIN19 = 19,
GPIO_PIN20 = 20,
GPIO_PIN21 = 21,
GPIO_PIN22 = 22,
GPIO_PIN23 = 23,
GPIO_PIN24 = 24,
GPIO_PIN25 = 25,
GPIO_PIN26 = 26,
GPIO_PIN27 = 27,
GPIO_PIN28 = 28,
GPIO_PIN29 = 29,
GPIO_PIN30 = 30,
GPIO_PIN31 = 31
} airspy_gpio_pin_t;
#ifdef __cplusplus
} // __cplusplus defined.
#endif
#endif//__AIRSPY_COMMANDS_H__

View File

@@ -0,0 +1,134 @@
/*
Copyright (C) 2014, Youssef Touil <youssef@airspy.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#ifndef FILTERS_H
#define FILTERS_H
#include <stdint.h>
#define HB_KERNEL_FLOAT_LEN 47
const float HB_KERNEL_FLOAT[HB_KERNEL_FLOAT_LEN] =
{
-0.000998606272947510,
0.000000000000000000,
0.001695637278417295,
0.000000000000000000,
-0.003054430179754289,
0.000000000000000000,
0.005055504379767936,
0.000000000000000000,
-0.007901319195893647,
0.000000000000000000,
0.011873357051047719,
0.000000000000000000,
-0.017411159379930066,
0.000000000000000000,
0.025304817427568772,
0.000000000000000000,
-0.037225225204559217,
0.000000000000000000,
0.057533286997004301,
0.000000000000000000,
-0.102327462004259350,
0.000000000000000000,
0.317034472508947400,
0.500000000000000000,
0.317034472508947400,
0.000000000000000000,
-0.102327462004259350,
0.000000000000000000,
0.057533286997004301,
0.000000000000000000,
-0.037225225204559217,
0.000000000000000000,
0.025304817427568772,
0.000000000000000000,
-0.017411159379930066,
0.000000000000000000,
0.011873357051047719,
0.000000000000000000,
-0.007901319195893647,
0.000000000000000000,
0.005055504379767936,
0.000000000000000000,
-0.003054430179754289,
0.000000000000000000,
0.001695637278417295,
0.000000000000000000,
-0.000998606272947510
};
#define HB_KERNEL_INT16_LEN 47
const int16_t HB_KERNEL_INT16[HB_KERNEL_INT16_LEN] =
{
-33,
0,
56,
0,
-100,
0,
166,
0,
-259,
0,
389,
0,
-571,
0,
829,
0,
-1220,
0,
1885,
0,
-3353,
0,
10389,
16384,
10389,
0,
-3353,
0,
1885,
0,
-1220,
0,
829,
0,
-571,
0,
389,
0,
-259,
0,
166,
0,
-100,
0,
56,
0,
-33
};
#endif // FILTERS_H

View File

@@ -0,0 +1,47 @@
/*
Copyright (C) 2014, Youssef Touil <youssef@airspy.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#ifndef IQCONVERTER_FLOAT_H
#define IQCONVERTER_FLOAT_H
#include <stdint.h>
#define IQCONVERTER_NZEROS 2
#define IQCONVERTER_NPOLES 2
typedef struct {
float avg;
float hbc;
int len;
int fir_index;
int delay_index;
float *fir_kernel;
float *fir_queue;
float *delay_line;
} iqconverter_float_t;
iqconverter_float_t *iqconverter_float_create(const float *hb_kernel, int len);
void iqconverter_float_free(iqconverter_float_t *cnv);
void iqconverter_float_reset(iqconverter_float_t *cnv);
void iqconverter_float_process(iqconverter_float_t *cnv, float *samples, int len);
#endif // IQCONVERTER_FLOAT_H

View File

@@ -0,0 +1,45 @@
/*
Copyright (C) 2014, Youssef Touil <youssef@airspy.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#ifndef IQCONVERTER_INT16_H
#define IQCONVERTER_INT16_H
#include <stdint.h>
typedef struct {
int len;
int fir_index;
int delay_index;
int16_t old_x;
int16_t old_y;
int32_t old_e;
int32_t *fir_kernel;
int32_t *fir_queue;
int16_t *delay_line;
} iqconverter_int16_t;
iqconverter_int16_t *iqconverter_int16_create(const int16_t *hb_kernel, int len);
void iqconverter_int16_free(iqconverter_int16_t *cnv);
void iqconverter_int16_reset(iqconverter_int16_t *cnv);
void iqconverter_int16_process(iqconverter_int16_t *cnv, int16_t *samples, int len);
#endif // IQCONVERTER_INT16_H

BIN
devices/elad-s1-handler.tgz Normal file

Binary file not shown.

View File

@@ -0,0 +1,83 @@
cmake_minimum_required( VERSION 2.6 )
#set ( CMAKE_BUILD_TYPE Release )
set (objectName device_elad-s1)
ADD_DEFINITIONS (-DQT_SHARED)
ADD_DEFINITIONS (-DQT_NO_DEBUG)
set (CMAKE_INSTALL_PREFIX ../../../../../../../)
add_definitions ( -Wall )
find_package (Qt5Widgets REQUIRED)
find_package (Qt5Declarative REQUIRED)
find_library (DYNAMIC_LOAD dl)
if(NOT(DYNAMIC_LOAD))
message(FATAL_ERROR "please install -ldl")
else(NOT(DYNAMIC_LOAD))
set(extraLibs ${DYNAMIC_LOAD})
endif(NOT(DYNAMIC_LOAD))
#
find_library (PTHREADS pthread)
if(NOT(PTHREADS))
message (FATAL_ERROR "please install libpthread")
else(NOT(PTHREADS))
set (extraLibs ${extraLibs} ${PTHREADS})
endif(NOT(PTHREADS))
set (${objectName}_UIS ./widget.ui)
include_directories (
${CMAKE_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${QT5Widgets_INCLUDES}
${QT_QTCORE_INCLUDE_DIR}
${QT_QTGUI_INCLUDE_DIR}
.
../
../..
../../radio-utils
../../../includes
../../../includes/filters
../../../includes/various
../../../includes/output
)
set ( ${objectName}_HDRS
../rig-interface.h
./elad-s1.h
./elad-worker.h
./elad-loader.h
../../../includes/swradio-constants.h
../../../includes/filters/fir-filters.h
../../../includes/various/ringbuffer.h
)
set ( ${objectName}_SRCS
./elad-s1.cpp
./elad-worker.cpp
./elad-loader.cpp
../../../src/filters/fir-filters.cpp
../../../src/filters/iir-filters.cpp
../../../src/various/sincos.cpp
../../../src/various/utilities.cpp
)
set (${objectName}_UIS ./widget.ui)
QT5_WRAP_UI(UIS ${${objectName}_UIS})
set ( ${objectName}_MOCS
../rig-interface.h
./elad-s1.h
)
add_library (${objectName}
SHARED ${${objectName}_SRCS}
${UIS} ${RSCS} ${TRS} ${MOCS}
)
target_link_libraries (${objectName}
Qt5::Widgets
${extraLibs}
${SAMPLERATE_LIBRARIES}
)
INSTALL(TARGETS ${objectName} LIBRARY DESTINATION ./linux-bin/input-plugins-sw)

View File

@@ -0,0 +1,89 @@
#
/*
* Copyright (C) 2008, 2009, 2010
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of qt-dab
*
* qt-dab is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation as version 2 of the License.
*
* qt-dab is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with qt-dab; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "elad-filter.h"
#include <math.h>
#ifndef M_PI
# define M_PI 3.14159265358979323846 /* pi */
#endif
eladFilter::eladFilter (int16_t firSize,
int32_t cutoffFreq,
int32_t sampleRate) {
float tmp [firSize];
float lo = (float)(cutoffFreq) / sampleRate;
float sum = 0.0;
int16_t i;
this -> buffer_re = new float [firSize];
this -> buffer_im = new float [firSize];
this -> kernel = new float [firSize];
this -> firSize = firSize;
ip = 0;
//
// create a low pass filter for lo;
for (i = 0; i < firSize; i ++) {
if (i == firSize / 2)
tmp [i] = 2 * M_PI * lo;
else
tmp [i] = sin (2 * M_PI * lo * (i - firSize /2)) / (i - firSize/2);
//
// windowing with Blackman
tmp [i] *= (0.42 -
0.5 * cos (2 * M_PI * (float)i / (float)firSize) +
0.08 * cos (4 * M_PI * (float)i / (float)firSize));
sum += tmp [i];
}
//
// and the kernel
for (i = 0; i < firSize; i ++)
kernel [i] = tmp [i] / sum;
}
eladFilter::~eladFilter (void) {
delete [] kernel;
delete [] buffer_re;
delete [] buffer_im;
}
// we process the samples backwards rather than reversing
// the kernel
std::complex<float> eladFilter::Pass (std::complex<float> val) {
int16_t i;
float tmp_1 = 0;
float tmp_2 = 0;
buffer_re [ip] = real (val);
buffer_im [ip] = imag (val);
for (i = 0; i < firSize; i ++) {
int16_t index = ip - i;
if (index < 0)
index += firSize;
tmp_1 += buffer_re [index] * kernel [i];
tmp_2 += buffer_im [index] * kernel [i];
}
ip = (ip + 1) % firSize;
return std::complex<float> (tmp_1, tmp_2);;
}

View File

@@ -0,0 +1,45 @@
#
/*
* Copyright (C) 2010, 2011, 2012
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of qt-dab
*
* qt-dab is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* qt-dab is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with qt-dab; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __ELAD_FILTER__
#define __ELAD_FILTER__
#include <stdlib.h>
#include <math.h>
#include <complex>
class eladFilter {
public:
eladFilter (int16_t, int32_t, int32_t);
~eladFilter (void);
std::complex<float> Pass (std::complex<float>);
private:
int16_t firSize;
float *kernel;
float *buffer_re;
float *buffer_im;
int16_t ip;
int32_t sampleRate;
};
#endif

View File

@@ -0,0 +1,219 @@
#
/*
* Copyright (C) 2014
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Programming
*
* This file is part of the Qt-DAB program
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <QThread>
#include <QSettings>
#include <QHBoxLayout>
#include <QLabel>
#include <QMessageBox>
#include <QDir>
#include "elad-handler.h" // our header
#include "elad-worker.h" // the thread, reading in the data
#include "elad-loader.h" // function loader
#include <stdio.h>
#define RATE 3072000
// Currently, we do not have lots of settings,
// it just might change suddenly, but not today
eladHandler::eladHandler (QSettings *s) {
int16_t success;
this -> eladSettings = s;
this -> myFrame = new QFrame (NULL);
setupUi (myFrame);
myFrame -> show ();
_I_Buffer = NULL;
theLoader = NULL;
theWorker = NULL;
vfoOffset =
eladSettings -> value ("elad-offset", 0). toInt ();
//
// sometimes problems with dynamic linkage of libusb, it is
// loaded indirectly through the dll
if (libusb_init (NULL) < 0) {
fprintf (stderr, "libusb problem\n"); // should not happen
throw (21);
}
libusb_exit (NULL);
theLoader = new eladLoader (RATE, &success);
if (success != 0) {
if (success == -1)
QMessageBox::warning (myFrame, tr ("sdr"),
tr ("No success in loading libs\n"));
else
if (success == -2)
QMessageBox::warning (myFrame, tr ("sdr"),
tr ("No success in setting up USB\n"));
else
if (success == -3)
QMessageBox::warning (myFrame, tr ("sdr"),
tr ("No success in FPGA init\n"));
else
if (success == -4)
QMessageBox::warning (myFrame, tr ("sdr"),
tr ("No success in hardware init\n"));
statusLabel -> setText ("not functioning");
delete theLoader;
theLoader = NULL;
delete myFrame;
throw (21);
}
//
// Note (10.10.2014:
// It turns out that the elad provides for 32 bit samples
// packed as bytes
statusLabel -> setText ("Loaded");
//
// buffersize app 0.5 seconds of data
_I_Buffer = new RingBuffer<std::complex<float>>(32 * 32768);
vfoFrequency = Khz (220000);
//
// since localFilter and gainReduced are also used as
// parameter for the API functions, they are int's rather
// than bool.
localFilter = 0;
filterText -> setText ("no filter");
gainReduced = 0;
gainLabel -> setText ("0");
connect (hzOffset, SIGNAL (valueChanged (int)),
this, SLOT (setOffset (int)));
connect (gainReduction, SIGNAL (clicked (void)),
this, SLOT (setGainReduction (void)));
connect (filter, SIGNAL (clicked (void)),
this, SLOT (setFilter (void)));
}
//
eladHandler::~eladHandler (void) {
eladSettings -> setValue ("elad-offset", vfoOffset);
stopReader ();
if (_I_Buffer != NULL)
delete _I_Buffer;
if (theLoader != NULL)
delete theLoader;
if (theWorker != NULL)
delete theWorker;
}
int32_t eladHandler::defaultFrequency (void) {
return Khz (220000);
}
void eladHandler::setVFOFrequency (int32_t newFrequency) {
int32_t realFreq = newFrequency - vfoOffset;
if (theWorker == NULL) {
vfoFrequency = newFrequency - vfoOffset;
return;
}
theWorker -> setVFOFrequency (realFreq);
vfoFrequency = theWorker -> getVFOFrequency ();
}
int32_t eladHandler::getVFOFrequency (void) {
return vfoFrequency + vfoOffset;
}
bool eladHandler::restartReader (void) {
bool success;
if (theWorker != NULL)
return true;
_I_Buffer -> FlushRingBuffer ();
theWorker = new eladWorker (vfoFrequency,
theLoader,
this,
_I_Buffer,
&success);
fprintf (stderr, "worker started, success = %d\n", success);
return success;
}
void eladHandler::stopReader (void) {
if (theWorker == NULL)
return;
theWorker -> stop ();
while (theWorker -> isRunning ())
usleep (100);
delete theWorker;
theWorker = NULL;
}
// we are - in this context - certain that whenever getSamples
// is called, there are sufficient samples available.
int32_t eladHandler::getSamples (std::complex<float> *V, int32_t size) {
return _I_Buffer -> getDataFromBuffer (V, size);
}
int32_t eladHandler::Samples (void) {
return _I_Buffer -> GetRingBufferReadAvailable () / 2;
}
void eladHandler::resetBuffer (void) {
_I_Buffer -> FlushRingBuffer ();
}
//
// Although we are getting 30-more bits in, the adc in the
// elad gives us 14 bits. That + 20 db gain results in app 105 db
// plus a marge it is app 120 a 130 db, so the bit depth for the scope
// is 21
int16_t eladHandler::bitDepth (void) {
return 21;
}
//
void eladHandler::setOffset (int k) {
vfoOffset = k;
}
void eladHandler::setGainReduction (void) {
gainReduced = gainReduced == 1 ? 0 : 1;
theLoader -> set_en_ext_io_ATT20 (theLoader -> getHandle (),
&gainReduced);
gainLabel -> setText (gainReduced == 1 ? "-20" : "0");
}
void eladHandler::setFilter (void) {
localFilter = localFilter == 1 ? 0 : 1;
theLoader -> set_en_ext_io_LP30 (theLoader -> getHandle (),
&localFilter);
filterText -> setText (localFilter == 1 ? "30 Mhz" : "no filter");
}
void eladHandler::show_eladFrequency (int f) {
eladFrequency -> display (f);
}
void eladHandler::show_iqSwitch (bool b) {
if (b)
elad_iqSwitch -> setText ("reversed IQ");
else
elad_iqSwitch -> setText ("normal IQ");
}

View File

@@ -0,0 +1,79 @@
#
/*
* Copyright (C) 2014 .. 2017
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of the Qt-DAB
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __ELAD_HANDLER__
#define __ELAD_HANDLER__
#include <QObject>
#include <QFrame>
#include <QFileDialog>
#include "dab-constants.h"
#include "virtual-input.h"
#include "ringbuffer.h"
#include "ui_widget.h"
#include <libusb-1.0/libusb.h>
class QSettings;
class eladWorker;
class eladLoader;
typedef std::complex<float>(*makeSampleP)(uint8_t *);
class eladHandler: public virtualInput, public Ui_Form {
Q_OBJECT
public:
eladHandler (QSettings *);
~eladHandler (void);
void setVFOFrequency (int32_t);
int32_t getVFOFrequency (void);
bool legalFrequency (int32_t);
int32_t defaultFrequency (void);
bool restartReader (void);
void stopReader (void);
int32_t getSamples (std::complex<float> *, int32_t);
int32_t Samples (void);
void resetBuffer (void);
int32_t getRate (void);
int16_t bitDepth (void);
private slots:
void setGainReduction (void);
void setOffset (int);
void setFilter (void);
public slots:
void show_eladFrequency (int);
void show_iqSwitch (bool);
private:
QSettings *eladSettings;
bool deviceOK;
eladLoader *theLoader;
eladWorker *theWorker;
RingBuffer<std::complex<float>> *_I_Buffer;
QFrame *myFrame;
int32_t vfoFrequency;
int32_t vfoOffset;
int gainReduced;
int localFilter;
uint8_t conversionNumber;
int16_t iqSize;
};
#endif

View File

@@ -0,0 +1,196 @@
#
/*
* Copyright (C) 2014
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of Qt-DAB
*
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "elad-loader.h"
//
// Straight forward class to load the functions from the
// elad library
eladLoader::eladLoader (int32_t theRate, int16_t *success) {
int rc;
libraryLoaded = false;
hardware_OK = false;
usb_OK = false;
*success = -1; // just the default
fprintf (stderr, "going to load libusb\n");
hwHandle = dlopen ("libusb-1.0.so", RTLD_NOW | RTLD_GLOBAL);
hwLibname = new char [100];
sprintf (hwLibname, "libfdms1_hw_init_%d.so.1.0", theRate);
// "/usr/local/lib64/libfdms1_hw_init_%d.so.1.0", theRate);
fprintf (stderr, "going to load %s\n", hwLibname);
hwHandle = dlopen (hwLibname, RTLD_NOW);
if (hwHandle == NULL) {
fprintf (stderr, "error report %s\n", dlerror ());
libusb_close (dev_handle);
return;
}
// load the init function
Init = (FDMS1_HW_INIT) dlsym (hwHandle, (const char *)"fdms1_hw_init");
if (Init == NULL) {
fprintf (stderr, "Could not load fdms1_hw_init\n");
dlclose (hwHandle);
return;
}
//
// now for the control library
cwLibname = "libfdms1_hw_ctrl.so.1.0";
// cwLibname = "/usr/local/lib64/libfdms1_hw_ctrl.so.1.0";
fprintf (stderr, "going to load %s\n", cwLibname);
cwHandle = dlopen (cwLibname, RTLD_NOW);
if (cwHandle == NULL) {
fprintf (stderr, "error report %s\n", dlerror ());
dlclose (hwHandle);
return;
}
libraryLoaded = true;
//
// Load the functions one by one
set_en_ext_io_ATT20 = (Pset_en_ext_io_ATT20)
GETPROCADDRESS (cwHandle, "set_en_ext_io_ATT20");
if (set_en_ext_io_ATT20 == NULL) {
fprintf (stderr, "Could not load set_en_ext_io_ATT20\n");
return;
}
set_en_ext_io_LP30 = (Pset_en_ext_io_ATT20)
GETPROCADDRESS (cwHandle, "set_en_ext_io_LP30");
if (set_en_ext_io_LP30 == NULL) {
fprintf (stderr, "Could not load set_en_ext_io_ATT20\n");
return;
}
OpenHW = (OPEN_HW) GETPROCADDRESS (cwHandle, "OpenHW");
SetHWLO = (SET_HWLO) GETPROCADDRESS (cwHandle, "SetHWLO");
StartFIFO = (START_FIFO) GETPROCADDRESS (cwHandle, "StartFIFO");
StopFIFO = (STOP_FIFO) GETPROCADDRESS (cwHandle, "StopFIFO");
StopHW = (STOP_HW) GETPROCADDRESS (cwHandle, "StopHW");
CloseHW = (CLOSE_HW) GETPROCADDRESS (cwHandle, "CloseHW");
fprintf (stderr, "Functions seem to be loaded\n");
//
// We first open the USB lib
usb_OK = false;
dev_handle = startUSB ();
if (dev_handle == NULL) {
*success = -2;
return;
}
usb_OK = true;
// we are going for init
fprintf (stderr, "Loading FPGA, please wait\n");
rc = Init (dev_handle);
if (rc == 0) {
fprintf (stderr, "Loading FPGA Image failed %d\n", rc);
*success = -3;
return;
}
rc = OpenHW (dev_handle, theRate);
fprintf (stderr, "Hardware opened %s\n", rc == 1 ? "good" : "failed");
hardware_OK = rc == 1;
if (!hardware_OK) {
*success = -4;
return;
}
if (hardware_OK) {
int d_en_ext_io_ATT20 = 1;
int d_en_ext_io_LP30 = 1;
set_en_ext_io_ATT20 (dev_handle, &d_en_ext_io_ATT20);
set_en_ext_io_LP30 (dev_handle, &d_en_ext_io_LP30);
}
*success = 0;
}
eladLoader::~eladLoader (void) {
if (hardware_OK) {
StopHW ();
CloseHW ();
}
if (usb_OK)
libusb_close (dev_handle);
if (libraryLoaded) {
dlclose (cwHandle);
dlclose (hwHandle);
}
}
//
libusb_device_handle *eladLoader::startUSB (void) {
libusb_device_handle *dev_handle = NULL;
uint16_t vendor_id = 0x1721;
uint16_t product_id = 0x0610;
context = 0;
int rc = libusb_init ( &context );
if (rc == 0 && context != 0) {
libusb_set_debug (context,3);
}
else {
fprintf (stderr,
"Error in libusb_init: [%d] %s\n",
rc, libusb_error_name (rc));
return NULL;
}
dev_handle = libusb_open_device_with_vid_pid (context,
vendor_id,
product_id);
if (dev_handle == 0) {
fprintf (stderr, "Error in libusb_open_device_with_vid_pid\n");
fprintf (stderr,
"Check FDMS1 is properly connected and turned on.\n");
return NULL;
}
fprintf (stderr, "libusb_open_device_with_vid_pid OK\n");
if (libusb_kernel_driver_active (dev_handle, 0) ){
printf("Device busy...detaching...\n");
libusb_detach_kernel_driver (dev_handle, 0);
} else
printf("Device free from kernel, continue...\n");
rc = libusb_claim_interface (dev_handle, 0);
//claim interface 0 (the first) of device
if (rc < 0) {
fprintf (stderr,
"Cannot claim interface: [%d] %s\n",
rc, libusb_error_name (rc));
return NULL;
}
return dev_handle;
}
libusb_device_handle *eladLoader::getHandle (void) {
return dev_handle;
}
bool eladLoader::OK (void) {
return libraryLoaded && hardware_OK && usb_OK;
}

View File

@@ -0,0 +1,81 @@
#
/*
* Copyright (C) 2014 .. 2017
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of the Qt-DAB.
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//
// We use a straightforward class "eladLoader" both as
// loader and as container for the dll functions.
#ifndef __ELAD_LOADER
#define __ELAD_LOADER
#include "dab-constants.h"
#include <stdint.h>
#include <libusb-1.0/libusb.h>
// The naming of functions for accessing shared libraries
// differ between Linux and Windows
#define GETPROCADDRESS dlsym
// Dll function prototypes
typedef void (*Pset_en_ext_io_ATT20)(libusb_device_handle *, int *);
typedef void (*Pset_en_ext_io_LP30)(libusb_device_handle *, int *);
typedef int (*OPEN_HW)(libusb_device_handle *, long);
typedef int (*SET_HWLO)(libusb_device_handle *, long *);
typedef void (*START_FIFO)(libusb_device_handle *);
typedef void (*STOP_FIFO)(libusb_device_handle *);
typedef void (*STOP_HW)(void);
typedef void (*CLOSE_HW)(void);
typedef int (*FDMS1_HW_INIT)(libusb_device_handle *);
class eladLoader {
public:
eladLoader (int32_t, int16_t *);
~eladLoader (void);
bool OK (void);
libusb_device_handle *getHandle (void);
Pset_en_ext_io_ATT20 set_en_ext_io_ATT20;
Pset_en_ext_io_LP30 set_en_ext_io_LP30;
OPEN_HW OpenHW;
SET_HWLO SetHWLO;
START_FIFO StartFIFO;
STOP_FIFO StopFIFO;
STOP_HW StopHW;
CLOSE_HW CloseHW;
FDMS1_HW_INIT Init;
private:
libusb_device_handle *startUSB (void);
HINSTANCE hwHandle;
HINSTANCE cwHandle;
libusb_device_handle *dev_handle;
libusb_context *context;
bool libraryLoaded;
bool usb_OK;
bool hardware_OK;
const char *cwLibname;
char *hwLibname;
int32_t theRate;
};
#endif

View File

@@ -0,0 +1,26 @@
#
TEMPLATE = lib
CONFIG += plugin
QT += core gui widgets
INCLUDEPATH += . \
../ ../.. \
../../../includes \
../../../includes/various
HEADERS = ../rig-interface.h \
../../../includes/swradio-constants.h \
./elad-s1.h \
./elad-worker.h \
./elad-loader.h \
../../../includes/various/ringbuffer.h
SOURCES = ./elad-s1.cpp \
./elad-worker.cpp \
./elad-loader.cpp
TARGET = $$qtLibraryTarget(device_elad-s1sw)
FORMS += ./widget.ui
unix{
DESTDIR = ../../../../../linux-bin/input-plugins-sw
LIBS += -lusb-1.0 -ldl
}

View File

@@ -0,0 +1,290 @@
#
/*
* Copyright (C) 2014
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Programming
*
* This file is part of the Qt-DAB
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "dab-constants.h" // some general definitions
#include "elad-worker.h" // our header
#include "elad-handler.h"
#include "elad-loader.h" // the API definition
#include "ringbuffer.h" // the buffer
// The elad-worker is a simple wrapper around the elad
// interface. It is a pretty simple thread performing the
// basic functions, it reads the bytes, converts them to
// samples and converts the rate to 2048000
//
eladWorker::eladWorker (int32_t defaultFreq,
eladLoader *f,
eladHandler *h,
RingBuffer<std::complex<float>> *theBuffer,
bool *OK) {
int i;
fprintf (stderr, "creating a worker\n");
_I_Buffer = new RingBuffer<uint8_t> (16 * 32768);
fprintf (stderr, "local buffer allocated\n");
this -> theRate = 3072000;
this -> defaultFreq = defaultFreq;
this -> functions = f;
this -> theBuffer = theBuffer;
*OK = false; // just the default
iqSwitch = false;
theFilter = new eladFilter (5, 1024000, 3072000);
conversionNumber = theRate == 192000 ? 1:
theRate <= 3072000 ? 2 : 3;
//
// we convert to complexes directly
iqSize = conversionNumber == 3 ? 4 : 8;
convBufferSize = theRate / 1000;
convIndex = 0;
convBuffer = new std::complex<float> [convBufferSize + 1];
fprintf (stderr, "iqSize = %d, conversion = %d\n",
iqSize, conversionNumber);
// The sizes of the mapTable and the convTable are
// predefined and follow from the input and output rate
// (theRate / 1000) vs (2048000 / 1000)
for (i = 0; i < 2048; i ++) {
float inVal = float (theRate / 1000);
mapTable_int [i] = int (floor (i * (inVal / 2048.0)));
mapTable_float [i] = i * (inVal / 2048.0) - mapTable_int [i];
}
fprintf (stderr, "mapTables initialized\n");
//
fprintf (stderr, "testing functions\n");
if (!functions -> OK ())
return;
lastFrequency = defaultFreq; // the parameter!!!!
runnable = true;
fprintf (stderr, "functions are OK\n");
functions -> StartFIFO (functions -> getHandle ());
connect (this, SIGNAL (show_eladFrequeny (int)),
h, SLOT (show_eladFrequency (int)));
connect (this, SIGNAL (show_iqSwitch (bool)),
h, SLOT (show_iqSwitch (bool)));
start ();
*OK = true;
}
// As usual, killing objects containing a thread need to
// be done carefully.
void eladWorker::stop (void) {
if (runnable)
functions -> StopFIFO (functions -> getHandle ());
runnable = false;
}
eladWorker::~eladWorker (void) {
stop ();
while (isRunning ())
msleep (1);
delete _I_Buffer;
delete [] convBuffer;
}
std::complex<float> makeSample_31bits (uint8_t *);
std::complex<float> makeSample_30bits (uint8_t *, bool);
std::complex<float> makeSample_15bits (uint8_t *);
typedef union {
struct __attribute__((__packed__)) {
float i;
float q;
} iqf;
struct __attribute__((__packed__)) {
int32_t i;
int32_t q;
} iq;
struct __attribute__((__packed__)) {
uint8_t i1;
uint8_t i2;
uint8_t i3;
uint8_t i4;
uint8_t q1;
uint8_t q2;
uint8_t q3;
uint8_t q4;
};
} iq_sample;
#define SCALE_FACTOR_30 1073741824.000
#define SCALE_FACTOR_29 536970912.000
#define SCALE_FACTOR_14 16384.000
std::complex<float> makeSample_31bits (uint8_t *buf) {
int ii = 0; int qq = 0;
int16_t i = 0;
uint8_t q0 = buf [i++];
uint8_t q1 = buf [i++];
uint8_t q2 = buf [i++];
uint8_t q3 = buf [i++];
uint8_t i0 = buf [i++];
uint8_t i1 = buf [i++];
uint8_t i2 = buf [i++];
uint8_t i3 = buf [i++];
ii = (i3 << 24) | (i2 << 16) | (i1 << 8) | i0;
qq = (q3 << 24) | (q2 << 16) | (q1 << 8) | q0;
return std::complex<float> ((float)qq / SCALE_FACTOR_30,
(float)ii / SCALE_FACTOR_30);
return std::complex<float> ((float)ii / SCALE_FACTOR_30,
(float)qq / SCALE_FACTOR_30);
}
std::complex<float> makeSample_30bits (uint8_t *buf, bool flag) {
int ii = 0; int qq = 0;
int16_t i = 0;
uint8_t q0 = buf [i++];
uint8_t q1 = buf [i++];
uint8_t q2 = buf [i++];
uint8_t q3 = buf [i++];
uint8_t i0 = buf [i++];
uint8_t i1 = buf [i++];
uint8_t i2 = buf [i++];
uint8_t i3 = buf [i++];
ii = (i3 << 24) | (i2 << 16) | (i1 << 8) | i0;
qq = (q3 << 24) | (q2 << 16) | (q1 << 8) | q0;
if (flag)
return std::complex<float> ((float)qq / SCALE_FACTOR_29,
(float)ii / SCALE_FACTOR_29);
else
return std::complex<float> ((float)ii / SCALE_FACTOR_29,
(float)qq / SCALE_FACTOR_29);
}
//
std::complex<float> makeSample_15bits (uint8_t *buf) {
int ii = 0; int qq = 0;
int16_t i = 0;
ii = (int)((unsigned char)(buf[i++]));
ii += (int)((unsigned char)(buf[i++])) << 8;
qq = (int)((unsigned char)(buf[i++]));
qq += (int)((unsigned char)(buf[i++])) << 8;
return std::complex<float> ((float)ii / SCALE_FACTOR_14,
(float)ii / SCALE_FACTOR_14);
return std::complex<float> ((float)qq / SCALE_FACTOR_14,
(float)ii / SCALE_FACTOR_14);
}
#define BUFFER_SIZE (8 * 8192)
uint8_t buffer [BUFFER_SIZE];
//
// To make life easy, we do all handling in this task,
// its "output", i.e. the shared buffer contains the
// samples, type complex, representing a samplerate 2048000
// Every millisecond we add 2048 samples by converting
// 3072 samples
void eladWorker:: run (void) {
int32_t amount;
int rc, i;
// when (re)starting, clean up first
_I_Buffer -> FlushRingBuffer ();
fprintf (stderr, "worker thread started\n");
while (runnable) {
rc = libusb_bulk_transfer (functions -> getHandle (),
(6 | LIBUSB_ENDPOINT_IN),
(uint8_t *)buffer,
BUFFER_SIZE * sizeof (uint8_t),
&amount,
2000);
if (rc) {
fprintf (stderr,
"Error in libusb_bulk_transfer: [%d] %s\n",
rc,
libusb_error_name (rc));
if (rc != 7)
break;
}
//
// Since we do not know whether the amount read is a multiple
// of iqSize, we use an intermediate buffer
_I_Buffer -> putDataIntoBuffer (buffer, amount);
while (_I_Buffer -> GetRingBufferReadAvailable () >= iqSize * 1024) {
uint8_t myBuffer [iqSize * 1024];
_I_Buffer -> getDataFromBuffer (myBuffer, iqSize * 1024);
//
// Having read 1024 * iqSize bytes, we can make them into complex samples
// and start converting the rate
for (i = 0; i < 1024; i ++) {
convBuffer [convIndex ++] =
// theFilter -> Pass (
// makeSample_30bits (&myBuffer [iqSize * i],
// iqSwitch));
makeSample_30bits (&myBuffer [iqSize * i],
iqSwitch);
if (convIndex > convBufferSize) {
std::complex<float> temp [2048];
int16_t j;
for (j = 0; j < 2048; j ++) {
int16_t inpBase = mapTable_int [j];
float inpRatio = mapTable_float [j];
temp [j] = cmul (convBuffer [inpBase + 1], inpRatio) +
cmul (convBuffer [inpBase], 1 - inpRatio);
}
theBuffer -> putDataIntoBuffer (temp, 2048);
// shift the sample at the end to the beginning, it is needed
// as the starting sample for the next time
convBuffer [0] = convBuffer [convBufferSize];
convIndex = 1;
}
}
}
}
fprintf (stderr, "eladWorker now stopped\n");
}
void eladWorker::setVFOFrequency (int32_t f) {
int result;
int realFreq;
if (!runnable)
return;
realFreq = f % Khz (3072);
iqSwitch = ((f / Khz (3072)) & 01) == 01;
lastFrequency = f;
result = functions -> SetHWLO (functions -> getHandle (),
&lastFrequency);
if (result == 1)
fprintf (stderr, "setting frequency to %d succeeded\n",
realFreq);
else
fprintf (stderr, "setting frequency to %d failed\n",
realFreq);
show_eladFrequency (realFreq);
show_iqSwitch (iqSwitch);
}
int32_t eladWorker::getVFOFrequency (void) {
return lastFrequency;
}

View File

@@ -0,0 +1,76 @@
#
/*
* Copyright (C) 2014 .. 2017
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of the Qt-DAB
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __ELAD_WORKER__
#define __ELAD_WORKER__
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <unistd.h>
#include <stdint.h>
#include <QThread>
#include "dab-constants.h"
#include "elad-filter.h"
#include "ringbuffer.h"
class eladLoader;
class eladHandler;
class eladWorker: public QThread {
Q_OBJECT
public:
eladWorker (int32_t, // initial freq
eladLoader *,
eladHandler *,
RingBuffer<std::complex<float>> *,
bool *);
~eladWorker (void);
void setVFOFrequency (int32_t);
int32_t getVFOFrequency (void);
void stop (void);
private:
void run (void);
eladLoader *functions; //
RingBuffer<uint8_t> *_I_Buffer;
RingBuffer<std::complex<float>> *theBuffer;
int32_t defaultFreq;
long int lastFrequency;
bool runnable;
int32_t theRate;
int mapTable_int [2048];
float mapTable_float [2048];
int conversionNumber;
// we convert to complexes directly
int iqSize;
int convBufferSize;
int convIndex;
std::complex<float> *convBuffer;
bool iqSwitch;
eladFilter *theFilter;
signals:
void show_eladFrequency (int);
void show_iqSwitch (bool);
};
#endif

View File

@@ -0,0 +1,207 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Form</class>
<widget class="QWidget" name="Form">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>239</width>
<height>320</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QFrame" name="frame">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>211</width>
<height>311</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<widget class="QLCDNumber" name="rateDisplay">
<property name="geometry">
<rect>
<x>0</x>
<y>90</y>
<width>121</width>
<height>31</height>
</rect>
</property>
<property name="lineWidth">
<number>2</number>
</property>
<property name="digitCount">
<number>7</number>
</property>
<property name="segmentStyle">
<enum>QLCDNumber::Flat</enum>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>10</x>
<y>160</y>
<width>101</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>elad-s1</string>
</property>
</widget>
<widget class="QSpinBox" name="hzOffset">
<property name="geometry">
<rect>
<x>0</x>
<y>120</y>
<width>121</width>
<height>31</height>
</rect>
</property>
<property name="maximum">
<number>999</number>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>120</x>
<y>130</y>
<width>31</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Hz</string>
</property>
</widget>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>91</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>gain reduction</string>
</property>
</widget>
<widget class="QLabel" name="statusLabel">
<property name="geometry">
<rect>
<x>50</x>
<y>200</y>
<width>121</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="gainReduction">
<property name="geometry">
<rect>
<x>100</x>
<y>10</y>
<width>41</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="gainLabel">
<property name="geometry">
<rect>
<x>20</x>
<y>10</y>
<width>71</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="filter">
<property name="geometry">
<rect>
<x>96</x>
<y>50</y>
<width>51</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>filter</string>
</property>
</widget>
<widget class="QLabel" name="filterText">
<property name="geometry">
<rect>
<x>10</x>
<y>50</y>
<width>91</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>no filter</string>
</property>
</widget>
<widget class="QLCDNumber" name="eladFrequency">
<property name="geometry">
<rect>
<x>10</x>
<y>190</y>
<width>161</width>
<height>23</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>10</x>
<y>220</y>
<width>161</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>elad frequency</string>
</property>
</widget>
<widget class="QLabel" name="elad_iqSwitch">
<property name="geometry">
<rect>
<x>82</x>
<y>250</y>
<width>91</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,174 @@
#
/*
* Copyright (C) 2013 .. 2017
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of the Qt-DAB program
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//
// For the different formats for input, we have
// different readers, with one "mother" reader.
// Note that the cardreader is quite different
// and coded elsewhere
//
#include "common-readers.h"
//
// The reader for 16 bit int values
//
reader_16::reader_16 (RingBuffer<std::complex<float>> *p,
int32_t base_16,
int32_t rate):virtualReader (p, rate) {
this -> base = base_16;
}
reader_16::~reader_16 (void) {
}
//
// apparently bytes are read in from low byte to high byte
void reader_16::processData (float IQoffs, void *data, int cnt) {
int32_t i;
std::complex<float> IQData [blockSize];
uint8_t *p = (uint8_t *)data;
(void)IQoffs;
(void)cnt;
for (i = 0; i < blockSize; i ++) {
uint8_t r0 = p [4 * i];
uint8_t r1 = p [4 * i + 1];
uint8_t i0 = p [4 * i + 2];
uint8_t i1 = p [4 * i + 3];
int16_t re = (r1 << 8) | r0;
int16_t im = (i1 << 8) | i0;
IQData [i] = std::complex<float> ((float)re / base,
(float)im / base);
}
convertandStore (IQData, blockSize);
}
int16_t reader_16::bitDepth (void) {
return 16;
}
//
// The reader for 24 bit integer values
//
reader_24::reader_24 (RingBuffer<std::complex<float>> *p,
int32_t base_24, int32_t rate):
virtualReader (p, rate) {
this -> base = base_24;
}
reader_24::~reader_24 (void) {
}
void reader_24::processData (float IQoffs, void *data, int cnt) {
int32_t i;
std::complex<float> IQData [blockSize];
uint8_t *p = (uint8_t *)data;
(void)IQoffs;
(void)cnt;
for (i = 0; i < blockSize; i ++) {
uint8_t r0 = p [6 * i];
uint8_t r1 = p [6 * i + 1];
uint8_t r2 = p [6 * i + 2];
uint8_t i0 = p [6 * i + 3];
uint8_t i1 = p [6 * i + 4];
uint8_t i2 = p [6 * i + 5];
int32_t re = int32_t (uint32_t (r2 << 16 | r1 << 8 | r0));
int32_t im = int32_t (uint32_t (i2 << 16 | i1 << 8 | i0));
IQData [i] = std::complex<float> ((float)re / base,
(float)im / base);
}
convertandStore (IQData, blockSize);
}
int16_t reader_24::bitDepth (void) {
return 24;
}
//
// The reader for 32 bit integer values
//
reader_32::reader_32 (RingBuffer<std::complex<float>> *p,
int32_t base_32, int32_t rate):
virtualReader (p, rate) {
this -> base = base_32;
}
reader_32::~reader_32 (void) {
}
void reader_32::processData (float IQoffs, void *data, int cnt) {
int32_t i;
std::complex<float> IQData [blockSize];
uint8_t *p = (uint8_t *)data;
(void)IQoffs;
(void)cnt;
for (i = 0; i < blockSize; i ++) {
uint8_t r0 = p [8 * i];
uint8_t r1 = p [8 * i + 1];
uint8_t r2 = p [8 * i + 2];
uint8_t r3 = p [8 * i + 3];
uint8_t i0 = p [8 * i + 4];
uint8_t i1 = p [8 * i + 5];
uint8_t i2 = p [8 * i + 6];
uint8_t i3 = p [8 * i + 7];
int32_t re = int32_t (uint32_t (r3 << 24 | r2 << 16 |
r1 << 8 | r0));
int32_t im = int32_t (uint32_t (i3 << 24 | i2 << 16 |
i1 << 8 | i0));
IQData [i] = std::complex<float> ((float)re / base,
(float)im / base);
}
convertandStore (IQData, blockSize);
}
int16_t reader_32::bitDepth (void) {
return 32;
}
//
// The reader for 32 bit float values
//
reader_float::reader_float (RingBuffer<std::complex<float>> *p,
int32_t rate):
virtualReader (p, rate) {
int16_t i;
}
reader_float::~reader_float (void) {
}
//
void reader_float::processData (float IQoffs, void *data, int cnt) {
int32_t i, j;
std::complex<float> IQData [blockSize];
float *p = (float *)data;
(void)IQoffs;
(void)cnt;
for (i = 0; i < blockSize; i ++)
IQData [i] = std::complex<float> (p [2 * i], p [2 * i + 1]);
convertandStore (IQData, blockSize);
}
int16_t reader_float::bitDepth (void) {
return 24;
}

View File

@@ -0,0 +1,53 @@
#
//
// For the different formats for input, we have
// different readers, with one "mother" reader.
// Note that the cardreader is quite different here
// and its code is elsewhere
#ifndef __COMMON_READERS
#define __COMMON_READERS
#include "virtual-reader.h"
class reader_16: public virtualReader {
public:
reader_16 (RingBuffer<std::complex<float>> *p, int32_t, int32_t);
~reader_16 (void);
void processData (float IQoffs, void *data, int cnt);
int16_t bitDepth (void);
};
class reader_24: public virtualReader {
public:
reader_24 (RingBuffer<std::complex<float>> *p, int32_t, int32_t);
~reader_24 (void);
void processData (float IQoffs, void *data, int cnt);
int16_t bitDepth (void);
};
class reader_32: public virtualReader {
public:
reader_32 (RingBuffer<std::complex<float>> *p, int32_t, int32_t);
~reader_32 (void);
void processData (float IQoffs, void *data, int cnt);
int16_t bitDepth (void);
};
//
// This is the only one we actually need for
// elad s2 as input device for DAB
class reader_float: public virtualReader {
public:
reader_float (RingBuffer<std::complex<float>> *p, int32_t);
~reader_float (void);
void processData (float IQoffs, void *data, int cnt);
int16_t bitDepth (void);
private:
int16_t mapTable_int [2048];
float mapTable_float [2048];
std::complex<float> convBuffer [3072 + 1];
int16_t convIndex;
};
#endif

View File

@@ -0,0 +1,387 @@
#
/*
* Copyright (C) 2013 .. 2017
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of the Qt-DAB program
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#
#include <QFileDialog>
#include <QSettings>
#include <QMessageBox>
#include "extio-handler.h"
#include "virtual-reader.h"
#include "common-readers.h"
#ifndef __MINGW32__
#include "dlfcn.h"
#endif
using namespace std;
#ifdef __MINGW32__
#define GETPROCADDRESS GetProcAddress
#define FREELIBRARY FreeLibrary
#else
#define GETPROCADDRESS dlsym
#define FREELIBRARY dlclose
#endif
//
// Simple interface routine to extio's
// The callback from the Extio*.dll does not contain a "context",
// so we have to create one artificially in order to access
// our functions
// Our context here is the instance of the class, stored in
// a static variable
static
extioHandler *myContext = NULL;
static
int extioCallback (int cnt, int status, float IQoffs, void *IQData) {
if (cnt > 0) { // we got data
if (myContext != NULL && myContext -> isStarted)
myContext -> theReader -> processData (IQoffs, IQData, cnt);
}
else // we got something
if (cnt < 0) {
fprintf (stderr, "got a status cmd %d\n", status);
switch (status) {
// for the SDR14
case extHw_Disconnected:
case extHw_READY:
case extHw_RUNNING:
case extHw_ERROR:
case extHw_OVERLOAD:
break;
case extHw_Changed_SampleRate: // 100 ignore
break;
case extHw_Changed_LO: // 101
break;
case extHw_Lock_LO: // 102
break;
case extHw_Unlock_LO: // 103
break;
case extHw_Changed_LO_Not_TUNE: // 104
break;
case extHw_Changed_TUNE: // 105
break;
case extHw_Changed_MODE: // 106
break;
case extHw_Start: // 107
break;
case extHw_Stop: // 108
break;
case extHw_Changed_FILTER: // 109
break;
default:
break;
}
}
return 1;
}
//
// the seemingly additional complexity is caused by the fact
// that naming of files in windows is in MultiBytechars
//
// We assume that if there are settings possible, they
// are dealt with by the producer of the extio, so here
// no frame whatsoever.
extioHandler::extioHandler (QSettings *s) {
#ifdef __MINGW32__
char temp [256];
wchar_t *windowsName;
int16_t wchars_num;
#endif
int32_t inputRate = 0;
inputRate = 2048000; // default
lastFrequency = Khz (25000);
base_16 = s -> value ("base_16", 128). toInt ();
base_24 = s -> value ("base_24", 32767 * 256). toInt ();
base_32 = s -> value ("base_32", 32767 * 32768). toInt ();
isStarted = false;
theReader = NULL;
dll_open = false;
QString dll_file = "foute boel";
dll_file = QFileDialog::
getOpenFileName (NULL,
tr ("load file .."),
QDir::currentPath (),
#ifdef __MINGW32__
tr ("libs (Extio*.dll)"));
#else
tr ("libs (*.so)"));
#endif
dll_file = QDir::toNativeSeparators (dll_file);
if (dll_file == QString ("")) {
QMessageBox::warning (NULL, tr ("sdr"),
tr ("incorrect filename\n"));
throw (20);
}
#ifdef __MINGW32__
wchars_num = MultiByteToWideChar (CP_UTF8, 0,
dll_file. toLatin1 (). data (),
-1, NULL, 0);
windowsName = new wchar_t [wchars_num];
MultiByteToWideChar (CP_UTF8, 0,
dll_file. toLatin1 (). data (),
-1, windowsName, wchars_num);
wcstombs (temp, windowsName, 128);
Handle = LoadLibrary (windowsName);
fprintf (stderr, "Last error = %ld\n", GetLastError ());
#else
Handle = dlopen (dll_file. toLatin1 (). data (), RTLD_NOW);
#endif
if (Handle == NULL) {
QMessageBox::warning (NULL, tr ("sdr"),
tr ("loading dll failed\n"));
throw (21);
}
if (!loadFunctions ()) {
QMessageBox::warning (NULL, tr ("sdr"),
tr ("loading functions failed\n"));
FREELIBRARY (Handle);
throw (22);
}
// apparently, the library is open, so record that
dll_open = true;
myContext = (extioHandler *)this;
//
// and start the rig
rigName = new char [128];
rigModel = new char [128];
if (!((*InitHW) (rigName, rigModel, hardwareType))) {
QMessageBox::warning (NULL, tr ("sdr"),
tr ("init failed\n"));
FREELIBRARY (Handle);
throw (23);
}
SetCallback (extioCallback);
if (!(*OpenHW)()) {
QMessageBox::warning (NULL, tr ("sdr"),
tr ("Opening hardware failed\n"));
FREELIBRARY (Handle);
throw (24);
}
bool OK = false;
while (!OK) {
inputRate = GetHWSR ();
fprintf (stderr, "inputRate = %d\n", inputRate);
if (inputRate < Khz (2000) ||
(1000 * (inputRate / 1000) != inputRate))
QMessageBox::warning (NULL, tr ("sdr"),
tr ("please select an inputrate 2048000"));
else
OK = true;
}
theBuffer = new RingBuffer<std::complex<float>>(1024 * 1024);
fprintf (stderr, "hardware type = %d\n", hardwareType);
switch (hardwareType) {
case exthwNone:
case exthwSDRX:
case exthwHPSDR:
case exthwSDR14:
case exthwSCdata:
default:
QMessageBox::warning (NULL, tr ("sdr"),
tr ("device not supported\n"));
return;
case exthwUSBdata16:
theReader = new reader_16 (theBuffer, base_16, inputRate);
break;
case exthwUSBdata24:
theReader = new reader_24 (theBuffer, base_24, inputRate);
break;
case exthwUSBdata32:
theReader = new reader_32 (theBuffer, base_32, inputRate);
break;
case exthwUSBfloat32:
theReader = new reader_float (theBuffer, inputRate);
break;
}
ShowGUI ();
fprintf (stderr, "Hw open successful\n");
}
extioHandler::~extioHandler (void) {
if (dll_open) {
HideGUI ();
StopHW ();
CloseHW ();
}
if (Handle != NULL)
FREELIBRARY (Handle);
if (theReader != NULL)
delete theReader;
}
bool extioHandler::loadFunctions (void) {
// start binding addresses,
InitHW = (pfnInitHW)GETPROCADDRESS (Handle, "InitHW");
if (InitHW == NULL) {
fprintf (stderr, "Failed to load InitHW\n");
return false;
}
OpenHW = (pfnOpenHW)GETPROCADDRESS (Handle, "OpenHW");
if (OpenHW == NULL) {
fprintf (stderr, "Failed to load OpenHW\n");
return false;
}
StartHW = (pfnStartHW)GETPROCADDRESS (Handle, "StartHW");
if (StartHW == NULL) {
fprintf (stderr, "Failed to load StartHW\n");
return false;
}
StopHW = (pfnStopHW)GETPROCADDRESS (Handle, "StopHW");
if (StopHW == NULL) {
fprintf (stderr, "Failed to load StopHW\n");
return false;
}
CloseHW = (pfnCloseHW)GETPROCADDRESS (Handle, "CloseHW");
if (CloseHW == NULL) {
fprintf (stderr, "Failed to load CloseHW\n");
return false;
}
// GetHWLO = (pfnGetHWLO)GETPROCADDRESS (Handle, "GetHWLO");
// if (GetHWLO == NULL) {
// fprintf (stderr, "Failed to load GetHWLO\n");
// return false;
// }
SetHWLO = (pfnSetHWLO)GETPROCADDRESS (Handle, "SetHWLO");
if (SetHWLO == NULL) {
fprintf (stderr, "Failed to load SetHWLO\n");
return false;
}
GetStatus = (pfnGetStatus)GETPROCADDRESS (Handle, "GetStatus");
if (GetStatus == NULL) {
fprintf (stderr, "Failed to load GetStatus\n");
return false;
}
SetCallback = (pfnSetCallback)
GETPROCADDRESS (Handle, "SetCallback");
if (SetCallback == NULL) {
fprintf (stderr, "Failed to load SetCallback\n");
return false;
}
//
// the "non essentials", packed in envelope functions:
L_ShowGUI = (pfnShowGUI)GETPROCADDRESS (Handle, "ShowGUI");
L_HideGUI = (pfnHideGUI)GETPROCADDRESS (Handle, "HideGUI");
L_GetHWSR = (pfnGetHWSR)GETPROCADDRESS (Handle, "GetHWSR");
L_GetFilters = (pfnGetFilters)GETPROCADDRESS (Handle, "GetFilters");
L_GetTune = (pfnGetTune)GETPROCADDRESS (Handle, "GetTune");
L_GetMode = (pfnGetMode)GETPROCADDRESS (Handle, "GetMode");
L_GetHWLO = (pfnGetHWLO)GETPROCADDRESS (Handle, "GetHWLO");
//
return true;
}
int32_t extioHandler::getRate (void) {
return GetHWSR ();
}
void extioHandler::setVFOFrequency (int32_t f) {
fprintf (stderr, "setting freq to %d\n", f);
int h = (*SetHWLO) ((int)f);
lastFrequency = f;
}
int32_t extioHandler::getVFOFrequency (void) {
// lastFrequency = (*GetHWLO)();
return lastFrequency;
}
//
// envelopes for functions that might or might not
// be available
void extioHandler::ShowGUI (void) {
if (L_ShowGUI != NULL)
(*L_ShowGUI) ();
}
void extioHandler::HideGUI (void) {
if (L_HideGUI != NULL)
(*L_HideGUI) ();
}
long extioHandler::GetHWSR (void) {
return L_GetHWSR != NULL ? (*L_GetHWSR) () : 192000;
}
long extioHandler::GetHWLO (void) {
return L_GetHWLO != NULL ? (*L_GetHWLO)() : Mhz (200);
}
//
//
// Handling the data
bool extioHandler::restartReader (void) {
fprintf (stderr, "restart reader entered (%d)\n", lastFrequency);
int32_t size = (*StartHW)(lastFrequency);
fprintf (stderr, "restart reader returned with %d\n", size);
theReader -> restartReader (size);
fprintf (stderr, "now we have restarted the reader\n");
isStarted = true;
return true;
}
void extioHandler::stopReader (void) {
if (isStarted) {
(*StopHW)();
theReader -> stopReader ();
isStarted = false;
}
}
int32_t extioHandler::Samples (void) {
int32_t x = theBuffer -> GetRingBufferReadAvailable ();
if (x < 0)
fprintf (stderr, "toch een fout in ringbuffer\n");
return x;
}
int32_t extioHandler::getSamples (std::complex<float> *buffer,
int32_t number) {
return theBuffer -> getDataFromBuffer (buffer, number);
}
int16_t extioHandler::bitDepth (void) {
return theReader -> bitDepth ();
}
int32_t extioHandler::defaultFrequency (void) {
return Khz (220000);
}

View File

@@ -0,0 +1,231 @@
#
/*
* Copyright (C) 2013 .. 2017
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of the Qt-DAB program
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __EXTIO_HANDLER__
#define __EXTIO_HANDLER__
#
#include <QWidget>
#include <QComboBox>
#include <QString>
#include <virtual-input.h>
#include "ringbuffer.h"
class QSettings;
class virtualReader;
// create type defs for the functions
#ifdef __MINGW32__
#define STDCALL __stdcall
#else
#define STDCALL
#endif
typedef int (*pfnExtIOCallback) (int cnt, int status, float IQoffs, void *IQdata);
typedef bool (STDCALL *pfnInitHW)(char *, char *, int& ); //
typedef bool (STDCALL *pfnOpenHW)(void);
typedef void (STDCALL *pfnCloseHW)(void);
typedef int (STDCALL *pfnStartHW)(long);
typedef void (STDCALL *pfnStopHW)(void);
typedef int (STDCALL *pfnSetHWLO)(long);
typedef void (STDCALL *pfnSetCallback)(pfnExtIOCallback funcptr);
typedef int (STDCALL *pfnGetStatus)(void);
//
typedef long (STDCALL *pfnGetHWLO)(void);
typedef long (STDCALL *pfnGetHWSR)(void);
typedef void (STDCALL *pfnRawDataReady)(long, void *, void *, int);
typedef void (STDCALL *pfnShowGUI)(void);
typedef void (STDCALL *pfnHideGUI)(void);
typedef long (STDCALL *pfnGetTune)(void);
typedef uint8_t (STDCALL *pfnGetMode)(void);
typedef void (STDCALL *pfnModeChanged)(char);
typedef void (STDCALL *pfnTuneChanged)(long freq);
typedef void (STDCALL *pfnIfLimitsChanged)(long low, long high);
typedef void (STDCALL *pfnFiltersChanged)(int, int, int, bool);
typedef void (STDCALL *pfnMuteChanged)(bool);
typedef void (STDCALL *pfnGetFilters)(int&, int&, int&);
// hwtype codes to be set with pfnInitHW
// Please ask Alberto di Bene (i2phd@weaksignals.com)
// for the assignment of an index code
// for cases different from the above.
// note: "exthwUSBdataNN" don't need to be from USB.
// The keyword "USB" is just for historical reasons,
// which may get removed later ..
typedef enum {
exthwNone = 0
, exthwSDR14 = 1
, exthwSDRX = 2
, exthwUSBdata16 = 3 // the hardware does its own digitization and the audio data are returned to Winrad
// via the callback device. Data must be in 16-bit (short) format, little endian.
, exthwSCdata = 4 // The audio data are returned via the (S)ound (C)ard managed by Winrad. The external
// hardware just controls the LO, and possibly a preselector, under DLL control.
, exthwUSBdata24 = 5 // the hardware does its own digitization and the audio data are returned to Winrad
// via the callback device. Data are in 24-bit integer format, little endian.
, exthwUSBdata32 = 6 // the hardware does its own digitization and the audio data are returned to Winrad
// via the callback device. Data are in 32-bit integer format, little endian.
, exthwUSBfloat32 = 7 // the hardware does its own digitization and the audio data are returned to Winrad
// via the callback device. Data are in 32-bit float format, little endian.
, exthwHPSDR = 8 // for HPSDR only!
} extHWtypeT;
// status codes for pfnExtIOCallback; used when cnt < 0
typedef enum {
// only processed/understood for SDR14
extHw_Disconnected = 0 // SDR-14/IQ not connected or powered off
, extHw_READY = 1 // IDLE / Ready
, extHw_RUNNING = 2 // RUNNING => not disconnected
, extHw_ERROR = 3 // ??
, extHw_OVERLOAD = 4 // OVERLOAD => not disconnected
// for all extIO's
, extHw_Changed_SampleRate = 100 // sampling speed has changed in the external HW
, extHw_Changed_LO = 101 // LO frequency has changed in the external HW
, extHw_Lock_LO = 102
, extHw_Unlock_LO = 103
, extHw_Changed_LO_Not_TUNE = 104 // CURRENTLY NOT YET IMPLEMENTED
// LO freq. has changed, Winrad must keep the Tune freq. unchanged
// (must immediately call GetHWLO() )
, extHw_Changed_TUNE = 105 // a change of the Tune freq. is being requested.
// Winrad must call GetTune() to know which value is wanted
, extHw_Changed_MODE = 106 // a change of demod. mode is being requested.
// Winrad must call GetMode() to know the new mode
, extHw_Start = 107 // The DLL wants Winrad to Start
, extHw_Stop = 108 // The DLL wants Winrad to Stop
, extHw_Changed_FILTER = 109 // a change in the band limits is being requested
// Winrad must call GetFilters()
// Above status codes are processed with Winrad 1.32.
// All Winrad derivation like WRplus, WinradF, WinradHD and
// HDSDR should understand them,
// but these do not provide version info with
// VersionInfo(progname, ver_major, ver_minor).
, extHw_Mercury_DAC_ON = 110 // enable audio output on the Mercury DAC when using the HPSDR
, extHw_Mercury_DAC_OFF = 111 // disable audio output on the Mercury DAC when using the HPSDR
, extHw_PC_Audio_ON = 112 // enable audio output on the PC sound card when using the HPSDR
, extHw_PC_Audio_OFF = 113 // disable audio output on the PC sound card when using the HPSDR
, extHw_Audio_MUTE_ON = 114 // the DLL is asking Winrad to mute the audio output
, extHw_Audio_MUTE_OFF = 115 // the DLL is asking Winrad to unmute the audio output
// Above status codes are processed with Winrad 1.33 and HDSDR
// Winrad 1.33 and HDSDR still do not provide their
// version with VersionInfo()
// Following status codes are processed when VersionInfo delivers
// 0 == strcmp(progname, "HDSDR") &&
// ( ver_major > 2 || ( ver_major == 2 && ver_minor >= 13 ) )
//
// all extHw_XX_SwapIQ_YYY callbacks shall be
// reported after each OpenHW() call
, extHw_RX_SwapIQ_ON = 116 // additionaly swap IQ - this does not modify the menu point / user selection
, extHw_RX_SwapIQ_OFF = 117 // the user selected swapIQ is additionally applied
, extHw_TX_SwapIQ_ON = 118 // additionaly swap IQ - this does not modify the menu point / user selection
, extHw_TX_SwapIQ_OFF = 119 // the user selected swapIQ is additionally applied
// Following status codes (for I/Q transceivers)
// are processed when VersionInfo delivers
// 0 == strcmp(progname, "HDSDR") &&
// ( ver_major > 2 || ( ver_major == 2 && ver_minor >= 13 ) )
, extHw_TX_Request = 120 // DLL requests TX mode / User pressed PTT
// exciter/transmitter must wait until SetModeRxTx() is called!
, extHw_RX_Request = 121 // DLL wants to leave TX mode / User released PTT
// exciter/transmitter must wait until SetModeRxTx() is called!
, extHw_CW_Pressed = 122 // User pressed CW key
, extHw_CW_Released = 123 // User released CW key
, extHw_PTT_as_CWkey = 124 // handle extHw_TX_Request as extHw_CW_Pressed in CW mode
// and extHw_RX_Request as extHw_CW_Released
, extHw_Changed_ATT = 125 // Attenuator changed => call GetActualAttIdx()
// Following status codes are processed when VersionInfo delivers
// 0 == strcmp(progname, "HDSDR") &&
// ( ver_major > 2 || ( ver_major == 2 && ver_minor >= 14 ) )
, extHw_Changed_ATTENS = 136 // refresh selectable attenuators => starts calling GetAttenuators()
} extHWstatusT;
// codes for pfnSetModeRxTx:
typedef enum {
extHw_modeRX = 0
, extHw_modeTX = 1
} extHw_ModeRxTxT;
class extioHandler:public virtualInput {
Q_OBJECT
public:
extioHandler (QSettings *);
~extioHandler (void);
int32_t getRate (void);
void setVFOFrequency (int32_t);
int32_t getVFOFrequency (void);
int32_t defaultFrequency (void);
bool restartReader (void);
void stopReader (void);
int32_t Samples (void);
int32_t getSamples (std::complex<float> *,
int32_t);
int16_t bitDepth (void);
long GetHWLO (void); // should be available
long GetHWSR (void); // may be a noop
//
// The call back need access to
virtualReader *theReader;
bool isStarted;
private:
int32_t base_16;
int32_t base_24;
int32_t base_32;
int32_t inputRate;
bool loadFunctions (void);
RingBuffer<std::complex<float>> *theBuffer;
// functions to be extracted from the dll
pfnInitHW InitHW; // should be available
pfnOpenHW OpenHW; // should be available
pfnSetHWLO SetHWLO; // should be available
pfnStartHW StartHW; // should be available
pfnStopHW StopHW; // should be available
pfnCloseHW CloseHW; // should be available
pfnGetStatus GetStatus; // should be available
pfnSetCallback SetCallback; // should be available
//
// optionals
pfnShowGUI L_ShowGUI;
pfnHideGUI L_HideGUI;
pfnGetHWSR L_GetHWSR;
pfnGetFilters L_GetFilters;
pfnGetTune L_GetTune;
pfnGetMode L_GetMode;
pfnGetHWLO L_GetHWLO; // should be available
void ShowGUI (void);
void HideGUI (void);
// filename of dll
QString dll_filename;
HINSTANCE Handle;
bool dll_open;
char *rigName;
char *rigModel;
int hardwareType;
signals:
// The following signals originate from the Winrad Extio interface
};
#endif

View File

@@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>extioWidget</class>
<widget class="QWidget" name="extioWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>148</width>
<height>170</height>
</rect>
</property>
<property name="windowTitle">
<string>extIO control</string>
</property>
<widget class="QFrame" name="frame">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>151</width>
<height>231</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>20</x>
<y>100</y>
<width>121</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>extIO handler</string>
</property>
</widget>
<widget class="QLabel" name="nameofdll">
<property name="geometry">
<rect>
<x>10</x>
<y>80</y>
<width>131</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="status">
<property name="geometry">
<rect>
<x>10</x>
<y>40</y>
<width>121</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
<widget class="QComboBox" name="theSelector">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>111</width>
<height>29</height>
</rect>
</property>
</widget>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,186 @@
#
/*
* Copyright (C) 2013 .. 2017
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Programming
*
* This file is part of the Qt-DAB program
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//
// For the different formats for input, we have
// different readers, with one "mother" reader.
// Note that the cardreader is quite different here
#ifndef __READER
#define __READER
#include <stdint.h>
#include <stdio.h>
#include "ringbuffer.h"
#include "dab-constants.h"
class reader {
protected:
RingBuffer<std::complex<float>> *theBuffer;
int32_t blockSize;
public:
reader (RingBuffer<std::complex<float>> *p) {
theBuffer = p;
blockSize = -1;
}
virtual ~reader (void) {
}
virtual void restartReader (int32_t s) {
blockSize = s;
}
virtual void stopReader (void) {
}
virtual void processData (float IQoffs, void *data, int cnt) {
(void)IQoffs;
(void)data;
(void)cnt;
}
virtual int16_t bitDepth (void) {
return 12;
}
};
class reader_16: public reader {
public:
reader_16 (RingBuffer<std::complex<float>> *p):reader (p) {
}
~reader_16 (void) {
}
void processData (float IQoffs, void *data, int cnt) {
int32_t i;
std::complex<float> temp [blockSize];
uint8_t *p = (uint8_t *)data;
(void)IQoffs;
for (i = 0; i < blockSize; i ++) {
uint8_t r0 = p [4 * i];
uint8_t r1 = p [4 * i + 1];
uint8_t i0 = p [4 * i + 2];
uint8_t i1 = p [4 * i + 3];
float re = (r0 << 8 | r1) / 32767.0;
float im = (i0 << 8 | i1) / 32767.0;
temp [i] = std::complex<float> (re, im);
}
theBuffer -> putDataIntoBuffer (temp, blockSize);
}
int16_t bitDepth (void) {
return 16;
}
};
class reader_24: public reader {
public:
reader_24 (RingBuffer<std::complex<float>> *p):reader (p) {
}
~reader_24 (void) {
}
void processData (float IQoffs, void *data, int cnt) {
int32_t i;
std::complex<float> temp [blockSize];
uint8_t *p = (uint8_t *)data;
(void)IQoffs;
for (i = 0; i < 6 * blockSize; i ++) {
uint8_t r0 = p [6 * i];
uint8_t r1 = p [6 * i + 1];
uint8_t r2 = p [6 * i + 2];
uint8_t i0 = p [6 * i + 3];
uint8_t i1 = p [6 * i + 4];
uint8_t i2 = p [6 * i + 5];
float re = (r0 << 16 | r1 << 8 | r2) / (32768 * 256);
float im = (i0 << 16 | i1 << 8 | i2) / (32768 * 256);
temp [i] = std::complex<float> (re, im);
}
theBuffer -> putDataIntoBuffer (temp, blockSize);
}
int16_t bitDepth (void) {
return 24;
}
};
class reader_32: public reader {
public:
reader_32 (RingBuffer<std::complex<float>> *p):reader (p) {
}
~reader_32 (void) {
}
void processData (float IQoffs, void *data, int cnt) {
int32_t i;
std::complex<float> temp [blockSize];
uint8_t *p = (uint8_t *)data;
(void)IQoffs;
for (i = 0; i < 8 * blockSize; i ++) {
uint8_t r0 = p [8 * i];
uint8_t r1 = p [8 * i + 1];
uint8_t r2 = p [8 * i + 2];
uint8_t r3 = p [8 * i + 3];
uint8_t i0 = p [8 * i + 4];
uint8_t i1 = p [8 * i + 5];
uint8_t i2 = p [8 * i + 6];
uint8_t i3 = p [8 * i + 7];
float re = (r0 << 24 | r1 << 16 | r2 << 8 | r3) / (32767 * 65536);
float im = (i0 << 24 | i1 << 16 | i2 << 8 | i3) / (32767 * 65336);
temp [i] = std::complex<float> (re, im);
}
theBuffer -> putDataIntoBuffer (temp, blockSize);
}
int16_t bitDepth (void) {
return 32;
}
};
class reader_float: public reader {
public:
reader_float (RingBuffer<std::complex<float>> *p):reader (p) {
}
~reader_float (void) {
}
void processData (float IQoffs, void *data, int cnt) {
int32_t i;
std::complex<float> temp [blockSize];
float *p = (float *)data;
(void)IQoffs;
for (i = 0; i < 2 * blockSize; i ++)
temp [i] = std::complex<float> (p [2 * i], p [2 * i + 1]);
theBuffer -> putDataIntoBuffer (temp, blockSize);
}
int16_t bitDepth (void) {
return 32;
}
};
#endif

View File

@@ -0,0 +1,93 @@
#
/*
* Copyright (C) 2013 .. 2017
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of the Qt-DAB program
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//
// For the different formats for input, we have
// different readers, with one "mother" reader.
// Note that the cardreader is quite different here
//
// This is the - almost empty - default implementation
#include "virtual-reader.h"
virtualReader::virtualReader (RingBuffer<std::complex<float>> *p,
int32_t rate) {
theBuffer = p;
blockSize = -1;
setMapper (rate, 2048000);
}
virtualReader::~virtualReader (void) {
}
void virtualReader::restartReader (int32_t s) {
fprintf (stderr, "Restart met block %d\n", s);
blockSize = s;
}
void virtualReader::stopReader (void) {
}
void virtualReader::processData (float IQoffs, void *data, int cnt) {
(void)IQoffs;
(void)data;
(void)cnt;
}
int16_t virtualReader::bitDepth (void) {
return 12;
}
void virtualReader::setMapper (int32_t inRate, int32_t outRate) {
int32_t i;
this -> inSize = inRate / 1000;
this -> outSize = outRate / 1000;
inTable = new std::complex<float> [inSize];
outTable = new std::complex<float> [outSize];
mapTable = new float [outSize];
for (i = 0; i < outSize; i ++)
mapTable [i] = (float) i * inRate / outRate;
conv = 0;
}
void virtualReader::convertandStore (std::complex<float> *s,
int32_t amount) {
int32_t i, j;
for (i = 0; i < amount; i ++) {
inTable [conv++] = s [i];
if (conv >= inSize) { // full buffer, map
for (j = 0; j < outSize - 1; j ++) {
int16_t base = (int)(floor (mapTable [j]));
float frac = mapTable [j] - base;
outTable [j] = cmul (inTable [base], 1 - frac) +
cmul (inTable [base + 1], frac);
}
//
// let op, het laatste element was nog niet gebruikta
conv = 1;
inTable [0] = inTable [inSize - 1];
theBuffer -> putDataIntoBuffer (outTable, outSize - 1);
}
}
}

View File

@@ -0,0 +1,64 @@
#
/*
* Copyright (C) 2013 .. 2017
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Programming
*
* This file is part of the Qt-DAB program
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//
// For the different formats for input, we have
// different readers, with one "mother" reader.
// Note that the cardreader is quite different here
#ifndef __VIRTUAL_READER__
#define __VIRTUAL_READER__
#include <stdint.h>
#include <stdio.h>
#include "ringbuffer.h"
#include "dab-constants.h"
//
// The virtualReader is the mother of the readers.
// The cardReader is slighty different, however
// made fitting the framework
class virtualReader {
protected:
RingBuffer<std::complex<float>> *theBuffer;
int32_t blockSize;
public:
virtualReader (RingBuffer<std::complex<float>> *p,
int32_t rate);
virtual ~virtualReader (void);
virtual void restartReader (int32_t s);
virtual void stopReader (void);
virtual void processData (float IQoffs, void *data, int cnt);
virtual int16_t bitDepth (void);
protected:
int32_t base;
void convertandStore (std::complex<float> *, int32_t);
private:
void setMapper (int32_t, int32_t);
float *mapTable;
int16_t conv;
int16_t inSize;
int16_t outSize;
std::complex<float> *inTable;
std::complex<float> *outTable;
};
#endif

View File

@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>filereaderWidget</class>
<widget class="QWidget" name="filereaderWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>589</width>
<height>124</height>
</rect>
</property>
<property name="windowTitle">
<string>Qt-DAB File Reader</string>
</property>
<widget class="QFrame" name="frame">
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>571</width>
<height>91</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>181</width>
<height>21</height>
</rect>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Path to file&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Playing pre-recorded file:</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
<widget class="QLabel" name="nameofFile">
<property name="geometry">
<rect>
<x>10</x>
<y>50</y>
<width>551</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string/>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,171 @@
#
/*
* Copyright (C) 2013 .. 2017
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of the Qt-DAB program
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* File reader:
* For the (former) files with 8 bit raw data from the
* dabsticks
*/
#include "rawfiles.h"
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
//
#include <sys/time.h>
#include <time.h>
static inline
int64_t getMyTime (void) {
struct timeval tv;
gettimeofday (&tv, NULL);
return ((int64_t)tv. tv_sec * 1000000 + (int64_t)tv. tv_usec);
}
#define INPUT_FRAMEBUFFERSIZE 8 * 32768
//
//
rawFiles::rawFiles (QString f) {
fileName = f;
myFrame = new QFrame;
setupUi (myFrame);
myFrame -> show ();
_I_Buffer = new RingBuffer<uint8_t>(INPUT_FRAMEBUFFERSIZE);
readerOK = false;
filePointer = fopen (f. toUtf8 (). data (), "rb");
if (filePointer == NULL) {
fprintf (stderr, "file %s cannot open\n",
f. toUtf8 (). data ());
perror ("file ?");
delete myFrame;
delete _I_Buffer;
throw (31);
}
nameofFile -> setText (f);
readerOK = true;
readerPausing = true;
currPos = 0;
start ();
}
rawFiles::~rawFiles (void) {
ExitCondition = true;
if (readerOK) {
while (isRunning ())
usleep (100);
fclose (filePointer);
}
delete _I_Buffer;
delete myFrame;
}
bool rawFiles::restartReader (void) {
if (readerOK)
readerPausing = false;
return readerOK;
}
void rawFiles::stopReader (void) {
if (readerOK)
readerPausing = true;
}
// size is in I/Q pairs, file contains 8 bits values
int32_t rawFiles::getSamples (std::complex<float> *V, int32_t size) {
int32_t amount, i;
uint8_t *temp = (uint8_t *)alloca (2 * size * sizeof (uint8_t));
if (filePointer == NULL)
return 0;
while ((int32_t)(_I_Buffer -> GetRingBufferReadAvailable ()) < 2 * size)
if (readerPausing)
usleep (100000);
else
msleep (100);
amount = _I_Buffer -> getDataFromBuffer (temp, 2 * size);
for (i = 0; i < amount / 2; i ++)
V [i] = std::complex<float> (float (temp [2 * i] - 128) / 128.0,
float (temp [2 * i + 1] - 128) / 128.0);
return amount / 2;
}
int32_t rawFiles::Samples (void) {
return _I_Buffer -> GetRingBufferReadAvailable () / 2;
}
void rawFiles::run (void) {
int32_t t, i;
uint8_t *bi;
int32_t bufferSize = 32768;
int64_t period;
int64_t nextStop;
if (!readerOK)
return;
ExitCondition = false;
period = (32768 * 1000) / (2 * 2048); // full IQś read
fprintf (stderr, "Period = %ld\n", period);
bi = new uint8_t [bufferSize];
nextStop = getMyTime ();
while (!ExitCondition) {
if (readerPausing) {
usleep (1000);
nextStop = getMyTime ();
continue;
}
while (_I_Buffer -> WriteSpace () < bufferSize + 10) {
if (ExitCondition)
break;
usleep (100);
}
nextStop += period;
t = readBuffer (bi, bufferSize);
if (t <= 0) {
for (i = 0; i < bufferSize; i ++)
bi [i] = 0;
t = bufferSize;
}
_I_Buffer -> putDataIntoBuffer (bi, t);
if (nextStop - getMyTime () > 0)
usleep (nextStop - getMyTime ());
}
fprintf (stderr, "taak voor replay eindigt hier\n");
}
/*
* length is number of uints that we read.
*/
int32_t rawFiles::readBuffer (uint8_t *data, int32_t length) {
int32_t n;
n = fread (data, sizeof (uint8_t), length, filePointer);
currPos += n;
if (n < length) {
fseek (filePointer, 0, SEEK_SET);
fprintf (stderr, "End of file, restarting\n");
}
return n & ~01;
}

View File

@@ -0,0 +1,66 @@
#
/*
* Copyright (C) 2013 .. 2017
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of the Qt-DAB program
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __RAW_FILES__
#define __RAW_FILES__
#include <QThread>
#include <QString>
#include <QFrame>
#include "dab-constants.h"
#include "virtual-input.h"
#include "ringbuffer.h"
#include "ui_filereader-widget.h"
class QLabel;
class QSettings;
class fileHulp;
/*
*/
class rawFiles: public virtualInput,
public Ui_filereaderWidget, QThread {
public:
rawFiles (QString);
~rawFiles (void);
int32_t getSamples (std::complex<float> *, int32_t);
uint8_t myIdentity (void);
int32_t Samples (void);
bool restartReader (void);
void stopReader (void);
private:
QString fileName;
virtual void run (void);
QFrame *myFrame;
int32_t readBuffer (uint8_t *, int32_t);
RingBuffer<uint8_t> *_I_Buffer;
int32_t bufferSize;
FILE *filePointer;
bool readerOK;
bool readerPausing;
bool ExitCondition;
bool ThreadFinished;
int64_t currPos;
};
#endif

View File

@@ -0,0 +1,178 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>rtl_tcp_widget</class>
<widget class="QWidget" name="rtl_tcp_widget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>168</width>
<height>237</height>
</rect>
</property>
<property name="windowTitle">
<string>rtl-tcp control</string>
</property>
<widget class="QFrame" name="frame">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>161</width>
<height>231</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>10</x>
<y>210</y>
<width>111</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>rtl_tcp_client</string>
</property>
</widget>
<widget class="QLabel" name="state">
<property name="geometry">
<rect>
<x>10</x>
<y>160</y>
<width>141</width>
<height>41</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="tcp_connect">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>111</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>connect</string>
</property>
</widget>
<widget class="QPushButton" name="tcp_disconnect">
<property name="geometry">
<rect>
<x>10</x>
<y>40</y>
<width>111</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>disconnect</string>
</property>
</widget>
<widget class="QLabel" name="connectedLabel">
<property name="geometry">
<rect>
<x>10</x>
<y>159</y>
<width>131</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QSpinBox" name="tcp_gain">
<property name="geometry">
<rect>
<x>10</x>
<y>70</y>
<width>71</width>
<height>21</height>
</rect>
</property>
<property name="maximum">
<number>999</number>
</property>
</widget>
<widget class="QSpinBox" name="tcp_ppm">
<property name="geometry">
<rect>
<x>10</x>
<y>100</y>
<width>71</width>
<height>21</height>
</rect>
</property>
<property name="minimum">
<number>-100</number>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>90</x>
<y>70</y>
<width>51</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string> gain</string>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>90</x>
<y>100</y>
<width>61</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>ppm</string>
</property>
</widget>
<widget class="QSpinBox" name="khzOffset">
<property name="geometry">
<rect>
<x>10</x>
<y>130</y>
<width>71</width>
<height>21</height>
</rect>
</property>
<property name="minimum">
<number>-100</number>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>90</x>
<y>130</y>
<width>51</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Offset</string>
</property>
</widget>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,287 @@
#
/*
* Copyright (C) 2013 .. 2017
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of the Qt-DAB program
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* A simple client for rtl_tcp
*/
#include <QSettings>
#include <QLabel>
#include <QMessageBox>
#include <QHostAddress>
#include <QTcpSocket>
#include <QFileDialog>
#include <QDir>
#include "rtl_tcp_client.h"
//
#define DEFAULT_FREQUENCY (Khz (220000))
rtl_tcp_client::rtl_tcp_client (QSettings *s) {
remoteSettings = s;
theFrame = new QFrame;
setupUi (theFrame);
this -> theFrame -> show ();
// setting the defaults and constants
theRate = 2048000;
remoteSettings -> beginGroup ("rtl_tcp_client");
theGain = remoteSettings ->
value ("rtl_tcp_client-gain", 20). toInt ();
thePpm = remoteSettings ->
value ("rtl_tcp_client-ppm", 0). toInt ();
vfoOffset = remoteSettings ->
value ("rtl_tcp_client-offset", 0). toInt ();
basePort = remoteSettings -> value ("rtl_tcp_port", 1234).toInt();
remoteSettings -> endGroup ();
tcp_gain -> setValue (theGain);
tcp_ppm -> setValue (thePpm);
vfoFrequency = DEFAULT_FREQUENCY;
theBuffer = new RingBuffer<uint8_t>(32 * 32768);
connected = false;
hostLineEdit = new QLineEdit (NULL);
dumping = false;
connect (tcp_connect, SIGNAL (clicked (void)),
this, SLOT (wantConnect (void)));
connect (tcp_disconnect, SIGNAL (clicked (void)),
this, SLOT (setDisconnect (void)));
connect (tcp_gain, SIGNAL (valueChanged (int)),
this, SLOT (sendGain (int)));
connect (tcp_ppm, SIGNAL (valueChanged (int)),
this, SLOT (set_fCorrection (int)));
connect (khzOffset, SIGNAL (valueChanged (int)),
this, SLOT (set_Offset (int)));
state -> setText ("waiting to start");
}
rtl_tcp_client::~rtl_tcp_client (void) {
remoteSettings -> beginGroup ("rtl_tcp_client");
if (connected) { // close previous connection
stopReader ();
// streamer. close ();
remoteSettings -> setValue ("remote-server",
toServer. peerAddress (). toString ());
QByteArray datagram;
}
remoteSettings -> setValue ("rtl_tcp_client-gain", theGain);
remoteSettings -> setValue ("rtl_tcp_client-ppm", thePpm);
remoteSettings -> setValue ("rtl_tcp_client-offset", vfoOffset);
remoteSettings -> endGroup ();
toServer. close ();
delete theBuffer;
delete hostLineEdit;
delete theFrame;
}
//
void rtl_tcp_client::wantConnect (void) {
QString ipAddress;
int16_t i;
QList<QHostAddress> ipAddressesList = QNetworkInterface::allAddresses();
if (connected)
return;
// use the first non-localhost IPv4 address
for (i = 0; i < ipAddressesList.size(); ++i) {
if (ipAddressesList.at (i) != QHostAddress::LocalHost &&
ipAddressesList. at (i). toIPv4Address ()) {
ipAddress = ipAddressesList. at(i). toString();
break;
}
}
// if we did not find one, use IPv4 localhost
if (ipAddress. isEmpty())
ipAddress = QHostAddress (QHostAddress::LocalHost).toString ();
remoteSettings -> beginGroup ("rtl_tcp_client");
ipAddress = remoteSettings ->
value ("remote-server", ipAddress). toString ();
remoteSettings -> endGroup ();
hostLineEdit -> setText (ipAddress);
hostLineEdit -> setInputMask ("000.000.000.000");
// Setting default IP address
hostLineEdit -> show ();
state -> setText ("Enter IP address, \nthen press return");
connect (hostLineEdit, SIGNAL (returnPressed (void)),
this, SLOT (setConnection (void)));
}
// if/when a return is pressed in the line edit,
// a signal appears and we are able to collect the
// inserted text. The format is the IP-V4 format.
// Using this text, we try to connect,
void rtl_tcp_client::setConnection (void) {
QString s = hostLineEdit -> text ();
QHostAddress theAddress = QHostAddress (s);
serverAddress = QHostAddress (s);
disconnect (hostLineEdit, SIGNAL (returnPressed (void)),
this, SLOT (setConnection (void)));
toServer. connectToHost (serverAddress, basePort);
if (!toServer. waitForConnected (2000)) {
QMessageBox::warning (theFrame, tr ("sdr"),
tr ("connection failed\n"));
return;
}
sendGain (theGain);
sendRate (theRate);
sendVFO (DEFAULT_FREQUENCY - theRate / 4);
toServer. waitForBytesWritten ();
state -> setText ("Connected");
connected = true;
}
int32_t rtl_tcp_client::getRate (void) {
return theRate;
}
int32_t rtl_tcp_client::defaultFrequency (void) {
return DEFAULT_FREQUENCY; // choose any legal frequency here
}
void rtl_tcp_client::setVFOFrequency (int32_t newFrequency) {
if (!connected)
return;
vfoFrequency = newFrequency;
// here the command to set the frequency
sendVFO (newFrequency);
}
int32_t rtl_tcp_client::getVFOFrequency (void) {
return vfoFrequency;
}
bool rtl_tcp_client::restartReader (void) {
if (connected)
return true;
connect (&toServer, SIGNAL (readyRead (void)),
this, SLOT (readData (void)));
return true;
}
void rtl_tcp_client::stopReader (void) {
if (connected)
disconnect (&toServer, SIGNAL (readyRead (void)),
this, SLOT (readData (void)));
}
//
//
// The brave old getSamples. For the dab stick, we get
// size: still in I/Q pairs, but we have to convert the data from
// uint8_t to DSPCOMPLEX *
int32_t rtl_tcp_client::getSamples (std::complex<float> *V, int32_t size) {
int32_t amount, i;
uint8_t *tempBuffer = (uint8_t *)alloca (2 * size * sizeof (uint8_t));
//
amount = theBuffer -> getDataFromBuffer (tempBuffer, 2 * size);
if (dumping)
fwrite (tempBuffer, amount, 1, dumpfilePointer);
for (i = 0; i < amount / 2; i ++)
V [i] = std::complex<float>
((float (tempBuffer [2 * i] - 128)) / 128.0,
(float (tempBuffer [2 * i + 1] - 128)) / 128.0);
return amount / 2;
}
int32_t rtl_tcp_client::Samples (void) {
return theBuffer -> GetRingBufferReadAvailable () / 2;
}
//
int16_t rtl_tcp_client::bitDepth (void) {
return 8;
}
// These functions are typical for network use
void rtl_tcp_client::readData (void) {
uint8_t buffer [8192];
while (toServer. bytesAvailable () > 8192) {
toServer. read ((char *)buffer, 8192);
theBuffer -> putDataIntoBuffer (buffer, 8192);
}
}
//
//
// commands are packed in 5 bytes, one "command byte"
// and an integer parameter
struct command {
unsigned char cmd;
unsigned int param;
}__attribute__((packed));
#define ONE_BYTE 8
void rtl_tcp_client::sendCommand (uint8_t cmd, int32_t param) {
QByteArray datagram;
datagram. resize (5);
datagram [0] = cmd; // command to set rate
datagram [4] = param & 0xFF; //lsb last
datagram [3] = (param >> ONE_BYTE) & 0xFF;
datagram [2] = (param >> (2 * ONE_BYTE)) & 0xFF;
datagram [1] = (param >> (3 * ONE_BYTE)) & 0xFF;
toServer. write (datagram. data (), datagram. size ());
}
void rtl_tcp_client::sendVFO (int32_t frequency) {
sendCommand (0x01, frequency);
}
void rtl_tcp_client::sendRate (int32_t theRate) {
sendCommand (0x02, theRate);
}
void rtl_tcp_client::setGainMode (int32_t gainMode) {
sendCommand (0x03, gainMode);
}
void rtl_tcp_client::sendGain (int gain) {
sendCommand (0x04, 10 * gain);
theGain = gain;
}
// correction is in ppm
void rtl_tcp_client::set_fCorrection (int32_t ppm) {
sendCommand (0x05, ppm);
thePpm = ppm;
}
void rtl_tcp_client::setDisconnect (void) {
if (connected) { // close previous connection
stopReader ();
remoteSettings -> beginGroup ("rtl_tcp_client");
remoteSettings -> setValue ("remote-server",
toServer. peerAddress (). toString ());
remoteSettings -> setValue ("rtl_tcp_client-gain", theGain);
remoteSettings -> setValue ("rtl_tcp_client-ppm", thePpm);
remoteSettings -> endGroup ();
toServer. close ();
}
connected = false;
connectedLabel -> setText (" ");
state -> setText ("disconnected");
}
void rtl_tcp_client::set_Offset (int32_t o) {
sendCommand (0x0a, Khz (o));
vfoOffset = o;
}

View File

@@ -0,0 +1,87 @@
#
/*
* Copyright (C) 2013 .. 2017
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of the Qt-DAB program
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __RTL_TCP_CLIENT__
#define __RTL_TCP_CLIENT__
#include <QtNetwork>
#include <QSettings>
#include <QLabel>
#include <QMessageBox>
#include <QLineEdit>
#include <QHostAddress>
#include <QByteArray>
#include <QTcpSocket>
#include <QTimer>
#include <QComboBox>
#include <stdio.h>
#include "dab-constants.h"
#include "virtual-input.h"
#include "ringbuffer.h"
#include "ui_rtl_tcp-widget.h"
class rtl_tcp_client: public virtualInput, Ui_rtl_tcp_widget {
Q_OBJECT
public:
rtl_tcp_client (QSettings *);
~rtl_tcp_client (void);
int32_t getRate (void);
int32_t defaultFrequency (void);
void setVFOFrequency (int32_t);
int32_t getVFOFrequency (void);
bool restartReader (void);
void stopReader (void);
int32_t getSamples (std::complex<float> *V, int32_t size);
int32_t Samples (void);
int16_t bitDepth (void);
private slots:
void sendGain (int);
void set_Offset (int);
void set_fCorrection (int);
void readData (void);
void setConnection (void);
void wantConnect (void);
void setDisconnect (void);
private:
void sendVFO (int32_t);
void sendRate (int32_t);
void setGainMode (int32_t gainMode);
void sendCommand (uint8_t, int32_t);
QLineEdit *hostLineEdit;
bool isvalidRate (int32_t);
QSettings *remoteSettings;
QFrame *theFrame;
int32_t theRate;
int32_t vfoFrequency;
RingBuffer<uint8_t> *theBuffer;
bool connected;
int16_t theGain;
int16_t thePpm;
QHostAddress serverAddress;
QTcpSocket toServer;
qint64 basePort;
bool dumping;
FILE *dumpfilePointer;
};
#endif

View File

@@ -0,0 +1,64 @@
#
/*
* Copyright (C) 2013 .. 2017
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of the Qt-DAB
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "rtl-dongleselect.h"
#include <stdio.h>
#include <QVBoxLayout>
//
// Whenever there are two or more RT2832 based sticks connected
// to the computer, the user is asked to make a choice.
rtl_dongleSelect::rtl_dongleSelect (void) {
toptext = new QLabel (this);
toptext -> setText ("Select a dongle");
selectorDisplay = new QListView (this);
QVBoxLayout *layOut = new QVBoxLayout;
layOut -> addWidget (selectorDisplay);
layOut -> addWidget (toptext);
setWindowTitle (tr("dongle select"));
setLayout (layOut);
dongleList. setStringList (Dongles);
Dongles = QStringList ();
dongleList. setStringList (Dongles);
selectorDisplay -> setModel (&dongleList);
connect (selectorDisplay, SIGNAL (clicked (QModelIndex)),
this, SLOT (selectDongle (QModelIndex)));
selectedItem = -1;
}
rtl_dongleSelect::~rtl_dongleSelect (void) {
}
void rtl_dongleSelect::addtoDongleList (const char *v) {
QString s (v);
Dongles << s;
dongleList. setStringList (Dongles);
selectorDisplay -> setModel (&dongleList);
selectorDisplay -> adjustSize ();
adjustSize ();
}
void rtl_dongleSelect::selectDongle (QModelIndex s) {
QDialog::done (s. row ());
}

View File

@@ -0,0 +1,50 @@
#
/*
* Copyright (C) 2013 .. 2017
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of the Qt-DAB program
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#
#ifndef __DONGLE_SELECT__
#define __DONGLE_SELECT__
#
#include <QDialog>
#include <QLabel>
#include <QListView>
#include <QStringListModel>
#include <QStringList>
#include <stdint.h>
class rtl_dongleSelect: public QDialog {
Q_OBJECT
public:
rtl_dongleSelect (void);
~rtl_dongleSelect (void);
void addtoDongleList (const char *);
private:
QLabel *toptext;
QListView *selectorDisplay;
QStringListModel dongleList;
QStringList Dongles;
int16_t selectedItem;
private slots:
void selectDongle (QModelIndex);
};
#endif

View File

@@ -0,0 +1,367 @@
/*
* rtl-sdr, turns your Realtek RTL2832 based DVB dongle into a SDR receiver
* Copyright (C) 2012-2013 by Steve Markgraf <steve@steve-m.de>
* Copyright (C) 2012 by Dimitri Stolnikov <horiz0n@gmx.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __RTL_SDR_H
#define __RTL_SDR_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include <rtl-sdr_export.h>
typedef struct rtlsdr_dev rtlsdr_dev_t;
RTLSDR_API uint32_t rtlsdr_get_device_count(void);
RTLSDR_API const char* rtlsdr_get_device_name(uint32_t index);
/*!
* Get USB device strings.
*
* NOTE: The string arguments must provide space for up to 256 bytes.
*
* \param index the device index
* \param manufact manufacturer name, may be NULL
* \param product product name, may be NULL
* \param serial serial number, may be NULL
* \return 0 on success
*/
RTLSDR_API int rtlsdr_get_device_usb_strings(uint32_t index,
char *manufact,
char *product,
char *serial);
/*!
* Get device index by USB serial string descriptor.
*
* \param serial serial string of the device
* \return device index of first device where the name matched
* \return -1 if name is NULL
* \return -2 if no devices were found at all
* \return -3 if devices were found, but none with matching name
*/
RTLSDR_API int rtlsdr_get_index_by_serial(const char *serial);
RTLSDR_API int rtlsdr_open(rtlsdr_dev_t **dev, uint32_t index);
RTLSDR_API int rtlsdr_close(rtlsdr_dev_t *dev);
/* configuration functions */
/*!
* Set crystal oscillator frequencies used for the RTL2832 and the tuner IC.
*
* Usually both ICs use the same clock. Changing the clock may make sense if
* you are applying an external clock to the tuner or to compensate the
* frequency (and samplerate) error caused by the original (cheap) crystal.
*
* NOTE: Call this function only if you fully understand the implications.
*
* \param dev the device handle given by rtlsdr_open()
* \param rtl_freq frequency value used to clock the RTL2832 in Hz
* \param tuner_freq frequency value used to clock the tuner IC in Hz
* \return 0 on success
*/
RTLSDR_API int rtlsdr_set_xtal_freq(rtlsdr_dev_t *dev, uint32_t rtl_freq,
uint32_t tuner_freq);
/*!
* Get crystal oscillator frequencies used for the RTL2832 and the tuner IC.
*
* Usually both ICs use the same clock.
*
* \param dev the device handle given by rtlsdr_open()
* \param rtl_freq frequency value used to clock the RTL2832 in Hz
* \param tuner_freq frequency value used to clock the tuner IC in Hz
* \return 0 on success
*/
RTLSDR_API int rtlsdr_get_xtal_freq(rtlsdr_dev_t *dev, uint32_t *rtl_freq,
uint32_t *tuner_freq);
/*!
* Get USB device strings.
*
* NOTE: The string arguments must provide space for up to 256 bytes.
*
* \param dev the device handle given by rtlsdr_open()
* \param manufact manufacturer name, may be NULL
* \param product product name, may be NULL
* \param serial serial number, may be NULL
* \return 0 on success
*/
RTLSDR_API int rtlsdr_get_usb_strings(rtlsdr_dev_t *dev, char *manufact,
char *product, char *serial);
/*!
* Write the device EEPROM
*
* \param dev the device handle given by rtlsdr_open()
* \param data buffer of data to be written
* \param offset address where the data should be written
* \param len length of the data
* \return 0 on success
* \return -1 if device handle is invalid
* \return -2 if EEPROM size is exceeded
* \return -3 if no EEPROM was found
*/
RTLSDR_API int rtlsdr_write_eeprom(rtlsdr_dev_t *dev, uint8_t *data,
uint8_t offset, uint16_t len);
/*!
* Read the device EEPROM
*
* \param dev the device handle given by rtlsdr_open()
* \param data buffer where the data should be written
* \param offset address where the data should be read from
* \param len length of the data
* \return 0 on success
* \return -1 if device handle is invalid
* \return -2 if EEPROM size is exceeded
* \return -3 if no EEPROM was found
*/
RTLSDR_API int rtlsdr_read_eeprom(rtlsdr_dev_t *dev, uint8_t *data,
uint8_t offset, uint16_t len);
RTLSDR_API int rtlsdr_set_center_freq(rtlsdr_dev_t *dev, uint32_t freq);
/*!
* Get actual frequency the device is tuned to.
*
* \param dev the device handle given by rtlsdr_open()
* \return 0 on error, frequency in Hz otherwise
*/
RTLSDR_API uint32_t rtlsdr_get_center_freq(rtlsdr_dev_t *dev);
/*!
* Set the frequency correction value for the device.
*
* \param dev the device handle given by rtlsdr_open()
* \param ppm correction value in parts per million (ppm)
* \return 0 on success
*/
RTLSDR_API int rtlsdr_set_freq_correction(rtlsdr_dev_t *dev, int ppm);
/*!
* Get actual frequency correction value of the device.
*
* \param dev the device handle given by rtlsdr_open()
* \return correction value in parts per million (ppm)
*/
RTLSDR_API int rtlsdr_get_freq_correction(rtlsdr_dev_t *dev);
enum rtlsdr_tuner {
RTLSDR_TUNER_UNKNOWN = 0,
RTLSDR_TUNER_E4000,
RTLSDR_TUNER_FC0012,
RTLSDR_TUNER_FC0013,
RTLSDR_TUNER_FC2580,
RTLSDR_TUNER_R820T,
RTLSDR_TUNER_R828D
};
/*!
* Get the tuner type.
*
* \param dev the device handle given by rtlsdr_open()
* \return RTLSDR_TUNER_UNKNOWN on error, tuner type otherwise
*/
RTLSDR_API enum rtlsdr_tuner rtlsdr_get_tuner_type(rtlsdr_dev_t *dev);
/*!
* Get a list of gains supported by the tuner.
*
* NOTE: The gains argument must be preallocated by the caller. If NULL is
* being given instead, the number of available gain values will be returned.
*
* \param dev the device handle given by rtlsdr_open()
* \param gains array of gain values. In tenths of a dB, 115 means 11.5 dB.
* \return <= 0 on error, number of available (returned) gain values otherwise
*/
RTLSDR_API int rtlsdr_get_tuner_gains(rtlsdr_dev_t *dev, int *gains);
/*!
* Set the gain for the device.
* Manual gain mode must be enabled for this to work.
*
* Valid gain values (in tenths of a dB) for the E4000 tuner:
* -10, 15, 40, 65, 90, 115, 140, 165, 190,
* 215, 240, 290, 340, 420, 430, 450, 470, 490
*
* Valid gain values may be queried with \ref rtlsdr_get_tuner_gains function.
*
* \param dev the device handle given by rtlsdr_open()
* \param gain in tenths of a dB, 115 means 11.5 dB.
* \return 0 on success
*/
RTLSDR_API int rtlsdr_set_tuner_gain(rtlsdr_dev_t *dev, int gain);
/*!
* Get actual gain the device is configured to.
*
* \param dev the device handle given by rtlsdr_open()
* \return 0 on error, gain in tenths of a dB, 115 means 11.5 dB.
*/
RTLSDR_API int rtlsdr_get_tuner_gain(rtlsdr_dev_t *dev);
/*!
* Set the intermediate frequency gain for the device.
*
* \param dev the device handle given by rtlsdr_open()
* \param stage intermediate frequency gain stage number (1 to 6 for E4000)
* \param gain in tenths of a dB, -30 means -3.0 dB.
* \return 0 on success
*/
RTLSDR_API int rtlsdr_set_tuner_if_gain(rtlsdr_dev_t *dev, int stage, int gain);
/*!
* Set the gain mode (automatic/manual) for the device.
* Manual gain mode must be enabled for the gain setter function to work.
*
* \param dev the device handle given by rtlsdr_open()
* \param manual gain mode, 1 means manual gain mode shall be enabled.
* \return 0 on success
*/
RTLSDR_API int rtlsdr_set_tuner_gain_mode(rtlsdr_dev_t *dev, int manual);
/* this will select the baseband filters according to the requested sample rate */
RTLSDR_API int rtlsdr_set_sample_rate(rtlsdr_dev_t *dev, uint32_t rate);
/*!
* Get actual sample rate the device is configured to.
*
* \param dev the device handle given by rtlsdr_open()
* \return 0 on error, sample rate in Hz otherwise
*/
RTLSDR_API uint32_t rtlsdr_get_sample_rate(rtlsdr_dev_t *dev);
/*!
* Enable test mode that returns an 8 bit counter instead of the samples.
* The counter is generated inside the RTL2832.
*
* \param dev the device handle given by rtlsdr_open()
* \param test mode, 1 means enabled, 0 disabled
* \return 0 on success
*/
RTLSDR_API int rtlsdr_set_testmode(rtlsdr_dev_t *dev, int on);
/*!
* Enable or disable the internal digital AGC of the RTL2832.
*
* \param dev the device handle given by rtlsdr_open()
* \param digital AGC mode, 1 means enabled, 0 disabled
* \return 0 on success
*/
RTLSDR_API int rtlsdr_set_agc_mode(rtlsdr_dev_t *dev, int on);
/*!
* Enable or disable the direct sampling mode. When enabled, the IF mode
* of the RTL2832 is activated, and rtlsdr_set_center_freq() will control
* the IF-frequency of the DDC, which can be used to tune from 0 to 28.8 MHz
* (xtal frequency of the RTL2832).
*
* \param dev the device handle given by rtlsdr_open()
* \param on 0 means disabled, 1 I-ADC input enabled, 2 Q-ADC input enabled
* \return 0 on success
*/
RTLSDR_API int rtlsdr_set_direct_sampling(rtlsdr_dev_t *dev, int on);
/*!
* Get state of the direct sampling mode
*
* \param dev the device handle given by rtlsdr_open()
* \return -1 on error, 0 means disabled, 1 I-ADC input enabled
* 2 Q-ADC input enabled
*/
RTLSDR_API int rtlsdr_get_direct_sampling(rtlsdr_dev_t *dev);
/*!
* Enable or disable offset tuning for zero-IF tuners, which allows to avoid
* problems caused by the DC offset of the ADCs and 1/f noise.
*
* \param dev the device handle given by rtlsdr_open()
* \param on 0 means disabled, 1 enabled
* \return 0 on success
*/
RTLSDR_API int rtlsdr_set_offset_tuning(rtlsdr_dev_t *dev, int on);
/*!
* Get state of the offset tuning mode
*
* \param dev the device handle given by rtlsdr_open()
* \return -1 on error, 0 means disabled, 1 enabled
*/
RTLSDR_API int rtlsdr_get_offset_tuning(rtlsdr_dev_t *dev);
/* streaming functions */
RTLSDR_API int rtlsdr_reset_buffer(rtlsdr_dev_t *dev);
RTLSDR_API int rtlsdr_read_sync(rtlsdr_dev_t *dev, void *buf, int len, int *n_read);
typedef void(*rtlsdr_read_async_cb_t)(unsigned char *buf, uint32_t len, void *ctx);
/*!
* Read samples from the device asynchronously. This function will block until
* it is being canceled using rtlsdr_cancel_async()
*
* NOTE: This function is deprecated and is subject for removal.
*
* \param dev the device handle given by rtlsdr_open()
* \param cb callback function to return received samples
* \param ctx user specific context to pass via the callback function
* \return 0 on success
*/
RTLSDR_API int rtlsdr_wait_async(rtlsdr_dev_t *dev, rtlsdr_read_async_cb_t cb, void *ctx);
/*!
* Read samples from the device asynchronously. This function will block until
* it is being canceled using rtlsdr_cancel_async()
*
* \param dev the device handle given by rtlsdr_open()
* \param cb callback function to return received samples
* \param ctx user specific context to pass via the callback function
* \param buf_num optional buffer count, buf_num * buf_len = overall buffer size
* set to 0 for default buffer count (32)
* \param buf_len optional buffer length, must be multiple of 512,
* set to 0 for default buffer length (16 * 32 * 512)
* \return 0 on success
*/
RTLSDR_API int rtlsdr_read_async(rtlsdr_dev_t *dev,
rtlsdr_read_async_cb_t cb,
void *ctx,
uint32_t buf_num,
uint32_t buf_len);
/*!
* Cancel all pending asynchronous operations on the device.
*
* \param dev the device handle given by rtlsdr_open()
* \return 0 on success
*/
RTLSDR_API int rtlsdr_cancel_async(rtlsdr_dev_t *dev);
#ifdef __cplusplus
}
#endif
#endif /* __RTL_SDR_H */

View File

@@ -0,0 +1,47 @@
/*
* rtl-sdr, turns your Realtek RTL2832 based DVB dongle into a SDR receiver
* Copyright (C) 2012 by Hoernchen <la@tfc-server.de>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef RTLSDR_EXPORT_H
#define RTLSDR_EXPORT_H
#if defined __GNUC__
# if __GNUC__ >= 4
# define __SDR_EXPORT __attribute__((visibility("default")))
# define __SDR_IMPORT __attribute__((visibility("default")))
# else
# define __SDR_EXPORT
# define __SDR_IMPORT
# endif
#elif _MSC_VER
# define __SDR_EXPORT __declspec(dllexport)
# define __SDR_IMPORT __declspec(dllimport)
#else
# define __SDR_EXPORT
# define __SDR_IMPORT
#endif
#ifndef rtlsdr_STATIC
# ifdef rtlsdr_EXPORTS
# define RTLSDR_API __SDR_EXPORT
# else
# define RTLSDR_API __SDR_IMPORT
# endif
#else
#define RTLSDR_API
#endif
#endif /* RTLSDR_EXPORT_H */

View File

@@ -0,0 +1,546 @@
#
/*
* Copyright (C) 2013 .. 2017
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of the Qt-DAB
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Qt-SDR; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* This particular driver is a very simple wrapper around the
* librtlsdr. In order to keep things simple, we dynamically
* load the dll (or .so). The librtlsdr is osmocom software and all rights
* are greatly acknowledged
*/
#include <QThread>
#include <QFileDialog>
#include <QDir>
#include "rtlsdr-handler.h"
#include "rtl-dongleselect.h"
#include "rtl-sdr.h"
#ifdef __MINGW32__
#define GETPROCADDRESS GetProcAddress
#else
#define GETPROCADDRESS dlsym
#endif
#define READLEN_DEFAULT 8192
//
// For the callback, we do need some environment which
// is passed through the ctx parameter
//
// This is the user-side call back function
// ctx is the calling task
static
void RTLSDRCallBack (uint8_t *buf, uint32_t len, void *ctx) {
rtlsdrHandler *theStick = (rtlsdrHandler *)ctx;
if ((theStick == NULL) || (len != READLEN_DEFAULT))
return;
(void)theStick -> _I_Buffer -> putDataIntoBuffer (buf, len);
}
//
// for handling the events in libusb, we need a controlthread
// whose sole purpose is to process the rtlsdr_read_async function
// from the lib.
class dll_driver : public QThread {
private:
rtlsdrHandler *theStick;
public:
dll_driver (rtlsdrHandler *d) {
theStick = d;
start ();
}
~dll_driver (void) {
}
private:
virtual void run (void) {
(theStick -> rtlsdr_read_async) (theStick -> device,
(rtlsdr_read_async_cb_t)&RTLSDRCallBack,
(void *)theStick,
0,
READLEN_DEFAULT);
}
};
//
// Our wrapper is a simple classs
rtlsdrHandler::rtlsdrHandler (QSettings *s) {
int16_t deviceCount;
int32_t r;
int16_t deviceIndex;
int16_t i;
QString temp;
int k;
rtlsdrSettings = s;
this -> myFrame = new QFrame (NULL);
setupUi (this -> myFrame);
this -> myFrame -> show ();
inputRate = 2048000;
libraryLoaded = false;
open = false;
_I_Buffer = NULL;
workerHandle = NULL;
lastFrequency = KHz (22000); // just a dummy
this -> vfoOffset = 0;
gains = NULL;
#ifdef __MINGW32__
const char *libraryString = "rtlsdr.dll";
Handle = LoadLibrary ((wchar_t *)L"rtlsdr.dll");
#else
const char *libraryString = "librtlsdr.so";
Handle = dlopen ("librtlsdr.so", RTLD_NOW);
#endif
if (Handle == NULL) {
fprintf (stderr, "failed to open %s\n", libraryString);
delete myFrame;
throw (20);
}
libraryLoaded = true;
if (!load_rtlFunctions ()) {
#ifdef __MINGW32__
FreeLibrary (Handle);
#else
dlclose (Handle);
#endif
delete myFrame;
throw (21);
}
//
// Ok, from here we have the library functions accessible
deviceCount = this -> rtlsdr_get_device_count ();
if (deviceCount == 0) {
fprintf (stderr, "No devices found\n");
#ifdef __MINGW32__
FreeLibrary (Handle);
#else
dlclose (Handle);
#endif
delete myFrame;
throw (22);
}
deviceIndex = 0; // default
if (deviceCount > 1) {
rtl_dongleSelect dongleSelector;
for (deviceIndex = 0; deviceIndex < deviceCount; deviceIndex ++) {
dongleSelector.
addtoDongleList (rtlsdr_get_device_name (deviceIndex));
}
deviceIndex = dongleSelector. QDialog::exec ();
}
//
// OK, now open the hardware
r = this -> rtlsdr_open (&device, deviceIndex);
if (r < 0) {
fprintf (stderr, "Opening rtlsdr device failed\n");
#ifdef __MINGW32__
FreeLibrary (Handle);
#else
dlclose (Handle);
#endif
delete myFrame;
throw (23);
}
open = true;
r = this -> rtlsdr_set_sample_rate (device,
inputRate);
if (r < 0) {
fprintf (stderr, "Setting samplerate failed\n");
rtlsdr_close (device);
#ifdef __MINGW32__
FreeLibrary (Handle);
#else
dlclose (Handle);
#endif
delete myFrame;
throw (24);
}
r = this -> rtlsdr_get_sample_rate (device);
fprintf (stderr, "samplerate set to %d\n", r);
gainsCount = rtlsdr_get_tuner_gains (device, NULL);
fprintf(stderr, "Supported gain values (%d): ", gainsCount);
gains = new int [gainsCount];
gainsCount = rtlsdr_get_tuner_gains (device, gains);
for (i = gainsCount; i > 0; i--) {
fprintf(stderr, "%.1f ", gains [i - 1] / 10.0);
combo_gain -> addItem (QString::number (gains [i - 1]));
}
fprintf(stderr, "\n");
rtlsdr_set_tuner_gain_mode (device, 1);
_I_Buffer = new RingBuffer<uint8_t>(8 * 1024 * 1024);
theGain = gains [gainsCount / 2]; // default
//
// See what the saved values are and restore the GUI settings
rtlsdrSettings -> beginGroup ("rtlsdrSettings");
coarseOffset = rtlsdrSettings -> value ("rtlsdrOffset", 0). toInt ();
temp = rtlsdrSettings -> value ("externalGain", "10"). toString ();
k = combo_gain -> findText (temp);
if (k != -1) {
combo_gain -> setCurrentIndex (k);
theGain = temp. toInt ();
}
temp = rtlsdrSettings -> value ("autogain",
"autogain_on"). toString ();
k = combo_autogain -> findText (temp);
if (k != -1)
combo_autogain -> setCurrentIndex (k);
ppm_correction -> setValue (rtlsdrSettings -> value ("ppm_correction", 0). toInt ());
KhzOffset -> setValue (rtlsdrSettings -> value ("KhzOffset", 0). toInt ());
rtlsdrSettings -> endGroup ();
//
// all sliders/values are set to previous values, now do the settings
// based on these slider values
rtlsdr_set_tuner_gain_mode (device,
combo_autogain -> currentText () == "autogain_on");
if (combo_autogain -> currentText () == "autogain_on")
rtlsdr_set_agc_mode (device, 1);
else
rtlsdr_set_agc_mode (device, 0);
rtlsdr_set_tuner_gain (device, theGain);
set_ppmCorrection (ppm_correction -> value ());
set_KhzOffset (KhzOffset -> value ());
//
dumping = false;
// and attach the buttons/sliders to the actions
connect (combo_gain, SIGNAL (activated (const QString &)),
this, SLOT (set_ExternalGain (const QString &)));
connect (combo_autogain, SIGNAL (activated (const QString &)),
this, SLOT (set_autogain (const QString &)));
connect (ppm_correction, SIGNAL (valueChanged (int)),
this, SLOT (set_ppmCorrection (int)));
connect (KhzOffset, SIGNAL (valueChanged (int)),
this, SLOT (set_KhzOffset (int)));
connect (dumpButton, SIGNAL (clicked (void)),
this, SLOT (dumpButton_pressed (void)));
}
rtlsdrHandler::~rtlsdrHandler (void) {
if (Handle == NULL) { // nothing achieved earlier on
delete myFrame;
return;
}
if (!open) {
#ifdef __MINGW32__
FreeLibrary (Handle);
#else
dlclose (Handle);
#endif
return;
}
stopReader ();
rtlsdrSettings -> beginGroup ("rtlsdrSettings");
rtlsdrSettings -> setValue ("rtlsdrOffset", coarseOffset);
rtlsdrSettings -> setValue ("externalGain",
combo_gain -> currentText ());
rtlsdrSettings -> setValue ("autogain",
combo_autogain -> currentText ());
rtlsdrSettings -> setValue ("ppm_correction",
ppm_correction -> value ());
rtlsdrSettings -> setValue ("KhzOffset",
KhzOffset -> value ());
rtlsdrSettings -> sync ();
rtlsdrSettings -> endGroup ();
this -> rtlsdr_close (device);
#ifdef __MINGW32__
FreeLibrary (Handle);
#else
dlclose (Handle);
#endif
if (_I_Buffer != NULL)
delete _I_Buffer;
if (gains != NULL)
delete[] gains;
delete myFrame;
}
void rtlsdrHandler::setVFOFrequency (int32_t f) {
lastFrequency = f;
(void)(this -> rtlsdr_set_center_freq (device, f + vfoOffset));
}
int32_t rtlsdrHandler::getVFOFrequency (void) {
return (int32_t)(this -> rtlsdr_get_center_freq (device)) - vfoOffset;
}
//
//
bool rtlsdrHandler::restartReader (void) {
int32_t r;
if (workerHandle != NULL)
return true;
_I_Buffer -> FlushRingBuffer ();
r = this -> rtlsdr_reset_buffer (device);
if (r < 0)
return false;
this -> rtlsdr_set_center_freq (device, lastFrequency + vfoOffset);
workerHandle = new dll_driver (this);
rtlsdr_set_agc_mode (device,
combo_autogain -> currentText () == "autogain_on" ? 1 : 0);
rtlsdr_set_tuner_gain (device, theGain);
return true;
}
void rtlsdrHandler::stopReader (void) {
if (workerHandle == NULL)
return;
if (workerHandle != NULL) { // we are running
this -> rtlsdr_cancel_async (device);
if (workerHandle != NULL) {
while (!workerHandle -> isFinished ())
usleep (100);
delete workerHandle;
}
}
workerHandle = NULL;
}
//
// when selecting the gain from a table, use the table value
void rtlsdrHandler::set_ExternalGain (const QString &gain) {
theGain = gain. toInt ();
rtlsdr_set_tuner_gain (device, gain. toInt ());
}
//
void rtlsdrHandler::set_autogain (const QString &autogain) {
rtlsdr_set_agc_mode (device, autogain == "autogain_off" ? 0 : 1);
rtlsdr_set_tuner_gain (device, theGain);
}
//
// correction is in Hz
void rtlsdrHandler::set_ppmCorrection (int32_t ppm) {
this -> rtlsdr_set_freq_correction (device, ppm);
}
void rtlsdrHandler::set_KhzOffset (int32_t o) {
vfoOffset = Khz (o);
(void)(this -> rtlsdr_set_center_freq (device, lastFrequency + vfoOffset));
}
//
// The brave old getSamples. For the dab stick, we get
// size samples: still in I/Q pairs, but we have to convert the data from
// uint8_t to DSPCOMPLEX *
int32_t rtlsdrHandler::getSamples (std::complex<float> *V, int32_t size) {
int32_t amount, i;
uint8_t *tempBuffer = (uint8_t *)alloca (2 * size * sizeof (uint8_t));
//
amount = _I_Buffer -> getDataFromBuffer (tempBuffer, 2 * size);
if (dumping)
fwrite (tempBuffer, amount, 1, dumpfilePointer);
for (i = 0; i < amount / 2; i ++)
V [i] = std::complex<float>
((float (tempBuffer [2 * i] - 128)) / 128.0,
(float (tempBuffer [2 * i + 1] - 128)) / 128.0);
return amount / 2;
}
int32_t rtlsdrHandler::Samples (void) {
return _I_Buffer -> GetRingBufferReadAvailable () / 2;
}
//
bool rtlsdrHandler::load_rtlFunctions (void) {
//
// link the required procedures
rtlsdr_open = (pfnrtlsdr_open)
GETPROCADDRESS (Handle, "rtlsdr_open");
if (rtlsdr_open == NULL) {
fprintf (stderr, "Could not find rtlsdr_open\n");
return false;
}
rtlsdr_close = (pfnrtlsdr_close)
GETPROCADDRESS (Handle, "rtlsdr_close");
if (rtlsdr_close == NULL) {
fprintf (stderr, "Could not find rtlsdr_close\n");
return false;
}
rtlsdr_set_sample_rate =
(pfnrtlsdr_set_sample_rate)GETPROCADDRESS (Handle, "rtlsdr_set_sample_rate");
if (rtlsdr_set_sample_rate == NULL) {
fprintf (stderr, "Could not find rtlsdr_set_sample_rate\n");
return false;
}
rtlsdr_get_sample_rate =
(pfnrtlsdr_get_sample_rate)GETPROCADDRESS (Handle, "rtlsdr_get_sample_rate");
if (rtlsdr_get_sample_rate == NULL) {
fprintf (stderr, "Could not find rtlsdr_get_sample_rate\n");
return false;
}
rtlsdr_get_tuner_gains = (pfnrtlsdr_get_tuner_gains)
GETPROCADDRESS (Handle, "rtlsdr_get_tuner_gains");
if (rtlsdr_get_tuner_gains == NULL) {
fprintf (stderr, "Could not find rtlsdr_get_tuner_gains\n");
return false;
}
rtlsdr_set_tuner_gain_mode = (pfnrtlsdr_set_tuner_gain_mode)
GETPROCADDRESS (Handle, "rtlsdr_set_tuner_gain_mode");
if (rtlsdr_set_tuner_gain_mode == NULL) {
fprintf (stderr, "Could not find rtlsdr_set_tuner_gain_mode\n");
return false;
}
rtlsdr_set_agc_mode = (pfnrtlsdr_set_agc_mode)
GETPROCADDRESS (Handle, "rtlsdr_set_agc_mode");
if (rtlsdr_set_agc_mode == NULL) {
fprintf (stderr, "Could not find rtlsdr_set_agc_mode\n");
return false;
}
rtlsdr_set_tuner_gain = (pfnrtlsdr_set_tuner_gain)
GETPROCADDRESS (Handle, "rtlsdr_set_tuner_gain");
if (rtlsdr_set_tuner_gain == NULL) {
fprintf (stderr, "Cound not find rtlsdr_set_tuner_gain\n");
return false;
}
rtlsdr_get_tuner_gain = (pfnrtlsdr_get_tuner_gain)
GETPROCADDRESS (Handle, "rtlsdr_get_tuner_gain");
if (rtlsdr_get_tuner_gain == NULL) {
fprintf (stderr, "Could not find rtlsdr_get_tuner_gain\n");
return false;
}
rtlsdr_set_center_freq = (pfnrtlsdr_set_center_freq)
GETPROCADDRESS (Handle, "rtlsdr_set_center_freq");
if (rtlsdr_set_center_freq == NULL) {
fprintf (stderr, "Could not find rtlsdr_set_center_freq\n");
return false;
}
rtlsdr_get_center_freq = (pfnrtlsdr_get_center_freq)
GETPROCADDRESS (Handle, "rtlsdr_get_center_freq");
if (rtlsdr_get_center_freq == NULL) {
fprintf (stderr, "Could not find rtlsdr_get_center_freq\n");
return false;
}
rtlsdr_reset_buffer = (pfnrtlsdr_reset_buffer)
GETPROCADDRESS (Handle, "rtlsdr_reset_buffer");
if (rtlsdr_reset_buffer == NULL) {
fprintf (stderr, "Could not find rtlsdr_reset_buffer\n");
return false;
}
rtlsdr_read_async = (pfnrtlsdr_read_async)
GETPROCADDRESS (Handle, "rtlsdr_read_async");
if (rtlsdr_read_async == NULL) {
fprintf (stderr, "Cound not find rtlsdr_read_async\n");
return false;
}
rtlsdr_get_device_count = (pfnrtlsdr_get_device_count)
GETPROCADDRESS (Handle, "rtlsdr_get_device_count");
if (rtlsdr_get_device_count == NULL) {
fprintf (stderr, "Could not find rtlsdr_get_device_count\n");
return false;
}
rtlsdr_cancel_async = (pfnrtlsdr_cancel_async)
GETPROCADDRESS (Handle, "rtlsdr_cancel_async");
if (rtlsdr_cancel_async == NULL) {
fprintf (stderr, "Could not find rtlsdr_cancel_async\n");
return false;
}
rtlsdr_set_direct_sampling = (pfnrtlsdr_set_direct_sampling)
GETPROCADDRESS (Handle, "rtlsdr_set_direct_sampling");
if (rtlsdr_set_direct_sampling == NULL) {
fprintf (stderr, "Could not find rtlsdr_set_direct_sampling\n");
return false;
}
rtlsdr_set_freq_correction = (pfnrtlsdr_set_freq_correction)
GETPROCADDRESS (Handle, "rtlsdr_set_freq_correction");
if (rtlsdr_set_freq_correction == NULL) {
fprintf (stderr, "Could not find rtlsdr_set_freq_correction\n");
return false;
}
rtlsdr_get_device_name = (pfnrtlsdr_get_device_name)
GETPROCADDRESS (Handle, "rtlsdr_get_device_name");
if (rtlsdr_get_device_name == NULL) {
fprintf (stderr, "Could not find rtlsdr_get_device_name\n");
return false;
}
fprintf (stderr, "OK, functions seem to be loaded\n");
return true;
}
void rtlsdrHandler::resetBuffer (void) {
_I_Buffer -> FlushRingBuffer ();
}
int16_t rtlsdrHandler::maxGain (void) {
return gainsCount;
}
int16_t rtlsdrHandler::bitDepth (void) {
return 8;
}
void rtlsdrHandler::dumpButton_pressed (void) {
if (!dumping) {
QString file = QFileDialog::getSaveFileName (NULL,
tr ("Save file ..."),
QDir::homePath (),
tr ("iq file (*.iq)"));
if (file == QString (""))
return;
file = QDir::toNativeSeparators (file);
if (!file.endsWith (".iq", Qt::CaseInsensitive))
file.append (".iq");
dumpfilePointer = fopen (file. toLatin1 (). data (), "w+b");
if (dumpfilePointer == NULL)
return;
dumpButton -> setText ("WRITING");
dumping = true;
}
else {
dumping = false;
fclose (dumpfilePointer);
dumpfilePointer = NULL;
dumpButton -> setText ("write raw bytes");
}
}

View File

@@ -0,0 +1,132 @@
#
/*
* Copyright (C) 2014 .. 2017
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of the Qt-DAB
* Many of the ideas as implemented in Qt-DAB are derived from
* other work, made available through the GNU general Public License.
* All copyrights of the original authors are recognized.
*
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __RTLSDR_HANDLER__
#define __RTLSDR_HANDLER__
#include <QObject>
#include <QSettings>
#include <stdio.h>
#include "dab-constants.h"
#include "virtual-input.h"
#include "ringbuffer.h"
#include "ui_rtlsdr-widget.h"
class dll_driver;
//
// create typedefs for the library functions
typedef struct rtlsdr_dev rtlsdr_dev_t;
extern "C" {
typedef void (*rtlsdr_read_async_cb_t) (uint8_t *buf, uint32_t len, void *ctx);
typedef int (* pfnrtlsdr_open )(rtlsdr_dev_t **, uint32_t);
typedef int (* pfnrtlsdr_close) (rtlsdr_dev_t *);
typedef int (* pfnrtlsdr_set_center_freq) (rtlsdr_dev_t *, uint32_t);
typedef uint32_t (* pfnrtlsdr_get_center_freq) (rtlsdr_dev_t *);
typedef int (* pfnrtlsdr_get_tuner_gains) (rtlsdr_dev_t *, int *);
typedef int (* pfnrtlsdr_set_tuner_gain_mode) (rtlsdr_dev_t *, int);
typedef int (* pfnrtlsdr_set_agc_mode) (rtlsdr_dev_t *, int);
typedef int (* pfnrtlsdr_set_sample_rate) (rtlsdr_dev_t *, uint32_t);
typedef int (* pfnrtlsdr_get_sample_rate) (rtlsdr_dev_t *);
typedef int (* pfnrtlsdr_set_tuner_gain) (rtlsdr_dev_t *, int);
typedef int (* pfnrtlsdr_get_tuner_gain) (rtlsdr_dev_t *);
typedef int (* pfnrtlsdr_reset_buffer) (rtlsdr_dev_t *);
typedef int (* pfnrtlsdr_read_async) (rtlsdr_dev_t *,
rtlsdr_read_async_cb_t,
void *,
uint32_t,
uint32_t);
typedef int (* pfnrtlsdr_cancel_async) (rtlsdr_dev_t *);
typedef int (* pfnrtlsdr_set_direct_sampling) (rtlsdr_dev_t *, int);
typedef uint32_t (* pfnrtlsdr_get_device_count) (void);
typedef int (* pfnrtlsdr_set_freq_correction)(rtlsdr_dev_t *, int);
typedef char *(* pfnrtlsdr_get_device_name)(int);
}
// This class is a simple wrapper around the
// rtlsdr library that is read in as dll (or .so file in linux)
// It does not do any processing
class rtlsdrHandler: public virtualInput, public Ui_dabstickWidget {
Q_OBJECT
public:
rtlsdrHandler (QSettings *);
~rtlsdrHandler (void);
void setVFOFrequency (int32_t);
int32_t getVFOFrequency (void);
// interface to the reader
bool restartReader (void);
void stopReader (void);
int32_t getSamples (std::complex<float> *, int32_t);
int32_t Samples (void);
void resetBuffer (void);
int16_t maxGain (void);
int16_t bitDepth (void);
//
// These need to be visible for the separate usb handling thread
RingBuffer<uint8_t> *_I_Buffer;
pfnrtlsdr_read_async rtlsdr_read_async;
struct rtlsdr_dev *device;
private:
QFrame *myFrame;
QSettings *rtlsdrSettings;
int32_t inputRate;
int32_t deviceCount;
HINSTANCE Handle;
dll_driver *workerHandle;
int32_t lastFrequency;
bool libraryLoaded;
bool open;
int *gains;
int16_t gainsCount;
bool dumping;
FILE *dumpfilePointer;
// here we need to load functions from the dll
bool load_rtlFunctions (void);
pfnrtlsdr_open rtlsdr_open;
pfnrtlsdr_close rtlsdr_close;
pfnrtlsdr_set_center_freq rtlsdr_set_center_freq;
pfnrtlsdr_get_center_freq rtlsdr_get_center_freq;
pfnrtlsdr_get_tuner_gains rtlsdr_get_tuner_gains;
pfnrtlsdr_set_tuner_gain_mode rtlsdr_set_tuner_gain_mode;
pfnrtlsdr_set_agc_mode rtlsdr_set_agc_mode;
pfnrtlsdr_set_sample_rate rtlsdr_set_sample_rate;
pfnrtlsdr_get_sample_rate rtlsdr_get_sample_rate;
pfnrtlsdr_set_tuner_gain rtlsdr_set_tuner_gain;
pfnrtlsdr_get_tuner_gain rtlsdr_get_tuner_gain;
pfnrtlsdr_reset_buffer rtlsdr_reset_buffer;
pfnrtlsdr_cancel_async rtlsdr_cancel_async;
pfnrtlsdr_set_direct_sampling rtlsdr_set_direct_sampling;
pfnrtlsdr_get_device_count rtlsdr_get_device_count;
pfnrtlsdr_set_freq_correction rtlsdr_set_freq_correction;
pfnrtlsdr_get_device_name rtlsdr_get_device_name;
private slots:
void set_ExternalGain (const QString &);
void set_autogain (const QString &);
void set_ppmCorrection (int);
void set_KhzOffset (int);
void dumpButton_pressed (void);
};
#endif

View File

@@ -0,0 +1,162 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>dabstickWidget</class>
<widget class="QWidget" name="dabstickWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>260</width>
<height>258</height>
</rect>
</property>
<property name="windowTitle">
<string>RT2832 dabstick</string>
</property>
<widget class="QFrame" name="contents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>221</width>
<height>231</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>10</x>
<y>150</y>
<width>101</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>dabstick</string>
</property>
</widget>
<widget class="QSpinBox" name="ppm_correction">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>91</width>
<height>21</height>
</rect>
</property>
<property name="minimum">
<number>-100</number>
</property>
<property name="maximum">
<number>100</number>
</property>
</widget>
<widget class="QSpinBox" name="KhzOffset">
<property name="geometry">
<rect>
<x>10</x>
<y>40</y>
<width>91</width>
<height>21</height>
</rect>
</property>
<property name="minimum">
<number>-100</number>
</property>
<property name="maximum">
<number>100</number>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>110</x>
<y>40</y>
<width>41</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>KHz</string>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>110</x>
<y>10</y>
<width>51</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>ppm</string>
</property>
</widget>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>110</x>
<y>70</y>
<width>41</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>gain</string>
</property>
</widget>
<widget class="QComboBox" name="combo_gain">
<property name="geometry">
<rect>
<x>10</x>
<y>70</y>
<width>91</width>
<height>21</height>
</rect>
</property>
</widget>
<widget class="QComboBox" name="combo_autogain">
<property name="geometry">
<rect>
<x>10</x>
<y>120</y>
<width>141</width>
<height>21</height>
</rect>
</property>
<item>
<property name="text">
<string>autogain_off</string>
</property>
</item>
<item>
<property name="text">
<string>autogain_on</string>
</property>
</item>
</widget>
<widget class="QPushButton" name="dumpButton">
<property name="geometry">
<rect>
<x>10</x>
<y>170</y>
<width>141</width>
<height>36</height>
</rect>
</property>
<property name="text">
<string>write raw bytes</string>
</property>
</widget>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,318 @@
//
// Copyright (c) 2013 Mirics Ltd, All Rights Reserved
//
#ifndef MIR_SDR_H
#define MIR_SDR_H
#ifndef _MIR_SDR_QUALIFIER
#if !defined(STATIC_LIB) && (defined(_M_X64) || defined(_M_IX86))
#define _MIR_SDR_QUALIFIER __declspec(dllimport)
#elif defined(STATIC_LIB) || defined(__GNUC__)
#define _MIR_SDR_QUALIFIER
#endif
#endif // _MIR_SDR_QUALIFIER
// Application code should check that it is compiled against the same API version
// mir_sdr_ApiVersion() returns the API version
#define MIR_SDR_API_VERSION (float)(2.09)
#if defined(ANDROID) || defined(__ANDROID__)
// Android requires a mechanism to request info from Java application
typedef enum
{
mir_sdr_GetFd = 0,
mir_sdr_FreeFd = 1,
mir_sdr_DevNotFound = 2,
mir_sdr_DevRemoved = 3
} mir_sdr_JavaReqT;
typedef int (*mir_sdr_SendJavaReq_t)(mir_sdr_JavaReqT cmd, int param);
#endif
typedef enum
{
mir_sdr_Success = 0,
mir_sdr_Fail = 1,
mir_sdr_InvalidParam = 2,
mir_sdr_OutOfRange = 3,
mir_sdr_GainUpdateError = 4,
mir_sdr_RfUpdateError = 5,
mir_sdr_FsUpdateError = 6,
mir_sdr_HwError = 7,
mir_sdr_AliasingError = 8,
mir_sdr_AlreadyInitialised = 9,
mir_sdr_NotInitialised = 10,
mir_sdr_NotEnabled = 11,
mir_sdr_HwVerError = 12,
mir_sdr_OutOfMemError = 13
} mir_sdr_ErrT;
typedef enum
{
mir_sdr_BW_Undefined = 0,
mir_sdr_BW_0_200 = 200,
mir_sdr_BW_0_300 = 300,
mir_sdr_BW_0_600 = 600,
mir_sdr_BW_1_536 = 1536,
mir_sdr_BW_5_000 = 5000,
mir_sdr_BW_6_000 = 6000,
mir_sdr_BW_7_000 = 7000,
mir_sdr_BW_8_000 = 8000
} mir_sdr_Bw_MHzT;
typedef enum
{
mir_sdr_IF_Undefined = -1,
mir_sdr_IF_Zero = 0,
mir_sdr_IF_0_450 = 450,
mir_sdr_IF_1_620 = 1620,
mir_sdr_IF_2_048 = 2048
} mir_sdr_If_kHzT;
typedef enum
{
mir_sdr_ISOCH = 0,
mir_sdr_BULK = 1
} mir_sdr_TransferModeT;
typedef enum
{
mir_sdr_CHANGE_NONE = 0x00,
mir_sdr_CHANGE_GR = 0x01,
mir_sdr_CHANGE_FS_FREQ = 0x02,
mir_sdr_CHANGE_RF_FREQ = 0x04,
mir_sdr_CHANGE_BW_TYPE = 0x08,
mir_sdr_CHANGE_IF_TYPE = 0x10,
mir_sdr_CHANGE_LO_MODE = 0x20,
mir_sdr_CHANGE_AM_PORT = 0x40
} mir_sdr_ReasonForReinitT;
typedef enum
{
mir_sdr_LO_Undefined = 0,
mir_sdr_LO_Auto = 1,
mir_sdr_LO_120MHz = 2,
mir_sdr_LO_144MHz = 3,
mir_sdr_LO_168MHz = 4
} mir_sdr_LoModeT;
typedef enum
{
mir_sdr_BAND_AM_LO = 0,
mir_sdr_BAND_AM_MID = 1,
mir_sdr_BAND_AM_HI = 2,
mir_sdr_BAND_VHF = 3,
mir_sdr_BAND_3 = 4,
mir_sdr_BAND_X = 5,
mir_sdr_BAND_4_5 = 6,
mir_sdr_BAND_L = 7
} mir_sdr_BandT;
typedef enum
{
mir_sdr_USE_SET_GR = 0,
mir_sdr_USE_SET_GR_ALT_MODE = 1,
mir_sdr_USE_RSP_SET_GR = 2
} mir_sdr_SetGrModeT;
typedef enum
{
mir_sdr_RSPII_BAND_UNKNOWN = 0,
mir_sdr_RSPII_BAND_AM_LO = 1,
mir_sdr_RSPII_BAND_AM_MID = 2,
mir_sdr_RSPII_BAND_AM_HI = 3,
mir_sdr_RSPII_BAND_VHF = 4,
mir_sdr_RSPII_BAND_3 = 5,
mir_sdr_RSPII_BAND_X_LO = 6,
mir_sdr_RSPII_BAND_X_MID = 7,
mir_sdr_RSPII_BAND_X_HI = 8,
mir_sdr_RSPII_BAND_4_5 = 9,
mir_sdr_RSPII_BAND_L = 10
} mir_sdr_RSPII_BandT;
typedef enum
{
mir_sdr_RSPII_ANTENNA_A = 5,
mir_sdr_RSPII_ANTENNA_B = 6
} mir_sdr_RSPII_AntennaSelectT;
typedef enum
{
mir_sdr_AGC_DISABLE = 0,
mir_sdr_AGC_100HZ = 1,
mir_sdr_AGC_50HZ = 2,
mir_sdr_AGC_5HZ = 3
} mir_sdr_AgcControlT;
typedef enum
{
mir_sdr_GAIN_MESSAGE_START_ID = 0x80000000,
mir_sdr_ADC_OVERLOAD_DETECTED = mir_sdr_GAIN_MESSAGE_START_ID + 1,
mir_sdr_ADC_OVERLOAD_CORRECTED = mir_sdr_GAIN_MESSAGE_START_ID + 2
} mir_sdr_GainMessageIdT;
typedef enum
{
mir_sdr_EXTENDED_MIN_GR = 0,
mir_sdr_NORMAL_MIN_GR = 20
} mir_sdr_MinGainReductionT;
typedef struct
{
char *SerNo;
char *DevNm;
unsigned char hwVer;
unsigned char devAvail;
} mir_sdr_DeviceT;
typedef struct
{
float curr;
float max;
float min;
} mir_sdr_GainValuesT;
// mir_sdr_StreamInit() callback function prototypes
typedef void (*mir_sdr_StreamCallback_t)(short *xi, short *xq, unsigned int firstSampleNum, int grChanged, int rfChanged, int fsChanged, unsigned int numSamples, unsigned int reset, void *cbContext);
typedef void (*mir_sdr_GainChangeCallback_t)(unsigned int gRdB, unsigned int lnaGRdB, void *cbContext);
typedef mir_sdr_ErrT (*mir_sdr_Init_t)(int gRdB, double fsMHz, double rfMHz, mir_sdr_Bw_MHzT bwType, mir_sdr_If_kHzT ifType, int *samplesPerPacket);
typedef mir_sdr_ErrT (*mir_sdr_Uninit_t)(void);
typedef mir_sdr_ErrT (*mir_sdr_ReadPacket_t)(short *xi, short *xq, unsigned int *firstSampleNum, int *grChanged, int *rfChanged, int *fsChanged);
typedef mir_sdr_ErrT (*mir_sdr_SetRf_t)(double drfHz, int abs, int syncUpdate);
typedef mir_sdr_ErrT (*mir_sdr_SetFs_t)(double dfsHz, int abs, int syncUpdate, int reCal);
typedef mir_sdr_ErrT (*mir_sdr_SetGr_t)(int gRdB, int abs, int syncUpdate);
typedef mir_sdr_ErrT (*mir_sdr_SetGrParams_t)(int minimumGr, int lnaGrThreshold);
typedef mir_sdr_ErrT (*mir_sdr_SetDcMode_t)(int dcCal, int speedUp);
typedef mir_sdr_ErrT (*mir_sdr_SetDcTrackTime_t)(int trackTime);
typedef mir_sdr_ErrT (*mir_sdr_SetSyncUpdateSampleNum_t)(unsigned int sampleNum);
typedef mir_sdr_ErrT (*mir_sdr_SetSyncUpdatePeriod_t)(unsigned int period);
typedef mir_sdr_ErrT (*mir_sdr_ApiVersion_t)(float *version);
typedef mir_sdr_ErrT (*mir_sdr_ResetUpdateFlags_t)(int resetGainUpdate, int resetRfUpdate, int resetFsUpdate);
#if defined(ANDROID) || defined(__ANDROID__)
typedef mir_sdr_ErrT (*mir_sdr_SetJavaReqCallback_t)(mir_sdr_SendJavaReq_t sendJavaReq);
#endif
typedef mir_sdr_ErrT (*mir_sdr_SetTransferMode_t)(mir_sdr_TransferModeT mode);
typedef mir_sdr_ErrT (*mir_sdr_DownConvert_t)(short *in, short *xi, short *xq, unsigned int samplesPerPacket, mir_sdr_If_kHzT ifType, unsigned int M, unsigned int preReset);
typedef mir_sdr_ErrT (*mir_sdr_SetParam_t)(unsigned int id, unsigned int value);
typedef mir_sdr_ErrT (*mir_sdr_SetPpm_t)(double ppm);
typedef mir_sdr_ErrT (*mir_sdr_SetLoMode_t)(mir_sdr_LoModeT loMode);
typedef mir_sdr_ErrT (*mir_sdr_SetGrAltMode_t)(int *gRidx, int LNAstate, int *gRdBsystem, int abs, int syncUpdate);
typedef mir_sdr_ErrT (*mir_sdr_DCoffsetIQimbalanceControl_t)(unsigned int DCenable, unsigned int IQenable);
typedef mir_sdr_ErrT (*mir_sdr_DecimateControl_t)(unsigned int enable, unsigned int decimationFactor, unsigned int wideBandSignal);
typedef mir_sdr_ErrT (*mir_sdr_AgcControl_t)(mir_sdr_AgcControlT enable, int setPoint_dBfs, int knee_dBfs, unsigned int decay_ms, unsigned int hang_ms, int syncUpdate, int LNAstate);
typedef mir_sdr_ErrT (*mir_sdr_StreamInit_t)(int *gRdB, double fsMHz, double rfMHz, mir_sdr_Bw_MHzT bwType, mir_sdr_If_kHzT ifType, int LNAstate, int *gRdBsystem, mir_sdr_SetGrModeT setGrMode, int *samplesPerPacket, mir_sdr_StreamCallback_t StreamCbFn, mir_sdr_GainChangeCallback_t GainChangeCbFn, void *cbContext);
typedef mir_sdr_ErrT (*mir_sdr_StreamUninit_t)(void);
typedef mir_sdr_ErrT (*mir_sdr_Reinit_t)(int *gRdB, double fsMHz, double rfMHz, mir_sdr_Bw_MHzT bwType, mir_sdr_If_kHzT ifType, mir_sdr_LoModeT loMode, int LNAstate, int *gRdBsystem, mir_sdr_SetGrModeT setGrMode, int *samplesPerPacket, mir_sdr_ReasonForReinitT reasonForReinit);
typedef mir_sdr_ErrT (*mir_sdr_GetGrByFreq_t)(double rfMHz, mir_sdr_BandT *band, int *gRdB, int LNAstate, int *gRdBsystem, mir_sdr_SetGrModeT setGrMode);
typedef mir_sdr_ErrT (*mir_sdr_DebugEnable_t)(unsigned int enable);
typedef mir_sdr_ErrT (*mir_sdr_GetCurrentGain_t)(mir_sdr_GainValuesT *gainVals);
typedef mir_sdr_ErrT (*mir_sdr_GetDevices_t)(mir_sdr_DeviceT *devices, unsigned int *numDevs, unsigned int maxDevs);
typedef mir_sdr_ErrT (*mir_sdr_SetDeviceIdx_t)(unsigned int idx);
typedef mir_sdr_ErrT (*mir_sdr_ReleaseDeviceIdx_t)(void);
typedef mir_sdr_ErrT (*mir_sdr_GetHwVersion_t)(unsigned char *ver);
typedef mir_sdr_ErrT (*mir_sdr_RSPII_AntennaControl_t)(mir_sdr_RSPII_AntennaSelectT select);
typedef mir_sdr_ErrT (*mir_sdr_RSPII_ExternalReferenceControl_t)(unsigned int output_enable);
typedef mir_sdr_ErrT (*mir_sdr_RSPII_BiasTControl_t)(unsigned int enable);
typedef mir_sdr_ErrT (*mir_sdr_RSPII_RfNotchEnable_t)(unsigned int enable);
typedef mir_sdr_ErrT (*mir_sdr_RSP_SetGr_t)(int gRdB, int LNAstate, int abs, int syncUpdate);
typedef mir_sdr_ErrT (*mir_sdr_RSP_SetGrLimits_t)(mir_sdr_MinGainReductionT minGr);
typedef mir_sdr_ErrT (*mir_sdr_AmPortSelect_t)(int port);
// API function definitions
#ifdef __cplusplus
extern "C"
{
#endif
_MIR_SDR_QUALIFIER mir_sdr_ErrT mir_sdr_Init(int gRdB, double fsMHz, double rfMHz, mir_sdr_Bw_MHzT bwType, mir_sdr_If_kHzT ifType, int *samplesPerPacket);
_MIR_SDR_QUALIFIER mir_sdr_ErrT mir_sdr_Uninit(void);
_MIR_SDR_QUALIFIER mir_sdr_ErrT mir_sdr_ReadPacket(short *xi, short *xq, unsigned int *firstSampleNum, int *grChanged, int *rfChanged, int *fsChanged);
_MIR_SDR_QUALIFIER mir_sdr_ErrT mir_sdr_SetRf(double drfHz, int abs, int syncUpdate);
_MIR_SDR_QUALIFIER mir_sdr_ErrT mir_sdr_SetFs(double dfsHz, int abs, int syncUpdate, int reCal);
_MIR_SDR_QUALIFIER mir_sdr_ErrT mir_sdr_SetGr(int gRdB, int abs, int syncUpdate);
_MIR_SDR_QUALIFIER mir_sdr_ErrT mir_sdr_SetGrParams(int minimumGr, int lnaGrThreshold);
_MIR_SDR_QUALIFIER mir_sdr_ErrT mir_sdr_SetDcMode(int dcCal, int speedUp);
_MIR_SDR_QUALIFIER mir_sdr_ErrT mir_sdr_SetDcTrackTime(int trackTime);
_MIR_SDR_QUALIFIER mir_sdr_ErrT mir_sdr_SetSyncUpdateSampleNum(unsigned int sampleNum);
_MIR_SDR_QUALIFIER mir_sdr_ErrT mir_sdr_SetSyncUpdatePeriod(unsigned int period);
_MIR_SDR_QUALIFIER mir_sdr_ErrT mir_sdr_ApiVersion(float *version); // Called by application to retrieve version of API used to create Dll
_MIR_SDR_QUALIFIER mir_sdr_ErrT mir_sdr_ResetUpdateFlags(int resetGainUpdate, int resetRfUpdate, int resetFsUpdate);
#if defined(ANDROID) || defined(__ANDROID__)
// This function provides a machanism for the Java application to set
// the callback function used to send request to it
_MIR_SDR_QUALIFIER mir_sdr_ErrT mir_sdr_SetJavaReqCallback(mir_sdr_SendJavaReq_t sendJavaReq);
#endif
_MIR_SDR_QUALIFIER mir_sdr_ErrT mir_sdr_SetTransferMode(mir_sdr_TransferModeT mode);
/*
* This following function will only operate correctly for the parameters detailed in the table below:
*
* IF freq | Signal BW | Input Sample Rate | Output Sample Rate | Required Decimation Factor
* -------------------------------------------------------------------------------------------
* 450kHz | 200kHz | 2000kHz | 500kHz | M=4
* 450kHz | 300kHz | 2000kHz | 500kHz | M=4
* 450kHz | 600kHz | 2000kHz | 1000kHz | M=2
* 2048kHz | 1536kHz | 8192kHz | 2048kHz | M=4
*
* If preReset == 1, then the filter state will be reset to 0 before starting the filtering operation.
*/
_MIR_SDR_QUALIFIER mir_sdr_ErrT mir_sdr_DownConvert(short *in, short *xi, short *xq, unsigned int samplesPerPacket, mir_sdr_If_kHzT ifType, unsigned int M, unsigned int preReset);
_MIR_SDR_QUALIFIER mir_sdr_ErrT mir_sdr_SetParam(unsigned int id, unsigned int value); // This MAY be called before mir_sdr_Init()
_MIR_SDR_QUALIFIER mir_sdr_ErrT mir_sdr_SetPpm(double ppm); // This MAY be called before mir_sdr_Init()
_MIR_SDR_QUALIFIER mir_sdr_ErrT mir_sdr_SetLoMode(mir_sdr_LoModeT loMode); // This MUST be called before mir_sdr_Init()/mir_sdr_StreamInit() - otherwise use mir_sdr_Reinit()
_MIR_SDR_QUALIFIER mir_sdr_ErrT mir_sdr_SetGrAltMode(int *gRidx, int LNAstate, int *gRdBsystem, int abs, int syncUpdate);
_MIR_SDR_QUALIFIER mir_sdr_ErrT mir_sdr_DCoffsetIQimbalanceControl(unsigned int DCenable, unsigned int IQenable);
/*
* Valid decimation factors for the following function are 2, 4, 8, 16 or 32 only
* Setting wideBandSignal=1 will use a slower filter but minimise the in-band roll-off
*/
_MIR_SDR_QUALIFIER mir_sdr_ErrT mir_sdr_DecimateControl(unsigned int enable, unsigned int decimationFactor, unsigned int wideBandSignal);
_MIR_SDR_QUALIFIER mir_sdr_ErrT mir_sdr_AgcControl(mir_sdr_AgcControlT enable, int setPoint_dBfs, int knee_dBfs, unsigned int decay_ms, unsigned int hang_ms, int syncUpdate, int LNAstate);
/*
* mir_sdr_StreamInit() replaces mir_sdr_Init() and sets up a thread (or chain of threads) inside the API which will perform the processing chain (shown below),
* and then use the callback function to return the data to the calling application/plug-in.
* Processing chain (in order):
* mir_sdr_ReadPacket()
* DCoffsetCorrection() - LIF mode - enabled by default
* DownConvert() - automatically enabled if the parameters shown for mir_sdr_DownConvert() are selected
* Decimate() - disabled by default
* DCoffsetCorrection() - ZIF mode - enabled by default
* IQimbalanceCorrection() - enabled by default
* Agc() - disabled by default
*/
_MIR_SDR_QUALIFIER mir_sdr_ErrT mir_sdr_StreamInit(int *gRdB, double fsMHz, double rfMHz, mir_sdr_Bw_MHzT bwType, mir_sdr_If_kHzT ifType, int LNAstate, int *gRdBsystem, mir_sdr_SetGrModeT setGrMode, int *samplesPerPacket, mir_sdr_StreamCallback_t StreamCbFn, mir_sdr_GainChangeCallback_t GainChangeCbFn, void *cbContext);
_MIR_SDR_QUALIFIER mir_sdr_ErrT mir_sdr_StreamUninit(void);
_MIR_SDR_QUALIFIER mir_sdr_ErrT mir_sdr_Reinit(int *gRdB, double fsMHz, double rfMHz, mir_sdr_Bw_MHzT bwType, mir_sdr_If_kHzT ifType, mir_sdr_LoModeT loMode, int LNAstate, int *gRdBsystem, mir_sdr_SetGrModeT setGrMode, int *samplesPerPacket, mir_sdr_ReasonForReinitT reasonForReinit);
_MIR_SDR_QUALIFIER mir_sdr_ErrT mir_sdr_GetGrByFreq(double rfMHz, mir_sdr_BandT *band, int *gRdB, int LNAstate, int *gRdBsystem, mir_sdr_SetGrModeT setGrMode);
_MIR_SDR_QUALIFIER mir_sdr_ErrT mir_sdr_DebugEnable(unsigned int enable);
_MIR_SDR_QUALIFIER mir_sdr_ErrT mir_sdr_GetCurrentGain(mir_sdr_GainValuesT *gainVals);
_MIR_SDR_QUALIFIER mir_sdr_ErrT mir_sdr_GetDevices(mir_sdr_DeviceT *devices, unsigned int *numDevs, unsigned int maxDevs);
_MIR_SDR_QUALIFIER mir_sdr_ErrT mir_sdr_SetDeviceIdx(unsigned int idx);
_MIR_SDR_QUALIFIER mir_sdr_ErrT mir_sdr_ReleaseDeviceIdx(void);
/*
* Uninit: ver = 0
* RSPI : ver = 1
* RSPII: ver = 2
*/
_MIR_SDR_QUALIFIER mir_sdr_ErrT mir_sdr_GetHwVersion(unsigned char *ver);
_MIR_SDR_QUALIFIER mir_sdr_ErrT mir_sdr_RSPII_AntennaControl(mir_sdr_RSPII_AntennaSelectT select);
_MIR_SDR_QUALIFIER mir_sdr_ErrT mir_sdr_RSPII_ExternalReferenceControl(unsigned int output_enable);
_MIR_SDR_QUALIFIER mir_sdr_ErrT mir_sdr_RSPII_BiasTControl(unsigned int enable);
_MIR_SDR_QUALIFIER mir_sdr_ErrT mir_sdr_RSPII_RfNotchEnable(unsigned int enable);
_MIR_SDR_QUALIFIER mir_sdr_ErrT mir_sdr_RSP_SetGr(int gRdB, int LNAstate, int abs, int syncUpdate);
_MIR_SDR_QUALIFIER mir_sdr_ErrT mir_sdr_RSP_SetGrLimits(mir_sdr_MinGainReductionT minGr);
_MIR_SDR_QUALIFIER mir_sdr_ErrT mir_sdr_AmPortSelect(int port); // If called after mir_sdr_Init() a call to mir_sdr_Reinit(..., reasonForReinit = mir_sdr_CHANGE_AM_PORT)
// is also required to change the port
#ifdef __cplusplus
}
#endif
#endif //MIR_SDR_H

View File

@@ -0,0 +1,597 @@
#
/*
* Copyright (C) 2014 .. 2017
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of Qt-DAB
*
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation version 2 of the License.
*
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Qt-DAB if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <QThread>
#include <QSettings>
#include <QHBoxLayout>
#include <QLabel>
#include "sdrplay-handler.h"
#include "sdrplayselect.h"
#define DEFAULT_GRED 40
sdrplayHandler::sdrplayHandler (QSettings *s) {
int err;
float ver;
mir_sdr_DeviceT devDesc [4];
mir_sdr_GainValuesT gainDesc;
sdrplaySelect *sdrplaySelector;
sdrplaySettings = s;
this -> myFrame = new QFrame (NULL);
setupUi (this -> myFrame);
this -> myFrame -> show ();
antennaSelector -> hide ();
this -> inputRate = Khz (2048);
_I_Buffer = NULL;
libraryLoaded = false;
#ifdef __MINGW32__
HKEY APIkey;
wchar_t APIkeyValue [256];
ULONG APIkeyValue_length = 255;
if (RegOpenKey (HKEY_LOCAL_MACHINE,
TEXT("Software\\MiricsSDR\\API"),
&APIkey) != ERROR_SUCCESS) {
fprintf (stderr,
"failed to locate API registry entry, error = %d\n",
(int)GetLastError());
delete myFrame;
throw (21);
}
RegQueryValueEx (APIkey,
(wchar_t *)L"Install_Dir",
NULL,
NULL,
(LPBYTE)&APIkeyValue,
(LPDWORD)&APIkeyValue_length);
// Ok, make explicit it is in the 64 bits section
wchar_t *x = wcscat (APIkeyValue, (wchar_t *)L"\\x86\\mir_sdr_api.dll");
// wchar_t *x = wcscat (APIkeyValue, (wchar_t *)L"\\x64\\mir_sdr_api.dll");
// fprintf (stderr, "Length of APIkeyValue = %d\n", APIkeyValue_length);
// wprintf (L"API registry entry: %s\n", APIkeyValue);
RegCloseKey(APIkey);
Handle = LoadLibrary (x);
if (Handle == NULL) {
fprintf (stderr, "Failed to open mir_sdr_api.dll\n");
delete myFrame;
throw (22);
}
#else
Handle = dlopen ("libusb-1.0.so", RTLD_NOW | RTLD_GLOBAL);
Handle = dlopen ("libmirsdrapi-rsp.so", RTLD_NOW);
if (Handle == NULL)
Handle = dlopen ("libmir_sdr.so", RTLD_NOW);
if (Handle == NULL) {
fprintf (stderr, "error report %s\n", dlerror ());
delete myFrame;
throw (23);
}
#endif
libraryLoaded = true;
bool success = loadFunctions ();
if (!success) {
#ifdef __MINGW32__
FreeLibrary (Handle);
#else
dlclose (Handle);
#endif
delete myFrame;
throw (23);
}
err = my_mir_sdr_ApiVersion (&ver);
if (ver < 2.05) {
fprintf (stderr, "sorry, library too old\n");
#ifdef __MINGW32__
FreeLibrary (Handle);
#else
dlclose (Handle);
#endif
delete myFrame;
throw (24);
}
api_version -> display (ver);
_I_Buffer = new RingBuffer<std::complex<float>>(1024 * 1024);
vfoFrequency = Khz (220000);
currentGred = DEFAULT_GRED;
//
// See if there are settings from previous incarnations
sdrplaySettings -> beginGroup ("sdrplaySettings");
coarseOffset =
sdrplaySettings -> value ("sdrplayOffset", 0). toInt ();
gainSlider -> setValue (
sdrplaySettings -> value ("sdrplayGain", 50). toInt ());
ppmControl -> setValue (
sdrplaySettings -> value ("sdrplay-ppm", 0). toInt ());
sdrplaySettings -> endGroup ();
setExternalGain (gainSlider -> value ());
set_ppmControl (ppmControl -> value ());
//
// and be prepared for future changes in the settings
connect (gainSlider, SIGNAL (valueChanged (int)),
this, SLOT (setExternalGain (int)));
connect (agcControl, SIGNAL (stateChanged (int)),
this, SLOT (agcControl_toggled (int)));
connect (ppmControl, SIGNAL (valueChanged (int)),
this, SLOT (set_ppmControl (int)));
my_mir_sdr_GetDevices (devDesc, &numofDevs, uint32_t (4));
if (numofDevs == 0) {
fprintf (stderr, "Sorry, no device found\n");
#ifdef __MINGW32__
FreeLibrary (Handle);
#else
dlclose (Handle);
#endif
delete myFrame;
throw (25);
}
if (numofDevs > 1) {
sdrplaySelector = new sdrplaySelect ();
for (deviceIndex = 0; deviceIndex < numofDevs; deviceIndex ++) {
#ifndef __MINGW32__
sdrplaySelector ->
addtoList (devDesc [deviceIndex]. DevNm);
#else
sdrplaySelector ->
addtoList (devDesc [deviceIndex]. SerNo);
#endif
}
deviceIndex = sdrplaySelector -> QDialog::exec ();
delete sdrplaySelector;
}
else
deviceIndex = 0;
serialNumber -> setText (devDesc [deviceIndex]. SerNo);
hwVersion = devDesc [deviceIndex]. hwVer;
fprintf (stderr, "hwVer = %d\n", hwVersion);
my_mir_sdr_SetDeviceIdx (deviceIndex);
antennaSelector -> hide ();
if (hwVersion == 2) {
antennaSelector -> show ();
connect (antennaSelector, SIGNAL (activated (const QString &)),
this, SLOT (set_antennaControl (const QString &)));
}
if (hwVersion == 255) {
nrBits = 14;
denominator = 16384;
}
else {
nrBits = 12;
denominator = 2048;
}
unsigned char text;
(void)my_mir_sdr_GetHwVersion (&text);
fprintf (stderr, "hwVersion = %o\n", hwVersion);
// my_mir_sdr_ResetUpdateFlags (1, 0, 0);
running. store (false);
agcMode = false;
}
sdrplayHandler::~sdrplayHandler (void) {
stopReader ();
if (!libraryLoaded)
return;
sdrplaySettings -> beginGroup ("sdrplaySettings");
sdrplaySettings -> setValue ("sdrplayOffset", coarseOffset);
sdrplaySettings -> setValue ("sdrplayGain", gainSlider -> value ());
sdrplaySettings -> setValue ("sdrplay-ppm", ppmControl -> value ());
sdrplaySettings -> endGroup ();
sdrplaySettings -> sync ();
delete myFrame;
if (numofDevs > 0)
my_mir_sdr_ReleaseDeviceIdx (deviceIndex);
if (_I_Buffer != NULL)
delete _I_Buffer;
#ifdef __MINGW32__
FreeLibrary (Handle);
#else
dlclose (Handle);
#endif
}
//
static inline
int16_t bankFor_sdr (int32_t freq) {
if (freq < 12 * MHz (1))
return mir_sdr_BAND_AM_LO;
if (freq < 30 * MHz (1))
return mir_sdr_BAND_AM_MID;
if (freq < 60 * MHz (1))
return mir_sdr_BAND_AM_HI;
if (freq < 120 * MHz (1))
return mir_sdr_BAND_VHF;
if (freq < 250 * MHz (1))
return mir_sdr_BAND_3;
if (freq < 420 * MHz (1))
return mir_sdr_BAND_X;
if (freq < 1000 * MHz (1))
return mir_sdr_BAND_4_5;
if (freq < 2000 * MHz (1))
return mir_sdr_BAND_L;
return -1;
}
int32_t sdrplayHandler::defaultFrequency (void) {
return Mhz (220);
}
void sdrplayHandler::setVFOFrequency (int32_t newFrequency) {
int gRdBSystem;
int samplesPerPacket;
mir_sdr_ErrT err;
int localGred = currentGred;
if (bankFor_sdr (newFrequency) == -1)
return;
if (!running. load ()) {
vfoFrequency = newFrequency;
return;
}
if (bankFor_sdr (newFrequency) == bankFor_sdr (vfoFrequency)) {
my_mir_sdr_SetRf (double (newFrequency), 1, 0);
vfoFrequency = newFrequency;
return;
}
err = my_mir_sdr_Reinit (&localGred,
double (inputRate) / Mhz (1),
double (newFrequency) / Mhz (1),
mir_sdr_BW_1_536,
mir_sdr_IF_Zero,
mir_sdr_LO_Undefined, // LOMode
0, // LNA enable
&gRdBSystem,
agcMode,
&samplesPerPacket,
mir_sdr_CHANGE_RF_FREQ);
if (err != mir_sdr_Success)
fprintf (stderr, "Error %d\n", err);
vfoFrequency = newFrequency;
}
int32_t sdrplayHandler::getVFOFrequency (void) {
return vfoFrequency;
}
void sdrplayHandler::setExternalGain (int newGain) {
// fprintf (stderr, "newGain = %d, slidervalue = %d\n",
// newGain,
// gainSlider -> value ());
if (newGain < 0 || newGain >= 102)
return;
currentGred = maxGain () - newGain;
(void) my_mir_sdr_SetGr (currentGred, 1, 0);
gainDisplay -> display (newGain);
}
int16_t sdrplayHandler::maxGain (void) {
return 101;
}
//
static
void myStreamCallback (int16_t *xi,
int16_t *xq,
uint32_t firstSampleNum,
int32_t grChanged,
int32_t rfChanged,
int32_t fsChanged,
uint32_t numSamples,
uint32_t reset,
void *cbContext) {
int16_t i;
sdrplayHandler *p = static_cast<sdrplayHandler *> (cbContext);
float denominator = p -> denominator;
std::complex<float> *localBuf =
(std::complex<float> *)alloca (numSamples * sizeof (std::complex<float>));
for (i = 0; i < (int)numSamples; i ++)
localBuf [i] = std::complex<float> (float (xi [i]) / denominator,
float (xq [i]) / denominator);
p -> _I_Buffer -> putDataIntoBuffer (localBuf, numSamples);
(void) firstSampleNum;
(void) grChanged;
(void) rfChanged;
(void) fsChanged;
(void) reset;
}
void myGainChangeCallback (uint32_t gRdB,
uint32_t lnaGRdB,
void *cbContext) {
// fprintf (stderr, "GainChangeCallback gives %X\n", gRdB);
(void)gRdB;
(void)lnaGRdB;
(void)cbContext;
}
bool sdrplayHandler::restartReader (void) {
int gRdBSystem;
int samplesPerPacket;
mir_sdr_ErrT err;
int localGRed = currentGred;
if (running. load ())
return true;
err = my_mir_sdr_StreamInit (&localGRed,
double (inputRate) / MHz (1),
double (vfoFrequency) / Mhz (1),
mir_sdr_BW_1_536,
mir_sdr_IF_Zero,
1, // lnaEnable do not know yet
&gRdBSystem,
mir_sdr_USE_SET_GR,
&samplesPerPacket,
(mir_sdr_StreamCallback_t)myStreamCallback,
(mir_sdr_GainChangeCallback_t)myGainChangeCallback,
this);
if (err != mir_sdr_Success) {
fprintf (stderr, "error code = %d\n", err);
return false;
}
my_mir_sdr_SetPpm (double (ppmControl -> value ()));
err = my_mir_sdr_SetDcMode (4, 1);
err = my_mir_sdr_SetDcTrackTime (63);
running. store (true);
return true;
}
void sdrplayHandler::stopReader (void) {
if (!running. load ())
return;
my_mir_sdr_StreamUninit ();
running. store (false);
}
//
// The brave old getSamples. For the sdrplay, we get
// size still in I/Q pairs
int32_t sdrplayHandler::getSamples (std::complex<float> *V, int32_t size) {
return _I_Buffer -> getDataFromBuffer (V, size);
}
int32_t sdrplayHandler::Samples (void) {
return _I_Buffer -> GetRingBufferReadAvailable ();
}
void sdrplayHandler::resetBuffer (void) {
_I_Buffer -> FlushRingBuffer ();
}
int16_t sdrplayHandler::bitDepth (void) {
return nrBits;
}
bool sdrplayHandler::loadFunctions (void) {
my_mir_sdr_StreamInit = (pfn_mir_sdr_StreamInit)
GETPROCADDRESS (this -> Handle,
"mir_sdr_StreamInit");
if (my_mir_sdr_StreamInit == NULL) {
fprintf (stderr, "Could not find mir_sdr_StreamInit\n");
return false;
}
my_mir_sdr_StreamUninit = (pfn_mir_sdr_StreamUninit)
GETPROCADDRESS (this -> Handle,
"mir_sdr_StreamUninit");
if (my_mir_sdr_StreamUninit == NULL) {
fprintf (stderr, "Could not find mir_sdr_StreamUninit\n");
return false;
}
my_mir_sdr_SetRf = (pfn_mir_sdr_SetRf)
GETPROCADDRESS (Handle, "mir_sdr_SetRf");
if (my_mir_sdr_SetRf == NULL) {
fprintf (stderr, "Could not find mir_sdr_SetRf\n");
return false;
}
my_mir_sdr_SetFs = (pfn_mir_sdr_SetFs)
GETPROCADDRESS (Handle, "mir_sdr_SetFs");
if (my_mir_sdr_SetFs == NULL) {
fprintf (stderr, "Could not find mir_sdr_SetFs\n");
return false;
}
my_mir_sdr_SetGr = (pfn_mir_sdr_SetGr)
GETPROCADDRESS (Handle, "mir_sdr_SetGr");
if (my_mir_sdr_SetGr == NULL) {
fprintf (stderr, "Could not find mir_sdr_SetGr\n");
return false;
}
my_mir_sdr_SetGrParams = (pfn_mir_sdr_SetGrParams)
GETPROCADDRESS (Handle, "mir_sdr_SetGrParams");
if (my_mir_sdr_SetGrParams == NULL) {
fprintf (stderr, "Could not find mir_sdr_SetGrParams\n");
return false;
}
my_mir_sdr_SetDcMode = (pfn_mir_sdr_SetDcMode)
GETPROCADDRESS (Handle, "mir_sdr_SetDcMode");
if (my_mir_sdr_SetDcMode == NULL) {
fprintf (stderr, "Could not find mir_sdr_SetDcMode\n");
return false;
}
my_mir_sdr_SetDcTrackTime = (pfn_mir_sdr_SetDcTrackTime)
GETPROCADDRESS (Handle, "mir_sdr_SetDcTrackTime");
if (my_mir_sdr_SetDcTrackTime == NULL) {
fprintf (stderr, "Could not find mir_sdr_SetDcTrackTime\n");
return false;
}
my_mir_sdr_SetSyncUpdateSampleNum = (pfn_mir_sdr_SetSyncUpdateSampleNum)
GETPROCADDRESS (Handle, "mir_sdr_SetSyncUpdateSampleNum");
if (my_mir_sdr_SetSyncUpdateSampleNum == NULL) {
fprintf (stderr, "Could not find mir_sdr_SetSyncUpdateSampleNum\n");
return false;
}
my_mir_sdr_SetSyncUpdatePeriod = (pfn_mir_sdr_SetSyncUpdatePeriod)
GETPROCADDRESS (Handle, "mir_sdr_SetSyncUpdatePeriod");
if (my_mir_sdr_SetSyncUpdatePeriod == NULL) {
fprintf (stderr, "Could not find mir_sdr_SetSyncUpdatePeriod\n");
return false;
}
my_mir_sdr_ApiVersion = (pfn_mir_sdr_ApiVersion)
GETPROCADDRESS (Handle, "mir_sdr_ApiVersion");
if (my_mir_sdr_ApiVersion == NULL) {
fprintf (stderr, "Could not find mir_sdr_ApiVersion\n");
return false;
}
my_mir_sdr_AgcControl = (pfn_mir_sdr_AgcControl)
GETPROCADDRESS (Handle, "mir_sdr_AgcControl");
if (my_mir_sdr_AgcControl == NULL) {
fprintf (stderr, "Could not find mir_sdr_AgcControl\n");
return false;
}
my_mir_sdr_Reinit = (pfn_mir_sdr_Reinit)
GETPROCADDRESS (Handle, "mir_sdr_Reinit");
if (my_mir_sdr_Reinit == NULL) {
fprintf (stderr, "Could not find mir_sdr_Reinit\n");
return false;
}
my_mir_sdr_SetPpm = (pfn_mir_sdr_SetPpm)
GETPROCADDRESS (Handle, "mir_sdr_SetPpm");
if (my_mir_sdr_SetPpm == NULL) {
fprintf (stderr, "Could not find mir_sdr_SetPpm\n");
return false;
}
my_mir_sdr_DebugEnable = (pfn_mir_sdr_DebugEnable)
GETPROCADDRESS (Handle, "mir_sdr_DebugEnable");
if (my_mir_sdr_DebugEnable == NULL) {
fprintf (stderr, "Could not find mir_sdr_DebugEnable\n");
return false;
}
my_mir_sdr_DCoffsetIQimbalanceControl =
(pfn_mir_sdr_DCoffsetIQimbalanceControl)
GETPROCADDRESS (Handle, "mir_sdr_DCoffsetIQimbalanceControl");
if (my_mir_sdr_DCoffsetIQimbalanceControl == NULL) {
fprintf (stderr, "Could not find mir_sdr_DCoffsetIQimbalanceControl\n");
return false;
}
my_mir_sdr_ResetUpdateFlags = (pfn_mir_sdr_ResetUpdateFlags)
GETPROCADDRESS (Handle, "mir_sdr_ResetUpdateFlags");
if (my_mir_sdr_ResetUpdateFlags == NULL) {
fprintf (stderr, "Could not find mir_sdr_ResetUpdateFlags\n");
return false;
}
my_mir_sdr_GetDevices = (pfn_mir_sdr_GetDevices)
GETPROCADDRESS (Handle, "mir_sdr_GetDevices");
if (my_mir_sdr_GetDevices == NULL) {
fprintf (stderr, "Could not find mir_sdr_GetDevices");
return false;
}
my_mir_sdr_GetCurrentGain = (pfn_mir_sdr_GetCurrentGain)
GETPROCADDRESS (Handle, "mir_sdr_GetCurrentGain");
if (my_mir_sdr_GetCurrentGain == NULL) {
fprintf (stderr, "Could not find mir_sdr_GetCurrentGain");
return false;
}
my_mir_sdr_GetHwVersion = (pfn_mir_sdr_GetHwVersion)
GETPROCADDRESS (Handle, "mir_sdr_GetHwVersion");
if (my_mir_sdr_GetHwVersion == NULL) {
fprintf (stderr, "Could not find mir_sdr_GetHwVersion");
return false;
}
my_mir_sdr_RSPII_AntennaControl = (pfn_mir_sdr_RSPII_AntennaControl)
GETPROCADDRESS (Handle, "mir_sdr_RSPII_AntennaControl");
if (my_mir_sdr_RSPII_AntennaControl == NULL) {
fprintf (stderr, "Could not find mir_sdr_RSPII_AntennaControl");
return false;
}
my_mir_sdr_SetDeviceIdx = (pfn_mir_sdr_SetDeviceIdx)
GETPROCADDRESS (Handle, "mir_sdr_SetDeviceIdx");
if (my_mir_sdr_SetDeviceIdx == NULL) {
fprintf (stderr, "Could not find mir_sdr_SetDeviceIdx");
return false;
}
my_mir_sdr_ReleaseDeviceIdx = (pfn_mir_sdr_ReleaseDeviceIdx)
GETPROCADDRESS (Handle, "mir_sdr_ReleaseDeviceIdx");
if (my_mir_sdr_ReleaseDeviceIdx == NULL) {
fprintf (stderr, "Could not find mir_sdr_ReleaseDeviceIdx");
return false;
}
return true;
}
void sdrplayHandler::agcControl_toggled (int agcMode) {
this -> agcMode = agcControl -> isChecked ();
my_mir_sdr_AgcControl (this -> agcMode, -currentGred, 0, 0, 0, 0, 1);
if (agcMode == 0)
setExternalGain (gainSlider -> value ());
}
void sdrplayHandler::set_ppmControl (int ppm) {
if (running. load ()) {
my_mir_sdr_SetPpm ((float)ppm);
my_mir_sdr_SetRf ((float)vfoFrequency, 1, 0);
}
}
void sdrplayHandler::set_antennaControl (const QString &s) {
mir_sdr_ErrT err;
if (hwVersion < 2) // should not happen
return;
if (s == "Antenna A")
err = my_mir_sdr_RSPII_AntennaControl (mir_sdr_RSPII_ANTENNA_A);
else
err = my_mir_sdr_RSPII_AntennaControl (mir_sdr_RSPII_ANTENNA_B);
}

View File

@@ -0,0 +1,158 @@
# /*
* Copyright (C) 2014 .. 2017
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of the Qt-DAB program
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __SDRPLAY_HANDLER__
#define __SDRPLAY_HANDLER__
#include <QObject>
#include <QFrame>
#include <QSettings>
#include <atomic>
#include "dab-constants.h"
#include "ringbuffer.h"
#include "virtual-input.h"
#include "ui_sdrplay-widget.h"
#include "mirsdrapi-rsp.h"
typedef void (*mir_sdr_StreamCallback_t)(int16_t *xi,
int16_t *xq,
uint32_t firstSampleNum,
int32_t grChanged,
int32_t rfChanged,
int32_t fsChanged,
uint32_t numSamples,
uint32_t reset,
void *cbContext);
typedef void (*mir_sdr_GainChangeCallback_t)(uint32_t gRdB,
uint32_t lnaGRdB,
void *cbContext);
#ifdef __MINGW32__
#define GETPROCADDRESS GetProcAddress
#else
#define GETPROCADDRESS dlsym
#endif
// Dll and ".so" function prototypes
typedef mir_sdr_ErrT (*pfn_mir_sdr_StreamInit) (int *gRdB, double fsMHz,
double rfMHz, mir_sdr_Bw_MHzT bwType, mir_sdr_If_kHzT ifType, int LNAEnable, int *gRdBsystem, int useGrAltMode, int *samplesPerPacket, mir_sdr_StreamCallback_t StreamCbFn, mir_sdr_GainChangeCallback_t GainChangeCbFn, void *cbContext);
typedef mir_sdr_ErrT (*pfn_mir_sdr_Reinit) (int *gRdB, double fsMHz,
double rfMHz, mir_sdr_Bw_MHzT bwType, mir_sdr_If_kHzT ifType,
mir_sdr_LoModeT, int, int*, int, int*, mir_sdr_ReasonForReinitT);
typedef mir_sdr_ErrT (*pfn_mir_sdr_StreamUninit)(void);
typedef mir_sdr_ErrT (*pfn_mir_sdr_SetRf)(double drfHz, int abs, int syncUpdate);
typedef mir_sdr_ErrT (*pfn_mir_sdr_SetFs)(double dfsHz, int abs, int syncUpdate, int reCal);
typedef mir_sdr_ErrT (*pfn_mir_sdr_SetGr)(int gRdB, int abs, int syncUpdate);
typedef mir_sdr_ErrT (*pfn_mir_sdr_SetGrParams)(int minimumGr, int lnaGrThreshold);
typedef mir_sdr_ErrT (*pfn_mir_sdr_SetDcMode)(int dcCal, int speedUp);
typedef mir_sdr_ErrT (*pfn_mir_sdr_SetDcTrackTime)(int trackTime);
typedef mir_sdr_ErrT (*pfn_mir_sdr_SetSyncUpdateSampleNum)(unsigned int sampleNum);
typedef mir_sdr_ErrT (*pfn_mir_sdr_SetSyncUpdatePeriod)(unsigned int period);
typedef mir_sdr_ErrT (*pfn_mir_sdr_ApiVersion)(float *version);
typedef mir_sdr_ErrT (*pfn_mir_sdr_ResetUpdateFlags)(int resetGainUpdate, int resetRfUpdate, int resetFsUpdate);
typedef mir_sdr_ErrT (*pfn_mir_sdr_AgcControl)(uint32_t, int, int, uint32_t,
uint32_t, int, int);
typedef mir_sdr_ErrT (*pfn_mir_sdr_DCoffsetIQimbalanceControl) (uint32_t, uint32_t);
typedef mir_sdr_ErrT (*pfn_mir_sdr_SetPpm)(double);
typedef mir_sdr_ErrT (*pfn_mir_sdr_DebugEnable)(uint32_t);
typedef mir_sdr_ErrT (*pfn_mir_sdr_GetDevices) (mir_sdr_DeviceT *, uint32_t *, uint32_t);
typedef mir_sdr_ErrT (*pfn_mir_sdr_GetCurrentGain) (mir_sdr_GainValuesT *);
typedef mir_sdr_ErrT (*pfn_mir_sdr_GetHwVersion) (unsigned char *);
typedef mir_sdr_ErrT (*pfn_mir_sdr_RSPII_AntennaControl) (mir_sdr_RSPII_AntennaSelectT);
typedef mir_sdr_ErrT (*pfn_mir_sdr_SetDeviceIdx) (unsigned int);
typedef mir_sdr_ErrT (*pfn_mir_sdr_ReleaseDeviceIdx) (unsigned int);
///////////////////////////////////////////////////////////////////////////
class sdrplayHandler: public virtualInput, public Ui_sdrplayWidget {
Q_OBJECT
public:
sdrplayHandler (QSettings *);
~sdrplayHandler (void);
void setVFOFrequency (int32_t);
int32_t getVFOFrequency (void);
int32_t defaultFrequency (void);
bool restartReader (void);
void stopReader (void);
int32_t getSamples (std::complex<float> *,
int32_t);
int32_t Samples (void);
void resetBuffer (void);
int16_t maxGain (void);
int16_t bitDepth (void);
//
// The buffer should be visible by the callback function
RingBuffer<std::complex<float>> *_I_Buffer;
float denominator;
private:
pfn_mir_sdr_StreamInit my_mir_sdr_StreamInit;
pfn_mir_sdr_Reinit my_mir_sdr_Reinit;
pfn_mir_sdr_StreamUninit my_mir_sdr_StreamUninit;
pfn_mir_sdr_SetRf my_mir_sdr_SetRf;
pfn_mir_sdr_SetFs my_mir_sdr_SetFs;
pfn_mir_sdr_SetGr my_mir_sdr_SetGr;
pfn_mir_sdr_SetGrParams my_mir_sdr_SetGrParams;
pfn_mir_sdr_SetDcMode my_mir_sdr_SetDcMode;
pfn_mir_sdr_SetDcTrackTime my_mir_sdr_SetDcTrackTime;
pfn_mir_sdr_SetSyncUpdateSampleNum
my_mir_sdr_SetSyncUpdateSampleNum;
pfn_mir_sdr_SetSyncUpdatePeriod
my_mir_sdr_SetSyncUpdatePeriod;
pfn_mir_sdr_ApiVersion my_mir_sdr_ApiVersion;
pfn_mir_sdr_ResetUpdateFlags
my_mir_sdr_ResetUpdateFlags;
pfn_mir_sdr_AgcControl my_mir_sdr_AgcControl;
pfn_mir_sdr_DCoffsetIQimbalanceControl
my_mir_sdr_DCoffsetIQimbalanceControl;
pfn_mir_sdr_SetPpm my_mir_sdr_SetPpm;
pfn_mir_sdr_DebugEnable my_mir_sdr_DebugEnable;
pfn_mir_sdr_GetDevices my_mir_sdr_GetDevices;
pfn_mir_sdr_GetCurrentGain my_mir_sdr_GetCurrentGain;
pfn_mir_sdr_GetHwVersion my_mir_sdr_GetHwVersion;
pfn_mir_sdr_RSPII_AntennaControl my_mir_sdr_RSPII_AntennaControl;
pfn_mir_sdr_SetDeviceIdx my_mir_sdr_SetDeviceIdx;
pfn_mir_sdr_ReleaseDeviceIdx my_mir_sdr_ReleaseDeviceIdx;
int16_t hwVersion;
uint32_t numofDevs;
int16_t deviceIndex;
bool loadFunctions (void);
QSettings *sdrplaySettings;
QFrame *myFrame;
int32_t inputRate;
int32_t vfoFrequency;
int currentGred;
bool libraryLoaded;
std::atomic<bool> running;
HINSTANCE Handle;
bool agcMode;
int16_t nrBits;
private slots:
void setExternalGain (int);
void agcControl_toggled (int);
void set_ppmControl (int);
void set_antennaControl (const QString &);
};
#endif

View File

@@ -0,0 +1,168 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>sdrplayWidget</class>
<widget class="QWidget" name="sdrplayWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>256</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>SDRplay control</string>
</property>
<widget class="QFrame" name="frame">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>211</width>
<height>291</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>10</x>
<y>80</y>
<width>101</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>mirics-SDRplay</string>
</property>
</widget>
<widget class="QLabel" name="statusLabel">
<property name="geometry">
<rect>
<x>16</x>
<y>180</y>
<width>121</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLCDNumber" name="api_version">
<property name="geometry">
<rect>
<x>20</x>
<y>40</y>
<width>91</width>
<height>21</height>
</rect>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<property name="segmentStyle">
<enum>QLCDNumber::Flat</enum>
</property>
</widget>
<widget class="QSlider" name="gainSlider">
<property name="geometry">
<rect>
<x>170</x>
<y>29</y>
<width>20</width>
<height>171</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
<widget class="QLCDNumber" name="gainDisplay">
<property name="geometry">
<rect>
<x>160</x>
<y>0</y>
<width>41</width>
<height>23</height>
</rect>
</property>
<property name="digitCount">
<number>3</number>
</property>
<property name="segmentStyle">
<enum>QLCDNumber::Flat</enum>
</property>
</widget>
<widget class="QCheckBox" name="agcControl">
<property name="geometry">
<rect>
<x>110</x>
<y>140</y>
<width>51</width>
<height>25</height>
</rect>
</property>
<property name="text">
<string>agc</string>
</property>
</widget>
<widget class="QSpinBox" name="ppmControl">
<property name="geometry">
<rect>
<x>10</x>
<y>15</y>
<width>81</width>
<height>21</height>
</rect>
</property>
<property name="minimum">
<number>-200</number>
</property>
<property name="maximum">
<number>200</number>
</property>
</widget>
<widget class="QLabel" name="serialNumber">
<property name="geometry">
<rect>
<x>10</x>
<y>210</y>
<width>141</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QComboBox" name="antennaSelector">
<property name="geometry">
<rect>
<x>10</x>
<y>230</y>
<width>181</width>
<height>36</height>
</rect>
</property>
<item>
<property name="text">
<string>Antenna A</string>
</property>
</item>
<item>
<property name="text">
<string>Antenna B</string>
</property>
</item>
</widget>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,68 @@
#
/*
* Copyright (C) 2014 .. 2017
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of the Qt-DAB program
* Many of the ideas as implemented in Qt-DAB are derived from
* other work, made available through the GNU general Public License.
* All copyrights of the original authors are recognized.
*
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <stdio.h>
#include <QVBoxLayout>
#include "sdrplayselect.h"
//
// Whenever there are two or more sdrplay devices connected
// to the computer, the user is asked to make a choice.
sdrplaySelect::sdrplaySelect (void) {
toptext = new QLabel (this);
toptext -> setText ("Select an rsp device");
selectorDisplay = new QListView (this);
QVBoxLayout *layOut = new QVBoxLayout;
layOut -> addWidget (selectorDisplay);
layOut -> addWidget (toptext);
setWindowTitle (tr("RSP select"));
setLayout (layOut);
Devices = QStringList ();
deviceList. setStringList (Devices);
selectorDisplay -> setModel (&deviceList);
connect (selectorDisplay, SIGNAL (clicked (QModelIndex)),
this, SLOT (select_rsp (QModelIndex)));
selectedItem = -1;
}
sdrplaySelect::~sdrplaySelect (void) {
}
void sdrplaySelect::addtoList (const char *v) {
QString s (v);
Devices << s;
deviceList. setStringList (Devices);
selectorDisplay -> setModel (&deviceList);
selectorDisplay -> adjustSize ();
adjustSize ();
}
void sdrplaySelect::select_rsp (QModelIndex s) {
QDialog::done (s. row ());
}

View File

@@ -0,0 +1,50 @@
#
/*
* Copyright (C) 2014 .. 2017
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of the Qt-DAB program
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#
#ifndef __SDRPLAY_SELECT__
#define __SDRPLAY_SELECT__
#
#include <QDialog>
#include <QLabel>
#include <QListView>
#include <QStringListModel>
#include <QStringList>
#include <stdint.h>
class sdrplaySelect: public QDialog {
Q_OBJECT
public:
sdrplaySelect (void);
~sdrplaySelect (void);
void addtoList (const char *);
private:
QLabel *toptext;
QListView *selectorDisplay;
QStringListModel deviceList;
QStringList Devices;
int16_t selectedItem;
private slots:
void select_rsp (QModelIndex);
};
#endif

243
devices/uhd/uhd-input.cpp Normal file
View File

@@ -0,0 +1,243 @@
/*
*
* Copyright (C) 2015
* Sebastian Held <sebastian.held@imst.de>
*
* This file is part of Qt-DAB
*
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Qt-DAB-J; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "uhd-input.h"
#include <uhd/types/tune_request.hpp>
#include <uhd/utils/thread_priority.hpp>
#include <uhd/utils/safe_main.hpp>
#include <uhd/exception.hpp>
#include <boost/program_options.hpp>
#include <boost/format.hpp>
#include <boost/thread.hpp>
#include <iostream>
#include <fstream>
#include <csignal>
#include <complex>
uhd_streamer::uhd_streamer (uhdInput *d) {
m_theStick = d;
m_stop_signal_called = false;
//create a receive streamer
uhd::stream_args_t stream_args( "fc32", "sc16" );
m_theStick -> m_rx_stream =
m_theStick -> m_usrp -> get_rx_stream (stream_args);
//setup streaming
uhd::stream_cmd_t stream_cmd (uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS );
stream_cmd.num_samps = 0;
stream_cmd.stream_now = true;
stream_cmd.time_spec = uhd::time_spec_t();
m_theStick -> m_rx_stream -> issue_stream_cmd (stream_cmd);
start();
}
void uhd_streamer::stop (void) {
m_stop_signal_called = true;
while (isRunning ())
wait(1);
}
void uhd_streamer::run (void) {
while (!m_stop_signal_called) {
// get write position, ignore data2 and size2
int32_t size1, size2;
void *data1, *data2;
m_theStick -> theBuffer -> GetRingBufferWriteRegions (10000,
&data1,
&size1,
&data2,
&size2);
if (size1 == 0) {
// no room in ring buffer, wait for main thread to process the data
usleep (100); // wait 100 us
continue;
}
uhd::rx_metadata_t md;
size_t num_rx_samps =
m_theStick -> m_rx_stream -> recv (data1, size1, md, 1.0);
m_theStick -> theBuffer -> AdvanceRingBufferWriteIndex (num_rx_samps);
if (md.error_code == uhd::rx_metadata_t::ERROR_CODE_TIMEOUT) {
std::cout << boost::format ("Timeout while streaming") << std::endl;
continue;
}
if (md.error_code == uhd::rx_metadata_t::ERROR_CODE_OVERFLOW) {
std::cerr << boost::format ("Got an overflow indication") << std::endl;
continue;
}
// if (md.error_code != uhd::rx_metadata_t::ERROR_CODE_NONE) {
// std::cerr << boost::format("Receiver error: %s") % md.strerror() << std::endl;
// continue;
// }
}
}
uhdInput::uhdInput (QSettings *s, bool *success ) {
this -> uhdSettings = s;
this -> myFrame = new QFrame (NULL);
setupUi (this -> myFrame);
this -> myFrame -> show ();
this -> inputRate = Khz (2048);
this -> ringbufferSize = 1024; // blocks of 1024 complexes
this -> theBuffer = NULL; // also indicates good init or not
*success = false;
lastFrequency = 100000;
m_workerHandle = 0;
// create a usrp device.
std::string args;
std::cout << std::endl;
std::cout << boost::format("Creating the usrp device with: %s...") % args << std::endl;
try {
m_usrp = uhd::usrp::multi_usrp::make (args);
// Lock mboard clocks
std::string ref("internal");
m_usrp -> set_clock_source (ref);
std::cout << boost::format("Using Device: %s") % m_usrp->get_pp_string() << std::endl;
// set sample rate
m_usrp -> set_rx_rate (inputRate);
inputRate = m_usrp -> get_rx_rate ();
std::cout << boost::format("Actual RX Rate: %f Msps...") % (inputRate/1e6) << std::endl << std::endl;
// allocate the rx buffer
theBuffer = new RingBuffer<std::complex<float> >(ringbufferSize * 1024);
}
catch (...) {
fprintf (stderr, "No luck with uhd\n");
return;
}
// some housekeeping for the local frame
externalGain -> setMaximum (maxGain ());
uhdSettings -> beginGroup ("uhdSettings");
externalGain -> setValue (
uhdSettings -> value ("externalGain", 40). toInt ());
f_correction -> setValue (
uhdSettings -> value ("f_correction", 0). toInt ());
KhzOffset -> setValue (
uhdSettings -> value ("KhzOffset", 0). toInt ());
uhdSettings -> endGroup ();
setExternalGain (externalGain -> value ());
set_KhzOffset (KhzOffset -> value ());
connect (externalGain, SIGNAL (valueChanged (int)),
this, SLOT (setExternalGain (int)));
connect (KhzOffset, SIGNAL (valueChanged (int)),
this, SLOT (set_KhzOffset (int)));
*success = true;
}
uhdInput::~uhdInput (void) {
if (theBuffer != NULL) {
stopReader();
uhdSettings -> beginGroup ("uhdSettings");
uhdSettings -> setValue ("externalGain",
externalGain -> value ());
uhdSettings -> setValue ("f_correction",
f_correction -> value ());
uhdSettings -> setValue ("KhzOffset",
KhzOffset -> value ());
uhdSettings -> endGroup ();
delete theBuffer;
}
delete myFrame;
}
void uhdInput::setVFOFrequency (int32_t freq) {
std::cout << boost::format ("Setting RX Freq: %f MHz...") % (freq/1e6) << std::endl;
uhd::tune_request_t tune_request (freq);
m_usrp->set_rx_freq (tune_request);
}
int32_t uhdInput::getVFOFrequency (void) {
int32_t freq = m_usrp -> get_rx_freq ();
std::cout << boost::format("Actual RX Freq: %f MHz...") % (freq/1e6) << std::endl << std::endl;
return freq;
}
bool uhdInput::restartReader (void) {
if (m_workerHandle != 0)
return true;
theBuffer -> FlushRingBuffer ();
m_workerHandle = new uhd_streamer (this);
return true;
}
void uhdInput::stopReader (void) {
if (m_workerHandle == 0)
return;
m_workerHandle -> stop ();
delete m_workerHandle;
m_workerHandle = 0;
}
//
// not used:
uint8_t uhdInput::myIdentity (void) {
return DAB_STICK;
}
int32_t uhdInput::getSamples (std::complex<float> *v, int32_t size) {
size = std::min ((uint32_t)size,
(uint32_t)(theBuffer -> GetRingBufferReadAvailable ()));
theBuffer -> getDataFromBuffer (v, size);
return size;
}
int32_t uhdInput::Samples (void) {
return theBuffer -> GetRingBufferReadAvailable();
}
void uhdInput::resetBuffer (void) {
theBuffer -> FlushRingBuffer();
}
void uhdInput::set_fCorrection (int32_t f) {
(void)f;
}
int16_t uhdInput::maxGain (void) {
uhd::gain_range_t range = m_usrp->get_rx_gain_range();
return range.stop();
}
void uhdInput::setExternalGain (int32_t gain) {
std::cout << boost::format("Setting RX Gain: %f dB...") % gain << std::endl;
m_usrp -> set_rx_gain (gain);
double gain_f = m_usrp -> get_rx_gain ();
std::cout << boost::format("Actual RX Gain: %f dB...") % gain_f << std::endl << std::endl;
}
void uhdInput::set_KhzOffset (int32_t o) {
vfoOffset = o;
}
int16_t uhdInput::bitDepth (void) {
return 16;
}

87
devices/uhd/uhd-input.h Normal file
View File

@@ -0,0 +1,87 @@
#
/*
* Copyright (C) 2015
* Sebastian Held <sebastian.held@imst.de>
*
* This file is part of the SDR-J.
* Many of the ideas as implemented in SDR-J are derived from
* other work, made available through the GNU general Public License.
* All copyrights of the original authors are recognized.
*
* SDR-J is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* SDR-J is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with SDR-J; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __UHDINPUT
#define __UHDINPUT
#include "virtual-input.h"
#include <uhd/usrp/multi_usrp.hpp>
#include "ringbuffer.h"
#include <QThread>
#include <QSettings>
#include <QFrame>
#include <QObject>
#include "ui_uhd-widget.h"
class uhdInput;
//
// the real worker:
class uhd_streamer : public QThread {
public:
uhd_streamer (uhdInput *d);
void stop();
private:
uhdInput* m_theStick;
virtual void run();
volatile bool m_stop_signal_called;
};
class uhdInput: public virtualInput, public Ui_uhdWidget {
Q_OBJECT
friend class uhd_streamer;
public:
uhdInput (QSettings *dabSettings, bool *success);
virtual ~uhdInput (void);
virtual void setVFOFrequency (int32_t freq);
virtual int32_t getVFOFrequency (void);
bool legalFrequency (int32_t) {return true;}
int32_t defaultFrequency (void) {return 100000000;}
virtual bool restartReader (void);
virtual void stopReader (void);
virtual int32_t getSamples (std::complex<float> *, int32_t size);
virtual int32_t Samples (void);
uint8_t myIdentity (void);
virtual void resetBuffer (void);
virtual int16_t maxGain (void);
int16_t bitDepth (void);
//
private:
QSettings *uhdSettings;
QFrame *myFrame;
uhd::usrp::multi_usrp::sptr m_usrp;
uhd::rx_streamer::sptr m_rx_stream;
RingBuffer<std::complex<float> > *theBuffer;
uhd_streamer* m_workerHandle;
int32_t inputRate;
int32_t ringbufferSize;
private slots:
void setExternalGain (int);
void set_fCorrection (int);
void set_KhzOffset (int);
};
#endif

145
devices/uhd/uhd-widget.ui Normal file
View File

@@ -0,0 +1,145 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>uhdWidget</class>
<widget class="QWidget" name="uhdWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>256</width>
<height>133</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QFrame" name="frame">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>211</width>
<height>221</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>10</x>
<y>100</y>
<width>101</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>uhd device</string>
</property>
</widget>
<widget class="QSpinBox" name="externalGain">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>91</width>
<height>21</height>
</rect>
</property>
<property name="maximum">
<number>103</number>
</property>
<property name="value">
<number>55</number>
</property>
</widget>
<widget class="QSpinBox" name="f_correction">
<property name="geometry">
<rect>
<x>0</x>
<y>20</y>
<width>91</width>
<height>21</height>
</rect>
</property>
<property name="minimum">
<number>-100</number>
</property>
<property name="maximum">
<number>100</number>
</property>
</widget>
<widget class="QSpinBox" name="KhzOffset">
<property name="geometry">
<rect>
<x>0</x>
<y>40</y>
<width>91</width>
<height>21</height>
</rect>
</property>
<property name="maximum">
<number>1000000</number>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>100</x>
<y>40</y>
<width>41</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>KHz</string>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>100</x>
<y>20</y>
<width>51</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>ppm</string>
</property>
</widget>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>100</x>
<y>0</y>
<width>101</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>gain reductiom</string>
</property>
</widget>
<widget class="QLabel" name="statusLabel">
<property name="geometry">
<rect>
<x>16</x>
<y>180</y>
<width>121</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
</widget>
</widget>
<resources/>
<connections/>
</ui>

77
devices/virtual-input.cpp Normal file
View File

@@ -0,0 +1,77 @@
#
/*
* Copyright (C) 2010, 2011, 2012
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of the Qt-DAB
*
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Qt-DAB-J; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Default (void) implementation of
* virtual input class
*/
#include "virtual-input.h"
virtualInput::virtualInput (void) {
lastFrequency = 100000;
vfoOffset = 0;
theGain = 50;
coarseOffset = 0;
}
virtualInput::~virtualInput (void) {
}
void virtualInput::setVFOFrequency (int32_t f) {
lastFrequency = f;
}
int32_t virtualInput::getVFOFrequency (void) {
return lastFrequency;
}
bool virtualInput::restartReader (void) {
return true;
}
void virtualInput::stopReader (void) {
}
int32_t virtualInput::getSamples (std::complex<float> *v, int32_t amount) {
(void)v;
(void)amount;
return amount;
}
int32_t virtualInput::Samples (void) {
return 1024;
}
int32_t virtualInput::defaultFrequency (void) {
return Khz (220000);
}
void virtualInput::resetBuffer (void) {
}
void virtualInput::setOffset (int32_t o) {
coarseOffset = o;
}
int32_t virtualInput::getOffset (void) {
return coarseOffset;
}

56
devices/virtual-input.h Normal file
View File

@@ -0,0 +1,56 @@
#
/*
* Copyright (C) 2014 .. 2017
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of the Qt-DAB program
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* We have to create a simple virtual class here, since we
* want the interface with different devices (including filehandling)
* to be transparent
*/
#ifndef __VIRTUAL_INPUT__
#define __VIRTUAL_INPUT__
#include <stdint.h>
#include "dab-constants.h"
#include <QObject>
class virtualInput: public QObject {
public:
virtualInput (void);
virtual ~virtualInput (void);
virtual void setVFOFrequency (int32_t);
virtual int32_t getVFOFrequency (void);
virtual int32_t defaultFrequency(void);
virtual bool restartReader (void);
virtual void stopReader (void);
virtual int32_t getSamples (std::complex<float> *, int32_t);
virtual int32_t Samples (void);
virtual void resetBuffer (void);
virtual int16_t bitDepth (void) { return 10;}
virtual int32_t getOffset (void);
virtual void setOffset (int32_t);
//
protected:
int32_t lastFrequency;
int32_t vfoOffset;
int theGain;
int32_t coarseOffset;
};
#endif

View File

@@ -0,0 +1,179 @@
#
/*
* Copyright (C) 2013 .. 2017
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of the Qt-DAB program
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/time.h>
#include <time.h>
#include <QString>
#include "wavfiles.h"
static inline
int64_t getMyTime (void) {
struct timeval tv;
gettimeofday (&tv, NULL);
return ((int64_t)tv. tv_sec * 1000000 + (int64_t)tv. tv_usec);
}
#define __BUFFERSIZE 8 * 32768
wavFiles::wavFiles (QString f) {
SF_INFO *sf_info;
fileName = f;
myFrame = new QFrame;
setupUi (myFrame);
myFrame -> show ();
tester = 3;
readerOK = false;
_I_Buffer = new RingBuffer<std::complex<float>>(__BUFFERSIZE);
sf_info = (SF_INFO *)alloca (sizeof (SF_INFO));
sf_info -> format = 0;
filePointer = sf_open (f. toUtf8 (). data (), SFM_READ, sf_info);
if (filePointer == NULL) {
fprintf (stderr, "file %s no legitimate sound file\n",
f. toUtf8 ().data ());
delete myFrame;
throw (24);
}
if ((sf_info -> samplerate != 2048000) ||
(sf_info -> channels != 2)) {
fprintf (stderr, "This is not a recorded dab file, sorry\n");
sf_close (filePointer);
delete myFrame;
throw (25);
}
nameofFile -> setText (f);
readerOK = true;
readerPausing = true;
currPos = 0;
// start ();
}
wavFiles::~wavFiles (void) {
ExitCondition = true;
if (readerOK) {
while (isRunning ())
usleep (100);
sf_close (filePointer);
}
delete _I_Buffer;
delete myFrame;
}
bool wavFiles::restartReader (void) {
if (readerOK)
readerPausing = false;
start ();
return readerOK;
}
void wavFiles::stopReader (void) {
if (readerOK)
readerPausing = true;
}
// size is in I/Q pairs
int32_t wavFiles::getSamples (std::complex<float> *V, int32_t size) {
int32_t amount;
if (filePointer == NULL)
return 0;
while (_I_Buffer -> GetRingBufferReadAvailable () < size)
if (readerPausing)
usleep (100000);
else
usleep (100);
amount = _I_Buffer -> getDataFromBuffer (V, size);
return amount;
}
int32_t wavFiles::Samples (void) {
return _I_Buffer -> GetRingBufferReadAvailable ();
}
void wavFiles::run (void) {
int32_t t, i;
std::complex<float> *bi;
int32_t bufferSize = 32768;
int64_t period;
int64_t nextStop;
if (!readerOK)
return;
ExitCondition = false;
period = (32768 * 1000) / 2048; // full IQś read
fprintf (stderr, "Period = %ld\n", period);
bi = new std::complex<float> [bufferSize];
nextStop = getMyTime ();
while (!ExitCondition) {
if (readerPausing) {
usleep (1000);
nextStop = getMyTime ();
continue;
}
while (_I_Buffer -> WriteSpace () < bufferSize) {
if (ExitCondition)
break;
usleep (100);
}
nextStop += period;
t = readBuffer (bi, bufferSize);
if (t < bufferSize) {
for (i = t; i < bufferSize; i ++)
bi [i] = 0;
t = bufferSize;
}
_I_Buffer -> putDataIntoBuffer (bi, bufferSize);
if (nextStop - getMyTime () > 0)
usleep (nextStop - getMyTime ());
}
fprintf (stderr, "taak voor replay eindigt hier\n"); fflush (stderr);
}
/*
* length is number of uints that we read.
*/
int32_t wavFiles::readBuffer (std::complex<float> *data, int32_t length) {
int32_t i, n;
float temp [2 * length];
n = sf_readf_float (filePointer, temp, length);
if (n < length) {
sf_seek (filePointer, 0, SEEK_SET);
fprintf (stderr, "End of file, restarting\n");
}
for (i = 0; i < n; i ++)
data [i] = std::complex<float> (temp [2 * i], temp [2 * i + 1]);
return n & ~01;
}

View File

@@ -0,0 +1,61 @@
#
/*
* Copyright (C) 2013 .. 2017
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of the Qt-DAB program
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __WAV_FILES__
#define __WAV_FILES__
#include <QThread>
#include <QString>
#include <QFrame>
#include <sndfile.h>
#include "dab-constants.h"
#include "virtual-input.h"
#include "ringbuffer.h"
#include "ui_filereader-widget.h"
class wavFiles: public virtualInput,
public Ui_filereaderWidget, QThread {
public:
wavFiles (QString);
~wavFiles (void);
int32_t getSamples (std::complex<float> *, int32_t);
uint8_t myIdentity (void);
int32_t Samples (void);
bool restartReader (void);
void stopReader (void);
private:
QString fileName;
int tester;
QFrame *myFrame;
virtual void run (void);
int32_t readBuffer (std::complex<float> *, int32_t);
RingBuffer<std::complex<float>> *_I_Buffer;
int32_t bufferSize;
SNDFILE *filePointer;
bool readerOK;
bool readerPausing;
bool ExitCondition;
int64_t currPos;
};
#endif

409
forms/dabradio.ui Normal file
View File

@@ -0,0 +1,409 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>dabradio</class>
<widget class="QMainWindow" name="dabradio">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>453</width>
<height>405</height>
</rect>
</property>
<property name="windowTitle">
<string>dabradio</string>
</property>
<widget class="QWidget" name="centralwidget">
<widget class="QComboBox" name="streamoutSelector">
<property name="geometry">
<rect>
<x>10</x>
<y>150</y>
<width>191</width>
<height>31</height>
</rect>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Select a device (channel) for the audio output. On program start up a default is chosen.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<item>
<property name="text">
<string>Select audio device</string>
</property>
</item>
</widget>
<widget class="QComboBox" name="channelSelector">
<property name="geometry">
<rect>
<x>100</x>
<y>110</y>
<width>101</width>
<height>41</height>
</rect>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Select the DAB channel.&lt;/p&gt;&lt;p&gt;This depends on the band chosen.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QLabel" name="timeDisplay">
<property name="geometry">
<rect>
<x>30</x>
<y>300</y>
<width>161</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="dynamicLabel">
<property name="geometry">
<rect>
<x>20</x>
<y>340</y>
<width>401</width>
<height>41</height>
</rect>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Dynamic label (DLS)&lt;/p&gt;&lt;p&gt;The selected program may carry some textual information, that information is displayed here.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
<widget class="QListView" name="ensembleDisplay">
<property name="geometry">
<rect>
<x>210</x>
<y>10</y>
<width>221</width>
<height>321</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="versionName">
<property name="geometry">
<rect>
<x>20</x>
<y>280</y>
<width>171</width>
<height>20</height>
</rect>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Copyright (C) 2016, 2017 Jan van Katwijk (J.vanKatwijk@gmail.com), Lazy Chair Programming&lt;/p&gt;&lt;p&gt;Qt-DAB is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="syncedLabel">
<property name="geometry">
<rect>
<x>90</x>
<y>1</y>
<width>51</width>
<height>21</height>
</rect>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>190</red>
<green>190</green>
<blue>190</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Indicator for time synchronization&lt;/p&gt;&lt;p&gt;Green means that the software recognizes that there are DAB frames, not necessarily that the software is able to decode the DAB stream.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="text">
<string>Sync</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLCDNumber" name="ensembleId">
<property name="geometry">
<rect>
<x>120</x>
<y>70</y>
<width>71</width>
<height>31</height>
</rect>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Ensemble ID&lt;/p&gt;&lt;p&gt;The hecadecimal number shows the ensemble ID.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="digitCount">
<number>4</number>
</property>
<property name="mode">
<enum>QLCDNumber::Hex</enum>
</property>
<property name="segmentStyle">
<enum>QLCDNumber::Flat</enum>
</property>
</widget>
<widget class="QLabel" name="ensembleName">
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>191</width>
<height>31</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>18</pointsize>
</font>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Ensemble name&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string/>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
<widget class="QLabel" name="stereoLabel">
<property name="geometry">
<rect>
<x>160</x>
<y>0</y>
<width>41</width>
<height>21</height>
</rect>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>190</red>
<green>190</green>
<blue>190</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>190</red>
<green>190</green>
<blue>190</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Stereo label&lt;/p&gt;&lt;p&gt;Green means that the program is in stereo.&lt;br/&gt;Red means no audio or mono transmission.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="text">
<string>ST</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QPushButton" name="showProgramData">
<property name="geometry">
<rect>
<x>10</x>
<y>60</y>
<width>91</width>
<height>51</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>11</pointsize>
</font>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Push this button for further technical information about the selected program&lt;/p&gt;&lt;p&gt;Push again for closing the pop-up-window.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Technical
details</string>
</property>
</widget>
<widget class="QPushButton" name="scanButton">
<property name="geometry">
<rect>
<x>10</x>
<y>110</y>
<width>91</width>
<height>41</height>
</rect>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Push this button for starting a scan over the channels in the current selected band (default VHF Band III or optionally L-Band)&lt;/p&gt;&lt;p&gt;During the scan a list of all services of all ensembles will be built and presented. One may select&lt;/p&gt;&lt;p&gt;a service from this list.&lt;/p&gt;&lt;p&gt;Push again to stop scanning.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Scan band</string>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>40</x>
<y>0</y>
<width>21</width>
<height>21</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>14</pointsize>
</font>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;DAB2 copyright:&lt;/p&gt;&lt;p&gt;J van Katwijk, Lazy Chair Computing. J.vanKatwijk@gmail.com&lt;/p&gt;&lt;p&gt;Copyright of the Qt toolkit used: the Qt Company&lt;/p&gt;&lt;p&gt;Copyright of the libraries used for SDRplay, rtl-sdr based sticks, AIRspy, portaudio, libsndfile and libsamplerate libfaad to their developers&lt;/p&gt;&lt;p&gt;Copyright of the MP2 library used Martin J Fiedler&lt;/p&gt;&lt;p&gt;Copyright of the firecode checker: Gnu Radio&lt;/p&gt;&lt;p&gt;Copyright of the viterbi decoder kernel: the Spiral project&lt;/p&gt;&lt;p&gt;Copyright of the Reed Solomon Decoder software: Phil Karns&lt;/p&gt;&lt;p&gt;All copyrights gratefully acknowledged&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;DAB2 (an SDR-J program) is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>©</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QwtPlot" name="spectrumDisplay">
<property name="geometry">
<rect>
<x>10</x>
<y>180</y>
<width>191</width>
<height>91</height>
</rect>
</property>
</widget>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<customwidgets>
<customwidget>
<class>QwtPlot</class>
<extends>QFrame</extends>
<header>qwt_plot.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

528
forms/technical_data.ui Normal file
View File

@@ -0,0 +1,528 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>technical_data</class>
<widget class="QWidget" name="technical_data">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>249</width>
<height>561</height>
</rect>
</property>
<property name="windowTitle">
<string>Technical Details</string>
</property>
<widget class="QLCDNumber" name="startAddressDisplay">
<property name="geometry">
<rect>
<x>160</x>
<y>190</y>
<width>64</width>
<height>23</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="segmentStyle">
<enum>QLCDNumber::Flat</enum>
</property>
</widget>
<widget class="QLCDNumber" name="lengthDisplay">
<property name="geometry">
<rect>
<x>160</x>
<y>220</y>
<width>64</width>
<height>23</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="segmentStyle">
<enum>QLCDNumber::Flat</enum>
</property>
</widget>
<widget class="QLabel" name="language">
<property name="geometry">
<rect>
<x>120</x>
<y>350</y>
<width>101</width>
<height>21</height>
</rect>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Language (defined by provider)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="text">
<string>language</string>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>20</x>
<y>190</y>
<width>141</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Start Address of CU</string>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>20</x>
<y>220</y>
<width>121</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Used CUs</string>
</property>
</widget>
<widget class="QLabel" name="programType">
<property name="geometry">
<rect>
<x>120</x>
<y>370</y>
<width>101</width>
<height>21</height>
</rect>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;PTY (Program Type)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="text">
<string>programType</string>
</property>
</widget>
<widget class="QLabel" name="l6">
<property name="geometry">
<rect>
<x>20</x>
<y>280</y>
<width>121</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Bitrate in kBit/s</string>
</property>
</widget>
<widget class="QLCDNumber" name="bitrateDisplay">
<property name="geometry">
<rect>
<x>160</x>
<y>280</y>
<width>64</width>
<height>23</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="segmentStyle">
<enum>QLCDNumber::Flat</enum>
</property>
</widget>
<widget class="QLCDNumber" name="subChIdDisplay">
<property name="geometry">
<rect>
<x>160</x>
<y>250</y>
<width>64</width>
<height>23</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="segmentStyle">
<enum>QLCDNumber::Flat</enum>
</property>
</widget>
<widget class="QLabel" name="label_6">
<property name="geometry">
<rect>
<x>20</x>
<y>250</y>
<width>111</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Subchannel ID</string>
</property>
</widget>
<widget class="QLabel" name="uepField">
<property name="geometry">
<rect>
<x>120</x>
<y>310</y>
<width>101</width>
<height>21</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Shows Protection Level and Type (A or B)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="text">
<string>uepField</string>
</property>
</widget>
<widget class="QLabel" name="ASCTy">
<property name="geometry">
<rect>
<x>120</x>
<y>330</y>
<width>101</width>
<height>21</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="text">
<string>ASCTy</string>
</property>
</widget>
<widget class="QLabel" name="ensemble">
<property name="geometry">
<rect>
<x>20</x>
<y>50</y>
<width>221</width>
<height>31</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>16</pointsize>
</font>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Ensemble Name&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>ensemble</string>
</property>
</widget>
<widget class="QLCDNumber" name="frequency">
<property name="geometry">
<rect>
<x>20</x>
<y>80</y>
<width>141</width>
<height>31</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Frequency in MHz&lt;/p&gt;&lt;p&gt;Only shown when the input is not a pre-recorded file.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<property name="smallDecimalPoint">
<bool>true</bool>
</property>
<property name="digitCount">
<number>8</number>
</property>
<property name="segmentStyle">
<enum>QLCDNumber::Flat</enum>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>180</x>
<y>90</y>
<width>41</width>
<height>31</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Frequency in MHz&lt;/p&gt;&lt;p&gt;Only shown when the input is not a pre-recorded file.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>MHz</string>
</property>
</widget>
<widget class="QProgressBar" name="ficError_display">
<property name="geometry">
<rect>
<x>20</x>
<y>400</y>
<width>201</width>
<height>23</height>
</rect>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Quality of FIC decoding, 100 is good&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="value">
<number>24</number>
</property>
</widget>
<widget class="QProgressBar" name="frameError_display">
<property name="geometry">
<rect>
<x>20</x>
<y>430</y>
<width>201</width>
<height>23</height>
</rect>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Frame errors. Indication of the quality of the DAB+ frame detection. 100 is good.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="value">
<number>24</number>
</property>
</widget>
<widget class="QProgressBar" name="rsError_display">
<property name="geometry">
<rect>
<x>20</x>
<y>460</y>
<width>201</width>
<height>23</height>
</rect>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Quality of the DAB+ frames. &lt;/p&gt;&lt;p&gt;Indicator for the amount of times meaning the frames contain more errors than the Reed Solomon correction can correct. &lt;/p&gt;&lt;p&gt;100 is good.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="value">
<number>24</number>
</property>
</widget>
<widget class="QProgressBar" name="aacError_display">
<property name="geometry">
<rect>
<x>20</x>
<y>490</y>
<width>201</width>
<height>23</height>
</rect>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Indicator of the success rate of handling the AAC frames in the DAB+ transmissions.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="value">
<number>24</number>
</property>
</widget>
<widget class="QLabel" name="cpuLabel">
<property name="geometry">
<rect>
<x>20</x>
<y>158</y>
<width>121</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>CPU Usage in %</string>
</property>
</widget>
<widget class="QLabel" name="programName">
<property name="geometry">
<rect>
<x>20</x>
<y>120</y>
<width>221</width>
<height>31</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>16</pointsize>
</font>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:14pt;&quot;&gt;Service name&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>programName</string>
</property>
</widget>
<widget class="QLabel" name="motAvailable">
<property name="geometry">
<rect>
<x>180</x>
<y>530</y>
<width>41</width>
<height>20</height>
</rect>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Slide show indicator&lt;/p&gt;&lt;p&gt;Green means MOT frames are received.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; color:#ffffff;&quot;&gt;MOT&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLabel" name="label_7">
<property name="geometry">
<rect>
<x>20</x>
<y>530</y>
<width>151</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>MOT Decoding</string>
</property>
</widget>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>20</x>
<y>310</y>
<width>91</width>
<height>21</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>17</height>
</size>
</property>
<property name="text">
<string>Prot. level:</string>
</property>
</widget>
<widget class="QLabel" name="label_8">
<property name="geometry">
<rect>
<x>20</x>
<y>330</y>
<width>91</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Type:</string>
</property>
</widget>
<widget class="QLabel" name="label_9">
<property name="geometry">
<rect>
<x>20</x>
<y>350</y>
<width>91</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Language:</string>
</property>
</widget>
<widget class="QLabel" name="label_10">
<property name="geometry">
<rect>
<x>20</x>
<y>370</y>
<width>91</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>PTY:</string>
</property>
</widget>
<widget class="QLCDNumber" name="cpuMonitor">
<property name="geometry">
<rect>
<x>160</x>
<y>160</y>
<width>64</width>
<height>23</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="segmentStyle">
<enum>QLCDNumber::Flat</enum>
</property>
</widget>
<widget class="QLCDNumber" name="snrDisplay">
<property name="geometry">
<rect>
<x>20</x>
<y>10</y>
<width>64</width>
<height>23</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="digitCount">
<number>3</number>
</property>
<property name="segmentStyle">
<enum>QLCDNumber::Flat</enum>
</property>
</widget>
<widget class="QLCDNumber" name="correctorDisplay">
<property name="geometry">
<rect>
<x>133</x>
<y>10</y>
<width>71</width>
<height>23</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="segmentStyle">
<enum>QLCDNumber::Flat</enum>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>

BIN
i18n/de_DE.qm Normal file

Binary file not shown.

843
i18n/de_DE.ts Normal file
View File

@@ -0,0 +1,843 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="de_DE">
<context>
<name>CAndroid_RTL_SDR</name>
<message>
<source>Android RTL-SDR driver is not installed</source>
<translation type="vanished">Android RTL-SDR Treiber ist nicht installiert</translation>
</message>
<message>
<source>Do you would like to install it? After install start welle.io again.</source>
<translation type="vanished">Soll er installiert werden? welle.io muss nach der Treiberinstallation neu gestartet werden.</translation>
</message>
</context>
<context>
<name>CDABConstants</name>
<message>
<location filename="../src/DabConstants.cpp" line="37"/>
<source>none</source>
<translation>nicht gesetzt</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="38"/>
<source>News</source>
<translation>Nachrichten</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="39"/>
<source>Current Affairs</source>
<translation>Aktuelle Nachrichten</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="40"/>
<source>Information</source>
<translation>Informationen</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="41"/>
<source>Sport</source>
<translation>Sport</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="42"/>
<source>Education</source>
<translation>Bildung</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="43"/>
<source>Drama</source>
<translation>Drama</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="44"/>
<source>Arts</source>
<translation>Kunst</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="45"/>
<source>Science</source>
<translation>Forschung</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="46"/>
<source>Talk</source>
<translation>Talk</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="47"/>
<source>Pop Music</source>
<translation>Pop</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="48"/>
<source>Rock Music</source>
<translation>Rock</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="49"/>
<source>Easy Listening</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="50"/>
<source>Light classical</source>
<translation>Klassik</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="51"/>
<source>Classical Music</source>
<translation>Klassik</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="52"/>
<source>Other Music</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="53"/>
<source>Weather</source>
<translation>Wetter</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="54"/>
<source>Finance</source>
<translation>Finanzen</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="55"/>
<source>Children&apos;s</source>
<translation>Kinder</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="56"/>
<source>Factual</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="57"/>
<source>Religion</source>
<translation>Religion</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="58"/>
<source>Phone In</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="59"/>
<source>Travel</source>
<translation>Reise</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="60"/>
<source>Leisure</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="61"/>
<source>Jazz and Blues</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="62"/>
<source>Country Music</source>
<translation>Country</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="63"/>
<source>National Music</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="64"/>
<source>Oldies Music</source>
<translation>Oldies</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="65"/>
<source>Folk Music</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="66"/>
<source>entry 29 not used</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="67"/>
<source>entry 30 not used</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="68"/>
<source>entry 31 not used</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="82"/>
<source>Unknown</source>
<translation>Unbekannt</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="83"/>
<source>Albanian</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="84"/>
<source>Breton</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="85"/>
<source>Catalan</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="86"/>
<source>Croatian</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="87"/>
<source>Welsh</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="88"/>
<source>Czech</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="89"/>
<source>Danish</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="90"/>
<source>German</source>
<translation>Deutsch</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="91"/>
<source>English</source>
<translation>Englisch</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="92"/>
<source>Spanish</source>
<translation>Spanisch</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="93"/>
<source>Esperanto</source>
<translation>Esperanto</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="94"/>
<source>Estonian</source>
<translation>Estnisch</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="95"/>
<source>Basque</source>
<translation>Baskisch</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="96"/>
<source>Faroese</source>
<translation>Färöisch</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="97"/>
<source>French</source>
<translation>Französisch</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="98"/>
<source>Frisian</source>
<translation>Friesisch</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="99"/>
<source>Irish</source>
<translation>Irisch</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="100"/>
<source>Gaelic</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="101"/>
<source>Galician</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="102"/>
<source>Icelandic</source>
<translation>Isländisch</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="103"/>
<source>Italian</source>
<translation>Italienisch</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="104"/>
<source>Lappish</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="105"/>
<source>Latin</source>
<translation>Latein</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="106"/>
<source>Latvian</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="107"/>
<source>Luxembourgian</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="108"/>
<source>Lithuanian</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="109"/>
<source>Hungarian</source>
<translation>Ungarisch</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="110"/>
<source>Maltese</source>
<translation>Maltesisch</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="111"/>
<source>Dutch</source>
<translation>Niederländisch</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="112"/>
<source>Norwegian</source>
<translation>Norwegisch</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="113"/>
<source>Occitan</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="114"/>
<source>Polish</source>
<translation>Polnisch</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="115"/>
<source>Portuguese</source>
<translation>Portugiesisch</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="116"/>
<source>Romanian</source>
<translation>Rumänisch</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="117"/>
<source>Romansh</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="118"/>
<source>Serbian</source>
<translation>Serbisch</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="119"/>
<source>Slovak</source>
<translation>Slowakisch</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="120"/>
<source>Slovene</source>
<translation>Slowenisch</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="121"/>
<source>Finnish</source>
<translation>Finnisch</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="122"/>
<source>Swedish</source>
<translation>Schwedisch</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="123"/>
<source>Turkish</source>
<translation>Türkisch</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="124"/>
<source>Flemish</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="125"/>
<source>Walloon</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CGUI</name>
<message>
<location filename="../src/gui/CGUI.cpp" line="185"/>
<source>Station list is empty</source>
<translation>Keine Sender vorhanden</translation>
</message>
<message>
<location filename="../src/gui/CGUI.cpp" line="120"/>
<source>version</source>
<translation>Version</translation>
</message>
<message>
<location filename="../src/gui/CGUI.cpp" line="121"/>
<source>Git revision</source>
<translation>Git Revision</translation>
</message>
<message>
<location filename="../src/gui/CGUI.cpp" line="122"/>
<source>Build on</source>
<translation>Übersetzt am</translation>
</message>
<message>
<location filename="../src/gui/CGUI.cpp" line="123"/>
<source>QT version</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CRadioController</name>
<message>
<location filename="../src/CRadioController.cpp" line="88"/>
<source>Unknown</source>
<translation>Unbekannt</translation>
</message>
<message>
<location filename="../src/CRadioController.cpp" line="94"/>
<location filename="../src/CRadioController.cpp" line="473"/>
<source>No Station</source>
<translation>Kein Sender gewählt</translation>
</message>
<message>
<location filename="../src/CRadioController.cpp" line="438"/>
<source>RAW File</source>
<translation>RAW Datei</translation>
</message>
<message>
<location filename="../src/CRadioController.cpp" line="450"/>
<location filename="../src/CRadioController.cpp" line="751"/>
<source>Scanning</source>
<translation>Scanne</translation>
</message>
<message>
<location filename="../src/CRadioController.cpp" line="452"/>
<location filename="../src/CRadioController.cpp" line="848"/>
<source>Found channels</source>
<translation>Gefundene Sender</translation>
</message>
<message>
<location filename="../src/CRadioController.cpp" line="821"/>
<source>Lost signal or bad signal quality, trying to find it again.</source>
<translation>Kein oder schlechter Empfang. Suche Sender neu.</translation>
</message>
<message>
<location filename="../src/CRadioController.cpp" line="687"/>
<source>Radio device is not ready or does not exits.</source>
<translation>Radioempfänger meldet einen Fehler oder existiert nicht.</translation>
</message>
<message>
<location filename="../src/CRadioController.cpp" line="410"/>
<location filename="../src/CRadioController.cpp" line="718"/>
<source>Tuning</source>
<translation>Suche</translation>
</message>
</context>
<context>
<name>ChannelBrowser</name>
<message>
<location filename="../src/gui/QML/ChannelBrowser.qml" line="289"/>
<source></source>
<translation></translation>
</message>
<message>
<location filename="../src/gui/QML/ChannelBrowser.qml" line="488"/>
<location filename="../src/gui/QML/ChannelBrowser.qml" line="658"/>
<source>Found channels</source>
<translation type="unfinished">Gefundene Sender</translation>
</message>
<message>
<location filename="../src/gui/QML/ChannelBrowser.qml" line="495"/>
<source>Automatic RF gain</source>
<translation type="unfinished">Auto HF-Verstärkung</translation>
</message>
<message>
<location filename="../src/gui/QML/ChannelBrowser.qml" line="514"/>
<source>Manual gain</source>
<translation type="unfinished">Manuelle Verstärkung</translation>
</message>
<message>
<location filename="../src/gui/QML/ChannelBrowser.qml" line="519"/>
<source>Value: </source>
<translation type="unfinished">Aktuell: </translation>
</message>
<message>
<source>Select channel manually</source>
<translation type="obsolete">Manuelle Kanalwahl</translation>
</message>
<message>
<location filename="../src/gui/QML/ChannelBrowser.qml" line="537"/>
<source>Clear station list</source>
<translation type="unfinished">Lösche Senderliste</translation>
</message>
<message>
<location filename="../src/gui/QML/ChannelBrowser.qml" line="573"/>
<source>Full screen mode</source>
<translation type="unfinished">Vollbildmodus</translation>
</message>
<message>
<location filename="../src/gui/QML/ChannelBrowser.qml" line="582"/>
<source>Channel list layout</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/gui/QML/ChannelBrowser.qml" line="593"/>
<source>Expert mode</source>
<translation type="unfinished">Expertenmodus</translation>
</message>
<message>
<location filename="../src/gui/QML/ChannelBrowser.qml" line="607"/>
<source>Exit welle.io</source>
<translation type="unfinished">welle.io beenden</translation>
</message>
</context>
<context>
<name>ExpertView</name>
<message>
<location filename="../src/gui/QML/ExpertView.qml" line="19"/>
<source>Device</source>
<translation>Radioempfänger</translation>
</message>
<message>
<location filename="../src/gui/QML/ExpertView.qml" line="25"/>
<source>Current channel</source>
<translation>Aktueller Kanal</translation>
</message>
<message>
<location filename="../src/gui/QML/ExpertView.qml" line="31"/>
<source>Frequency correction</source>
<translation>Frequenzkorrektur</translation>
</message>
<message>
<location filename="../src/gui/QML/ExpertView.qml" line="37"/>
<source>SNR</source>
<translation>SNR</translation>
</message>
<message>
<location filename="../src/gui/QML/ExpertView.qml" line="43"/>
<source>Frame errors</source>
<translation>Framefehler</translation>
</message>
<message>
<location filename="../src/gui/QML/ExpertView.qml" line="49"/>
<source>RS errors</source>
<translation>RS Fehler</translation>
</message>
<message>
<location filename="../src/gui/QML/ExpertView.qml" line="55"/>
<source>AAC errors</source>
<translation>AAC Framefehler</translation>
</message>
<message>
<location filename="../src/gui/QML/ExpertView.qml" line="61"/>
<source>Frame synchronization</source>
<translation>Synchronisation</translation>
</message>
<message>
<location filename="../src/gui/QML/ExpertView.qml" line="67"/>
<source>FIC CRC</source>
<translation>FIC CRC</translation>
</message>
<message>
<location filename="../src/gui/QML/ExpertView.qml" line="62"/>
<location filename="../src/gui/QML/ExpertView.qml" line="68"/>
<source>OK</source>
<translation>OK</translation>
</message>
<message>
<location filename="../src/gui/QML/ExpertView.qml" line="62"/>
<source>Not synced</source>
<translation>Nicht synchron</translation>
</message>
<message>
<location filename="../src/gui/QML/ExpertView.qml" line="68"/>
<source>Error</source>
<translation>Fehler</translation>
</message>
</context>
<context>
<name>QObject</name>
<message>
<location filename="../src/input/CInputFactory.cpp" line="62"/>
<source>No valid device found use Null device instead.</source>
<translation>Kein Radioempfänger gefunden.</translation>
</message>
<message>
<location filename="../src/input/CInputFactory.cpp" line="64"/>
<source>Error while opening device</source>
<translation>Fehler beim Zugriff auf Empfänger</translation>
</message>
<message>
<location filename="../src/input/CRAWFile.cpp" line="153"/>
<source>Unknown RAW file format</source>
<translation>Unbekanntes RAW-Dateiformat</translation>
</message>
<message>
<location filename="../src/input/CRAWFile.cpp" line="160"/>
<source>Cannot open file</source>
<translation>Fehler beim Öffnen der Datei</translation>
</message>
<message>
<location filename="../src/input/CRAWFile.cpp" line="255"/>
<source>End of file, restarting</source>
<translation>RAW-Datei zu Ende, beginne von vorn</translation>
</message>
<message>
<source>AGC overload. Maybe you are using a to high gain.</source>
<translation type="obsolete">HF-Eingangsverstärkung ist zu groß (AGC ist übersteuert).</translation>
</message>
<message>
<location filename="../src/input/CRTL_SDR.cpp" line="340"/>
<location filename="../src/input/CRTL_TCP_Client.cpp" line="359"/>
<source>ADC overload. Maybe you are using a to high gain.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/input/CRTL_SDR.cpp" line="402"/>
<source>RTL-SDR is unplugged.</source>
<translation>RTL-SDR wurde entfernt.</translation>
</message>
<message>
<location filename="../src/input/CRTL_TCP_Client.cpp" line="179"/>
<source>RTL-TCP connection closed.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/input/CRTL_TCP_Client.cpp" line="312"/>
<source>Connection failed to server </source>
<translation>Verbindungsfehler zu Server </translation>
</message>
</context>
<context>
<name>SettingsPage</name>
<message>
<location filename="../src/gui/QML/SettingsPage.qml" line="94"/>
<source>Channel scan</source>
<translation>Sendersuchlauf</translation>
</message>
<message>
<location filename="../src/gui/QML/SettingsPage.qml" line="100"/>
<source>Start</source>
<translation>Start</translation>
</message>
<message>
<location filename="../src/gui/QML/SettingsPage.qml" line="111"/>
<source>Stop</source>
<translation>Stopp</translation>
</message>
<message>
<location filename="../src/gui/QML/SettingsPage.qml" line="50"/>
<source>Found channels</source>
<translation>Gefundene Sender</translation>
</message>
<message>
<location filename="../src/gui/QML/SettingsPage.qml" line="127"/>
<source>Found stations</source>
<translation>Gefundene Programme</translation>
</message>
<message>
<location filename="../src/gui/QML/SettingsPage.qml" line="178"/>
<source>Hardware RF gain</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/gui/QML/SettingsPage.qml" line="191"/>
<source>Automatic RF gain</source>
<translation>Auto HF-Verstärkung</translation>
</message>
<message>
<location filename="../src/gui/QML/SettingsPage.qml" line="208"/>
<source>Manual gain</source>
<translation>Manuelle Verstärkung</translation>
</message>
<message>
<location filename="../src/gui/QML/SettingsPage.qml" line="209"/>
<source>Value: </source>
<translation>Aktuell: </translation>
</message>
<message>
<location filename="../src/gui/QML/SettingsPage.qml" line="229"/>
<source>Full screen mode</source>
<translation>Vollbildmodus</translation>
</message>
<message>
<location filename="../src/gui/QML/SettingsPage.qml" line="239"/>
<source>Channel list layout (experimental)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/gui/QML/SettingsPage.qml" line="252"/>
<source>Expert mode</source>
<translation>Expertenmodus</translation>
</message>
<message>
<source>Select channel manually</source>
<translation type="vanished">Manuelle Kanalwahl</translation>
</message>
<message>
<location filename="../src/gui/QML/SettingsPage.qml" line="135"/>
<source>Clear station list</source>
<translation>Lösche Senderliste</translation>
</message>
<message>
<location filename="../src/gui/QML/SettingsPage.qml" line="265"/>
<source>Exit welle.io</source>
<translation>welle.io beenden</translation>
</message>
</context>
<context>
<name>SpectrumView</name>
<message>
<location filename="../src/gui/QML/SpectrumView.qml" line="14"/>
<source>Spectrum</source>
<translation>Spektrum</translation>
</message>
<message>
<location filename="../src/gui/QML/SpectrumView.qml" line="45"/>
<source>Amplitude</source>
<translation>Amplitude</translation>
</message>
<message>
<location filename="../src/gui/QML/SpectrumView.qml" line="51"/>
<source>Frequency</source>
<translation>Frequenz</translation>
</message>
</context>
<context>
<name>TouchSwitch</name>
<message>
<location filename="../src/gui/QML/style/TouchSwitch.qml" line="16"/>
<source>ON</source>
<translation>AN</translation>
</message>
<message>
<location filename="../src/gui/QML/style/TouchSwitch.qml" line="17"/>
<source>OFF</source>
<translation>AUS</translation>
</message>
</context>
<context>
<name>main</name>
<message>
<location filename="../src/main.cpp" line="122"/>
<source>Set the GUI language (e.g. de-DE)</source>
<translation>GUI Sprache festlegen</translation>
</message>
<message>
<location filename="../src/main.cpp" line="123"/>
<source>Language</source>
<translation>Sprache</translation>
</message>
<message>
<source>Input device</source>
<translation type="vanished">Radioempfänger</translation>
</message>
<message>
<location filename="../src/main.cpp" line="127"/>
<source>Input device. Possible is: auto (default), airspy, rtl_tcp, rtl_sdr, rawfile, soapysdr</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/main.cpp" line="128"/>
<source>Name</source>
<translation>Name</translation>
</message>
<message>
<location filename="../src/main.cpp" line="132"/>
<source>DAB mode. Possible is: 1, 2 or 4, default: 1</source>
<translation>DAB Mode. Möglich ist 1, 2 oder 4, Standard: 1</translation>
</message>
<message>
<location filename="../src/main.cpp" line="133"/>
<source>Mode</source>
<translation>Modus</translation>
</message>
<message>
<location filename="../src/main.cpp" line="137"/>
<source>rtl_tcp server IP address. Only valid for input rtl_tcp.</source>
<translation>rtl_tcp server IP Adresse. Nur gültig für Empfänger rtl_tcp.</translation>
</message>
<message>
<location filename="../src/main.cpp" line="138"/>
<source>IP address</source>
<translation>IP-Adresse</translation>
</message>
<message>
<location filename="../src/main.cpp" line="142"/>
<source>rtl_tcp server IP port. Only valid for input rtl_tcp.</source>
<translation>IP Port. Nur gültig für Empfänger rtl_tcp.</translation>
</message>
<message>
<location filename="../src/main.cpp" line="143"/>
<source>Port</source>
<translation>Port</translation>
</message>
<message>
<location filename="../src/main.cpp" line="147"/>
<source>I/Q RAW file. Only valid for input rawfile.</source>
<translation>I/Q RAW Datei als Radioempfänger. Nur gültig für Empfänger rawfile.</translation>
</message>
<message>
<location filename="../src/main.cpp" line="148"/>
<source>I/Q RAW file</source>
<translation>I/Q RAW Rohdatei</translation>
</message>
<message>
<location filename="../src/main.cpp" line="152"/>
<source>I/Q RAW file format. Possible is: u8 (standard), s8, s16le, s16be. Only valid for input rawfile.</source>
<translation>I/Q RAW Rohdateiformat. Möglich ist u8 (Standard), s8, s16le, s16be. Nur gültig für Radioempfänger rawfile.</translation>
</message>
<message>
<location filename="../src/main.cpp" line="153"/>
<source>I/Q RAW file format</source>
<translation>I/Q RAW Rohdatenformat</translation>
</message>
<message>
<location filename="../src/gui/QML/main.qml" line="104"/>
<source>Expert mode is enabled</source>
<translation>Expertenmodus eingeschaltet</translation>
</message>
<message>
<location filename="../src/gui/QML/main.qml" line="106"/>
<source>Expert mode is disabled</source>
<translation>Expertenmodus ausgeschaltet</translation>
</message>
</context>
</TS>

BIN
i18n/hu_HU.qm Normal file

Binary file not shown.

816
i18n/hu_HU.ts Normal file
View File

@@ -0,0 +1,816 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="hu_HU">
<context>
<name>CDABConstants</name>
<message>
<location filename="../src/DabConstants.cpp" line="37"/>
<source>none</source>
<translation type="unfinished">Meghatározatlan</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="38"/>
<source>News</source>
<translation type="unfinished">Hírek</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="39"/>
<source>Current Affairs</source>
<translation type="unfinished">Aktuális ügyek</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="40"/>
<source>Information</source>
<translation type="unfinished">Információ</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="41"/>
<source>Sport</source>
<translation type="unfinished">Sport</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="42"/>
<source>Education</source>
<translation type="unfinished">Oktatás</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="43"/>
<source>Drama</source>
<translation type="unfinished">Dráma</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="44"/>
<source>Arts</source>
<translation type="unfinished">Kultúra</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="45"/>
<source>Science</source>
<translation type="unfinished">Tudomány</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="46"/>
<source>Talk</source>
<translation type="unfinished">Vegyes</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="47"/>
<source>Pop Music</source>
<translation type="unfinished">Popzene</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="48"/>
<source>Rock Music</source>
<translation type="unfinished">Rockzene</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="49"/>
<source>Easy Listening</source>
<translation type="unfinished">Lágy zenék</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="50"/>
<source>Light classical</source>
<translation type="unfinished">Könnyű klasszikus zene</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="51"/>
<source>Classical Music</source>
<translation type="unfinished">Komoly klasszikus zene</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="52"/>
<source>Other Music</source>
<translation type="unfinished">Egyéb zene</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="53"/>
<source>Weather</source>
<translation type="unfinished">Időjárás</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="54"/>
<source>Finance</source>
<translation type="unfinished">Pénzügy</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="55"/>
<source>Children&apos;s</source>
<translation type="unfinished">Gyermekprogramok</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="56"/>
<source>Factual</source>
<translation type="unfinished">Szociális ügyek</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="57"/>
<source>Religion</source>
<translation type="unfinished">Vallás</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="58"/>
<source>Phone In</source>
<translation type="unfinished">Telefonos műsor</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="59"/>
<source>Travel</source>
<translation type="unfinished">Utazás</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="60"/>
<source>Leisure</source>
<translation type="unfinished">Szabadidő</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="61"/>
<source>Jazz and Blues</source>
<translation type="unfinished">Jazz</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="62"/>
<source>Country Music</source>
<translation type="unfinished">Country</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="63"/>
<source>National Music</source>
<translation type="unfinished">Nemzet zenéje</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="64"/>
<source>Oldies Music</source>
<translation type="unfinished">Régi slágerek</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="65"/>
<source>Folk Music</source>
<translation type="unfinished">Népzene</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="66"/>
<source>entry 29 not used</source>
<translation type="unfinished">Dokumentumműsor</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="67"/>
<source>entry 30 not used</source>
<translation type="unfinished">Riadó próbája</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="68"/>
<source>entry 31 not used</source>
<translation type="unfinished">Riadó</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="82"/>
<source>Unknown</source>
<translation type="unfinished">Ismeretlen</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="83"/>
<source>Albanian</source>
<translation type="unfinished">Albán</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="84"/>
<source>Breton</source>
<translation type="unfinished">Breton</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="85"/>
<source>Catalan</source>
<translation type="unfinished">Katalán</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="86"/>
<source>Croatian</source>
<translation type="unfinished">Horvát</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="87"/>
<source>Welsh</source>
<translation type="unfinished">Walesi</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="88"/>
<source>Czech</source>
<translation type="unfinished">Cseh</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="89"/>
<source>Danish</source>
<translation type="unfinished">Dán</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="90"/>
<source>German</source>
<translation type="unfinished">Német</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="91"/>
<source>English</source>
<translation type="unfinished">Angol</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="92"/>
<source>Spanish</source>
<translation type="unfinished">Spanyol</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="93"/>
<source>Esperanto</source>
<translation type="unfinished">Eszperantó</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="94"/>
<source>Estonian</source>
<translation type="unfinished">Észt</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="95"/>
<source>Basque</source>
<translation type="unfinished">Baszk</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="96"/>
<source>Faroese</source>
<translation type="unfinished">Feröeri</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="97"/>
<source>French</source>
<translation type="unfinished">Francia</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="98"/>
<source>Frisian</source>
<translation type="unfinished">Fríz</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="99"/>
<source>Irish</source>
<translation type="unfinished">Ír</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="100"/>
<source>Gaelic</source>
<translation type="unfinished">Gall</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="101"/>
<source>Galician</source>
<translation type="unfinished">Galíciai</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="102"/>
<source>Icelandic</source>
<translation type="unfinished">Izlandi</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="103"/>
<source>Italian</source>
<translation type="unfinished">Olasz</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="104"/>
<source>Lappish</source>
<translation type="unfinished">Lapp</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="105"/>
<source>Latin</source>
<translation type="unfinished">Latin</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="106"/>
<source>Latvian</source>
<translation type="unfinished">Lett</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="107"/>
<source>Luxembourgian</source>
<translation type="unfinished">Luxemburgi</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="108"/>
<source>Lithuanian</source>
<translation type="unfinished">Litván</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="109"/>
<source>Hungarian</source>
<translation type="unfinished">Magyar</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="110"/>
<source>Maltese</source>
<translation type="unfinished">Máltai</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="111"/>
<source>Dutch</source>
<translation type="unfinished">Holland</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="112"/>
<source>Norwegian</source>
<translation type="unfinished">Norvég</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="113"/>
<source>Occitan</source>
<translation type="unfinished">Provanszál</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="114"/>
<source>Polish</source>
<translation type="unfinished">Lengyel</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="115"/>
<source>Portuguese</source>
<translation type="unfinished">Portugál</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="116"/>
<source>Romanian</source>
<translation type="unfinished">Román</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="117"/>
<source>Romansh</source>
<translation type="unfinished">Romans</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="118"/>
<source>Serbian</source>
<translation type="unfinished">Szerb</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="119"/>
<source>Slovak</source>
<translation type="unfinished">Szlovák</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="120"/>
<source>Slovene</source>
<translation type="unfinished">Szlovén</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="121"/>
<source>Finnish</source>
<translation type="unfinished">Finn</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="122"/>
<source>Swedish</source>
<translation type="unfinished">Svéd</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="123"/>
<source>Turkish</source>
<translation type="unfinished">Török</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="124"/>
<source>Flemish</source>
<translation type="unfinished">Flamand</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="125"/>
<source>Walloon</source>
<translation type="unfinished">Vallon</translation>
</message>
</context>
<context>
<name>CGUI</name>
<message>
<location filename="../src/gui/CGUI.cpp" line="120"/>
<source>version</source>
<translation type="unfinished">verzió</translation>
</message>
<message>
<location filename="../src/gui/CGUI.cpp" line="121"/>
<source>Git revision</source>
<translation type="unfinished">Git revízió</translation>
</message>
<message>
<location filename="../src/gui/CGUI.cpp" line="122"/>
<source>Build on</source>
<translation type="unfinished">Készült</translation>
</message>
<message>
<location filename="../src/gui/CGUI.cpp" line="123"/>
<source>QT version</source>
<translation type="unfinished">QT verzió</translation>
</message>
<message>
<location filename="../src/gui/CGUI.cpp" line="185"/>
<source>Station list is empty</source>
<translation type="unfinished">Állomáslista üres</translation>
</message>
</context>
<context>
<name>CRadioController</name>
<message>
<location filename="../src/CRadioController.cpp" line="88"/>
<source>Unknown</source>
<translation type="unfinished">Ismeretlen</translation>
</message>
<message>
<location filename="../src/CRadioController.cpp" line="94"/>
<location filename="../src/CRadioController.cpp" line="473"/>
<source>No Station</source>
<translation type="unfinished">Nincs állomás</translation>
</message>
<message>
<location filename="../src/CRadioController.cpp" line="410"/>
<location filename="../src/CRadioController.cpp" line="718"/>
<source>Tuning</source>
<translation type="unfinished">Hangolás</translation>
</message>
<message>
<location filename="../src/CRadioController.cpp" line="438"/>
<source>RAW File</source>
<translation type="unfinished">RAW Fájl</translation>
</message>
<message>
<location filename="../src/CRadioController.cpp" line="450"/>
<location filename="../src/CRadioController.cpp" line="751"/>
<source>Scanning</source>
<translation type="unfinished">Keresés</translation>
</message>
<message>
<location filename="../src/CRadioController.cpp" line="452"/>
<location filename="../src/CRadioController.cpp" line="848"/>
<source>Found channels</source>
<translation type="unfinished">Megtalált állomások</translation>
</message>
<message>
<location filename="../src/CRadioController.cpp" line="687"/>
<source>Radio device is not ready or does not exits.</source>
<translation type="unfinished">A rádióvevő nem áll készen vagy nincs.</translation>
</message>
<message>
<location filename="../src/CRadioController.cpp" line="821"/>
<source>Lost signal or bad signal quality, trying to find it again.</source>
<translation type="unfinished">Nincs jel vagy rossz jelminőség, próbálja újra a hangolást.</translation>
</message>
</context>
<context>
<name>ChannelBrowser</name>
<message>
<location filename="../src/gui/QML/ChannelBrowser.qml" line="275"/>
<source></source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/gui/QML/ChannelBrowser.qml" line="488"/>
<location filename="../src/gui/QML/ChannelBrowser.qml" line="658"/>
<source>Found channels</source>
<translation type="unfinished">Megtalált állomások</translation>
</message>
<message>
<location filename="../src/gui/QML/ChannelBrowser.qml" line="495"/>
<source>Automatic RF gain</source>
<translation type="unfinished">Automatikus RF erősítés</translation>
</message>
<message>
<location filename="../src/gui/QML/ChannelBrowser.qml" line="514"/>
<source>Manual gain</source>
<translation type="unfinished">Kézi RF erősítés</translation>
</message>
<message>
<location filename="../src/gui/QML/ChannelBrowser.qml" line="519"/>
<source>Value: </source>
<translation type="unfinished">Érték:</translation>
</message>
<message>
<location filename="../src/gui/QML/ChannelBrowser.qml" line="537"/>
<source>Clear station list</source>
<translation type="unfinished">Állomáslista törlése</translation>
</message>
<message>
<location filename="../src/gui/QML/ChannelBrowser.qml" line="573"/>
<source>Full screen mode</source>
<translation type="unfinished">Teljesképernyő mód</translation>
</message>
<message>
<location filename="../src/gui/QML/ChannelBrowser.qml" line="582"/>
<source>Channel list layout</source>
<translation type="unfinished">Állomáslista elrendezés</translation>
</message>
<message>
<location filename="../src/gui/QML/ChannelBrowser.qml" line="593"/>
<source>Expert mode</source>
<translation type="unfinished">Haladó mód</translation>
</message>
<message>
<location filename="../src/gui/QML/ChannelBrowser.qml" line="607"/>
<source>Exit welle.io</source>
<translation type="unfinished">Kilépés welle.io-ból</translation>
</message>
</context>
<context>
<name>ExpertView</name>
<message>
<location filename="../src/gui/QML/ExpertView.qml" line="19"/>
<source>Device</source>
<translation type="unfinished">Eszköz</translation>
</message>
<message>
<location filename="../src/gui/QML/ExpertView.qml" line="25"/>
<source>Current channel</source>
<translation type="unfinished">Aktuális csatorna</translation>
</message>
<message>
<location filename="../src/gui/QML/ExpertView.qml" line="31"/>
<source>Frequency correction</source>
<translation type="unfinished">Frekvencia korrekció</translation>
</message>
<message>
<location filename="../src/gui/QML/ExpertView.qml" line="37"/>
<source>SNR</source>
<translation type="unfinished">Jel-zaj viszony</translation>
</message>
<message>
<location filename="../src/gui/QML/ExpertView.qml" line="43"/>
<source>Frame errors</source>
<translation type="unfinished">Frame hibák</translation>
</message>
<message>
<location filename="../src/gui/QML/ExpertView.qml" line="49"/>
<source>RS errors</source>
<translation type="unfinished">RS hibák</translation>
</message>
<message>
<location filename="../src/gui/QML/ExpertView.qml" line="55"/>
<source>AAC errors</source>
<translation type="unfinished">AAC hibák</translation>
</message>
<message>
<location filename="../src/gui/QML/ExpertView.qml" line="61"/>
<source>Frame synchronization</source>
<translation type="unfinished">Frame szinkronizálás</translation>
</message>
<message>
<location filename="../src/gui/QML/ExpertView.qml" line="62"/>
<location filename="../src/gui/QML/ExpertView.qml" line="68"/>
<source>OK</source>
<translation type="unfinished">Rendben</translation>
</message>
<message>
<location filename="../src/gui/QML/ExpertView.qml" line="62"/>
<source>Not synced</source>
<translation type="unfinished">Nem szinkronizált</translation>
</message>
<message>
<location filename="../src/gui/QML/ExpertView.qml" line="67"/>
<source>FIC CRC</source>
<translation type="unfinished">FIC CRC</translation>
</message>
<message>
<location filename="../src/gui/QML/ExpertView.qml" line="68"/>
<source>Error</source>
<translation type="unfinished">Hiba</translation>
</message>
</context>
<context>
<name>QObject</name>
<message>
<location filename="../src/input/CInputFactory.cpp" line="62"/>
<source>No valid device found use Null device instead.</source>
<translation type="unfinished">Megfelelő rádióvevő nem található, helyette a &quot;Null&quot; eszköz van használatban.</translation>
</message>
<message>
<location filename="../src/input/CInputFactory.cpp" line="64"/>
<source>Error while opening device</source>
<translation type="unfinished">Hiba az eszköz megnyitásakor</translation>
</message>
<message>
<location filename="../src/input/CRAWFile.cpp" line="153"/>
<source>Unknown RAW file format</source>
<translation type="unfinished">Ismeretlen RAW fájl formátum</translation>
</message>
<message>
<location filename="../src/input/CRAWFile.cpp" line="160"/>
<source>Cannot open file</source>
<translation type="unfinished">A fájl nem nyitható</translation>
</message>
<message>
<location filename="../src/input/CRAWFile.cpp" line="255"/>
<source>End of file, restarting</source>
<translation type="unfinished">Fájlnak vége, újraindítás</translation>
</message>
<message>
<location filename="../src/input/CRTL_SDR.cpp" line="340"/>
<location filename="../src/input/CRTL_TCP_Client.cpp" line="359"/>
<source>ADC overload. Maybe you are using a to high gain.</source>
<translation type="unfinished">ADC túlterhelve. Talán túl nagy erősítést használsz.</translation>
</message>
<message>
<location filename="../src/input/CRTL_SDR.cpp" line="402"/>
<source>RTL-SDR is unplugged.</source>
<translation type="unfinished">RTL-SDR nincs csatlakoztatva</translation>
</message>
<message>
<location filename="../src/input/CRTL_TCP_Client.cpp" line="179"/>
<source>RTL-TCP connection closed.</source>
<translation type="unfinished">RTL-TCP kapcsolat zárva</translation>
</message>
<message>
<location filename="../src/input/CRTL_TCP_Client.cpp" line="312"/>
<source>Connection failed to server </source>
<translation type="unfinished">Szerverkapcsolat hiba</translation>
</message>
</context>
<context>
<name>SettingsPage</name>
<message>
<location filename="../src/gui/QML/SettingsPage.qml" line="50"/>
<source>Found channels</source>
<translation type="unfinished">Megtalált állomások száma</translation>
</message>
<message>
<location filename="../src/gui/QML/SettingsPage.qml" line="94"/>
<source>Channel scan</source>
<translation type="unfinished">Állomás keresés</translation>
</message>
<message>
<location filename="../src/gui/QML/SettingsPage.qml" line="100"/>
<source>Start</source>
<translation type="unfinished">Indít</translation>
</message>
<message>
<location filename="../src/gui/QML/SettingsPage.qml" line="111"/>
<source>Stop</source>
<translation type="unfinished">Megállít</translation>
</message>
<message>
<location filename="../src/gui/QML/SettingsPage.qml" line="127"/>
<source>Found stations</source>
<translation type="unfinished">Megtalált állomások száma</translation>
</message>
<message>
<location filename="../src/gui/QML/SettingsPage.qml" line="135"/>
<source>Clear station list</source>
<translation type="unfinished">Állomáslista törlése</translation>
</message>
<message>
<location filename="../src/gui/QML/SettingsPage.qml" line="178"/>
<source>Hardware RF gain</source>
<translation type="unfinished">Hardveres RF erősítés</translation>
</message>
<message>
<location filename="../src/gui/QML/SettingsPage.qml" line="191"/>
<source>Automatic RF gain</source>
<translation type="unfinished">Automatikus RF erősítés</translation>
</message>
<message>
<location filename="../src/gui/QML/SettingsPage.qml" line="208"/>
<source>Manual gain</source>
<translation type="unfinished">Kézi RF erősítés</translation>
</message>
<message>
<location filename="../src/gui/QML/SettingsPage.qml" line="209"/>
<source>Value: </source>
<translation type="unfinished">Érték:</translation>
</message>
<message>
<location filename="../src/gui/QML/SettingsPage.qml" line="229"/>
<source>Full screen mode</source>
<translation type="unfinished">Teljesképernyő mód</translation>
</message>
<message>
<location filename="../src/gui/QML/SettingsPage.qml" line="239"/>
<source>Channel list layout (experimental)</source>
<translation type="unfinished">Állomáslista elrendezés (kisérleti)</translation>
</message>
<message>
<location filename="../src/gui/QML/SettingsPage.qml" line="252"/>
<source>Expert mode</source>
<translation type="unfinished">Haladó mód</translation>
</message>
<message>
<location filename="../src/gui/QML/SettingsPage.qml" line="265"/>
<source>Exit welle.io</source>
<translation type="unfinished">Kilépés welle.io-ból</translation>
</message>
</context>
<context>
<name>SpectrumView</name>
<message>
<location filename="../src/gui/QML/SpectrumView.qml" line="14"/>
<source>Spectrum</source>
<translation type="unfinished">Spektrum</translation>
</message>
<message>
<location filename="../src/gui/QML/SpectrumView.qml" line="45"/>
<source>Amplitude</source>
<translation type="unfinished">Amplitúdó</translation>
</message>
<message>
<location filename="../src/gui/QML/SpectrumView.qml" line="51"/>
<source>Frequency</source>
<translation type="unfinished">Frekvencia</translation>
</message>
</context>
<context>
<name>TouchSwitch</name>
<message>
<location filename="../src/gui/QML/style/TouchSwitch.qml" line="16"/>
<source>ON</source>
<translation type="unfinished">BE</translation>
</message>
<message>
<location filename="../src/gui/QML/style/TouchSwitch.qml" line="17"/>
<source>OFF</source>
<translation type="unfinished">KI</translation>
</message>
</context>
<context>
<name>main</name>
<message>
<location filename="../src/gui/QML/main.qml" line="104"/>
<source>Expert mode is enabled</source>
<translation type="unfinished">Haladó mód bekapcsolva</translation>
</message>
<message>
<location filename="../src/gui/QML/main.qml" line="106"/>
<source>Expert mode is disabled</source>
<translation type="unfinished">Haladó mód kikapcsolva</translation>
</message>
<message>
<location filename="../src/main.cpp" line="122"/>
<source>Set the GUI language (e.g. de-DE)</source>
<translation type="unfinished">Kezelőfelület nyelvének beállítása (pld: hu-HU)</translation>
</message>
<message>
<location filename="../src/main.cpp" line="123"/>
<source>Language</source>
<translation type="unfinished">Nyelv</translation>
</message>
<message>
<location filename="../src/main.cpp" line="127"/>
<source>Input device. Possible is: auto (default), airspy, rtl_tcp, rtl_sdr, rawfile, soapysdr</source>
<translation type="unfinished">Bemeneti eszköz. Választható: auto (alapértelmezett), airspy, rtl_tcp, rtl_sdr, rawfile, soapysdr</translation>
</message>
<message>
<location filename="../src/main.cpp" line="128"/>
<source>Name</source>
<translation type="unfinished">Név</translation>
</message>
<message>
<location filename="../src/main.cpp" line="132"/>
<source>DAB mode. Possible is: 1, 2 or 4, default: 1</source>
<translation type="unfinished">DAB mód: Választható: 1, 2 vagy 4, alapértelmezett:1</translation>
</message>
<message>
<location filename="../src/main.cpp" line="133"/>
<source>Mode</source>
<translation type="unfinished">Mód</translation>
</message>
<message>
<location filename="../src/main.cpp" line="137"/>
<source>rtl_tcp server IP address. Only valid for input rtl_tcp.</source>
<translation type="unfinished">rtl_tcp szerver IP cím. Csak a bemeneti rtl_tcp-re érvényes.</translation>
</message>
<message>
<location filename="../src/main.cpp" line="138"/>
<source>IP address</source>
<translation type="unfinished">IP cím</translation>
</message>
<message>
<location filename="../src/main.cpp" line="142"/>
<source>rtl_tcp server IP port. Only valid for input rtl_tcp.</source>
<translation type="unfinished">rtl_tcp szerver IP port. Csak a bemeneti rtl_tcp-re érvényes.</translation>
</message>
<message>
<location filename="../src/main.cpp" line="143"/>
<source>Port</source>
<translation type="unfinished">Port</translation>
</message>
<message>
<location filename="../src/main.cpp" line="147"/>
<source>I/Q RAW file. Only valid for input rawfile.</source>
<translation type="unfinished">I/Q RAW fájl. Csak a bemeneti raw fáljra érvényes.</translation>
</message>
<message>
<location filename="../src/main.cpp" line="148"/>
<source>I/Q RAW file</source>
<translation type="unfinished">I/Q RAW fájl</translation>
</message>
<message>
<location filename="../src/main.cpp" line="152"/>
<source>I/Q RAW file format. Possible is: u8 (standard), s8, s16le, s16be. Only valid for input rawfile.</source>
<translation type="unfinished">I/Q RAW fájl formátum. Válaszható: u8(alapértelmezett), s8, s16le. Csak a bemeneti raw fájlra érvényes.</translation>
</message>
<message>
<location filename="../src/main.cpp" line="153"/>
<source>I/Q RAW file format</source>
<translation type="unfinished">I/Q RAW fájl formátum</translation>
</message>
</context>
</TS>

BIN
i18n/it_IT.qm Normal file

Binary file not shown.

753
i18n/it_IT.ts Normal file
View File

@@ -0,0 +1,753 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="it">
<context>
<name>CAndroid_RTL_SDR</name>
<message>
<location filename="../src/input/CAndroid_RTL_SDR.cpp" line="111"/>
<location filename="../src/input/CAndroid_RTL_SDR.cpp" line="140"/>
<source>Android RTL-SDR driver is not installed</source>
<translation>Il driver RTL-SDR per Android non è installato</translation>
</message>
<message>
<location filename="../src/input/CAndroid_RTL_SDR.cpp" line="111"/>
<source>Do you would like to install it? After install start welle.io again.</source>
<translation>Vuoi installarlo? Una volta installato riapri welle.io.</translation>
</message>
</context>
<context>
<name>CDABConstants</name>
<message>
<location filename="../src/DabConstants.cpp" line="37"/>
<source>none</source>
<translation>Nessuno</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="38"/>
<source>news</source>
<translation>Notizie</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="39"/>
<source>current affairs</source>
<translation>Attualità</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="40"/>
<source>information</source>
<translation>Informazione</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="41"/>
<source>sport</source>
<translation>Sport</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="42"/>
<source>education</source>
<translation>Educazione</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="43"/>
<source>dram</source>
<translation>Dramma</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="44"/>
<source>arts</source>
<translation>Arti</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="45"/>
<source>science</source>
<translation>Scienza</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="46"/>
<source>talk</source>
<translation>Discorso</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="47"/>
<source>pop music</source>
<translation>Pop</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="48"/>
<source>rock music</source>
<translation>Rock</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="49"/>
<source>easy listening</source>
<translation>Easy Listening</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="50"/>
<source>light classical</source>
<translation>Musica leggera</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="51"/>
<source>classical music</source>
<translation>Classica</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="52"/>
<source>other music</source>
<translation>Altra musica</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="53"/>
<source>wheather</source>
<translation>Meteo</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="54"/>
<source>finance</source>
<translation>Finanza</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="55"/>
<source>children&apos;s</source>
<translation>Bambini</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="56"/>
<source>factual</source>
<translation>Fatti</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="57"/>
<source>religion</source>
<translation>Religione</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="58"/>
<source>phone in</source>
<translation>Chiamata</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="59"/>
<source>travel</source>
<translation>Viaggio</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="60"/>
<source>leisure</source>
<translation>Svago</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="61"/>
<source>jazz and blues</source>
<translation>Jazz and Blues</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="62"/>
<source>country music</source>
<translation>Country</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="63"/>
<source>national music</source>
<translation>Musica Nazionale</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="64"/>
<source>oldies music</source>
<translation>Oldies</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="65"/>
<source>folk music</source>
<translation>Musica Folk</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="66"/>
<source>entry 29 not used</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="67"/>
<source>entry 30 not used</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="68"/>
<source>entry 31 not used</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="82"/>
<source>Unknown</source>
<translation>Sconosciuto</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="83"/>
<source>Albanian</source>
<translation>Albanese</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="84"/>
<source>Breton</source>
<translation>Bretone</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="85"/>
<source>Catalan</source>
<translation>Catalano</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="86"/>
<source>Croatian</source>
<translation>Croato</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="87"/>
<source>Welsh</source>
<translation>Gallese</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="88"/>
<source>Czech</source>
<translation>Ceco</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="89"/>
<source>Danish</source>
<translation>Danese</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="90"/>
<source>German</source>
<translation>Tedesco</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="91"/>
<source>English</source>
<translation>Inglese</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="92"/>
<source>Spanish</source>
<translation>Spagnolo</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="93"/>
<source>Esperanto</source>
<translation>Esperanto</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="94"/>
<source>Estonian</source>
<translation>Estone</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="95"/>
<source>Basque</source>
<translation>Basco</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="96"/>
<source>Faroese</source>
<translation>Faroese</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="97"/>
<source>French</source>
<translation>Francese</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="98"/>
<source>Frisian</source>
<translation>Frisone</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="99"/>
<source>Irish</source>
<translation>Irlandese</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="100"/>
<source>GaeliC</source>
<translation>Gaelico</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="101"/>
<source>Galician</source>
<translation>Gallego</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="102"/>
<source>IcelandiC</source>
<translation>Islandese</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="103"/>
<source>Italian</source>
<translation>Italiano</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="104"/>
<source>Lappish</source>
<translation>Lappone</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="105"/>
<source>Latin</source>
<translation>LAtino</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="106"/>
<source>Latvian</source>
<translation>Lettone</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="107"/>
<source>Luxembourgian</source>
<translation>Lussemburghese</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="108"/>
<source>Lithuanian</source>
<translation>Lituano</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="109"/>
<source>Hungarian</source>
<translation>Ungherese</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="110"/>
<source>Maltese</source>
<translation>Maltese</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="111"/>
<source>Dutch</source>
<translation>Olandese</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="112"/>
<source>Norwegian</source>
<translation>Norvegese</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="113"/>
<source>Occitan</source>
<translation>Occitano</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="114"/>
<source>Polish</source>
<translation>Polacco</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="115"/>
<source>Postuguese</source>
<translation>Portoghese</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="116"/>
<source>Romanian</source>
<translation>Rumeno</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="117"/>
<source>Romansh</source>
<translation>Ladino</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="118"/>
<source>Serbian</source>
<translation>Serbo</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="119"/>
<source>Slovak</source>
<translation>Slovacco</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="120"/>
<source>Slovene</source>
<translation>Sloveno</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="121"/>
<source>Finnish</source>
<translation>Finlandese</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="122"/>
<source>Swedish</source>
<translation>Svedese</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="123"/>
<source>Tuskish</source>
<translation>Turco</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="124"/>
<source>Flemish</source>
<translation>Fiammingo</translation>
</message>
<message>
<location filename="../src/DabConstants.cpp" line="125"/>
<source>Walloon</source>
<translation>Vallone</translation>
</message>
</context>
<context>
<name>CGUI</name>
<message>
<location filename="../src/gui/CGUI.cpp" line="68"/>
<source>Station list is empty</source>
<translation>La lista delle stazioni è vuota</translation>
</message>
<message>
<location filename="../src/gui/CGUI.cpp" line="101"/>
<source>version</source>
<translation>versione</translation>
</message>
<message>
<location filename="../src/gui/CGUI.cpp" line="102"/>
<source>Git revision</source>
<translation>Versione di Git</translation>
</message>
<message>
<location filename="../src/gui/CGUI.cpp" line="103"/>
<source>Build on</source>
<translation>Compilata il </translation>
</message>
</context>
<context>
<name>CRadioController</name>
<message>
<location filename="../src/CRadioController.cpp" line="58"/>
<source>Unknown</source>
<translation>Sconosciuto</translation>
</message>
<message>
<location filename="../src/CRadioController.cpp" line="61"/>
<location filename="../src/CRadioController.cpp" line="252"/>
<source>No Station</source>
<translation>Nessuna Stazione</translation>
</message>
<message>
<location filename="../src/CRadioController.cpp" line="232"/>
<source>RAW File</source>
<translation>File RAW</translation>
</message>
<message>
<location filename="../src/CRadioController.cpp" line="242"/>
<source>Scanning</source>
<translation>Cerco</translation>
</message>
<message>
<location filename="../src/CRadioController.cpp" line="495"/>
<source>Lost signal or bad signal quality, trying to find it again.</source>
<translation>Segnale perso o debole, provo a ritrovarlo.</translation>
</message>
<message>
<location filename="../src/CRadioController.cpp" line="376"/>
<source>Radio device is not ready or does not exits.</source>
<translation>Il dispositivo radio non è pronto o non è connesso.</translation>
</message>
<message>
<location filename="../src/CRadioController.cpp" line="407"/>
<source>Tuning</source>
<translation>Sintonizzo</translation>
</message>
</context>
<context>
<name>ExpertView</name>
<message>
<location filename="../src/gui/QML/ExpertView.qml" line="19"/>
<source>Device</source>
<translation>Dispositivo</translation>
</message>
<message>
<location filename="../src/gui/QML/ExpertView.qml" line="24"/>
<source>Current channel</source>
<translation>Canale attuale</translation>
</message>
<message>
<location filename="../src/gui/QML/ExpertView.qml" line="29"/>
<source>Frequency correction</source>
<translation>Correzione di frequenza</translation>
</message>
<message>
<location filename="../src/gui/QML/ExpertView.qml" line="34"/>
<source>SNR</source>
<translation>SNR</translation>
</message>
<message>
<location filename="../src/gui/QML/ExpertView.qml" line="39"/>
<source>Frame errors</source>
<translation>Errori di frame</translation>
</message>
<message>
<location filename="../src/gui/QML/ExpertView.qml" line="44"/>
<source>RS errors</source>
<translation>Errore RS</translation>
</message>
<message>
<location filename="../src/gui/QML/ExpertView.qml" line="49"/>
<source>AAC errors</source>
<translation>Errori AAC</translation>
</message>
<message>
<location filename="../src/gui/QML/ExpertView.qml" line="54"/>
<source>Frame synchronization</source>
<translation>Sincronizzazione</translation>
</message>
<message>
<location filename="../src/gui/QML/ExpertView.qml" line="59"/>
<source>FIC CRC</source>
<translation>FIC CRC</translation>
</message>
<message>
<location filename="../src/gui/QML/ExpertView.qml" line="94"/>
<location filename="../src/gui/QML/ExpertView.qml" line="100"/>
<source>OK</source>
<translation>OK</translation>
</message>
<message>
<location filename="../src/gui/QML/ExpertView.qml" line="96"/>
<source>Not synced</source>
<translation>Non sincronizzato</translation>
</message>
<message>
<location filename="../src/gui/QML/ExpertView.qml" line="102"/>
<source>Error</source>
<translation>Errore</translation>
</message>
</context>
<context>
<name>QObject</name>
<message>
<location filename="../src/input/CInputFactory.cpp" line="66"/>
<source>No valid device found use Null device instead.</source>
<translation>Nessun dispositivo radio valido trovato.</translation>
</message>
<message>
<location filename="../src/input/CInputFactory.cpp" line="68"/>
<source>Error while opening device</source>
<translation>Errore all&apos;apertura del dispositivo</translation>
</message>
<message>
<location filename="../src/input/CRAWFile.cpp" line="151"/>
<source>Unknown RAW file format</source>
<translation>Formato del file RAW sconosciuto</translation>
</message>
<message>
<location filename="../src/input/CRAWFile.cpp" line="158"/>
<source>Cannot open file</source>
<translation>Non posso aprire il file</translation>
</message>
<message>
<location filename="../src/input/CRAWFile.cpp" line="254"/>
<source>End of file, restarting</source>
<translation>Fine del file RAW, riavvio</translation>
</message>
<message>
<location filename="../src/input/CRTL_SDR.cpp" line="326"/>
<location filename="../src/input/CRTL_TCP_Client.cpp" line="325"/>
<source>ADC overload. Maybe you are using a to high gain.</source>
<translation>Sovraccarico ADC. Forse stai usando troppo guadagno.</translation>
</message>
<message>
<location filename="../src/input/CRTL_SDR.cpp" line="388"/>
<source>RTL-SDR is unplugged.</source>
<translation>Il dispositivo RTL-SDR è scollegato.</translation>
</message>
<message>
<location filename="../src/input/CRTL_TCP_Client.cpp" line="277"/>
<source>Connection failed to server </source>
<translation>Connessione al server fallita</translation>
</message>
</context>
<context>
<name>SettingsPage</name>
<message>
<location filename="../src/gui/QML/SettingsPage.qml" line="77"/>
<source>Channel scan</source>
<translation>Scansione canali</translation>
</message>
<message>
<location filename="../src/gui/QML/SettingsPage.qml" line="83"/>
<source>Start</source>
<translation>Inizia</translation>
</message>
<message>
<location filename="../src/gui/QML/SettingsPage.qml" line="94"/>
<source>Stop</source>
<translation>Ferma</translation>
</message>
<message>
<location filename="../src/gui/QML/SettingsPage.qml" line="38"/>
<source>Found channels</source>
<translation>Canali trovati</translation>
</message>
<message>
<location filename="../src/gui/QML/SettingsPage.qml" line="110"/>
<source>Found stations</source>
<translation>Stazioni trovate</translation>
</message>
<message>
<location filename="../src/gui/QML/SettingsPage.qml" line="124"/>
<source>Automatic RF gain</source>
<translation>Guadagno RF automatico</translation>
</message>
<message>
<location filename="../src/gui/QML/SettingsPage.qml" line="140"/>
<source>Manual gain</source>
<translation>Guadagno manuale</translation>
</message>
<message>
<location filename="../src/gui/QML/SettingsPage.qml" line="141"/>
<source>Value: </source>
<translation>Valore:</translation>
</message>
<message>
<location filename="../src/gui/QML/SettingsPage.qml" line="160"/>
<source>Full screen mode</source>
<translation>Modalità tutto schermo</translation>
</message>
<message>
<location filename="../src/gui/QML/SettingsPage.qml" line="169"/>
<source>Expert mode</source>
<translation>Modalità pro</translation>
</message>
<message>
<location filename="../src/gui/QML/SettingsPage.qml" line="188"/>
<source>Select channel manually</source>
<translation>Seleziona il canale manualmente</translation>
</message>
<message>
<location filename="../src/gui/QML/SettingsPage.qml" line="200"/>
<source>Clear station list</source>
<translation>Elimina la lista delle stazioni</translation>
</message>
<message>
<location filename="../src/gui/QML/SettingsPage.qml" line="236"/>
<source>Exit welle.io</source>
<translation>Esci da welle.io</translation>
</message>
</context>
<context>
<name>SpectrumView</name>
<message>
<location filename="../src/gui/QML/SpectrumView.qml" line="14"/>
<source>Spectrum</source>
<translation>Spettro</translation>
</message>
<message>
<location filename="../src/gui/QML/SpectrumView.qml" line="41"/>
<source>Amplitude</source>
<translation>Ampiezza</translation>
</message>
<message>
<location filename="../src/gui/QML/SpectrumView.qml" line="47"/>
<source>Frequency</source>
<translation>Frequenza</translation>
</message>
</context>
<context>
<name>TouchSwitch</name>
<message>
<location filename="../src/gui/QML/style/TouchSwitch.qml" line="56"/>
<source>ON</source>
<translation>ON</translation>
</message>
<message>
<location filename="../src/gui/QML/style/TouchSwitch.qml" line="68"/>
<source>OFF</source>
<translation>OFF</translation>
</message>
</context>
<context>
<name>main</name>
<message>
<location filename="../src/main.cpp" line="81"/>
<source>Set the GUI language (e.g. de-DE)</source>
<translation>Imposta il linguaggio della GUI (es. it-IT)</translation>
</message>
<message>
<location filename="../src/main.cpp" line="82"/>
<source>Language</source>
<translation>Lingua</translation>
</message>
<message>
<location filename="../src/main.cpp" line="86"/>
<source>Input device</source>
<translation>Dispositivo radio</translation>
</message>
<message>
<location filename="../src/main.cpp" line="87"/>
<source>Name</source>
<translation>Nome</translation>
</message>
<message>
<location filename="../src/main.cpp" line="91"/>
<source>DAB mode. Possible is: 1, 2 or 4, default: 1</source>
<translation>Modalità DAB. Consentiti: 1, 2 o 4, default: 1</translation>
</message>
<message>
<location filename="../src/main.cpp" line="92"/>
<source>Mode</source>
<translation>Modo</translation>
</message>
<message>
<location filename="../src/main.cpp" line="96"/>
<source>rtl_tcp server IP address. Only valid for input rtl_tcp.</source>
<translation>Indirizzo IP del server rtl_tcp. Valido solo per rtl_tcp.</translation>
</message>
<message>
<location filename="../src/main.cpp" line="97"/>
<source>IP address</source>
<translation>Indirizzo IP</translation>
</message>
<message>
<location filename="../src/main.cpp" line="101"/>
<source>rtl_tcp server IP port. Only valid for input rtl_tcp.</source>
<translation>Porta del server rtl_tcp. Valido solo per rtl_tcp.</translation>
</message>
<message>
<location filename="../src/main.cpp" line="102"/>
<source>Port</source>
<translation>Porta</translation>
</message>
<message>
<location filename="../src/main.cpp" line="106"/>
<source>I/Q RAW file. Only valid for input rawfile.</source>
<translation>File I/Q RAW. Valido solo per file raw.</translation>
</message>
<message>
<location filename="../src/main.cpp" line="107"/>
<source>I/Q RAW file</source>
<translation>I/Q RAW File</translation>
</message>
<message>
<location filename="../src/main.cpp" line="111"/>
<source>I/Q RAW file format. Possible is: u8, s16le, default: u8. Only valid for input rawfile.</source>
<translation>Formato file I/Q RAW. Ammesso: u8, s16le, default: u8. Valido solo per file raw.</translation>
</message>
<message>
<location filename="../src/main.cpp" line="112"/>
<source>I/Q RAW file format</source>
<translation>Formato file I/Q RAW</translation>
</message>
<message>
<location filename="../src/gui/QML/main.qml" line="104"/>
<source>Expert mode is enabled</source>
<translation>La modalità esperto è abilitata</translation>
</message>
<message>
<location filename="../src/gui/QML/main.qml" line="106"/>
<source>Expert mode is disabled</source>
<translation>La modalità esperto è disabilitata</translation>
</message>
</context>
</TS>

BIN
icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

View File

@@ -0,0 +1,85 @@
#
/*
* Copyright (C) 2014 .. 2017
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of the Qt-DAB.
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#
#ifndef __AUDIO_BACKEND__
#define __AUDIO_BACKEND__
#include <QSemaphore>
#include "virtual-backend.h"
#include <vector>
#ifdef __THREADED_BACKEND
#include <QThread>
#include <atomic>
#endif
#include "ringbuffer.h"
#include <stdio.h>
class frameProcessor;
class protection;
class RadioInterface;
#ifdef __THREADED_BACKEND
class audioBackend:public QThread, public virtualBackend {
#else
class audioBackend:public virtualBackend {
#endif
public:
audioBackend (RadioInterface *mr,
audiodata *d,
RingBuffer<int16_t> *,
QString picturesPath);
~audioBackend (void);
int32_t process (int16_t *, int16_t);
void stopRunning (void);
protected:
RadioInterface *myRadioInterface;
RingBuffer<int16_t> *audioBuffer;
private:
#ifdef __THREADED_BACKEND
void run (void);
atomic<bool> running;
QSemaphore freeSlots;
QSemaphore usedSlots;
int16_t *theData [20];
int16_t nextIn;
int16_t nextOut;
#endif
void processSegment (int16_t *Data);
uint8_t dabModus;
int16_t fragmentSize;
int16_t bitRate;
bool shortForm;
int16_t protLevel;
std::vector<uint8_t> outV;
int16_t **interleaveData;
std::vector<int16_t> tempX;
int16_t countforInterleaver;
int16_t interleaverIndex;
std::vector<uint8_t> disperseVector;
protection *protectionHandler;
frameProcessor *our_dabProcessor;
};
#endif

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