9 Commits

Author SHA1 Message Date
2ce1738a49 added retroactive recording menu option 2024-11-08 00:14:47 +01:00
f205d97b52 Merge pull request #1518 from Oskar-Dudek/patch-3
Some checks failed
Build Binaries / build_windows (push) Waiting to run
Build Binaries / build_macos_intel (push) Waiting to run
Build Binaries / build_macos_arm (push) Waiting to run
Build Binaries / build_raspios_bullseye_armhf (push) Waiting to run
Build Binaries / create_full_archive (push) Blocked by required conditions
Build Binaries / update_nightly_release (push) Blocked by required conditions
Build Binaries / build_debian_buster (push) Failing after 4s
Build Binaries / build_debian_bullseye (push) Failing after 4s
Build Binaries / build_debian_bookworm (push) Failing after 5s
Build Binaries / build_debian_sid (push) Failing after 4s
Build Binaries / build_ubuntu_focal (push) Failing after 4s
Build Binaries / build_ubuntu_jammy (push) Failing after 8s
Build Binaries / build_ubuntu_mantic (push) Failing after 4s
Build Binaries / build_ubuntu_noble (push) Failing after 5s
Build Binaries / build_android (push) Failing after 5s
Build Binaries / check_spelling (push) Failing after 4s
Build Binaries / check_formatting (push) Successful in 4s
Fix ireland.json
2024-11-07 17:36:13 +01:00
628dcfcce0 Fix ireland.json
I used jsonlint.com and i edited it in some places and it says json valid, please can you try this version
2024-11-07 16:26:37 +00:00
d1e7cc56b4 re-disable the M17 decoder module in MacOS ARM nightly builds due to codec2 package bug 2024-11-07 15:02:16 +01:00
334860c963 attempt to enable M17 Decoder on MacOS ARM 2024-11-07 14:53:27 +01:00
5ab3428b90 update readme
Some checks failed
Build Binaries / build_windows (push) Waiting to run
Build Binaries / build_macos_intel (push) Waiting to run
Build Binaries / build_macos_arm (push) Waiting to run
Build Binaries / create_full_archive (push) Blocked by required conditions
Build Binaries / build_raspios_bullseye_armhf (push) Waiting to run
Build Binaries / update_nightly_release (push) Blocked by required conditions
Build Binaries / build_debian_buster (push) Failing after 5s
Build Binaries / build_debian_bullseye (push) Failing after 5s
Build Binaries / build_debian_bookworm (push) Failing after 5s
Build Binaries / build_debian_sid (push) Failing after 5s
Build Binaries / build_ubuntu_focal (push) Failing after 4s
Build Binaries / build_ubuntu_jammy (push) Failing after 4s
Build Binaries / build_ubuntu_mantic (push) Failing after 6s
Build Binaries / build_ubuntu_noble (push) Failing after 5s
Build Binaries / build_android (push) Failing after 5s
Build Binaries / check_spelling (push) Failing after 3s
Build Binaries / check_formatting (push) Successful in 4s
2024-11-06 21:27:45 +01:00
7f002f6276 add lower limit to network source samplerate 2024-11-06 20:54:01 +01:00
a728403a3f Merge branch 'master' of https://github.com/AlexandreRouma/SDRPlusPlus 2024-11-06 20:29:58 +01:00
0f1d2da3b7 finish and enable the network source 2024-11-06 20:29:50 +01:00
8 changed files with 168 additions and 54 deletions

View File

@ -138,7 +138,7 @@ jobs:
- name: Prepare CMake - name: Prepare CMake
working-directory: ${{runner.workspace}}/build working-directory: ${{runner.workspace}}/build
run: cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 $GITHUB_WORKSPACE -DOPT_BUILD_PLUTOSDR_SOURCE=ON -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 -DOPT_BUILD_RFNM_SOURCE=ON -DOPT_BUILD_FOBOSSDR_SOURCE=ON -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_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=OFF -DOPT_BUILD_PERSEUS_SOURCE=ON -DOPT_BUILD_AUDIO_SOURCE=OFF -DOPT_BUILD_RFNM_SOURCE=ON -DOPT_BUILD_FOBOSSDR_SOURCE=ON -DUSE_BUNDLE_DEFAULTS=ON -DCMAKE_BUILD_TYPE=Release
- name: Build - name: Build
working-directory: ${{runner.workspace}}/build working-directory: ${{runner.workspace}}/build
@ -195,7 +195,7 @@ jobs:
- name: Prepare CMake - name: Prepare CMake
working-directory: ${{runner.workspace}}/build working-directory: ${{runner.workspace}}/build
run: cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 $GITHUB_WORKSPACE -DOPT_BUILD_PLUTOSDR_SOURCE=ON -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=OFF -DOPT_BUILD_PERSEUS_SOURCE=OFF -DOPT_BUILD_AUDIO_SOURCE=OFF -DOPT_BUILD_RFNM_SOURCE=ON -DOPT_BUILD_FOBOSSDR_SOURCE=ON -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_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=OFF -DOPT_BUILD_AUDIO_SOURCE=OFF -DOPT_BUILD_RFNM_SOURCE=ON -DOPT_BUILD_FOBOSSDR_SOURCE=ON -DUSE_BUNDLE_DEFAULTS=ON -DCMAKE_BUILD_TYPE=Release
- name: Build - name: Build
working-directory: ${{runner.workspace}}/build working-directory: ${{runner.workspace}}/build

View File

@ -183,6 +183,8 @@ int sdrpp_main(int argc, char* argv[]) {
defConfig["moduleInstances"]["Hermes Source"]["enabled"] = true; defConfig["moduleInstances"]["Hermes Source"]["enabled"] = true;
defConfig["moduleInstances"]["LimeSDR Source"]["module"] = "limesdr_source"; defConfig["moduleInstances"]["LimeSDR Source"]["module"] = "limesdr_source";
defConfig["moduleInstances"]["LimeSDR Source"]["enabled"] = true; defConfig["moduleInstances"]["LimeSDR Source"]["enabled"] = true;
defConfig["moduleInstances"]["Network Source"]["module"] = "network_source";
defConfig["moduleInstances"]["Network Source"]["enabled"] = true;
defConfig["moduleInstances"]["PerseusSDR Source"]["module"] = "perseus_source"; defConfig["moduleInstances"]["PerseusSDR Source"]["module"] = "perseus_source";
defConfig["moduleInstances"]["PerseusSDR Source"]["enabled"] = true; defConfig["moduleInstances"]["PerseusSDR Source"]["enabled"] = true;
defConfig["moduleInstances"]["PlutoSDR Source"]["module"] = "plutosdr_source"; defConfig["moduleInstances"]["PlutoSDR Source"]["module"] = "plutosdr_source";

View File

@ -39,6 +39,7 @@ bundle_install_binary $BUNDLE $BUNDLE/Contents/Plugins $BUILD_DIR/source_modules
bundle_install_binary $BUNDLE $BUNDLE/Contents/Plugins $BUILD_DIR/source_modules/hackrf_source/hackrf_source.dylib bundle_install_binary $BUNDLE $BUNDLE/Contents/Plugins $BUILD_DIR/source_modules/hackrf_source/hackrf_source.dylib
bundle_install_binary $BUNDLE $BUNDLE/Contents/Plugins $BUILD_DIR/source_modules/hermes_source/hermes_source.dylib bundle_install_binary $BUNDLE $BUNDLE/Contents/Plugins $BUILD_DIR/source_modules/hermes_source/hermes_source.dylib
bundle_install_binary $BUNDLE $BUNDLE/Contents/Plugins $BUILD_DIR/source_modules/limesdr_source/limesdr_source.dylib bundle_install_binary $BUNDLE $BUNDLE/Contents/Plugins $BUILD_DIR/source_modules/limesdr_source/limesdr_source.dylib
bundle_install_binary $BUNDLE $BUNDLE/Contents/Plugins $BUILD_DIR/source_modules/network_source/network_source.dylib
bundle_install_binary $BUNDLE $BUNDLE/Contents/Plugins $BUILD_DIR/source_modules/perseus_source/perseus_source.dylib bundle_install_binary $BUNDLE $BUNDLE/Contents/Plugins $BUILD_DIR/source_modules/perseus_source/perseus_source.dylib
bundle_install_binary $BUNDLE $BUNDLE/Contents/Plugins $BUILD_DIR/source_modules/plutosdr_source/plutosdr_source.dylib bundle_install_binary $BUNDLE $BUNDLE/Contents/Plugins $BUILD_DIR/source_modules/plutosdr_source/plutosdr_source.dylib
bundle_install_binary $BUNDLE $BUNDLE/Contents/Plugins $BUILD_DIR/source_modules/rfnm_source/rfnm_source.dylib bundle_install_binary $BUNDLE $BUNDLE/Contents/Plugins $BUILD_DIR/source_modules/rfnm_source/rfnm_source.dylib

View File

@ -35,6 +35,8 @@ cp $build_dir/source_modules/hermes_source/Release/hermes_source.dll sdrpp_windo
cp $build_dir/source_modules/limesdr_source/Release/limesdr_source.dll sdrpp_windows_x64/modules/ cp $build_dir/source_modules/limesdr_source/Release/limesdr_source.dll sdrpp_windows_x64/modules/
cp 'C:/Program Files/PothosSDR/bin/LimeSuite.dll' sdrpp_windows_x64/ cp 'C:/Program Files/PothosSDR/bin/LimeSuite.dll' sdrpp_windows_x64/
cp $build_dir/source_modules/network_source/Release/network_source.dll sdrpp_windows_x64/modules/
cp $build_dir/source_modules/perseus_source/Release/perseus_source.dll sdrpp_windows_x64/modules/ cp $build_dir/source_modules/perseus_source/Release/perseus_source.dll sdrpp_windows_x64/modules/
cp 'C:/Program Files/PothosSDR/bin/perseus-sdr.dll' sdrpp_windows_x64/ cp 'C:/Program Files/PothosSDR/bin/perseus-sdr.dll' sdrpp_windows_x64/

View File

@ -52,9 +52,22 @@ public:
sampleTypes.define(wav::SAMP_TYPE_INT32, "Int32", wav::SAMP_TYPE_INT32); sampleTypes.define(wav::SAMP_TYPE_INT32, "Int32", wav::SAMP_TYPE_INT32);
sampleTypes.define(wav::SAMP_TYPE_FLOAT32, "Float32", wav::SAMP_TYPE_FLOAT32); sampleTypes.define(wav::SAMP_TYPE_FLOAT32, "Float32", wav::SAMP_TYPE_FLOAT32);
// Define retroactive buffer sizes
retroBufSizes.define(0, "None", 0);
retroBufSizes.define(1 << 18, "256MB", 1 << 18);
retroBufSizes.define(1 << 19, "512MB", 1 << 19);
retroBufSizes.define(1 << 20, "1GB", 1 << 20);
retroBufSizes.define(1 << 21, "2GB", 1 << 21);
retroBufSizes.define(1 << 22, "4GB", 1 << 22);
retroBufSizes.define(1 << 23, "8GB", 1 << 23);
retroBufSizes.define(1 << 24, "16GB", 1 << 24);
retroBufSizes.define(1 << 25, "32GB", 1 << 25);
retroBufSizes.define(1 << 26, "64GB", 1 << 26);
// Load default config for option lists // Load default config for option lists
containerId = containers.valueId(wav::FORMAT_WAV); containerId = containers.valueId(wav::FORMAT_WAV);
sampleTypeId = sampleTypes.valueId(wav::SAMP_TYPE_INT16); sampleTypeId = sampleTypes.valueId(wav::SAMP_TYPE_INT16);
retroBufSizeId = retroBufSizes.nameId("None");
// Load config // Load config
config.acquire(); config.acquire();
@ -70,6 +83,9 @@ public:
if (config.conf[name].contains("sampleType") && sampleTypes.keyExists(config.conf[name]["sampleType"])) { if (config.conf[name].contains("sampleType") && sampleTypes.keyExists(config.conf[name]["sampleType"])) {
sampleTypeId = sampleTypes.keyId(config.conf[name]["sampleType"]); sampleTypeId = sampleTypes.keyId(config.conf[name]["sampleType"]);
} }
if (config.conf[name].contains("retroBufferSize") && retroBufSizes.keyExists(config.conf[name]["retroBufferSize"])) {
retroBufSizeId = retroBufSizes.keyId(config.conf[name]["retroBufferSize"]);
}
if (config.conf[name].contains("audioStream")) { if (config.conf[name].contains("audioStream")) {
selectedStreamName = config.conf[name]["audioStream"]; selectedStreamName = config.conf[name]["audioStream"];
} }
@ -282,6 +298,14 @@ private:
config.release(true); config.release(true);
} }
ImGui::LeftLabel("Retroactive buffer");
ImGui::FillWidth();
if (ImGui::Combo(CONCAT("##_recorder_retro_buf_size_", _this->name), &_this->retroBufSizeId, _this->retroBufSizes.txt)) {
config.acquire();
config.conf[_this->name]["retroBufferSize"] = _this->retroBufSizes.key(_this->retroBufSizeId);
config.release(true);
}
if (_this->recording) { style::endDisabled(); } if (_this->recording) { style::endDisabled(); }
// Show additional audio options // Show additional audio options
@ -566,11 +590,13 @@ private:
OptionList<std::string, wav::Format> containers; OptionList<std::string, wav::Format> containers;
OptionList<int, wav::SampleType> sampleTypes; OptionList<int, wav::SampleType> sampleTypes;
OptionList<int64_t, int64_t> retroBufSizes;
FolderSelect folderSelect; FolderSelect folderSelect;
int recMode = RECORDER_MODE_AUDIO; int recMode = RECORDER_MODE_AUDIO;
int containerId; int containerId;
int sampleTypeId; int sampleTypeId;
int retroBufSizeId;
bool stereo = true; bool stereo = true;
std::string selectedStreamName = ""; std::string selectedStreamName = "";
float audioVolume = 1.0f; float audioVolume = 1.0f;

View File

@ -324,13 +324,13 @@ Modules in beta are still included in releases for the most part but not enabled
| audio_source | Working | rtaudio | OPT_BUILD_AUDIO_SOURCE | ✅ | ✅ | ✅ | | audio_source | Working | rtaudio | OPT_BUILD_AUDIO_SOURCE | ✅ | ✅ | ✅ |
| bladerf_source | Working | libbladeRF | OPT_BUILD_BLADERF_SOURCE | ⛔ | ✅ (not Debian Buster) | ✅ | | bladerf_source | Working | libbladeRF | OPT_BUILD_BLADERF_SOURCE | ⛔ | ✅ (not Debian Buster) | ✅ |
| file_source | Working | - | OPT_BUILD_FILE_SOURCE | ✅ | ✅ | ✅ | | file_source | Working | - | OPT_BUILD_FILE_SOURCE | ✅ | ✅ | ✅ |
| fobossdr_source | Beta | libfobos | OPT_BUILD_FOBOSSDR_SOURCE | ✅ | ✅ | ✅ | | fobossdr_source | Working | libfobos | OPT_BUILD_FOBOSSDR_SOURCE | ✅ | ✅ | ✅ |
| hackrf_source | Working | libhackrf | OPT_BUILD_HACKRF_SOURCE | ✅ | ✅ | ✅ | | hackrf_source | Working | libhackrf | OPT_BUILD_HACKRF_SOURCE | ✅ | ✅ | ✅ |
| harogic_source | Beta | htra_api | OPT_BUILD_HAROGIC_SOURCE | ⛔ | ⛔ | ✅ | | harogic_source | Beta | htra_api | OPT_BUILD_HAROGIC_SOURCE | ⛔ | ⛔ | ✅ |
| hermes_source | Beta | - | OPT_BUILD_HERMES_SOURCE | ✅ | ✅ | ✅ | | hermes_source | Beta | - | OPT_BUILD_HERMES_SOURCE | ✅ | ✅ | ✅ |
| kcsdr_source | Unfinished | libkcsdr | OPT_BUILD_KCSDR_SOURCE | ⛔ | ⛔ | ⛔ | | kcsdr_source | Unfinished | libkcsdr | OPT_BUILD_KCSDR_SOURCE | ⛔ | ⛔ | ⛔ |
| limesdr_source | Working | liblimesuite | OPT_BUILD_LIMESDR_SOURCE | ⛔ | ✅ | ✅ | | limesdr_source | Working | liblimesuite | OPT_BUILD_LIMESDR_SOURCE | ⛔ | ✅ | ✅ |
| network_source | Unfinished | - | OPT_BUILD_NETWORK_SOURCE | ✅ | ✅ | | | network_source | Beta | - | OPT_BUILD_NETWORK_SOURCE | ✅ | ✅ | |
| perseus_source | Beta | libperseus-sdr | OPT_BUILD_PERSEUS_SOURCE | ⛔ | ✅ | ✅ | | perseus_source | Beta | libperseus-sdr | OPT_BUILD_PERSEUS_SOURCE | ⛔ | ✅ | ✅ |
| plutosdr_source | Working | libiio, libad9361 | OPT_BUILD_PLUTOSDR_SOURCE | ✅ | ✅ | ✅ | | plutosdr_source | Working | libiio, libad9361 | OPT_BUILD_PLUTOSDR_SOURCE | ✅ | ✅ | ✅ |
| rfnm_source | Beta | librfnm | OPT_BUILD_RFNM_SOURCE | ⛔ | ✅ | ✅ | | rfnm_source | Beta | librfnm | OPT_BUILD_RFNM_SOURCE | ⛔ | ✅ | ✅ |
@ -352,8 +352,8 @@ Modules in beta are still included in releases for the most part but not enabled
| android_audio_sink | Working | - | OPT_BUILD_ANDROID_AUDIO_SINK | ⛔ | ✅ | ✅ (Android only) | | android_audio_sink | Working | - | OPT_BUILD_ANDROID_AUDIO_SINK | ⛔ | ✅ | ✅ (Android only) |
| audio_sink | Working | rtaudio | OPT_BUILD_AUDIO_SINK | ✅ | ✅ | ✅ | | audio_sink | Working | rtaudio | OPT_BUILD_AUDIO_SINK | ✅ | ✅ | ✅ |
| network_sink | Working | - | OPT_BUILD_NETWORK_SINK | ✅ | ✅ | ✅ | | network_sink | Working | - | OPT_BUILD_NETWORK_SINK | ✅ | ✅ | ✅ |
| new_portaudio_sink | Beta | portaudio | OPT_BUILD_NEW_PORTAUDIO_SINK | ⛔ | ✅ | ⛔ | | new_portaudio_sink | Working | portaudio | OPT_BUILD_NEW_PORTAUDIO_SINK | ⛔ | ✅ | ⛔ |
| portaudio_sink | Beta | portaudio | OPT_BUILD_PORTAUDIO_SINK | ⛔ | ✅ | ⛔ | | portaudio_sink | Working | portaudio | OPT_BUILD_PORTAUDIO_SINK | ⛔ | ✅ | ⛔ |
## Decoders ## Decoders
@ -419,8 +419,8 @@ If you still have an issue, please open an issue about it or ask on the discord.
# Contributing # Contributing
Feel free to submit pull requests and report bugs via the GitHub issue tracker. Feel free to submit band plans via the GitHub issue tracker.
I will soon publish a contributing.md listing the code style to use. For code changes, please create a feature request instead.
# Credits # Credits

View File

@ -23,6 +23,12 @@
"start": 531000, "start": 531000,
"end": 1602000 "end": 1602000
}, },
{
"name": "160m ham band",
"type": "amateur",
"start": 1810000,
"end": 2000000
},
{ {
"name": "120m SW broadcast", "name": "120m SW broadcast",
"type": "broadcast", "type": "broadcast",
@ -35,6 +41,12 @@
"start": 3200000, "start": 3200000,
"end": 3400000 "end": 3400000
}, },
{
"name": "80m ham band",
"type": "amateur",
"start": 3500000,
"end": 3800000
},
{ {
"name": "75m SW Broadcast", "name": "75m SW Broadcast",
"type": "broadcast", "type": "broadcast",
@ -47,12 +59,24 @@
"start": 4750000, "start": 4750000,
"end": 5060000 "end": 5060000
}, },
{
"name": "60m ham band",
"type": "amateur",
"start": 5351500,
"end": 5366500
},
{ {
"name": "49m SW Broadcast", "name": "49m SW Broadcast",
"type": "broadcast", "type": "broadcast",
"start": 5900000, "start": 5900000,
"end": 6200000 "end": 6200000
}, },
{
"name": "40m ham band",
"type": "amateur",
"start": 7000000,
"end": 7200000
},
{ {
"name": "40m SW Broadcast", "name": "40m SW Broadcast",
"type": "broadcast", "type": "broadcast",
@ -65,6 +89,12 @@
"start": 9400000, "start": 9400000,
"end": 9900000 "end": 9900000
}, },
{
"name": "30m ham band",
"type": "amateur",
"start": 10100000,
"end": 10150000
},
{ {
"name": "25m SW Broadcast", "name": "25m SW Broadcast",
"type": "broadcast", "type": "broadcast",
@ -77,12 +107,24 @@
"start": 13570000, "start": 13570000,
"end": 13870000 "end": 13870000
}, },
{
"name": "20m ham band",
"type": "amateur",
"start": 14000000,
"end": 14350000
},
{ {
"name": "19m SW Broadcast", "name": "19m SW Broadcast",
"type": "broadcast", "type": "broadcast",
"start": 15100000, "start": 15100000,
"end": 15800000 "end": 15800000
}, },
{
"name": "17m ham band",
"type": "amateur",
"start": 18068000,
"end": 18168000
},
{ {
"name": "16m SW Broadcast", "name": "16m SW Broadcast",
"type": "broadcast", "type": "broadcast",
@ -95,23 +137,65 @@
"start": 18900000, "start": 18900000,
"end": 19020000 "end": 19020000
}, },
{
"name": "15m ham band",
"type": "amateur",
"start": 21000000,
"end": 21450000
},
{ {
"name": "13m SW Broadcast", "name": "13m SW Broadcast",
"type": "broadcast", "type": "broadcast",
"start": 21450000, "start": 21450000,
"end": 21850000 "end": 21850000
}, },
{
"name": "12m ham band",
"type": "amateur",
"start": 24890000,
"end": 24990000
},
{ {
"name": "11m SW Broadcast", "name": "11m SW Broadcast",
"type": "broadcast", "type": "broadcast",
"start": 25670000, "start": 25670000,
"end": 26100000 "end": 26100000
}, },
{
"name": "10m ham band",
"type": "amateur",
"start": 28000000,
"end": 29700000
},
{ {
"name": "FM Broadcast", "name": "FM Broadcast",
"type": "broadcast", "type": "broadcast",
"start": 87500000, "start": 87500000,
"end": 108000000 "end": 108000000
},
{
"name": "6m ham band",
"type": "amateur",
"start": 50000000,
"end": 52000000
},
{
"name": "4m ham band",
"type": "amateur",
"start": 70000000,
"end": 70500000
},
{
"name": "2m ham band",
"type": "amateur",
"start": 144000000,
"end": 146000000
},
{
"name": "70cm ham band",
"type": "amateur",
"start": 430000000,
"end": 440000000
} }
] ]
} }

View File

@ -36,10 +36,10 @@ enum SampleType {
}; };
const size_t SAMPLE_TYPE_SIZE[] { const size_t SAMPLE_TYPE_SIZE[] {
sizeof(int8_t)*2, 2*sizeof(int8_t),
sizeof(int16_t)*2, 2*sizeof(int16_t),
sizeof(int32_t)*2, 2*sizeof(int32_t),
sizeof(float)*2, 2*sizeof(float),
}; };
class NetworkSourceModule : public ModuleManager::Instance { class NetworkSourceModule : public ModuleManager::Instance {
@ -58,20 +58,6 @@ public:
handler.tuneHandler = tune; handler.tuneHandler = tune;
handler.stream = &stream; handler.stream = &stream;
// Define samplerates
for (int i = 3000; i <= 192000; i <<= 1) {
samplerates.define(i, getSrScaled(i), i);
}
for (int i = 250000; i < 1000000; i += 250000) {
samplerates.define(i, getSrScaled(i), i);
}
for (int i = 1000000; i < 10000000; i += 500000) {
samplerates.define(i, getSrScaled(i), i);
}
for (int i = 10000000; i <= 100000000; i += 5000000) {
samplerates.define(i, getSrScaled(i), i);
}
// Define protocols // Define protocols
// protocols.define("TCP (Server)", PROTOCOL_TCP_SERVER); // protocols.define("TCP (Server)", PROTOCOL_TCP_SERVER);
protocols.define("TCP (Client)", PROTOCOL_TCP_CLIENT); protocols.define("TCP (Client)", PROTOCOL_TCP_CLIENT);
@ -86,8 +72,8 @@ public:
// Load config // Load config
config.acquire(); config.acquire();
if (config.conf[name].contains("samplerate")) { if (config.conf[name].contains("samplerate")) {
int sr = config.conf[name]["samplerate"]; samplerate = config.conf[name]["samplerate"];
if (samplerates.keyExists(sr)) { samplerate = samplerates.value(samplerates.keyId(sr)); } tempSamplerate = samplerate;
} }
if (config.conf[name].contains("protocol")) { if (config.conf[name].contains("protocol")) {
std::string protoStr = config.conf[name]["protocol"]; std::string protoStr = config.conf[name]["protocol"];
@ -108,7 +94,6 @@ public:
config.release(); config.release();
// Set menu IDs // Set menu IDs
srId = samplerates.valueId(samplerate);
protoId = protocols.valueId(proto); protoId = protocols.valueId(proto);
sampTypeId = sampleTypes.valueId(sampType); sampTypeId = sampleTypes.valueId(sampType);
@ -228,35 +213,24 @@ private:
if (_this->running) { SmGui::BeginDisabled(); } if (_this->running) { SmGui::BeginDisabled(); }
// Hostname and port field // Hostname and port field
if (ImGui::InputText(("##iq_exporter_host_" + _this->name).c_str(), _this->hostname, sizeof(_this->hostname))) { if (SmGui::InputText(("##network_source_host_" + _this->name).c_str(), _this->hostname, sizeof(_this->hostname))) {
config.acquire(); config.acquire();
config.conf[_this->name]["host"] = _this->hostname; config.conf[_this->name]["host"] = _this->hostname;
config.release(true); config.release(true);
} }
ImGui::SameLine(); SmGui::SameLine();
ImGui::FillWidth(); SmGui::FillWidth();
if (ImGui::InputInt(("##iq_exporter_port_" + _this->name).c_str(), &_this->port, 0, 0)) { if (SmGui::InputInt(("##network_source_port_" + _this->name).c_str(), &_this->port, 0, 0)) {
_this->port = std::clamp<int>(_this->port, 1, 65535); _this->port = std::clamp<int>(_this->port, 1, 65535);
config.acquire(); config.acquire();
config.conf[_this->name]["port"] = _this->port; config.conf[_this->name]["port"] = _this->port;
config.release(true); config.release(true);
} }
// Samplerate selector
ImGui::LeftLabel("Samplerate");
ImGui::FillWidth();
if (ImGui::Combo(("##iq_exporter_sr_" + _this->name).c_str(), &_this->srId, _this->samplerates.txt)) {
_this->samplerate = _this->samplerates.value(_this->srId);
core::setInputSampleRate(_this->samplerate);
config.acquire();
config.conf[_this->name]["samplerate"] = _this->samplerates.key(_this->srId);
config.release(true);
}
// Mode protocol selector // Mode protocol selector
ImGui::LeftLabel("Protocol"); SmGui::LeftLabel("Protocol");
ImGui::FillWidth(); SmGui::FillWidth();
if (ImGui::Combo(("##iq_exporter_proto_" + _this->name).c_str(), &_this->protoId, _this->protocols.txt)) { if (SmGui::Combo(("##network_source_proto_" + _this->name).c_str(), &_this->protoId, _this->protocols.txt)) {
_this->proto = _this->protocols.value(_this->protoId); _this->proto = _this->protocols.value(_this->protoId);
config.acquire(); config.acquire();
config.conf[_this->name]["protocol"] = _this->protocols.key(_this->protoId); config.conf[_this->name]["protocol"] = _this->protocols.key(_this->protoId);
@ -264,15 +238,38 @@ private:
} }
// Sample type selector // Sample type selector
ImGui::LeftLabel("Sample type"); SmGui::LeftLabel("Sample type");
ImGui::FillWidth(); SmGui::FillWidth();
if (ImGui::Combo(("##iq_exporter_samp_" + _this->name).c_str(), &_this->sampTypeId, _this->sampleTypes.txt)) { if (SmGui::Combo(("##network_source_samp_" + _this->name).c_str(), &_this->sampTypeId, _this->sampleTypes.txt)) {
_this->sampType = _this->sampleTypes.value(_this->sampTypeId); _this->sampType = _this->sampleTypes.value(_this->sampTypeId);
config.acquire(); config.acquire();
config.conf[_this->name]["sampleType"] = _this->sampleTypes.key(_this->sampTypeId); config.conf[_this->name]["sampleType"] = _this->sampleTypes.key(_this->sampTypeId);
config.release(true); config.release(true);
} }
// Samplerate selector
SmGui::LeftLabel("Samplerate");
SmGui::FillWidth();
if (SmGui::InputInt(("##network_source_sr_" + _this->name).c_str(), &_this->tempSamplerate)) {
// Prevent silly values from silly users
_this->tempSamplerate = std::max<int>(_this->tempSamplerate, 1000);
}
bool applyEn = (!_this->running && _this->tempSamplerate != _this->samplerate);
if (!applyEn) { SmGui::BeginDisabled(); }
SmGui::FillWidth();
if (SmGui::Button(("Apply##network_source_apply_" + _this->name).c_str())) {
_this->samplerate = _this->tempSamplerate;
core::setInputSampleRate(_this->samplerate);
config.acquire();
config.conf[_this->name]["samplerate"] = _this->samplerate;
config.release(true);
}
if (!applyEn) { SmGui::EndDisabled(); }
if (_this->tempSamplerate != _this->samplerate) {
SmGui::TextColored(ImVec4(1.0f, 1.0f, 0.0f, 1.0f), "Warning: Samplerate not applied yet");
}
if (_this->running) { SmGui::EndDisabled(); } if (_this->running) { SmGui::EndDisabled(); }
} }
@ -280,14 +277,17 @@ private:
// Compute sizes // Compute sizes
int blockSize = samplerate / 200; int blockSize = samplerate / 200;
int sampleSize = SAMPLE_TYPE_SIZE[sampType]; int sampleSize = SAMPLE_TYPE_SIZE[sampType];
int frameSize = blockSize*sampleSize;
// Chose amount of bytes to attempt to read
bool forceSize = (proto != PROTOCOL_UDP);
int frameSize = sampleSize * (forceSize ? blockSize : STREAM_BUFFER_SIZE);
// Allocate receive buffer // Allocate receive buffer
uint8_t* buffer = dsp::buffer::alloc<uint8_t>(frameSize); uint8_t* buffer = dsp::buffer::alloc<uint8_t>(frameSize);
while (true) { while (true) {
// Read samples from socket // Read samples from socket
int bytes = sock->recv(buffer, frameSize, true); int bytes = sock->recv(buffer, frameSize, forceSize);
if (bytes <= 0) { break; } if (bytes <= 0) { break; }
// Convert to CF32 (note: problem if partial sample) // Convert to CF32 (note: problem if partial sample)
@ -325,7 +325,7 @@ private:
double freq; double freq;
int samplerate = 1000000; int samplerate = 1000000;
int srId; int tempSamplerate = 1000000;
Protocol proto = PROTOCOL_UDP; Protocol proto = PROTOCOL_UDP;
int protoId; int protoId;
SampleType sampType = SAMPLE_TYPE_INT16; SampleType sampType = SAMPLE_TYPE_INT16;
@ -333,7 +333,6 @@ private:
char hostname[1024] = "localhost"; char hostname[1024] = "localhost";
int port = 1234; int port = 1234;
OptionList<int, int> samplerates;
OptionList<std::string, Protocol> protocols; OptionList<std::string, Protocol> protocols;
OptionList<std::string, SampleType> sampleTypes; OptionList<std::string, SampleType> sampleTypes;