mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-07-08 18:15:21 +02:00
Compare commits
10 Commits
retroactiv
...
new_sdrpla
Author | SHA1 | Date | |
---|---|---|---|
c266a37a6b | |||
895199ae94 | |||
d62426364a | |||
304d5c42cc | |||
11f87e0fe2 | |||
e192cb963b | |||
fe407a2f27 | |||
6891d0bb0f | |||
b835d07573 | |||
69161253e8 |
4
.github/workflows/build_all.yml
vendored
4
.github/workflows/build_all.yml
vendored
@ -138,7 +138,7 @@ jobs:
|
||||
|
||||
- name: Prepare CMake
|
||||
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=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=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
|
||||
|
||||
- name: Build
|
||||
working-directory: ${{runner.workspace}}/build
|
||||
@ -195,7 +195,7 @@ jobs:
|
||||
|
||||
- name: Prepare CMake
|
||||
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=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=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
|
||||
|
||||
- name: Build
|
||||
working-directory: ${{runner.workspace}}/build
|
||||
|
@ -147,12 +147,12 @@ int sdrpp_main(int argc, char* argv[]) {
|
||||
defConfig["menuElements"][3]["name"] = "Sinks";
|
||||
defConfig["menuElements"][3]["open"] = true;
|
||||
|
||||
defConfig["menuElements"][3]["name"] = "Frequency Manager";
|
||||
defConfig["menuElements"][3]["open"] = true;
|
||||
|
||||
defConfig["menuElements"][4]["name"] = "VFO Color";
|
||||
defConfig["menuElements"][4]["name"] = "Frequency Manager";
|
||||
defConfig["menuElements"][4]["open"] = true;
|
||||
|
||||
defConfig["menuElements"][5]["name"] = "VFO Color";
|
||||
defConfig["menuElements"][5]["open"] = true;
|
||||
|
||||
defConfig["menuElements"][6]["name"] = "Band Plan";
|
||||
defConfig["menuElements"][6]["open"] = true;
|
||||
|
||||
@ -232,12 +232,19 @@ int sdrpp_main(int argc, char* argv[]) {
|
||||
|
||||
defConfig["modules"] = json::array();
|
||||
|
||||
defConfig["offsetMode"] = (int)0; // Off
|
||||
defConfig["offset"] = 0.0;
|
||||
defConfig["offsets"]["SpyVerter"] = 120000000.0;
|
||||
defConfig["offsets"]["Ham-It-Up"] = 125000000.0;
|
||||
defConfig["offsets"]["MMDS S-band (1998MHz)"] = -1998000000.0;
|
||||
defConfig["offsets"]["DK5AV X-Band"] = -6800000000.0;
|
||||
defConfig["offsets"]["Ku LNB (9750MHz)"] = -9750000000.0;
|
||||
defConfig["offsets"]["Ku LNB (10700MHz)"] = -10700000000.0;
|
||||
|
||||
defConfig["selectedOffset"] = "None";
|
||||
defConfig["manualOffset"] = 0.0;
|
||||
defConfig["showMenu"] = true;
|
||||
defConfig["showWaterfall"] = true;
|
||||
defConfig["source"] = "";
|
||||
defConfig["decimationPower"] = 0;
|
||||
defConfig["decimation"] = 1;
|
||||
defConfig["iqCorrection"] = false;
|
||||
defConfig["invertIQ"] = false;
|
||||
|
||||
@ -318,12 +325,18 @@ int sdrpp_main(int argc, char* argv[]) {
|
||||
|
||||
// Remove unused elements
|
||||
auto items = core::configManager.conf.items();
|
||||
auto newConf = core::configManager.conf;
|
||||
bool configCorrected = false;
|
||||
for (auto const& item : items) {
|
||||
if (!defConfig.contains(item.key())) {
|
||||
flog::info("Unused key in config {0}, repairing", item.key());
|
||||
core::configManager.conf.erase(item.key());
|
||||
newConf.erase(item.key());
|
||||
configCorrected = true;
|
||||
}
|
||||
}
|
||||
if (configCorrected) {
|
||||
core::configManager.conf = newConf;
|
||||
}
|
||||
|
||||
// Update to new module representation in config if needed
|
||||
for (auto [_name, inst] : core::configManager.conf["moduleInstances"].items()) {
|
||||
|
@ -5,113 +5,120 @@
|
||||
#include <gui/main_window.h>
|
||||
#include <gui/style.h>
|
||||
#include <signal_path/signal_path.h>
|
||||
#include <utils/optionlist.h>
|
||||
#include <gui/dialogs/dialog_box.h>
|
||||
|
||||
namespace sourcemenu {
|
||||
int offsetMode = 0;
|
||||
int sourceId = 0;
|
||||
double customOffset = 0.0;
|
||||
double effectiveOffset = 0.0;
|
||||
int decimationPower = 0;
|
||||
EventHandler<std::string> sourcesChangedHandler;
|
||||
EventHandler<std::string> sourceUnregisterHandler;
|
||||
OptionList<std::string, std::string> sources;
|
||||
std::string selectedSource;
|
||||
|
||||
int decimId = 0;
|
||||
OptionList<int, int> decimations;
|
||||
|
||||
bool iqCorrection = false;
|
||||
bool invertIQ = false;
|
||||
|
||||
EventHandler<std::string> sourceRegisteredHandler;
|
||||
EventHandler<std::string> sourceUnregisterHandler;
|
||||
EventHandler<std::string> sourceUnregisteredHandler;
|
||||
int offsetId = 0;
|
||||
double manualOffset = 0.0;
|
||||
std::string selectedOffset;
|
||||
double effectiveOffset = 0.0;
|
||||
OptionList<std::string, double> offsets;
|
||||
std::map<std::string, double> namedOffsets;
|
||||
|
||||
std::vector<std::string> sourceNames;
|
||||
std::string sourceNamesTxt;
|
||||
std::string selectedSource;
|
||||
bool showAddOffsetDialog = false;
|
||||
char newOffsetName[1024];
|
||||
double newOffset = 0.0;
|
||||
|
||||
bool showDelOffsetDialog = false;
|
||||
std::string delOffsetName = "";
|
||||
|
||||
// Offset IDs
|
||||
enum {
|
||||
OFFSET_MODE_NONE,
|
||||
OFFSET_MODE_CUSTOM,
|
||||
OFFSET_MODE_SPYVERTER,
|
||||
OFFSET_MODE_HAM_IT_UP,
|
||||
OFFSET_MODE_MMDS_SB_1998,
|
||||
OFFSET_MODE_DK5AV_XB,
|
||||
OFFSET_MODE_KU_LNB_9750,
|
||||
OFFSET_MODE_KU_LNB_10700,
|
||||
_OFFSET_MODE_COUNT
|
||||
OFFSET_ID_NONE,
|
||||
OFFSET_ID_MANUAL,
|
||||
OFFSET_ID_CUSTOM_BASE
|
||||
};
|
||||
|
||||
const char* offsetModesTxt = "None\0"
|
||||
"Custom\0"
|
||||
"SpyVerter\0"
|
||||
"Ham-It-Up\0"
|
||||
"MMDS S-band (1998MHz)\0"
|
||||
"DK5AV X-Band\0"
|
||||
"Ku LNB (9750MHz)\0"
|
||||
"Ku LNB (10700MHz)\0";
|
||||
|
||||
const char* decimationStages = "None\0"
|
||||
"2\0"
|
||||
"4\0"
|
||||
"8\0"
|
||||
"16\0"
|
||||
"32\0"
|
||||
"64\0";
|
||||
|
||||
void updateOffset() {
|
||||
if (offsetMode == OFFSET_MODE_CUSTOM) { effectiveOffset = customOffset; }
|
||||
else if (offsetMode == OFFSET_MODE_SPYVERTER) {
|
||||
effectiveOffset = 120000000;
|
||||
} // 120MHz Up-conversion
|
||||
else if (offsetMode == OFFSET_MODE_HAM_IT_UP) {
|
||||
effectiveOffset = 125000000;
|
||||
} // 125MHz Up-conversion
|
||||
else if (offsetMode == OFFSET_MODE_MMDS_SB_1998) {
|
||||
effectiveOffset = -1998000000;
|
||||
} // 1.998GHz Down-conversion
|
||||
else if (offsetMode == OFFSET_MODE_DK5AV_XB) {
|
||||
effectiveOffset = -6800000000;
|
||||
} // 6.8GHz Down-conversion
|
||||
else if (offsetMode == OFFSET_MODE_KU_LNB_9750) {
|
||||
effectiveOffset = -9750000000;
|
||||
} // 9.750GHz Down-conversion
|
||||
else if (offsetMode == OFFSET_MODE_KU_LNB_10700) {
|
||||
effectiveOffset = -10700000000;
|
||||
} // 10.7GHz Down-conversion
|
||||
else {
|
||||
// Compute the effective offset
|
||||
switch (offsetId) {
|
||||
case OFFSET_ID_NONE:
|
||||
effectiveOffset = 0;
|
||||
break;
|
||||
case OFFSET_ID_MANUAL:
|
||||
effectiveOffset = manualOffset;
|
||||
break;
|
||||
default:
|
||||
effectiveOffset = namedOffsets[offsets.name(offsetId)];
|
||||
break;
|
||||
}
|
||||
|
||||
// Apply it
|
||||
sigpath::sourceManager.setTuningOffset(effectiveOffset);
|
||||
}
|
||||
|
||||
void selectOffsetById(int id) {
|
||||
// Update the offset mode
|
||||
offsetId = id;
|
||||
selectedOffset = offsets.name(id);
|
||||
|
||||
// Update the offset
|
||||
updateOffset();
|
||||
}
|
||||
|
||||
void selectOffsetByName(const std::string& name) {
|
||||
// If the name doesn't exist, select 'None'
|
||||
if (!offsets.nameExists(name)) {
|
||||
selectOffsetById(OFFSET_ID_NONE);
|
||||
return;
|
||||
}
|
||||
|
||||
// Select using the ID associated with the name
|
||||
selectOffsetById(offsets.nameId(name));
|
||||
}
|
||||
|
||||
void refreshSources() {
|
||||
sourceNames = sigpath::sourceManager.getSourceNames();
|
||||
sourceNamesTxt.clear();
|
||||
// Get sources
|
||||
auto sourceNames = sigpath::sourceManager.getSourceNames();
|
||||
|
||||
// Define source options
|
||||
sources.clear();
|
||||
for (auto name : sourceNames) {
|
||||
sourceNamesTxt += name;
|
||||
sourceNamesTxt += '\0';
|
||||
sources.define(name, name, name);
|
||||
}
|
||||
}
|
||||
|
||||
void selectSource(std::string name) {
|
||||
if (sourceNames.empty()) {
|
||||
// If there is no source, give up
|
||||
if (sources.empty()) {
|
||||
sourceId = 0;
|
||||
selectedSource.clear();
|
||||
return;
|
||||
}
|
||||
auto it = std::find(sourceNames.begin(), sourceNames.end(), name);
|
||||
if (it == sourceNames.end()) {
|
||||
selectSource(sourceNames[0]);
|
||||
|
||||
// If a source with the given name doesn't exist, select the first source instead
|
||||
if (!sources.valueExists(name)) {
|
||||
selectSource(sources.value(0));
|
||||
return;
|
||||
}
|
||||
sourceId = std::distance(sourceNames.begin(), it);
|
||||
selectedSource = sourceNames[sourceId];
|
||||
sigpath::sourceManager.selectSource(sourceNames[sourceId]);
|
||||
|
||||
// Update the GUI variables
|
||||
sourceId = sources.valueId(name);
|
||||
selectedSource = name;
|
||||
|
||||
// Select the source module
|
||||
sigpath::sourceManager.selectSource(name);
|
||||
}
|
||||
|
||||
void onSourceRegistered(std::string name, void* ctx) {
|
||||
void onSourcesChanged(std::string name, void* ctx) {
|
||||
// Update the source list
|
||||
refreshSources();
|
||||
|
||||
if (selectedSource.empty()) {
|
||||
sourceId = 0;
|
||||
selectSource(sourceNames[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
sourceId = std::distance(sourceNames.begin(), std::find(sourceNames.begin(), sourceNames.end(), selectedSource));
|
||||
// Reselect the current source
|
||||
selectSource(selectedSource);
|
||||
}
|
||||
|
||||
void onSourceUnregister(std::string name, void* ctx) {
|
||||
@ -120,60 +127,173 @@ namespace sourcemenu {
|
||||
// TODO: Stop everything
|
||||
}
|
||||
|
||||
void onSourceUnregistered(std::string name, void* ctx) {
|
||||
refreshSources();
|
||||
void reloadOffsets() {
|
||||
// Clear list
|
||||
offsets.clear();
|
||||
namedOffsets.clear();
|
||||
|
||||
if (sourceNames.empty()) {
|
||||
selectedSource = "";
|
||||
return;
|
||||
// Define special offset modes
|
||||
offsets.define("None", OFFSET_ID_NONE);
|
||||
offsets.define("Manual", OFFSET_ID_MANUAL);
|
||||
|
||||
// Acquire the config file
|
||||
core::configManager.acquire();
|
||||
|
||||
// Load custom offsets
|
||||
auto ofs = core::configManager.conf["offsets"].items();
|
||||
for (auto& o : ofs) {
|
||||
namedOffsets[o.key()] = (double)o.value();
|
||||
}
|
||||
|
||||
if (name == selectedSource) {
|
||||
sourceId = std::clamp<int>(sourceId, 0, sourceNames.size() - 1);
|
||||
selectSource(sourceNames[sourceId]);
|
||||
return;
|
||||
// Define custom offsets
|
||||
for (auto& [name, offset] : namedOffsets) {
|
||||
offsets.define(name, offsets.size());
|
||||
}
|
||||
|
||||
sourceId = std::distance(sourceNames.begin(), std::find(sourceNames.begin(), sourceNames.end(), selectedSource));
|
||||
// Release the config file
|
||||
core::configManager.release();
|
||||
}
|
||||
|
||||
void init() {
|
||||
// Load offset modes
|
||||
reloadOffsets();
|
||||
|
||||
// Define decimation values
|
||||
decimations.define(1, "None", 1);
|
||||
decimations.define(2, "2x", 2);
|
||||
decimations.define(4, "4x", 4);
|
||||
decimations.define(8, "8x", 8);
|
||||
decimations.define(16, "16x", 16);
|
||||
decimations.define(32, "32x", 32);
|
||||
decimations.define(64, "64x", 64);
|
||||
|
||||
// Acquire the config file
|
||||
core::configManager.acquire();
|
||||
std::string selected = core::configManager.conf["source"];
|
||||
customOffset = core::configManager.conf["offset"];
|
||||
offsetMode = core::configManager.conf["offsetMode"];
|
||||
decimationPower = core::configManager.conf["decimationPower"];
|
||||
|
||||
// Load other settings
|
||||
std::string selectedSource = core::configManager.conf["source"];
|
||||
manualOffset = core::configManager.conf["manualOffset"];
|
||||
std::string selectedOffset = core::configManager.conf["selectedOffset"];
|
||||
iqCorrection = core::configManager.conf["iqCorrection"];
|
||||
invertIQ = core::configManager.conf["invertIQ"];
|
||||
int decimation = core::configManager.conf["decimation"];
|
||||
if (decimations.keyExists(decimation)) {
|
||||
decimId = decimations.keyId(decimation);
|
||||
}
|
||||
|
||||
// Release the config file
|
||||
core::configManager.release();
|
||||
|
||||
// Select the source module
|
||||
refreshSources();
|
||||
selectSource(selectedSource);
|
||||
|
||||
// Update frontend settings
|
||||
sigpath::iqFrontEnd.setDCBlocking(iqCorrection);
|
||||
sigpath::iqFrontEnd.setInvertIQ(invertIQ);
|
||||
updateOffset();
|
||||
sigpath::iqFrontEnd.setDecimation(decimations.value(decimId));
|
||||
selectOffsetByName(selectedOffset);
|
||||
|
||||
refreshSources();
|
||||
selectSource(selected);
|
||||
sigpath::iqFrontEnd.setDecimation(1 << decimationPower);
|
||||
|
||||
sourceRegisteredHandler.handler = onSourceRegistered;
|
||||
// Register handlers
|
||||
sourcesChangedHandler.handler = onSourcesChanged;
|
||||
sourceUnregisterHandler.handler = onSourceUnregister;
|
||||
sourceUnregisteredHandler.handler = onSourceUnregistered;
|
||||
sigpath::sourceManager.onSourceRegistered.bindHandler(&sourceRegisteredHandler);
|
||||
sigpath::sourceManager.onSourceRegistered.bindHandler(&sourcesChangedHandler);
|
||||
sigpath::sourceManager.onSourceUnregister.bindHandler(&sourceUnregisterHandler);
|
||||
sigpath::sourceManager.onSourceUnregistered.bindHandler(&sourceUnregisteredHandler);
|
||||
sigpath::sourceManager.onSourceUnregistered.bindHandler(&sourcesChangedHandler);
|
||||
}
|
||||
|
||||
core::configManager.release();
|
||||
void addOffset(const std::string& name, double offset) {
|
||||
// Acquire the config file
|
||||
core::configManager.acquire();
|
||||
|
||||
// Define a new offset
|
||||
core::configManager.conf["offsets"][name] = offset;
|
||||
|
||||
// Acquire the config file
|
||||
core::configManager.release(true);
|
||||
|
||||
// Reload the offsets
|
||||
reloadOffsets();
|
||||
|
||||
// Attempt to re-select the same one
|
||||
selectOffsetByName(selectedOffset);
|
||||
}
|
||||
|
||||
void delOffset(const std::string& name) {
|
||||
// Acquire the config file
|
||||
core::configManager.acquire();
|
||||
|
||||
// Define a new offset
|
||||
core::configManager.conf["offsets"].erase(name);
|
||||
|
||||
// Acquire the config file
|
||||
core::configManager.release(true);
|
||||
|
||||
// Reload the offsets
|
||||
reloadOffsets();
|
||||
|
||||
// Attempt to re-select the same one
|
||||
selectOffsetByName(selectedOffset);
|
||||
}
|
||||
|
||||
bool addOffsetDialog() {
|
||||
bool open = true;
|
||||
gui::mainWindow.lockWaterfallControls = true;
|
||||
|
||||
float menuWidth = ImGui::GetContentRegionAvail().x;
|
||||
|
||||
const char* id = "Add offset##sdrpp_add_offset_dialog_";
|
||||
ImGui::OpenPopup(id);
|
||||
|
||||
if (ImGui::BeginPopup(id, ImGuiWindowFlags_NoResize)) {
|
||||
ImGui::LeftLabel("Name");
|
||||
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
|
||||
ImGui::InputText("##sdrpp_add_offset_name", newOffsetName, 1023);
|
||||
|
||||
ImGui::LeftLabel("Offset");
|
||||
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
|
||||
ImGui::InputDouble("##sdrpp_add_offset_offset", &newOffset);
|
||||
|
||||
bool nameExists = offsets.nameExists(newOffsetName);
|
||||
bool reservedName = !strcmp(newOffsetName, "None") || !strcmp(newOffsetName, "Manual");
|
||||
bool denyApply = !newOffsetName[0] || nameExists || reservedName;
|
||||
|
||||
if (nameExists) {
|
||||
ImGui::TextColored(ImVec4(1.0f, 0.0f, 0.0f, 1.0f), "An offset with the given name already exists.");
|
||||
}
|
||||
else if (reservedName) {
|
||||
ImGui::TextColored(ImVec4(1.0f, 0.0f, 0.0f, 1.0f), "The given name is reserved.");
|
||||
}
|
||||
|
||||
if (denyApply) { style::beginDisabled(); }
|
||||
if (ImGui::Button("Apply")) {
|
||||
addOffset(newOffsetName, newOffset);
|
||||
open = false;
|
||||
}
|
||||
if (denyApply) { style::endDisabled(); }
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Cancel")) {
|
||||
open = false;
|
||||
}
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
return open;
|
||||
}
|
||||
|
||||
void draw(void* ctx) {
|
||||
float itemWidth = ImGui::GetContentRegionAvail().x;
|
||||
float lineHeight = ImGui::GetTextLineHeightWithSpacing();
|
||||
float spacing = lineHeight - ImGui::GetTextLineHeight();
|
||||
bool running = gui::mainWindow.sdrIsRunning();
|
||||
|
||||
if (running) { style::beginDisabled(); }
|
||||
|
||||
ImGui::SetNextItemWidth(itemWidth);
|
||||
if (ImGui::Combo("##source", &sourceId, sourceNamesTxt.c_str())) {
|
||||
selectSource(sourceNames[sourceId]);
|
||||
if (ImGui::Combo("##source", &sourceId, sources.txt)) {
|
||||
std::string newSource = sources.value(sourceId);
|
||||
selectSource(newSource);
|
||||
core::configManager.acquire();
|
||||
core::configManager.conf["source"] = sourceNames[sourceId];
|
||||
core::configManager.conf["source"] = newSource;
|
||||
core::configManager.release(true);
|
||||
}
|
||||
|
||||
@ -196,21 +316,45 @@ namespace sourcemenu {
|
||||
}
|
||||
|
||||
ImGui::LeftLabel("Offset mode");
|
||||
ImGui::SetNextItemWidth(itemWidth - ImGui::GetCursorPosX());
|
||||
if (ImGui::Combo("##_sdrpp_offset_mode", &offsetMode, offsetModesTxt)) {
|
||||
updateOffset();
|
||||
ImGui::SetNextItemWidth(itemWidth - ImGui::GetCursorPosX() - 2.0f*(lineHeight + 1.5f*spacing));
|
||||
if (ImGui::Combo("##_sdrpp_offset", &offsetId, offsets.txt)) {
|
||||
selectOffsetById(offsetId);
|
||||
core::configManager.acquire();
|
||||
core::configManager.conf["offsetMode"] = offsetMode;
|
||||
core::configManager.conf["selectedOffset"] = offsets.key(offsetId);
|
||||
core::configManager.release(true);
|
||||
}
|
||||
ImGui::SameLine();
|
||||
ImGui::SetCursorPosX(ImGui::GetCursorPosX() - spacing);
|
||||
if (offsetId < OFFSET_ID_CUSTOM_BASE) { ImGui::BeginDisabled(); }
|
||||
if (ImGui::Button("-##_sdrpp_offset_del_", ImVec2(lineHeight + 0.5f*spacing, 0))) {
|
||||
delOffsetName = selectedOffset;
|
||||
showDelOffsetDialog = true;
|
||||
}
|
||||
if (offsetId < OFFSET_ID_CUSTOM_BASE) { ImGui::EndDisabled(); }
|
||||
ImGui::SameLine();
|
||||
ImGui::SetCursorPosX(ImGui::GetCursorPosX() - spacing);
|
||||
if (ImGui::Button("+##_sdrpp_offset_add_", ImVec2(lineHeight + 0.5f*spacing, 0))) {
|
||||
strcpy(newOffsetName, "New Offset");
|
||||
showAddOffsetDialog = true;
|
||||
}
|
||||
|
||||
// Offset delete confirmation
|
||||
if (ImGui::GenericDialog("sdrpp_del_offset_confirm", showDelOffsetDialog, GENERIC_DIALOG_BUTTONS_YES_NO, []() {
|
||||
ImGui::Text("Deleting offset named \"%s\". Are you sure?", delOffsetName.c_str());
|
||||
}) == GENERIC_DIALOG_BUTTON_YES) {
|
||||
delOffset(delOffsetName);
|
||||
}
|
||||
|
||||
// Offset add diaglog
|
||||
if (showAddOffsetDialog) { showAddOffsetDialog = addOffsetDialog(); }
|
||||
|
||||
ImGui::LeftLabel("Offset");
|
||||
ImGui::SetNextItemWidth(itemWidth - ImGui::GetCursorPosX());
|
||||
if (offsetMode == OFFSET_MODE_CUSTOM) {
|
||||
if (ImGui::InputDouble("##freq_offset", &customOffset, 1.0, 100.0)) {
|
||||
ImGui::FillWidth();
|
||||
if (offsetId == OFFSET_ID_MANUAL) {
|
||||
if (ImGui::InputDouble("##freq_offset", &manualOffset, 1.0, 100.0)) {
|
||||
updateOffset();
|
||||
core::configManager.acquire();
|
||||
core::configManager.conf["offset"] = customOffset;
|
||||
core::configManager.conf["manualOffset"] = manualOffset;
|
||||
core::configManager.release(true);
|
||||
}
|
||||
}
|
||||
@ -222,11 +366,11 @@ namespace sourcemenu {
|
||||
|
||||
if (running) { style::beginDisabled(); }
|
||||
ImGui::LeftLabel("Decimation");
|
||||
ImGui::SetNextItemWidth(itemWidth - ImGui::GetCursorPosX());
|
||||
if (ImGui::Combo("##source_decim", &decimationPower, decimationStages)) {
|
||||
sigpath::iqFrontEnd.setDecimation(1 << decimationPower);
|
||||
ImGui::FillWidth();
|
||||
if (ImGui::Combo("##source_decim", &decimId, decimations.txt)) {
|
||||
sigpath::iqFrontEnd.setDecimation(decimations.value(decimId));
|
||||
core::configManager.acquire();
|
||||
core::configManager.conf["decimationPower"] = decimationPower;
|
||||
core::configManager.conf["decimation"] = decimations.key(decimId);
|
||||
core::configManager.release(true);
|
||||
}
|
||||
if (running) { style::endDisabled(); }
|
||||
|
@ -1,3 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
#define VERSION_STR "1.2.0"
|
||||
#define VERSION_STR "1.2.1"
|
@ -52,22 +52,9 @@ public:
|
||||
sampleTypes.define(wav::SAMP_TYPE_INT32, "Int32", wav::SAMP_TYPE_INT32);
|
||||
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
|
||||
containerId = containers.valueId(wav::FORMAT_WAV);
|
||||
sampleTypeId = sampleTypes.valueId(wav::SAMP_TYPE_INT16);
|
||||
retroBufSizeId = retroBufSizes.nameId("None");
|
||||
|
||||
// Load config
|
||||
config.acquire();
|
||||
@ -83,9 +70,6 @@ public:
|
||||
if (config.conf[name].contains("sampleType") && sampleTypes.keyExists(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")) {
|
||||
selectedStreamName = config.conf[name]["audioStream"];
|
||||
}
|
||||
@ -298,14 +282,6 @@ private:
|
||||
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(); }
|
||||
|
||||
// Show additional audio options
|
||||
@ -590,13 +566,11 @@ private:
|
||||
|
||||
OptionList<std::string, wav::Format> containers;
|
||||
OptionList<int, wav::SampleType> sampleTypes;
|
||||
OptionList<int64_t, int64_t> retroBufSizes;
|
||||
FolderSelect folderSelect;
|
||||
|
||||
int recMode = RECORDER_MODE_AUDIO;
|
||||
int containerId;
|
||||
int sampleTypeId;
|
||||
int retroBufSizeId;
|
||||
bool stereo = true;
|
||||
std::string selectedStreamName = "";
|
||||
float audioVolume = 1.0f;
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <config.h>
|
||||
#include <sdrplay_api.h>
|
||||
#include <gui/smgui.h>
|
||||
#include <utils/optionlist.h>
|
||||
|
||||
#define CONCAT(a, b) ((std::string(a) + b).c_str())
|
||||
|
||||
@ -15,57 +16,12 @@ SDRPP_MOD_INFO{
|
||||
/* Name: */ "sdrplay_source",
|
||||
/* Description: */ "SDRplay source module for SDR++",
|
||||
/* Author: */ "Ryzerth",
|
||||
/* Version: */ 0, 1, 0,
|
||||
/* Version: */ 0, 2, 0,
|
||||
/* Max instances */ 1
|
||||
};
|
||||
|
||||
ConfigManager config;
|
||||
|
||||
unsigned int sampleRates[] = {
|
||||
2000000,
|
||||
3000000,
|
||||
4000000,
|
||||
5000000,
|
||||
6000000,
|
||||
7000000,
|
||||
8000000,
|
||||
9000000,
|
||||
10000000
|
||||
};
|
||||
|
||||
const char* sampleRatesTxt =
|
||||
"2MHz\0"
|
||||
"3MHz\0"
|
||||
"4MHz\0"
|
||||
"5MHz\0"
|
||||
"6MHz\0"
|
||||
"7MHz\0"
|
||||
"8MHz\0"
|
||||
"9MHz\0"
|
||||
"10MHz\0";
|
||||
|
||||
sdrplay_api_Bw_MHzT bandwidths[] = {
|
||||
sdrplay_api_BW_0_200,
|
||||
sdrplay_api_BW_0_300,
|
||||
sdrplay_api_BW_0_600,
|
||||
sdrplay_api_BW_1_536,
|
||||
sdrplay_api_BW_5_000,
|
||||
sdrplay_api_BW_6_000,
|
||||
sdrplay_api_BW_7_000,
|
||||
sdrplay_api_BW_8_000,
|
||||
};
|
||||
|
||||
const char* bandwidthsTxt =
|
||||
"200KHz\0"
|
||||
"300KHz\0"
|
||||
"600KHz\0"
|
||||
"1.536MHz\0"
|
||||
"5MHz\0"
|
||||
"6MHz\0"
|
||||
"7MHz\0"
|
||||
"8MHz\0"
|
||||
"Auto\0";
|
||||
|
||||
sdrplay_api_Bw_MHzT preferedBandwidth[] = {
|
||||
sdrplay_api_BW_5_000,
|
||||
sdrplay_api_BW_5_000,
|
||||
@ -208,6 +164,11 @@ public:
|
||||
name += devArr[i].SerNo;
|
||||
name += ')';
|
||||
break;
|
||||
case SDRPLAY_RSP1B_ID:
|
||||
name = "RSP1B (";
|
||||
name += devArr[i].SerNo;
|
||||
name += ')';
|
||||
break;
|
||||
case SDRPLAY_RSP2_ID:
|
||||
name = "RSP2 (";
|
||||
name += devArr[i].SerNo;
|
||||
@ -223,6 +184,11 @@ public:
|
||||
name += devArr[i].SerNo;
|
||||
name += ')';
|
||||
break;
|
||||
case SDRPLAY_RSPdxR2_ID:
|
||||
name = "RSPdx-R2 (";
|
||||
name += devArr[i].SerNo;
|
||||
name += ')';
|
||||
break;
|
||||
default:
|
||||
name = "Unknown (";
|
||||
name += devArr[i].SerNo;
|
||||
@ -290,6 +256,30 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
// Define the valid samplerates
|
||||
samplerates.clear();
|
||||
samplerates.define(2e6, "2MHz", 2e6);
|
||||
samplerates.define(3e6, "3MHz", 3e6);
|
||||
samplerates.define(4e6, "4MHz", 4e6);
|
||||
samplerates.define(5e6, "5MHz", 5e6);
|
||||
samplerates.define(6e6, "6MHz", 6e6);
|
||||
samplerates.define(7e6, "7MHz", 7e6);
|
||||
samplerates.define(8e6, "8MHz", 8e6);
|
||||
samplerates.define(9e6, "9MHz", 9e6);
|
||||
samplerates.define(10e6, "10MHz", 10e6);
|
||||
|
||||
// Define the valid bandwidths
|
||||
bandwidths.clear();
|
||||
bandwidths.define(200e3, "200KHz", sdrplay_api_BW_0_200);
|
||||
bandwidths.define(300e3, "300KHz", sdrplay_api_BW_0_300);
|
||||
bandwidths.define(600e3, "600KHz", sdrplay_api_BW_0_600);
|
||||
bandwidths.define(1.536e6, "1.536MHz", sdrplay_api_BW_1_536);
|
||||
bandwidths.define(5e6, "5MHz", sdrplay_api_BW_5_000);
|
||||
bandwidths.define(6e6, "6MHz", sdrplay_api_BW_6_000);
|
||||
bandwidths.define(7e6, "7MHz", sdrplay_api_BW_7_000);
|
||||
bandwidths.define(8e6, "8MHz", sdrplay_api_BW_8_000);
|
||||
bandwidths.define(0, "Auto", sdrplay_api_BW_Undefined);
|
||||
|
||||
channelParams = openDevParams->rxChannelA;
|
||||
|
||||
selectedName = devNameList[id];
|
||||
@ -297,7 +287,7 @@ public:
|
||||
if (openDev.hwVer == SDRPLAY_RSP1_ID) {
|
||||
lnaSteps = 4;
|
||||
}
|
||||
else if (openDev.hwVer == SDRPLAY_RSP1A_ID) {
|
||||
else if (openDev.hwVer == SDRPLAY_RSP1A_ID || openDev.hwVer == SDRPLAY_RSP1B_ID) {
|
||||
lnaSteps = 10;
|
||||
}
|
||||
else if (openDev.hwVer == SDRPLAY_RSP2_ID) {
|
||||
@ -306,78 +296,54 @@ public:
|
||||
else if (openDev.hwVer == SDRPLAY_RSPduo_ID) {
|
||||
lnaSteps = 10;
|
||||
}
|
||||
else if (openDev.hwVer == SDRPLAY_RSPdx_ID) {
|
||||
else if (openDev.hwVer == SDRPLAY_RSPdx_ID || openDev.hwVer == SDRPLAY_RSPdxR2_ID) {
|
||||
lnaSteps = 28;
|
||||
}
|
||||
|
||||
bool created = false;
|
||||
// Select default settings
|
||||
srId = 0;
|
||||
sampleRate = samplerates.value(0);
|
||||
bandwidthId = 8;
|
||||
lnaGain = lnaSteps - 1;
|
||||
gain = 59;
|
||||
agc = false;
|
||||
agcAttack = 500;
|
||||
agcDecay = 500;
|
||||
agcDecayDelay = 200;
|
||||
agcDecayThreshold = 5;
|
||||
agcSetPoint = -30;
|
||||
ifModeId = 0;
|
||||
rsp1a_fmmwNotch = false;
|
||||
rsp2_fmmwNotch = false;
|
||||
rspdx_fmmwNotch = false;
|
||||
rspduo_fmmwNotch = false;
|
||||
rsp1a_dabNotch = false;
|
||||
rspdx_dabNotch = false;
|
||||
rspduo_dabNotch = false;
|
||||
rsp1a_biasT = false;
|
||||
rsp2_biasT = false;
|
||||
rspdx_biasT = false;
|
||||
rspduo_biasT = false;
|
||||
rsp2_antennaPort = 0;
|
||||
rspdx_antennaPort = 0;
|
||||
rspduo_antennaPort = 0;
|
||||
|
||||
config.acquire();
|
||||
if (!config.conf["devices"].contains(selectedName)) {
|
||||
created = true;
|
||||
config.conf["devices"][selectedName]["sampleRate"] = sampleRates[0];
|
||||
config.conf["devices"][selectedName]["bwMode"] = 8; // Auto
|
||||
config.conf["devices"][selectedName]["lnaGain"] = lnaSteps - 1;
|
||||
config.conf["devices"][selectedName]["ifGain"] = 59;
|
||||
config.conf["devices"][selectedName]["agc"] = false;
|
||||
|
||||
config.conf["devices"][selectedName]["agcAttack"] = 500;
|
||||
config.conf["devices"][selectedName]["agcDecay"] = 500;
|
||||
config.conf["devices"][selectedName]["agcDecayDelay"] = 200;
|
||||
config.conf["devices"][selectedName]["agcDecayThreshold"] = 5;
|
||||
config.conf["devices"][selectedName]["agcSetPoint"] = -30;
|
||||
|
||||
config.conf["devices"][selectedName]["ifModeId"] = 0;
|
||||
|
||||
if (openDev.hwVer == SDRPLAY_RSP1_ID) {
|
||||
// No config to load
|
||||
}
|
||||
else if (openDev.hwVer == SDRPLAY_RSP1A_ID) {
|
||||
config.conf["devices"][selectedName]["fmmwNotch"] = false;
|
||||
config.conf["devices"][selectedName]["dabNotch"] = false;
|
||||
config.conf["devices"][selectedName]["biast"] = false;
|
||||
}
|
||||
else if (openDev.hwVer == SDRPLAY_RSP2_ID) {
|
||||
config.conf["devices"][selectedName]["antenna"] = 0;
|
||||
config.conf["devices"][selectedName]["fmmwNotch"] = false;
|
||||
config.conf["devices"][selectedName]["biast"] = false;
|
||||
}
|
||||
else if (openDev.hwVer == SDRPLAY_RSPduo_ID) {
|
||||
config.conf["devices"][selectedName]["antenna"] = 0;
|
||||
config.conf["devices"][selectedName]["fmmwNotch"] = false;
|
||||
config.conf["devices"][selectedName]["dabNotch"] = false;
|
||||
config.conf["devices"][selectedName]["biast"] = false;
|
||||
}
|
||||
else if (openDev.hwVer == SDRPLAY_RSPdx_ID) {
|
||||
config.conf["devices"][selectedName]["antenna"] = 0;
|
||||
config.conf["devices"][selectedName]["fmmwNotch"] = false;
|
||||
config.conf["devices"][selectedName]["dabNotch"] = false;
|
||||
config.conf["devices"][selectedName]["biast"] = false;
|
||||
}
|
||||
}
|
||||
|
||||
// General options
|
||||
if (config.conf["devices"][selectedName].contains("sampleRate")) {
|
||||
sampleRate = config.conf["devices"][selectedName]["sampleRate"];
|
||||
bool found = false;
|
||||
for (int i = 0; i < 9; i++) {
|
||||
if (sampleRates[i] == sampleRate) {
|
||||
srId = i;
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
sampleRate = sampleRates[0];
|
||||
srId = 0;
|
||||
if (config.conf["devices"][selectedName].contains("samplerate")) {
|
||||
int sr = config.conf["devices"][selectedName]["samplerate"];
|
||||
if (samplerates.keyExists(sr)) {
|
||||
srId = samplerates.keyId(sr);
|
||||
sampleRate = samplerates[srId];
|
||||
}
|
||||
}
|
||||
|
||||
if (config.conf["devices"][selectedName].contains("ifModeId")) {
|
||||
ifModeId = config.conf["devices"][selectedName]["ifModeId"];
|
||||
if (ifModeId != 0) {
|
||||
sampleRate = ifModes[ifModeId].effectiveSamplerate;
|
||||
}
|
||||
}
|
||||
|
||||
if (config.conf["devices"][selectedName].contains("bwMode")) {
|
||||
bandwidthId = config.conf["devices"][selectedName]["bwMode"];
|
||||
}
|
||||
@ -388,11 +354,6 @@ public:
|
||||
gain = config.conf["devices"][selectedName]["ifGain"];
|
||||
}
|
||||
if (config.conf["devices"][selectedName].contains("agc")) {
|
||||
if (!config.conf["devices"][selectedName]["agc"].is_boolean()) {
|
||||
int oldMode = config.conf["devices"][selectedName]["agc"];
|
||||
config.conf["devices"][selectedName]["agc"] = (bool)(oldMode != 0);
|
||||
created = true;
|
||||
}
|
||||
agc = config.conf["devices"][selectedName]["agc"];
|
||||
}
|
||||
if (config.conf["devices"][selectedName].contains("agcAttack")) {
|
||||
@ -415,7 +376,7 @@ public:
|
||||
if (openDev.hwVer == SDRPLAY_RSP1_ID) {
|
||||
// No config to load
|
||||
}
|
||||
else if (openDev.hwVer == SDRPLAY_RSP1A_ID) {
|
||||
else if (openDev.hwVer == SDRPLAY_RSP1A_ID || openDev.hwVer == SDRPLAY_RSP1B_ID) {
|
||||
if (config.conf["devices"][selectedName].contains("fmmwNotch")) {
|
||||
rsp1a_fmmwNotch = config.conf["devices"][selectedName]["fmmwNotch"];
|
||||
}
|
||||
@ -451,7 +412,7 @@ public:
|
||||
rspduo_biasT = config.conf["devices"][selectedName]["biast"];
|
||||
}
|
||||
}
|
||||
else if (openDev.hwVer == SDRPLAY_RSPdx_ID) {
|
||||
else if (openDev.hwVer == SDRPLAY_RSPdx_ID || openDev.hwVer == SDRPLAY_RSPdxR2_ID) {
|
||||
if (config.conf["devices"][selectedName].contains("antenna")) {
|
||||
rspdx_antennaPort = config.conf["devices"][selectedName]["antenna"];
|
||||
}
|
||||
@ -466,7 +427,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
config.release(created);
|
||||
config.release();
|
||||
|
||||
if (lnaGain >= lnaSteps) { lnaGain = lnaSteps - 1; }
|
||||
|
||||
@ -614,7 +575,7 @@ private:
|
||||
|
||||
// General options
|
||||
if (_this->ifModeId == 0) {
|
||||
_this->bandwidth = (_this->bandwidthId == 8) ? preferedBandwidth[_this->srId] : bandwidths[_this->bandwidthId];
|
||||
_this->bandwidth = (_this->bandwidthId == 8) ? preferedBandwidth[_this->srId] : _this->bandwidths[_this->bandwidthId];
|
||||
_this->openDevParams->devParams->fsFreq.fsHz = _this->sampleRate;
|
||||
_this->channelParams->tunerParams.bwType = _this->bandwidth;
|
||||
}
|
||||
@ -693,14 +654,14 @@ private:
|
||||
}
|
||||
|
||||
if (_this->ifModeId == 0) {
|
||||
if (SmGui::Combo(CONCAT("##sdrplay_sr", _this->name), &_this->srId, sampleRatesTxt)) {
|
||||
_this->sampleRate = sampleRates[_this->srId];
|
||||
if (SmGui::Combo(CONCAT("##sdrplay_sr", _this->name), &_this->srId, _this->samplerates.txt)) {
|
||||
_this->sampleRate = _this->samplerates[_this->srId];
|
||||
if (_this->bandwidthId == 8) {
|
||||
_this->bandwidth = preferedBandwidth[_this->srId];
|
||||
}
|
||||
core::setInputSampleRate(_this->sampleRate);
|
||||
config.acquire();
|
||||
config.conf["devices"][_this->selectedName]["sampleRate"] = _this->sampleRate;
|
||||
config.conf["devices"][_this->selectedName]["samplerate"] = _this->samplerates.key(_this->srId);
|
||||
config.release(true);
|
||||
}
|
||||
|
||||
@ -715,8 +676,8 @@ private:
|
||||
|
||||
SmGui::LeftLabel("Bandwidth");
|
||||
SmGui::FillWidth();
|
||||
if (SmGui::Combo(CONCAT("##sdrplay_bw", _this->name), &_this->bandwidthId, bandwidthsTxt)) {
|
||||
_this->bandwidth = (_this->bandwidthId == 8) ? preferedBandwidth[_this->srId] : bandwidths[_this->bandwidthId];
|
||||
if (SmGui::Combo(CONCAT("##sdrplay_bw", _this->name), &_this->bandwidthId, _this->bandwidths.txt)) {
|
||||
_this->bandwidth = (_this->bandwidthId == 8) ? preferedBandwidth[_this->srId] : _this->bandwidths[_this->bandwidthId];
|
||||
if (_this->running) {
|
||||
_this->channelParams->tunerParams.bwType = _this->bandwidth;
|
||||
sdrplay_api_Update(_this->openDev.dev, _this->openDev.tuner, sdrplay_api_Update_Tuner_BwType, sdrplay_api_Update_Ext1_None);
|
||||
@ -745,10 +706,28 @@ private:
|
||||
}
|
||||
else {
|
||||
config.acquire();
|
||||
_this->sampleRate = config.conf["devices"][_this->selectedName]["sampleRate"];
|
||||
_this->bandwidthId = config.conf["devices"][_this->selectedName]["bwMode"];
|
||||
config.release(false);
|
||||
_this->bandwidth = (_this->bandwidthId == 8) ? preferedBandwidth[_this->srId] : bandwidths[_this->bandwidthId];
|
||||
// Reload samplerate
|
||||
if (config.conf["devices"][_this->selectedName].contains("samplerate")) {
|
||||
int sr = config.conf["devices"][_this->selectedName]["samplerate"];
|
||||
if (_this->samplerates.keyExists(sr)) {
|
||||
_this->srId = _this->samplerates.keyId(sr);
|
||||
}
|
||||
}
|
||||
else {
|
||||
_this->srId = 0;
|
||||
}
|
||||
|
||||
// Reload bandwidth
|
||||
if (config.conf["devices"][_this->selectedName].contains("bwMode")) {
|
||||
_this->bandwidthId = config.conf["devices"][_this->selectedName]["bwMode"];
|
||||
}
|
||||
else {
|
||||
// Auto
|
||||
_this->bandwidthId = 8;
|
||||
}
|
||||
_this->sampleRate = _this->samplerates[_this->srId];
|
||||
config.release();
|
||||
_this->bandwidth = (_this->bandwidthId == 8) ? preferedBandwidth[_this->srId] : _this->bandwidths[_this->bandwidthId];
|
||||
}
|
||||
core::setInputSampleRate(_this->sampleRate);
|
||||
config.acquire();
|
||||
@ -854,6 +833,7 @@ private:
|
||||
_this->RSP1Menu();
|
||||
break;
|
||||
case SDRPLAY_RSP1A_ID:
|
||||
case SDRPLAY_RSP1B_ID:
|
||||
_this->RSP1AMenu();
|
||||
break;
|
||||
case SDRPLAY_RSP2_ID:
|
||||
@ -863,6 +843,7 @@ private:
|
||||
_this->RSPduoMenu();
|
||||
break;
|
||||
case SDRPLAY_RSPdx_ID:
|
||||
case SDRPLAY_RSPdxR2_ID:
|
||||
_this->RSPdxMenu();
|
||||
break;
|
||||
default:
|
||||
@ -1146,7 +1127,7 @@ private:
|
||||
sdrplay_api_RxChannelParamsT* channelParams;
|
||||
|
||||
sdrplay_api_Bw_MHzT bandwidth;
|
||||
int bandwidthId = 0;
|
||||
int bandwidthId = 8; // Auto
|
||||
|
||||
int devId = 0;
|
||||
int srId = 0;
|
||||
@ -1201,6 +1182,9 @@ private:
|
||||
std::string devListTxt;
|
||||
std::vector<std::string> devNameList;
|
||||
std::string selectedName;
|
||||
|
||||
OptionList<int, int> samplerates;
|
||||
OptionList<int, sdrplay_api_Bw_MHzT> bandwidths;
|
||||
};
|
||||
|
||||
MOD_EXPORT void _INIT_() {
|
||||
|
Reference in New Issue
Block a user