Porównaj commity

...

20 Commity

Autor SHA1 Wiadomość Data
AlexandreRouma eab4264604
Merge pull request #1291 from AlexandreRouma/citest
Allow MacOS build to run on Catalina and newer
2024-01-22 11:32:25 -08:00
AlexandreRouma 4b77d8c395 prepare for merge back part 2, electric boogaloo 2024-01-22 20:31:18 +01:00
AlexandreRouma 854ed89b82 prepare for merge back 2024-01-22 20:30:53 +01:00
AlexandreRouma 27ab5bf3c1 Fix exceptions referenced in #1287 2024-01-22 19:46:01 +01:00
AlexandreRouma 159f59b858 fix return warning for #1234 2024-01-22 19:34:56 +01:00
AlexandreRouma 93cafe7109 fix typo referenced in #1083 2024-01-22 19:22:26 +01:00
AlexandreRouma 74ae8a45d9 fix incorrect formatting again for #1288 2024-01-22 18:17:23 +01:00
AlexandreRouma 691216a298 fix incorrect formatting #1288 this time in the right branch... 2024-01-22 17:31:09 +01:00
AlexandreRouma 3e58d4ba31 fix missing return statement 2024-01-22 02:10:48 +01:00
AlexandreRouma 86dcec7495
Merge pull request #1284 from hzeller/20240121-adapt-rtaudio
Make compatible with rtaudio API 5 and 6.
2024-01-21 16:31:31 -08:00
Henner Zeller 5a003e99d2 Address review comments. 2024-01-21 15:36:41 -08:00
AlexandreRouma f197cf6bd9
Fix styling in the other file 2024-01-21 23:49:23 +01:00
AlexandreRouma 8cefeadbd4
Fix styling, modern computers can display more than 40 columns 2024-01-21 23:48:04 +01:00
Henner Zeller 23ae66151b Make compatible with rtaudio API 5 and 6.
Recent rtaudio changed the API to not throw exceptions anymore and
also have DeviceIDs not queried by index but IDs that are provided
separately ( https://github.com/thestk/rtaudio/releases ).

Adapt the code-base to be compatible with the old and the new API
as we have to exepect that in a transition period both APIs are
common on various build platforms.
2024-01-21 14:37:30 -08:00
AlexandreRouma fa76b4e865 Made the contributing policy more clear 2024-01-21 20:19:46 +01:00
AlexandreRouma 5e195a0d43 testing something for macos (do not use this CI build) 2024-01-19 20:53:25 +01:00
AlexandreRouma 5e299d9d23 testing something silly 2 2024-01-19 20:01:05 +01:00
AlexandreRouma fd5813df6d testing something silly 2024-01-19 19:43:31 +01:00
AlexandreRouma eabb842b6b switched MacOS CI to debug mode 2024-01-19 19:11:01 +01:00
AlexandreRouma 5a1945f779 allow running code on older macos version (test) 2024-01-17 07:07:24 +01:00
21 zmienionych plików z 110 dodań i 114 usunięć

Wyświetl plik

@ -1,7 +1,4 @@
# Important
Only minor bug fixes and bandplans are accepted.
Pull requests adding features or any bug fix that requires significant code changes will be automatically rejected.
Only bandplan, colormaps and themes are accepted. Code pull requests are **NOT welcome**.
Open an issue requesting a feature or discussing a possible bugfix instead.

Wyświetl plik

@ -85,7 +85,7 @@ jobs:
path: ${{runner.workspace}}/sdrpp_windows_x64.zip
build_macos:
runs-on: macos-11
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
@ -100,29 +100,29 @@ jobs:
run: brew install pkg-config libusb fftw glfw airspy airspyhf portaudio hackrf libbladerf codec2 zstd autoconf automake libtool && pip3 install mako
- 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_OSX_DEPLOYMENT_TARGET=10.15 -DCMAKE_BUILD_TYPE=Release .. && make -j3 && sudo make install && cd ../../
- name: Install SDRplay API
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
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 ../../
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_OSX_DEPLOYMENT_TARGET=10.15 -DCMAKE_BUILD_TYPE=Release .. && make -j3 && sudo make install && cd ../../
- 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_OSX_DEPLOYMENT_TARGET=10.15 -DCMAKE_BUILD_TYPE=Release .. && make -j3 && sudo make install && cd ../../
- name: Install LimeSuite
run: git clone https://github.com/myriadrf/LimeSuite && cd LimeSuite && mkdir builddir && cd builddir && cmake -DCMAKE_BUILD_TYPE=Release .. && make -j3 && sudo make install && cd ../../
run: git clone https://github.com/myriadrf/LimeSuite && cd LimeSuite && mkdir builddir && cd builddir && cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 -DCMAKE_BUILD_TYPE=Release .. && make -j3 && sudo make install && cd ../../
- 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 ..
- 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 ../../
run: git clone https://github.com/osmocom/rtl-sdr && cd rtl-sdr && mkdir build && cd build && cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 -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
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 -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 $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
- name: Build
working-directory: ${{runner.workspace}}/build

Wyświetl plik

@ -1,65 +1,6 @@
# Pull Requests
**I DO NOT ACCEPT PULL-REQUEST FOR FEATURES OR BUGFIXES REQUIRING SIGNIFICANT CODE/STRUCTURE CHANGES.**
**SUCH PULL REQUESTS WILL BE CLOSED AUTOMATICALLY. OPEN AN ISSUE DETAILING FEATURE REQUESTS OR POTENTIAL BUGFIX INSTEAD.**
# Code Style
## Naming Convention
- Files: `snake_case.h` `snake_case.cpp`
- Namespaces: `CamelCase`
- Classes: `CamelCase`
- Structs: `CamelCase_t`
- Members: `camelCase`
- Enum: `SNAKE_CASE`
- Macros: `SNAKE_CASE`
## Brace Style
```c++
int myFunction() {
if (shortIf) { shortFunctionName(); }
if (longIf) {
longFunction();
otherStuff();
myLongFunction();
}
}
```
Note: If it makes the code cleaner, remember to use the `?` keyword instead of a `if else` statement.
## Pointers
Please use `type* name` for pointers.
## Structure
Headers and their associated C++ files shall be in the same directory. All headers must use `#pragma once` instead of other include guards. Only include files in a header that are being used in that header. Include the rest in the associated C++ file.
# Modules
## Module Naming Convention
All modules names must be `snake_case`. If the module is a source, it must end with `_source`. If it is a sink, it must end with `_sink`.
For example, lets take the module named `cool_source`:
- Directory: `cool_source`
- Class: `CoolSourceModule`
- Binary: `cool_source.<os dynlib extension>`
## Integration into main repository
If the module meets the code quality requirements, it may be added to the official repository. A module that doesn't require any external dependencies that the core doesn't already use may be enabled for build by default. Otherwise, they must be disabled for build by default with a `OPT_BUILD_MODULE_NAME` variable set to `OFF`.
# JSON Formatting
The ability to add new radio band allocation identifiers and color maps relies on JSON files. Proper formatting of these JSON files is important for reference and readability. The following guides will show you how to properly format the JSON files for their respective uses.
**IMPORTANT: JSON File cannot contain comments, there are only in this example for clarity**
Code pull requests are **NOT welcome**. Please open an issue discussing potential bugfixes or feature requests instead.
## Band Frequency Allocation
@ -119,8 +60,8 @@ Please follow this guide to properly format the JSON files for custom color maps
}
```
# Best Practices
# JSON Formatting
* All additions and/or bug fixes to the core must not add additional dependencies.
* Use VSCode for development, VS seems to cause issues.
* DO NOT use libboost for any code meant for this repository
The ability to add new radio band allocation identifiers and color maps relies on JSON files. Proper formatting of these JSON files is important for reference and readability. The following guides will show you how to properly format the JSON files for their respective uses.
**IMPORTANT: JSON File cannot contain comments, there are only in this example for clarity**

Wyświetl plik

@ -88,7 +88,7 @@ int CommandArgsParser::parse(int argc, char* argv[]) {
try {
carg.ival = std::stoi(arg);
}
catch (std::exception e) {
catch (const std::exception& e) {
printf("Invalid argument, failed to parse integer\n");
showHelp();
return -1;
@ -98,7 +98,7 @@ int CommandArgsParser::parse(int argc, char* argv[]) {
try {
carg.fval = std::stod(arg);
}
catch (std::exception e) {
catch (const std::exception& e) {
printf("Invalid argument, failed to parse float\n");
showHelp();
return -1;

Wyświetl plik

@ -36,8 +36,8 @@ void ConfigManager::load(json def, bool lock) {
file >> conf;
file.close();
}
catch (std::exception e) {
flog::error("Config file '{0}' is corrupted, resetting it", path);
catch (const std::exception& e) {
flog::error("Config file '{}' is corrupted, resetting it: {}", path, e.what());
conf = def;
save(false);
}

Wyświetl plik

@ -93,7 +93,7 @@ namespace dsp {
void disableBlock(Processor<T, T>* block, Func onOutputChange) {
// Check that the block is part of the chain
if (!blockExists(block)) {
throw std::runtime_error("[chain] Tried to enable a block that isn't part of the chain");
throw std::runtime_error("[chain] Tried to disable a block that isn't part of the chain");
}
// If already disabled, don't do anything
@ -163,10 +163,12 @@ namespace dsp {
private:
Processor<T, T>* blockBefore(Processor<T, T>* block) {
// TODO: This is wrong and must be fixed when I get more time
for (auto& ln : links) {
if (ln == block) { return NULL; }
if (states[ln]) { return ln; }
}
return NULL;
}
Processor<T, T>* blockAfter(Processor<T, T>* block) {

Wyświetl plik

@ -110,7 +110,7 @@ namespace dsp::demod {
else if (_mode == Mode::LSB) {
return -_bandwidth / 2.0;
}
else if (_mode == Mode::DSB) {
else {
return 0.0;
}
}

Wyświetl plik

@ -320,7 +320,7 @@ namespace net {
}
entry.handler(std::move(client), entry.ctx);
}
catch (std::exception e) {
catch (const std::exception& e) {
listening = false;
return;
}

Wyświetl plik

@ -257,6 +257,7 @@ namespace net::http {
// Deserialize
req.deserialize(respData);
return 0; // Might wanna return size instead
}
int Client::sendResponseHeader(ResponseHeader& resp) {
@ -274,6 +275,7 @@ namespace net::http {
// Deserialize
resp.deserialize(respData);
return 0; // Might wanna return size instead
}
int Client::sendChunkHeader(ChunkHeader& chdr) {

Wyświetl plik

@ -80,8 +80,8 @@ public:
try {
client = net::rigctl::connect(host, port);
}
catch (std::exception e) {
flog::error("Could not connect: {0}", e.what());
catch (const std::exception& e) {
flog::error("Could not connect: {}", e.what());
return;
}

Wyświetl plik

@ -200,8 +200,8 @@ private:
listener = net::listen(hostname, port);
listener->acceptAsync(clientHandler, this);
}
catch (std::exception e) {
flog::error("Could not start rigctl server: {0}", e.what());
catch (const std::exception& e) {
flog::error("Could not start rigctl server: {}", e.what());
}
}

Wyświetl plik

@ -31,6 +31,10 @@ public:
monoPacker.init(&s2m.out, 512);
stereoPacker.init(_stream->sinkOut, 512);
#if RTAUDIO_VERSION_MAJOR >= 6
audio.setErrorCallback(&errorCallback);
#endif
bool created = false;
std::string device = "";
config.acquire();
@ -42,12 +46,18 @@ public:
device = config.conf[_streamName]["device"];
config.release(created);
int count = audio.getDeviceCount();
RtAudio::DeviceInfo info;
#if RTAUDIO_VERSION_MAJOR >= 6
for (int i : audio.getDeviceIds()) {
#else
int count = audio.getDeviceCount();
for (int i = 0; i < count; i++) {
#endif
try {
info = audio.getDeviceInfo(i);
#if !defined(RTAUDIO_VERSION_MAJOR) || RTAUDIO_VERSION_MAJOR < 6
if (!info.probed) { continue; }
#endif
if (info.outputChannels == 0) { continue; }
if (info.isDefaultOutput) { defaultDevId = devList.size(); }
devList.push_back(info);
@ -55,8 +65,8 @@ public:
txtDevList += info.name;
txtDevList += '\0';
}
catch (std::exception e) {
flog::error("AudioSinkModule Error getting audio device info: {0}", e.what());
catch (const std::exception& e) {
flog::error("AudioSinkModule Error getting audio device ({}) info: {}", i, e.what());
}
}
selectByName(device);
@ -156,6 +166,22 @@ public:
}
}
#if RTAUDIO_VERSION_MAJOR >= 6
static void errorCallback(RtAudioErrorType type, const std::string& errorText) {
switch (type) {
case RtAudioErrorType::RTAUDIO_NO_ERROR:
return;
case RtAudioErrorType::RTAUDIO_WARNING:
case RtAudioErrorType::RTAUDIO_NO_DEVICES_FOUND:
case RtAudioErrorType::RTAUDIO_DEVICE_DISCONNECT:
flog::warn("AudioSinkModule Warning: {} ({})", errorText, (int)type);
break;
default:
throw std::runtime_error(errorText);
}
}
#endif
private:
bool doStart() {
RtAudio::StreamParameters parameters;
@ -172,8 +198,8 @@ private:
audio.startStream();
stereoPacker.start();
}
catch (RtAudioError& e) {
flog::error("Could not open audio device");
catch (const std::exception& e) {
flog::error("Could not open audio device {0}", e.what());
return false;
}

Wyświetl plik

@ -141,10 +141,10 @@ public:
return;
}
}
catch (std::exception e) {
catch (const std::exception& e) {
char buf[1024];
sprintf(buf, "%016" PRIX64, serial);
flog::error("Could not open Airspy {0}", buf);
flog::error("Could not open Airspy {}", buf);
}
selectedSerial = serial;

Wyświetl plik

@ -144,10 +144,10 @@ public:
return;
}
}
catch (std::exception e) {
catch (const std::exception& e) {
char buf[1024];
sprintf(buf, "%016" PRIX64, serial);
flog::error("Could not open Airspy HF+ {0}", buf);
flog::error("Could not open Airspy HF+ {}", buf);
}
selectedSerial = serial;

Wyświetl plik

@ -35,6 +35,10 @@ public:
AudioSourceModule(std::string name) {
this->name = name;
#if RTAUDIO_VERSION_MAJOR >= 6
audio.setErrorCallback(&errorCallback);
#endif
sampleRate = 48000.0;
handler.ctx = this;
@ -83,21 +87,28 @@ public:
void refresh() {
devices.clear();
#if RTAUDIO_VERSION_MAJOR >= 6
for (int i : audio.getDeviceIds()) {
#else
int count = audio.getDeviceCount();
for (int i = 0; i < count; i++) {
#endif
try {
// Get info
auto info = audio.getDeviceInfo(i);
#if !defined(RTAUDIO_VERSION_MAJOR) || RTAUDIO_VERSION_MAJOR < 6
if (!info.probed) { continue; }
#endif
// Check that it has a stereo input
if (info.probed && info.inputChannels < 2) { continue; }
if (info.inputChannels < 2) { continue; }
// Save info
DeviceInfo dinfo = { info, i };
devices.define(info.name, info.name, dinfo);
}
catch (std::exception e) {
flog::error("Error getting audio device info: {0}", e.what());
catch (const std::exception& e) {
flog::error("Error getting audio device ({}) info: {}", i, e.what());
}
}
}
@ -189,11 +200,11 @@ private:
_this->audio.startStream();
_this->running = true;
}
catch (std::exception e) {
flog::error("Error opening audio device: {0}", e.what());
catch (const std::exception& e) {
flog::error("Error opening audio device: {}", e.what());
}
flog::info("AudioSourceModule '{0}': Start!", _this->name);
flog::info("AudioSourceModule '{}': Start!", _this->name);
}
static void stop(void* ctx) {
@ -254,6 +265,22 @@ private:
return 0;
}
#if RTAUDIO_VERSION_MAJOR >= 6
static void errorCallback(RtAudioErrorType type, const std::string& errorText) {
switch (type) {
case RtAudioErrorType::RTAUDIO_NO_ERROR:
return;
case RtAudioErrorType::RTAUDIO_WARNING:
case RtAudioErrorType::RTAUDIO_NO_DEVICES_FOUND:
case RtAudioErrorType::RTAUDIO_DEVICE_DISCONNECT:
flog::warn("AudioSourceModule Warning: {} ({})", errorText, (int)type);
break;
default:
throw std::runtime_error(errorText);
}
}
#endif
std::string name;
bool enabled = true;
dsp::stream<dsp::complex_t> stream;
@ -290,4 +317,4 @@ MOD_EXPORT void _DELETE_INSTANCE_(ModuleManager::Instance* instance) {
MOD_EXPORT void _END_() {
config.disableAutoSave();
config.save();
}
}

Wyświetl plik

@ -139,8 +139,8 @@ private:
//gui::freqSelect.maxFreq = _this->centerFreq + (_this->sampleRate/2);
//gui::freqSelect.limitFreq = true;
}
catch (std::exception& e) {
flog::error("Error: {0}", e.what());
catch (const std::exception& e) {
flog::error("Error: {}", e.what());
}
config.acquire();
config.conf["path"] = _this->fileSelect.path;

Wyświetl plik

@ -154,8 +154,8 @@ private:
_this->client = rfspace::connect(_this->hostname, _this->port, &_this->stream);
_this->deviceInit();
}
catch (std::exception e) {
flog::error("Could not connect to SDR: {0}", e.what());
catch (const std::exception& e) {
flog::error("Could not connect to SDR: {}", e.what());
}
}
else if (connected && SmGui::Button("Disconnect##rfspace_source")) {

Wyświetl plik

@ -132,8 +132,8 @@ private:
try {
_this->client = rtltcp::connect(&_this->stream, _this->ip, _this->port);
}
catch (std::exception e) {
flog::error("Could connect to RTL-TCP server: {0}", e.what());
catch (const std::exception& e) {
flog::error("Could connect to RTL-TCP server: {}", e.what());
return;
}

Wyświetl plik

@ -233,8 +233,8 @@ private:
client = server::connect(hostname, port, &stream);
deviceInit();
}
catch (std::exception e) {
flog::error("Could not connect to SDR: {0}", e.what());
catch (const std::exception& e) {
flog::error("Could not connect to SDR: {}", e.what());
if (!strcmp(e.what(), "Server busy")) { serverBusy = true; }
}
}

Wyświetl plik

@ -1,5 +1,6 @@
#include "spectran_http_client.h"
#include <utils/flog.h>
#include <inttypes.h>
SpectranHTTPClient::SpectranHTTPClient(std::string host, int port, dsp::stream<dsp::complex_t>* stream) {
this->stream = stream;
@ -50,10 +51,10 @@ void SpectranHTTPClient::setCenterFrequency(uint64_t freq) {
// Make request
net::http::RequestHeader rqhdr(net::http::METHOD_PUT, "/control", host);
char buf[1024];
sprintf(buf, "{\"frequencyCenter\":%d,\"frequencySpan\":%d,\"type\":\"capture\"}", freq, _samplerate);
sprintf(buf, "{\"frequencyCenter\":%" PRIu64 ",\"frequencySpan\":%" PRIu64 ",\"type\":\"capture\"}", freq, _samplerate);
std::string data = buf;
char lenBuf[16];
sprintf(lenBuf, "%d", data.size());
sprintf(lenBuf, "%" PRIu64, (uint64_t)data.size());
rqhdr.setField("Content-Length", lenBuf);
controlHttp.sendRequestHeader(rqhdr);
controlSock->sendstr(data);

Wyświetl plik

@ -283,8 +283,8 @@ private:
flog::info("Connected to server");
}
}
catch (std::exception e) {
flog::error("Could not connect to spyserver {0}", e.what());
catch (const std::exception& e) {
flog::error("Could not connect to spyserver {}", e.what());
}
}