Skip to content

Commit 2f93c7a

Browse files
author
Ryzerth
committed
Fixed wrong sample rate at startup
1 parent 4abfe40 commit 2f93c7a

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

airspy_source/src/main.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,16 @@ class AirspySourceModule : public ModuleManager::Instance {
3838
handler.stream = &stream;
3939

4040
refresh();
41+
if (sampleRateList.size() > 0) {
42+
sampleRate = sampleRateList[0];
43+
}
4144

4245
// Select device from config
4346
config.aquire();
4447
std::string devSerial = config.conf["device"];
4548
config.release();
4649
selectByString(devSerial);
50+
core::setInputSampleRate(sampleRate);
4751

4852
sigpath::sourceManager.registerSource("Airspy", &handler);
4953
}
@@ -145,11 +149,13 @@ class AirspySourceModule : public ModuleManager::Instance {
145149

146150
// Load sample rate
147151
srId = 0;
152+
sampleRate = sampleRateList[0];
148153
if (config.conf["devices"][selectedSerStr].contains("sampleRate")) {
149154
int selectedSr = config.conf["devices"][selectedSerStr]["sampleRate"];
150155
for (int i = 0; i < sampleRateList.size(); i++) {
151156
if (sampleRateList[i] == selectedSr) {
152157
srId = i;
158+
sampleRate = selectedSr;
153159
break;
154160
}
155161
}
@@ -304,6 +310,7 @@ class AirspySourceModule : public ModuleManager::Instance {
304310
ImGui::SetNextItemWidth(menuWidth);
305311
if (ImGui::Combo(CONCAT("##_airspy_dev_sel_", _this->name), &_this->devId, _this->devListTxt.c_str())) {
306312
_this->selectBySerial(_this->devList[_this->devId]);
313+
core::setInputSampleRate(_this->sampleRate);
307314
if (_this->selectedSerStr != "") {
308315
config.aquire();
309316
config.conf["device"] = _this->selectedSerStr;
@@ -329,6 +336,7 @@ class AirspySourceModule : public ModuleManager::Instance {
329336
std::string devSerial = config.conf["device"];
330337
config.release();
331338
_this->selectByString(devSerial);
339+
core::setInputSampleRate(_this->sampleRate);
332340
}
333341

334342
if (_this->running) { style::endDisabled(); }

airspyhf_source/src/main.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class AirspyHFSourceModule : public ModuleManager::Instance {
4545
std::string devSerial = config.conf["device"];
4646
config.release();
4747
selectByString(devSerial);
48+
core::setInputSampleRate(sampleRate);
4849

4950
sigpath::sourceManager.registerSource("Airspy HF+", &handler);
5051
}
@@ -146,11 +147,13 @@ class AirspyHFSourceModule : public ModuleManager::Instance {
146147

147148
// Load sample rate
148149
srId = 0;
150+
sampleRate = sampleRateList[0];
149151
if (config.conf["devices"][selectedSerStr].contains("sampleRate")) {
150152
int selectedSr = config.conf["devices"][selectedSerStr]["sampleRate"];
151153
for (int i = 0; i < sampleRateList.size(); i++) {
152154
if (sampleRateList[i] == selectedSr) {
153155
srId = i;
156+
sampleRate = selectedSr;
154157
break;
155158
}
156159
}
@@ -261,6 +264,7 @@ class AirspyHFSourceModule : public ModuleManager::Instance {
261264
ImGui::SetNextItemWidth(menuWidth);
262265
if (ImGui::Combo(CONCAT("##_airspyhf_dev_sel_", _this->name), &_this->devId, _this->devListTxt.c_str())) {
263266
_this->selectBySerial(_this->devList[_this->devId]);
267+
core::setInputSampleRate(_this->sampleRate);
264268
if (_this->selectedSerStr != "") {
265269
config.aquire();
266270
config.conf["device"] = _this->selectedSerStr;
@@ -286,6 +290,7 @@ class AirspyHFSourceModule : public ModuleManager::Instance {
286290
std::string devSerial = config.conf["device"];
287291
config.release();
288292
_this->selectByString(devSerial);
293+
core::setInputSampleRate(_this->sampleRate);
289294
}
290295

291296
if (_this->running) { style::endDisabled(); }

0 commit comments

Comments
 (0)