mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2024-12-25 10:28:28 +01:00
Fixed wrong sample rate at startup
This commit is contained in:
parent
4abfe407da
commit
2f93c7ae58
@ -38,12 +38,16 @@ public:
|
|||||||
handler.stream = &stream;
|
handler.stream = &stream;
|
||||||
|
|
||||||
refresh();
|
refresh();
|
||||||
|
if (sampleRateList.size() > 0) {
|
||||||
|
sampleRate = sampleRateList[0];
|
||||||
|
}
|
||||||
|
|
||||||
// Select device from config
|
// Select device from config
|
||||||
config.aquire();
|
config.aquire();
|
||||||
std::string devSerial = config.conf["device"];
|
std::string devSerial = config.conf["device"];
|
||||||
config.release();
|
config.release();
|
||||||
selectByString(devSerial);
|
selectByString(devSerial);
|
||||||
|
core::setInputSampleRate(sampleRate);
|
||||||
|
|
||||||
sigpath::sourceManager.registerSource("Airspy", &handler);
|
sigpath::sourceManager.registerSource("Airspy", &handler);
|
||||||
}
|
}
|
||||||
@ -145,11 +149,13 @@ public:
|
|||||||
|
|
||||||
// Load sample rate
|
// Load sample rate
|
||||||
srId = 0;
|
srId = 0;
|
||||||
|
sampleRate = sampleRateList[0];
|
||||||
if (config.conf["devices"][selectedSerStr].contains("sampleRate")) {
|
if (config.conf["devices"][selectedSerStr].contains("sampleRate")) {
|
||||||
int selectedSr = config.conf["devices"][selectedSerStr]["sampleRate"];
|
int selectedSr = config.conf["devices"][selectedSerStr]["sampleRate"];
|
||||||
for (int i = 0; i < sampleRateList.size(); i++) {
|
for (int i = 0; i < sampleRateList.size(); i++) {
|
||||||
if (sampleRateList[i] == selectedSr) {
|
if (sampleRateList[i] == selectedSr) {
|
||||||
srId = i;
|
srId = i;
|
||||||
|
sampleRate = selectedSr;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -304,6 +310,7 @@ private:
|
|||||||
ImGui::SetNextItemWidth(menuWidth);
|
ImGui::SetNextItemWidth(menuWidth);
|
||||||
if (ImGui::Combo(CONCAT("##_airspy_dev_sel_", _this->name), &_this->devId, _this->devListTxt.c_str())) {
|
if (ImGui::Combo(CONCAT("##_airspy_dev_sel_", _this->name), &_this->devId, _this->devListTxt.c_str())) {
|
||||||
_this->selectBySerial(_this->devList[_this->devId]);
|
_this->selectBySerial(_this->devList[_this->devId]);
|
||||||
|
core::setInputSampleRate(_this->sampleRate);
|
||||||
if (_this->selectedSerStr != "") {
|
if (_this->selectedSerStr != "") {
|
||||||
config.aquire();
|
config.aquire();
|
||||||
config.conf["device"] = _this->selectedSerStr;
|
config.conf["device"] = _this->selectedSerStr;
|
||||||
@ -329,6 +336,7 @@ private:
|
|||||||
std::string devSerial = config.conf["device"];
|
std::string devSerial = config.conf["device"];
|
||||||
config.release();
|
config.release();
|
||||||
_this->selectByString(devSerial);
|
_this->selectByString(devSerial);
|
||||||
|
core::setInputSampleRate(_this->sampleRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_this->running) { style::endDisabled(); }
|
if (_this->running) { style::endDisabled(); }
|
||||||
|
@ -45,6 +45,7 @@ public:
|
|||||||
std::string devSerial = config.conf["device"];
|
std::string devSerial = config.conf["device"];
|
||||||
config.release();
|
config.release();
|
||||||
selectByString(devSerial);
|
selectByString(devSerial);
|
||||||
|
core::setInputSampleRate(sampleRate);
|
||||||
|
|
||||||
sigpath::sourceManager.registerSource("Airspy HF+", &handler);
|
sigpath::sourceManager.registerSource("Airspy HF+", &handler);
|
||||||
}
|
}
|
||||||
@ -146,11 +147,13 @@ public:
|
|||||||
|
|
||||||
// Load sample rate
|
// Load sample rate
|
||||||
srId = 0;
|
srId = 0;
|
||||||
|
sampleRate = sampleRateList[0];
|
||||||
if (config.conf["devices"][selectedSerStr].contains("sampleRate")) {
|
if (config.conf["devices"][selectedSerStr].contains("sampleRate")) {
|
||||||
int selectedSr = config.conf["devices"][selectedSerStr]["sampleRate"];
|
int selectedSr = config.conf["devices"][selectedSerStr]["sampleRate"];
|
||||||
for (int i = 0; i < sampleRateList.size(); i++) {
|
for (int i = 0; i < sampleRateList.size(); i++) {
|
||||||
if (sampleRateList[i] == selectedSr) {
|
if (sampleRateList[i] == selectedSr) {
|
||||||
srId = i;
|
srId = i;
|
||||||
|
sampleRate = selectedSr;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -261,6 +264,7 @@ private:
|
|||||||
ImGui::SetNextItemWidth(menuWidth);
|
ImGui::SetNextItemWidth(menuWidth);
|
||||||
if (ImGui::Combo(CONCAT("##_airspyhf_dev_sel_", _this->name), &_this->devId, _this->devListTxt.c_str())) {
|
if (ImGui::Combo(CONCAT("##_airspyhf_dev_sel_", _this->name), &_this->devId, _this->devListTxt.c_str())) {
|
||||||
_this->selectBySerial(_this->devList[_this->devId]);
|
_this->selectBySerial(_this->devList[_this->devId]);
|
||||||
|
core::setInputSampleRate(_this->sampleRate);
|
||||||
if (_this->selectedSerStr != "") {
|
if (_this->selectedSerStr != "") {
|
||||||
config.aquire();
|
config.aquire();
|
||||||
config.conf["device"] = _this->selectedSerStr;
|
config.conf["device"] = _this->selectedSerStr;
|
||||||
@ -286,6 +290,7 @@ private:
|
|||||||
std::string devSerial = config.conf["device"];
|
std::string devSerial = config.conf["device"];
|
||||||
config.release();
|
config.release();
|
||||||
_this->selectByString(devSerial);
|
_this->selectByString(devSerial);
|
||||||
|
core::setInputSampleRate(_this->sampleRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_this->running) { style::endDisabled(); }
|
if (_this->running) { style::endDisabled(); }
|
||||||
|
Loading…
Reference in New Issue
Block a user