Merge pull request #1252 from AlexandreRouma/master

Merging back modern stuff into the new sinks branch
This commit is contained in:
AlexandreRouma 2023-12-14 20:54:04 +01:00 committed by GitHub
commit 348bf75281
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 3358 additions and 136 deletions

View File

@ -96,11 +96,8 @@ jobs:
- name: Update brew repositories - name: Update brew repositories
run: brew update run: brew update
- name: Fix stuff
run: rm -f /usr/local/bin/2to3* /usr/local/bin/idle3* /usr/local/bin/pydoc3* /usr/local/bin/python3* /usr/local/bin/python3-config* && brew reinstall gettext
- name: Install dependencies - name: Install dependencies
run: brew install pkg-config libusb fftw glfw airspy airspyhf portaudio hackrf rtl-sdr libbladerf codec2 zstd autoconf automake libtool && pip3 install mako run: brew install pkg-config libusb fftw glfw airspy airspyhf portaudio hackrf libbladerf codec2 zstd autoconf automake libtool && pip3 install mako
- name: Install volk - name: Install volk
run: git clone --recursive https://github.com/gnuradio/volk && cd volk && mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release .. && make -j3 && sudo make install && cd ../../ run: git clone --recursive https://github.com/gnuradio/volk && cd volk && mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release .. && make -j3 && sudo make install && cd ../../
@ -109,7 +106,7 @@ jobs:
run: wget https://www.sdrplay.com/software/SDRplay_RSP_API-MacOSX-3.07.3.pkg && sudo installer -pkg SDRplay_RSP_API-MacOSX-3.07.3.pkg -target / run: wget https://www.sdrplay.com/software/SDRplay_RSP_API-MacOSX-3.07.3.pkg && sudo installer -pkg SDRplay_RSP_API-MacOSX-3.07.3.pkg -target /
- name: Install libiio - name: Install libiio
run: git clone https://github.com/analogdevicesinc/libiio && cd libiio && mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release .. && make -j3 && sudo make install && cd ../../ run: wget https://github.com/analogdevicesinc/libiio/archive/refs/tags/v0.25.zip && 7z x v0.25.zip && cd libiio-0.25 && mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release .. && make -j3 && sudo make install && cd ../../
- name: Install libad9361 - name: Install libad9361
run: git clone https://github.com/analogdevicesinc/libad9361-iio && cd libad9361-iio && mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release .. && make -j3 && sudo make install && cd ../../ run: git clone https://github.com/analogdevicesinc/libad9361-iio && cd libad9361-iio && mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release .. && make -j3 && sudo make install && cd ../../
@ -120,6 +117,9 @@ jobs:
- name: Install libperseus - name: Install libperseus
run: git clone https://github.com/Microtelecom/libperseus-sdr && cd libperseus-sdr && autoreconf -i && ./configure --prefix=/usr/local && make && make install && cd .. run: git clone https://github.com/Microtelecom/libperseus-sdr && cd libperseus-sdr && autoreconf -i && ./configure --prefix=/usr/local && make && make install && cd ..
- name: Install more recent librtlsdr
run: git clone https://github.com/osmocom/rtl-sdr && cd rtl-sdr && mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release .. && make -j3 LIBRARY_PATH=$(pkg-config --libs-only-L libusb-1.0 | sed 's/\-L//') && sudo make install && cd ../../
- name: Prepare CMake - name: Prepare CMake
working-directory: ${{runner.workspace}}/build working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DOPT_BUILD_PLUTOSDR_SOURCE=ON -DOPT_BUILD_SOAPY_SOURCE=OFF -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_AUDIO_SINK=OFF -DOPT_BUILD_PORTAUDIO_SINK=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=ON -DOPT_BUILD_PERSEUS_SOURCE=ON -DOPT_BUILD_AUDIO_SOURCE=OFF -DUSE_BUNDLE_DEFAULTS=ON -DCMAKE_BUILD_TYPE=Release run: cmake $GITHUB_WORKSPACE -DOPT_BUILD_PLUTOSDR_SOURCE=ON -DOPT_BUILD_SOAPY_SOURCE=OFF -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_AUDIO_SINK=OFF -DOPT_BUILD_PORTAUDIO_SINK=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=ON -DOPT_BUILD_PERSEUS_SOURCE=ON -DOPT_BUILD_AUDIO_SOURCE=OFF -DUSE_BUNDLE_DEFAULTS=ON -DCMAKE_BUILD_TYPE=Release
@ -137,13 +137,13 @@ jobs:
with: with:
name: sdrpp_macos_intel name: sdrpp_macos_intel
path: ${{runner.workspace}}/sdrpp_macos_intel.zip path: ${{runner.workspace}}/sdrpp_macos_intel.zip
build_debian_buster: build_debian_buster:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Create Docker Image - name: Create Docker Image
run: cd $GITHUB_WORKSPACE/docker_builds/debian_buster && docker build . --tag sdrpp_build run: cd $GITHUB_WORKSPACE/docker_builds/debian_buster && docker build . --tag sdrpp_build
@ -182,6 +182,28 @@ jobs:
name: sdrpp_debian_bullseye_amd64 name: sdrpp_debian_bullseye_amd64
path: ${{runner.workspace}}/sdrpp_debian_amd64.deb path: ${{runner.workspace}}/sdrpp_debian_amd64.deb
build_debian_bookworm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Create Docker Image
run: cd $GITHUB_WORKSPACE/docker_builds/debian_bookworm && docker build . --tag sdrpp_build
- name: Run Container
run: docker run --name build -v $GITHUB_WORKSPACE:/root/SDRPlusPlus --env BUILD_NO="-$GITHUB_RUN_NUMBER" sdrpp_build /root/do_build.sh
- name: Recover Deb Archive
working-directory: ${{runner.workspace}}
run: docker cp build:/root/SDRPlusPlus/sdrpp_debian_amd64.deb ./
- name: Save Deb Archive
uses: actions/upload-artifact@v3
with:
name: sdrpp_debian_bookworm_amd64
path: ${{runner.workspace}}/sdrpp_debian_amd64.deb
build_debian_sid: build_debian_sid:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -204,28 +226,6 @@ jobs:
name: sdrpp_debian_sid_amd64 name: sdrpp_debian_sid_amd64
path: ${{runner.workspace}}/sdrpp_debian_amd64.deb path: ${{runner.workspace}}/sdrpp_debian_amd64.deb
# build_ubuntu_bionic:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - name: Create Docker Image
# run: cd $GITHUB_WORKSPACE/docker_builds/ubuntu_bionic && docker build . --tag sdrpp_build
# - name: Run Container
# run: docker run --name build -v $GITHUB_WORKSPACE:/root/SDRPlusPlus --env BUILD_NO="-$GITHUB_RUN_NUMBER" sdrpp_build /root/do_build.sh
# - name: Recover Deb Archive
# working-directory: ${{runner.workspace}}
# run: docker cp build:/root/SDRPlusPlus/sdrpp_debian_amd64.deb ./
# - name: Save Deb Archive
# uses: actions/upload-artifact@v3
# with:
# name: sdrpp_ubuntu_bionic_amd64
# path: ${{runner.workspace}}/sdrpp_debian_amd64.deb
build_ubuntu_focal: build_ubuntu_focal:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -325,7 +325,7 @@ jobs:
path: ${{runner.workspace}}/sdrpp.apk path: ${{runner.workspace}}/sdrpp.apk
create_full_archive: create_full_archive:
needs: ['build_windows', 'build_macos', 'build_debian_buster', 'build_debian_bullseye', 'build_debian_sid', 'build_ubuntu_focal', 'build_ubuntu_jammy', 'build_raspios_bullseye_armhf', 'build_android'] needs: ['build_windows', 'build_macos', 'build_debian_buster', 'build_debian_bullseye', 'build_debian_bookworm', 'build_debian_sid', 'build_ubuntu_focal', 'build_ubuntu_jammy', 'build_raspios_bullseye_armhf', 'build_android']
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -339,6 +339,7 @@ jobs:
mv sdrpp_macos_intel/sdrpp_macos_intel.zip sdrpp_all/ && mv sdrpp_macos_intel/sdrpp_macos_intel.zip sdrpp_all/ &&
mv sdrpp_debian_buster_amd64/sdrpp_debian_amd64.deb sdrpp_all/sdrpp_debian_buster_amd64.deb && mv sdrpp_debian_buster_amd64/sdrpp_debian_amd64.deb sdrpp_all/sdrpp_debian_buster_amd64.deb &&
mv sdrpp_debian_bullseye_amd64/sdrpp_debian_amd64.deb sdrpp_all/sdrpp_debian_bullseye_amd64.deb && mv sdrpp_debian_bullseye_amd64/sdrpp_debian_amd64.deb sdrpp_all/sdrpp_debian_bullseye_amd64.deb &&
mv sdrpp_debian_bookworm_amd64/sdrpp_debian_amd64.deb sdrpp_all/sdrpp_debian_bookworm_amd64.deb &&
mv sdrpp_debian_sid_amd64/sdrpp_debian_amd64.deb sdrpp_all/sdrpp_debian_sid_amd64.deb && mv sdrpp_debian_sid_amd64/sdrpp_debian_amd64.deb sdrpp_all/sdrpp_debian_sid_amd64.deb &&
mv sdrpp_ubuntu_focal_amd64/sdrpp_debian_amd64.deb sdrpp_all/sdrpp_ubuntu_focal_amd64.deb && mv sdrpp_ubuntu_focal_amd64/sdrpp_debian_amd64.deb sdrpp_all/sdrpp_ubuntu_focal_amd64.deb &&
mv sdrpp_ubuntu_jammy_amd64/sdrpp_debian_amd64.deb sdrpp_all/sdrpp_ubuntu_jammy_amd64.deb && mv sdrpp_ubuntu_jammy_amd64/sdrpp_debian_amd64.deb sdrpp_all/sdrpp_ubuntu_jammy_amd64.deb &&

View File

@ -108,7 +108,6 @@ elseif (ANDROID)
) )
target_link_libraries(sdrpp_core PUBLIC target_link_libraries(sdrpp_core PUBLIC
/sdr-kit/${ANDROID_ABI}/lib/libcpu_features.a
/sdr-kit/${ANDROID_ABI}/lib/libvolk.so /sdr-kit/${ANDROID_ABI}/lib/libvolk.so
/sdr-kit/${ANDROID_ABI}/lib/libfftw3f.so /sdr-kit/${ANDROID_ABI}/lib/libfftw3f.so
/sdr-kit/${ANDROID_ABI}/lib/libzstd.so /sdr-kit/${ANDROID_ABI}/lib/libzstd.so

View File

@ -12,6 +12,7 @@ namespace sdrpp_credits {
"Howard0su", "Howard0su",
"John Donkersley", "John Donkersley",
"Joshua Kimsey", "Joshua Kimsey",
"Manawyrm",
"Martin Hauke", "Martin Hauke",
"Marvin Sinister", "Marvin Sinister",
"Maxime Biette", "Maxime Biette",
@ -21,7 +22,6 @@ namespace sdrpp_credits {
"Shuyuan Liu", "Shuyuan Liu",
"Syne Ardwin (WI9SYN)", "Syne Ardwin (WI9SYN)",
"Szymon Zakrent", "Szymon Zakrent",
"Tobias Mädel",
"Youssef Touil", "Youssef Touil",
"Zimm" "Zimm"
}; };

View File

@ -82,7 +82,7 @@ namespace dsp {
inline float fastAmplitude() { inline float fastAmplitude() {
float re_abs = fabsf(re); float re_abs = fabsf(re);
float im_abs = fabsf(re); float im_abs = fabsf(im);
if (re_abs > im_abs) { return re_abs + 0.4f * im_abs; } if (re_abs > im_abs) { return re_abs + 0.4f * im_abs; }
return im_abs + 0.4f * re_abs; return im_abs + 0.4f * re_abs;
} }
@ -125,4 +125,4 @@ namespace dsp {
float l; float l;
float r; float r;
}; };
} }

View File

@ -577,10 +577,22 @@ void MainWindow::draw() {
// Handle scrollwheel // Handle scrollwheel
int wheel = ImGui::GetIO().MouseWheel; int wheel = ImGui::GetIO().MouseWheel;
if (wheel != 0 && (gui::waterfall.mouseInFFT || gui::waterfall.mouseInWaterfall)) { if (wheel != 0 && (gui::waterfall.mouseInFFT || gui::waterfall.mouseInWaterfall)) {
// Select factor depending on modifier keys
double interval;
if (ImGui::IsKeyDown(ImGuiKey_LeftShift)) {
interval = vfo->snapInterval * 10.0;
}
else if (ImGui::IsKeyDown(ImGuiKey_LeftAlt)) {
interval = vfo->snapInterval * 0.1;
}
else {
interval = vfo->snapInterval;
}
double nfreq; double nfreq;
if (vfo != NULL) { if (vfo != NULL) {
nfreq = gui::waterfall.getCenterFrequency() + vfo->generalOffset + (vfo->snapInterval * wheel); nfreq = gui::waterfall.getCenterFrequency() + vfo->generalOffset + (interval * wheel);
nfreq = roundl(nfreq / vfo->snapInterval) * vfo->snapInterval; nfreq = roundl(nfreq / interval) * interval;
} }
else { else {
nfreq = gui::waterfall.getCenterFrequency() - (gui::waterfall.getViewBandwidth() * wheel / 20.0); nfreq = gui::waterfall.getCenterFrequency() - (gui::waterfall.getViewBandwidth() * wheel / 20.0);

View File

@ -2,7 +2,7 @@
#include <utils/flog.h> #include <utils/flog.h>
bool ModuleComManager::registerInterface(std::string moduleName, std::string name, void (*handler)(int code, void* in, void* out, void* ctx), void* ctx) { bool ModuleComManager::registerInterface(std::string moduleName, std::string name, void (*handler)(int code, void* in, void* out, void* ctx), void* ctx) {
std::lock_guard<std::mutex> lck(mtx); std::lock_guard<std::recursive_mutex> lck(mtx);
if (interfaces.find(name) != interfaces.end()) { if (interfaces.find(name) != interfaces.end()) {
flog::error("Tried creating module interface with an existing name: {0}", name); flog::error("Tried creating module interface with an existing name: {0}", name);
return false; return false;
@ -16,7 +16,7 @@ bool ModuleComManager::registerInterface(std::string moduleName, std::string nam
} }
bool ModuleComManager::unregisterInterface(std::string name) { bool ModuleComManager::unregisterInterface(std::string name) {
std::lock_guard<std::mutex> lck(mtx); std::lock_guard<std::recursive_mutex> lck(mtx);
if (interfaces.find(name) == interfaces.end()) { if (interfaces.find(name) == interfaces.end()) {
flog::error("Tried to erase module interface with unknown name: {0}", name); flog::error("Tried to erase module interface with unknown name: {0}", name);
return false; return false;
@ -26,13 +26,13 @@ bool ModuleComManager::unregisterInterface(std::string name) {
} }
bool ModuleComManager::interfaceExists(std::string name) { bool ModuleComManager::interfaceExists(std::string name) {
std::lock_guard<std::mutex> lck(mtx); std::lock_guard<std::recursive_mutex> lck(mtx);
if (interfaces.find(name) == interfaces.end()) { return false; } if (interfaces.find(name) == interfaces.end()) { return false; }
return true; return true;
} }
std::string ModuleComManager::getModuleName(std::string name) { std::string ModuleComManager::getModuleName(std::string name) {
std::lock_guard<std::mutex> lck(mtx); std::lock_guard<std::recursive_mutex> lck(mtx);
if (interfaces.find(name) == interfaces.end()) { if (interfaces.find(name) == interfaces.end()) {
flog::error("Tried to call unknown module interface: {0}", name); flog::error("Tried to call unknown module interface: {0}", name);
return ""; return "";
@ -41,7 +41,7 @@ std::string ModuleComManager::getModuleName(std::string name) {
} }
bool ModuleComManager::callInterface(std::string name, int code, void* in, void* out) { bool ModuleComManager::callInterface(std::string name, int code, void* in, void* out) {
std::lock_guard<std::mutex> lck(mtx); std::lock_guard<std::recursive_mutex> lck(mtx);
if (interfaces.find(name) == interfaces.end()) { if (interfaces.find(name) == interfaces.end()) {
flog::error("Tried to call unknown module interface: {0}", name); flog::error("Tried to call unknown module interface: {0}", name);
return false; return false;

View File

@ -18,6 +18,6 @@ public:
bool callInterface(std::string name, int code, void* in, void* out); bool callInterface(std::string name, int code, void* in, void* out);
private: private:
std::mutex mtx; std::recursive_mutex mtx;
std::map<std::string, ModuleComInterface> interfaces; std::map<std::string, ModuleComInterface> interfaces;
}; };

View File

@ -91,9 +91,9 @@ namespace riff {
file.write((char*)&desc.hdr.size, sizeof(desc.hdr.size)); file.write((char*)&desc.hdr.size, sizeof(desc.hdr.size));
file.seekp(pos); file.seekp(pos);
// If parent chunk, increment its size // If parent chunk, increment its size by the size of the sub-chunk plus the size of its header)
if (!chunks.empty()) { if (!chunks.empty()) {
chunks.top().hdr.size += desc.hdr.size; chunks.top().hdr.size += desc.hdr.size + sizeof(ChunkHeader);
} }
} }

View File

@ -0,0 +1,4 @@
FROM debian:bookworm
ENV DEBIAN_FRONTEND=noninteractive
COPY do_build.sh /root
RUN chmod +x /root/do_build.sh

View File

@ -0,0 +1,35 @@
#!/bin/bash
set -e
cd /root
# Install dependencies and tools
apt update
apt install -y build-essential cmake git libfftw3-dev libglfw3-dev libvolk2-dev libzstd-dev libsoapysdr-dev libairspyhf-dev libairspy-dev \
libiio-dev libad9361-dev librtaudio-dev libhackrf-dev librtlsdr-dev libbladerf-dev liblimesuite-dev p7zip-full wget portaudio19-dev \
libcodec2-dev autoconf libtool xxd
# Install SDRPlay libraries
wget https://www.sdrplay.com/software/SDRplay_RSP_API-Linux-3.07.1.run
7z x ./SDRplay_RSP_API-Linux-3.07.1.run
7z x ./SDRplay_RSP_API-Linux-3.07.1
cp x86_64/libsdrplay_api.so.3.07 /usr/lib/libsdrplay_api.so
cp inc/* /usr/include/
# Install libperseus
git clone https://github.com/Microtelecom/libperseus-sdr
cd libperseus-sdr
autoreconf -i
./configure
make
make install
ldconfig
cd ..
cd SDRPlusPlus
mkdir build
cd build
cmake .. -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=ON -DOPT_BUILD_PERSEUS_SOURCE=ON
make VERBOSE=1 -j2
cd ..
sh make_debian_package.sh ./build 'libfftw3-dev, libglfw3-dev, libvolk2-dev, librtaudio-dev, libzstd-dev'

View File

@ -4,7 +4,7 @@ cd /root
# Install dependencies and tools # Install dependencies and tools
apt update apt update
apt install -y build-essential cmake git libfftw3-dev libglfw3-dev libvolk2-dev libzstd-dev libsoapysdr-dev libairspyhf-dev libairspy-dev \ apt install -y build-essential cmake git libfftw3-dev libglfw3-dev libvolk-dev libzstd-dev libsoapysdr-dev libairspyhf-dev libairspy-dev \
libiio-dev libad9361-dev librtaudio-dev libhackrf-dev librtlsdr-dev libbladerf-dev liblimesuite-dev p7zip-full wget portaudio19-dev \ libiio-dev libad9361-dev librtaudio-dev libhackrf-dev librtlsdr-dev libbladerf-dev liblimesuite-dev p7zip-full wget portaudio19-dev \
libcodec2-dev autoconf libtool xxd libcodec2-dev autoconf libtool xxd
@ -32,4 +32,4 @@ cmake .. -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD
make VERBOSE=1 -j2 make VERBOSE=1 -j2
cd .. cd ..
sh make_debian_package.sh ./build 'libfftw3-dev, libglfw3-dev, libvolk2-dev, librtaudio-dev, libzstd-dev' sh make_debian_package.sh ./build 'libfftw3-dev, libglfw3-dev, libvolk-dev, librtaudio-dev, libzstd-dev'

View File

@ -81,7 +81,7 @@ bundle_find_full_path() {
# Correct dep path # Correct dep path
echo $RPATH/$RPATH_NEXT echo $RPATH/$RPATH_NEXT
return return -1
done done
# Search other common paths # Search other common paths

View File

@ -5,4 +5,5 @@ file(GLOB SRC "src/*.cpp")
include(${SDRPP_MODULE_CMAKE}) include(${SDRPP_MODULE_CMAKE})
target_include_directories(recorder PRIVATE "src/") target_include_directories(recorder PRIVATE "src/")
target_include_directories(recorder PRIVATE "../../decoder_modules/radio/src")

View File

@ -21,6 +21,7 @@
#include <core.h> #include <core.h>
#include <utils/optionlist.h> #include <utils/optionlist.h>
#include <utils/wav.h> #include <utils/wav.h>
#include <radio_interface.h>
#define CONCAT(a, b) ((std::string(a) + b).c_str()) #define CONCAT(a, b) ((std::string(a) + b).c_str())
@ -437,6 +438,17 @@ private:
if (dbLvl.r > lvl.r) { lvl.r = dbLvl.r; } if (dbLvl.r > lvl.r) { lvl.r = dbLvl.r; }
} }
std::map<int, const char*> radioModeToString = {
{ RADIO_IFACE_MODE_NFM, "NFM" },
{ RADIO_IFACE_MODE_WFM, "WFM" },
{ RADIO_IFACE_MODE_AM, "AM" },
{ RADIO_IFACE_MODE_DSB, "DSB" },
{ RADIO_IFACE_MODE_USB, "USB" },
{ RADIO_IFACE_MODE_CW, "CW" },
{ RADIO_IFACE_MODE_LSB, "LSB" },
{ RADIO_IFACE_MODE_RAW, "RAW" }
};
std::string genFileName(std::string templ, std::string type, std::string name) { std::string genFileName(std::string templ, std::string type, std::string name) {
// Get data // Get data
time_t now = time(0); time_t now = time(0);
@ -455,6 +467,7 @@ private:
char dayStr[128]; char dayStr[128];
char monStr[128]; char monStr[128];
char yearStr[128]; char yearStr[128];
const char* modeStr = "Unknown";
sprintf(freqStr, "%.0lfHz", freq); sprintf(freqStr, "%.0lfHz", freq);
sprintf(hourStr, "%02d", ltm->tm_hour); sprintf(hourStr, "%02d", ltm->tm_hour);
sprintf(minStr, "%02d", ltm->tm_min); sprintf(minStr, "%02d", ltm->tm_min);
@ -462,6 +475,11 @@ private:
sprintf(dayStr, "%02d", ltm->tm_mday); sprintf(dayStr, "%02d", ltm->tm_mday);
sprintf(monStr, "%02d", ltm->tm_mon + 1); sprintf(monStr, "%02d", ltm->tm_mon + 1);
sprintf(yearStr, "%02d", ltm->tm_year + 1900); sprintf(yearStr, "%02d", ltm->tm_year + 1900);
if (core::modComManager.getModuleName(name) == "radio") {
int mode;
core::modComManager.callInterface(name, RADIO_IFACE_CMD_GET_MODE, NULL, &mode);
modeStr = radioModeToString[mode];
}
// Replace in template // Replace in template
templ = std::regex_replace(templ, std::regex("\\$t"), type); templ = std::regex_replace(templ, std::regex("\\$t"), type);
@ -472,6 +490,7 @@ private:
templ = std::regex_replace(templ, std::regex("\\$d"), dayStr); templ = std::regex_replace(templ, std::regex("\\$d"), dayStr);
templ = std::regex_replace(templ, std::regex("\\$M"), monStr); templ = std::regex_replace(templ, std::regex("\\$M"), monStr);
templ = std::regex_replace(templ, std::regex("\\$y"), yearStr); templ = std::regex_replace(templ, std::regex("\\$y"), yearStr);
templ = std::regex_replace(templ, std::regex("\\$r"), modeStr);
return templ; return templ;
} }

View File

@ -333,6 +333,17 @@ private:
_this->client->readAsync(1024, _this->dataBuf, dataHandler, _this, false); _this->client->readAsync(1024, _this->dataBuf, dataHandler, _this, false);
} }
std::map<int, const char*> radioModeToString = {
{ RADIO_IFACE_MODE_NFM, "NFM" },
{ RADIO_IFACE_MODE_WFM, "WFM" },
{ RADIO_IFACE_MODE_AM, "AM" },
{ RADIO_IFACE_MODE_DSB, "DSB" },
{ RADIO_IFACE_MODE_USB, "USB" },
{ RADIO_IFACE_MODE_CW, "CW" },
{ RADIO_IFACE_MODE_LSB, "LSB" },
{ RADIO_IFACE_MODE_RAW, "RAW" }
};
void commandHandler(std::string cmd) { void commandHandler(std::string cmd) {
std::string corr = ""; std::string corr = "";
std::vector<std::string> parts; std::vector<std::string> parts;
@ -442,38 +453,18 @@ private:
pos++; pos++;
} }
const std::string& newModeStr = parts[1];
float newBandwidth = std::atoi(parts[2].c_str()); float newBandwidth = std::atoi(parts[2].c_str());
int newMode; auto it = std::find_if(radioModeToString.begin(), radioModeToString.end(), [&newModeStr](const auto& e) {
if (parts[1] == "FM") { return e.second == newModeStr;
newMode = RADIO_IFACE_MODE_NFM; });
} if (it == radioModeToString.end()) {
else if (parts[1] == "WFM") {
newMode = RADIO_IFACE_MODE_WFM;
}
else if (parts[1] == "AM") {
newMode = RADIO_IFACE_MODE_AM;
}
else if (parts[1] == "DSB") {
newMode = RADIO_IFACE_MODE_DSB;
}
else if (parts[1] == "USB") {
newMode = RADIO_IFACE_MODE_USB;
}
else if (parts[1] == "CW") {
newMode = RADIO_IFACE_MODE_CW;
}
else if (parts[1] == "LSB") {
newMode = RADIO_IFACE_MODE_LSB;
}
else if (parts[1] == "RAW") {
newMode = RADIO_IFACE_MODE_RAW;
}
else {
resp = "RPRT 1\n"; resp = "RPRT 1\n";
client->write(resp.size(), (uint8_t*)resp.c_str()); client->write(resp.size(), (uint8_t*)resp.c_str());
return; return;
} }
int newMode = it->first;
// If tuning is enabled, set the mode and optionally the bandwidth // If tuning is enabled, set the mode and optionally the bandwidth
if (!selectedVfo.empty() && core::modComManager.getModuleName(selectedVfo) == "radio" && tuningEnabled) { if (!selectedVfo.empty() && core::modComManager.getModuleName(selectedVfo) == "radio" && tuningEnabled) {
@ -492,31 +483,9 @@ private:
if (!selectedVfo.empty() && core::modComManager.getModuleName(selectedVfo) == "radio") { if (!selectedVfo.empty() && core::modComManager.getModuleName(selectedVfo) == "radio") {
int mode; int mode;
core::modComManager.callInterface(selectedVfo, RADIO_IFACE_CMD_GET_MODE, NULL, &mode); core::modComManager.callInterface(selectedVfo, RADIO_IFACE_CMD_GET_MODE, NULL, &mode);
resp = std::string(radioModeToString[mode]) + "\n";
if (mode == RADIO_IFACE_MODE_NFM) {
resp = "FM\n";
}
else if (mode == RADIO_IFACE_MODE_WFM) {
resp = "WFM\n";
}
else if (mode == RADIO_IFACE_MODE_AM) {
resp = "AM\n";
}
else if (mode == RADIO_IFACE_MODE_DSB) {
resp = "DSB\n";
}
else if (mode == RADIO_IFACE_MODE_USB) {
resp = "USB\n";
}
else if (mode == RADIO_IFACE_MODE_CW) {
resp = "CW\n";
}
else if (mode == RADIO_IFACE_MODE_LSB) {
resp = "LSB\n";
}
} }
else if (!selectedVfo.empty()) {
if (!selectedVfo.empty()) {
resp += std::to_string((int)sigpath::vfoManager.getBandwidth(selectedVfo)) + "\n"; resp += std::to_string((int)sigpath::vfoManager.getBandwidth(selectedVfo)) + "\n";
} }
else { else {

View File

@ -76,7 +76,7 @@ The preferred IDE is [VS Code](https://code.visualstudio.com/) in order to have
* [cmake](https://cmake.org) * [cmake](https://cmake.org)
* [vcpkg](https://vcpkg.io) * [vcpkg](https://vcpkg.io)
* [PothosSDR](https://github.com/pothosware/PothosSDR) (This will install libraries for most SDRs) * [PothosSDR](https://github.com/pothosware/PothosSDR) (This will install libraries for most SDRs. You have to install it in `C:/Program Files/PothosSDR`)
* [RtAudio](https://www.music.mcgill.ca/~gary/rtaudio/) (You have to build and install it in `C:/Program Files (x86)/RtAudio/`) * [RtAudio](https://www.music.mcgill.ca/~gary/rtaudio/) (You have to build and install it in `C:/Program Files (x86)/RtAudio/`)
After this, install the following dependencies using vcpkg: After this, install the following dependencies using vcpkg:
@ -115,16 +115,16 @@ You will next need to edit the `root_dev/config.json` file to point to the modul
From the top directory, you can simply run: From the top directory, you can simply run:
```bat ```bat
./build/Release/sdrpp.exe -r root_dev -s ./build/Release/sdrpp.exe -r root_dev -c
``` ```
Or, if you wish to run from the build directory e.g. `build/Release` and adapt the relative path to the `root_dev` folder: Or, if you wish to run from the build directory e.g. `build/Release` and adapt the relative path to the `root_dev` folder:
```bat ```bat
./sdrpp.exe -r ../../root_dev -s ./sdrpp.exe -r ../../root_dev -c
``` ```
The optional `-s` argument is for keeping the console active in order to see the error messages. The optional `-c` argument is for keeping the console active in order to see the error messages.
Because all the paths are relative, for the rest of the command line instructions we are going to assume you are running from the top directory using the former command. Because all the paths are relative, for the rest of the command line instructions we are going to assume you are running from the top directory using the former command.
As mentioned previously you need to edit `root_dev/config.json` to add the modules that were built. From the default configuration file you need to add the paths in the `modules` section. Add to this list all the modules you wish to use. As mentioned previously you need to edit `root_dev/config.json` to add the modules that were built. From the default configuration file you need to add the paths in the `modules` section. Add to this list all the modules you wish to use.
@ -473,6 +473,7 @@ I will soon publish a contributing.md listing the code style to use.
* [Howard0su](https://github.com/howard0su) * [Howard0su](https://github.com/howard0su)
* John Donkersley * John Donkersley
* [Joshua Kimsey](https://github.com/JoshuaKimsey) * [Joshua Kimsey](https://github.com/JoshuaKimsey)
* [Manawyrm](https://github.com/Manawyrm)
* [Martin Hauke](https://github.com/mnhauke) * [Martin Hauke](https://github.com/mnhauke)
* [Marvin Sinister](https://github.com/marvin-sinister) * [Marvin Sinister](https://github.com/marvin-sinister)
* [Maxime Biette](https://github.com/mbiette) * [Maxime Biette](https://github.com/mbiette)
@ -482,7 +483,6 @@ I will soon publish a contributing.md listing the code style to use.
* [Shuyuan Liu](https://github.com/shuyuan-liu) * [Shuyuan Liu](https://github.com/shuyuan-liu)
* [Syne Ardwin (WI9SYN)](https://esaille.me/) * [Syne Ardwin (WI9SYN)](https://esaille.me/)
* [Szymon Zakrent](https://github.com/zakrent) * [Szymon Zakrent](https://github.com/zakrent)
* [Tobias Mädel](https://github.com/Manawyrm)
* Youssef Touil * Youssef Touil
* [Zimm](https://github.com/invader-zimm) * [Zimm](https://github.com/invader-zimm)

View File

@ -149,6 +149,12 @@
"start": 28000000, "start": 28000000,
"end": 29700000 "end": 29700000
}, },
{
"name": "8m - Amateur",
"type": "amateur",
"start": 40660000,
"end": 40690000
},
{ {
"name": "6m - Amateur", "name": "6m - Amateur",
"type": "amateur", "type": "amateur",

View File

@ -115,7 +115,7 @@
"end": 4995000 "end": 4995000
}, },
{ {
"name": "60m - radiodiffusion", "name": "60m - radiodiffusion",
"type": "broadcast", "type": "broadcast",
"start": 5005000, "start": 5005000,
"end": 5060000 "end": 5060000
@ -340,7 +340,7 @@
"name": "11m - CB", "name": "11m - CB",
"type": "amateur", "type": "amateur",
"start": 26960000, "start": 26960000,
"end": 27230000 "end": 27410000
}, },
{ {
"name": "10m - Radioamateur", "name": "10m - Radioamateur",
@ -493,4 +493,4 @@
"end": 250000000000 "end": 250000000000
} }
] ]
} }

View File

@ -2,7 +2,7 @@
"name": "Germany", "name": "Germany",
"country_name": "Germany", "country_name": "Germany",
"country_code": "DE", "country_code": "DE",
"author_name": "Tobias Mädel", "author_name": "Manawyrm",
"author_url": "https://tbspace.de", "author_url": "https://tbspace.de",
"bands": [ "bands": [
{ {

File diff suppressed because it is too large Load Diff

View File

@ -227,6 +227,18 @@
"start": 144000000, "start": 144000000,
"end": 148000000 "end": 148000000
}, },
{
"name": "MURS (lower)",
"type": "amateur",
"start": 151820000,
"end": 151940000
},
{
"name": "MURS (upper)",
"type": "amateur",
"start": 154570000,
"end": 154600000
},
{ {
"name": "Marine", "name": "Marine",
"type": "marine", "type": "marine",

View File

@ -1,22 +0,0 @@
#!/bin/sh
set -e
[ $(id -u) = 0 ] && echo "Please do not run this script as root" && exit 100
echo "Installing dependencies"
sudo apt update
sudo apt install -y build-essential cmake git libfftw3-dev libglfw3-dev libvolk1-dev libzstd-dev libsoapysdr-dev libairspyhf-dev libairspy-dev \
libiio-dev libad9361-dev librtaudio-dev libhackrf-dev librtlsdr-dev libbladerf-dev liblimesuite-dev p7zip-full wget
echo "Preparing build"
mkdir -p build
cd build
cmake .. -DOPT_BUILD_LIMESDR_SOURCE=ON
echo "Building"
make
echo "Installing"
sudo make install
echo "Done!"

View File

@ -1,3 +1,4 @@
#define NOMINMAX
#include <imgui.h> #include <imgui.h>
#include <utils/flog.h> #include <utils/flog.h>
#include <module.h> #include <module.h>
@ -9,6 +10,8 @@
#include <filesystem> #include <filesystem>
#include <regex> #include <regex>
#include <gui/tuner.h> #include <gui/tuner.h>
#include <algorithm>
#include <stdexcept>
#define CONCAT(a, b) ((std::string(a) + b).c_str()) #define CONCAT(a, b) ((std::string(a) + b).c_str())
@ -121,6 +124,12 @@ private:
} }
try { try {
_this->reader = new WavReader(_this->fileSelect.path); _this->reader = new WavReader(_this->fileSelect.path);
if (_this->reader->getSampleRate() == 0) {
_this->reader->close();
delete _this->reader;
_this->reader = NULL;
throw std::runtime_error("Sample rate may not be zero");
}
_this->sampleRate = _this->reader->getSampleRate(); _this->sampleRate = _this->reader->getSampleRate();
core::setInputSampleRate(_this->sampleRate); core::setInputSampleRate(_this->sampleRate);
std::string filename = std::filesystem::path(_this->fileSelect.path).filename().string(); std::string filename = std::filesystem::path(_this->fileSelect.path).filename().string();
@ -130,7 +139,7 @@ private:
//gui::freqSelect.maxFreq = _this->centerFreq + (_this->sampleRate/2); //gui::freqSelect.maxFreq = _this->centerFreq + (_this->sampleRate/2);
//gui::freqSelect.limitFreq = true; //gui::freqSelect.limitFreq = true;
} }
catch (std::exception e) { catch (std::exception& e) {
flog::error("Error: {0}", e.what()); flog::error("Error: {0}", e.what());
} }
config.acquire(); config.acquire();
@ -144,8 +153,8 @@ private:
static void worker(void* ctx) { static void worker(void* ctx) {
FileSourceModule* _this = (FileSourceModule*)ctx; FileSourceModule* _this = (FileSourceModule*)ctx;
double sampleRate = _this->reader->getSampleRate(); double sampleRate = std::max(_this->reader->getSampleRate(), (uint32_t)1);
int blockSize = sampleRate / 200.0f; int blockSize = std::min((int)(sampleRate / 200.0f), (int)STREAM_BUFFER_SIZE);
int16_t* inBuf = new int16_t[blockSize * 2]; int16_t* inBuf = new int16_t[blockSize * 2];
while (true) { while (true) {
@ -159,8 +168,8 @@ private:
static void floatWorker(void* ctx) { static void floatWorker(void* ctx) {
FileSourceModule* _this = (FileSourceModule*)ctx; FileSourceModule* _this = (FileSourceModule*)ctx;
double sampleRate = _this->reader->getSampleRate(); double sampleRate = std::max(_this->reader->getSampleRate(), (uint32_t)1);
int blockSize = sampleRate / 200.0f; int blockSize = std::min((int)(sampleRate / 200.0f), (int)STREAM_BUFFER_SIZE);
dsp::complex_t* inBuf = new dsp::complex_t[blockSize]; dsp::complex_t* inBuf = new dsp::complex_t[blockSize];
while (true) { while (true) {
@ -214,4 +223,4 @@ MOD_EXPORT void _DELETE_INSTANCE_(void* instance) {
MOD_EXPORT void _END_() { MOD_EXPORT void _END_() {
config.disableAutoSave(); config.disableAutoSave();
config.save(); config.save();
} }