Added sample rates for RTL-SDR

This commit is contained in:
Ryzerth 2021-02-15 14:55:48 +01:00
parent b4d06697b4
commit 8f9fdd8b70
2 changed files with 12 additions and 6 deletions

View File

@ -30,6 +30,7 @@ const double sampleRates[] = {
1920000,
2048000,
2160000,
2400000,
2560000,
2880000,
3200000
@ -43,6 +44,7 @@ const char* sampleRatesTxt[] = {
"1.92MHz",
"2.048MHz",
"2.16MHz",
"2.4MHz",
"2.56MHz",
"2.88MHz",
"3.2MHz"
@ -68,7 +70,7 @@ public:
strcpy(dbTxt, "--");
for (int i = 0; i < 10; i++) {
for (int i = 0; i < 11; i++) {
sampleRateListTxt += sampleRatesTxt[i];
sampleRateListTxt += '\0';
}
@ -169,7 +171,7 @@ public:
// Load config
if (config.conf["devices"][selectedDevName].contains("sampleRate")) {
int selectedSr = config.conf["devices"][selectedDevName]["sampleRate"];
for (int i = 0; i < 10; i++) {
for (int i = 0; i < 11; i++) {
if (sampleRates[i] == selectedSr) {
srId = i;
sampleRate = selectedSr;
@ -241,6 +243,8 @@ private:
return;
}
spdlog::info("RTL-SDR Sample Rate: {0}", _this->sampleRate);
rtlsdr_set_sample_rate(_this->openDev, _this->sampleRate);
rtlsdr_set_center_freq(_this->openDev, _this->freq);
rtlsdr_set_tuner_bandwidth(_this->openDev, 0);

View File

@ -241,6 +241,8 @@ private:
}
if (_this->running) { style::endDisabled(); }
if (_this->deviceOpen) {
switch (_this->openDev.hwVer) {
case SDRPLAY_RSP1_ID:
@ -265,9 +267,7 @@ private:
}
else {
ImGui::TextColored(ImVec4(1.0f, 0.0f, 0.0f, 1.0f), "No device available");
}
if (_this->running) { style::endDisabled(); }
}
}
void RSP1Menu(float menuWidth) {
@ -275,7 +275,7 @@ private:
}
void RSP1AMenu(float menuWidth) {
ImGui::TextColored(ImVec4(1.0f, 0.0f, 0.0f, 1.0f), "Device currently unsupported");
}
void RSP2Menu(float menuWidth) {
@ -327,6 +327,8 @@ private:
int devId = 0;
int srId = 0;
int gainTest = 0;
std::vector<sdrplay_api_DeviceT> devList;
std::string devListTxt;
std::vector<uint32_t> sampleRateList;