mirror of
				https://github.com/AlexandreRouma/SDRPlusPlus.git
				synced 2025-10-31 08:58:13 +01:00 
			
		
		
		
	fix source/samplerate selection bugs
This commit is contained in:
		| @@ -152,7 +152,6 @@ public: | ||||
|  | ||||
|         // Update samplerate from ID | ||||
|         sampleRate = sampleRates[srId]; | ||||
|         core::setInputSampleRate(sampleRate); | ||||
|     } | ||||
|  | ||||
| private: | ||||
| @@ -232,6 +231,7 @@ private: | ||||
|         if (SmGui::Combo(CONCAT("##_audio_dev_sel_", _this->name), &_this->devId, _this->devices.txt)) { | ||||
|             std::string dev = _this->devices.key(_this->devId); | ||||
|             _this->select(dev); | ||||
|             core::setInputSampleRate(_this->sampleRate); | ||||
|             config.acquire(); | ||||
|             config.conf["device"] = dev; | ||||
|             config.release(true); | ||||
| @@ -253,6 +253,7 @@ private: | ||||
|         if (SmGui::Button(CONCAT("Refresh##_audio_refr_", _this->name))) { | ||||
|             _this->refresh(); | ||||
|             _this->select(_this->selectedDevice); | ||||
|             core::setInputSampleRate(_this->sampleRate); | ||||
|         } | ||||
|  | ||||
|         if (_this->running) { SmGui::EndDisabled(); } | ||||
|   | ||||
| @@ -304,6 +304,7 @@ private: | ||||
|         SmGui::ForceSync(); | ||||
|         if (SmGui::Combo(CONCAT("##_hackrf_dev_sel_", _this->name), &_this->devId, _this->devListTxt.c_str())) { | ||||
|             _this->selectBySerial(_this->devList[_this->devId]); | ||||
|             core::setInputSampleRate(_this->sampleRate); | ||||
|             config.acquire(); | ||||
|             config.conf["device"] = _this->selectedSerial; | ||||
|             config.release(true); | ||||
|   | ||||
| @@ -118,7 +118,6 @@ private: | ||||
|  | ||||
|         // Update host samplerate | ||||
|         sampleRate = samplerates.key(srId); | ||||
|         core::setInputSampleRate(sampleRate); | ||||
|     } | ||||
|  | ||||
|     static void menuSelected(void* ctx) { | ||||
| @@ -199,6 +198,7 @@ private: | ||||
|         SmGui::ForceSync(); | ||||
|         if (SmGui::Combo(CONCAT("##_hermes_dev_sel_", _this->name), &_this->devId, _this->devices.txt)) { | ||||
|             _this->selectMac(_this->devices.key(_this->devId)); | ||||
|             core::setInputSampleRate(_this->sampleRate); | ||||
|             if (!_this->selectedMac.empty()) { | ||||
|                 config.acquire(); | ||||
|                 config.conf["device"] = _this->devices.key(_this->devId); | ||||
| @@ -225,6 +225,7 @@ private: | ||||
|             std::string mac = config.conf["device"]; | ||||
|             config.release(); | ||||
|             _this->selectMac(mac); | ||||
|             core::setInputSampleRate(_this->sampleRate); | ||||
|         } | ||||
|  | ||||
|         if (_this->running) { SmGui::EndDisabled(); } | ||||
|   | ||||
| @@ -210,7 +210,6 @@ public: | ||||
|  | ||||
|         // Update samplerate | ||||
|         sampleRate = srList[srId]; | ||||
|         core::setInputSampleRate(sampleRate); | ||||
|  | ||||
|         // Close device | ||||
|         perseus_close(dev); | ||||
| @@ -329,6 +328,7 @@ private: | ||||
|         if (SmGui::Combo(CONCAT("##_airspyhf_dev_sel_", _this->name), &_this->devId, _this->devList.txt)) { | ||||
|             std::string serial = _this->devList.key(_this->devId); | ||||
|             _this->select(serial); | ||||
|             core::setInputSampleRate(_this->sampleRate); | ||||
|             config.acquire(); | ||||
|             config.conf["device"] = serial; | ||||
|             config.release(true); | ||||
|   | ||||
| @@ -244,9 +244,6 @@ private: | ||||
|             bwId = 0; | ||||
|             bandwidth = bandwidths.value(bwId); | ||||
|         } | ||||
|          | ||||
|         // Update core samplerate | ||||
|         core::setInputSampleRate(samplerate); | ||||
|     } | ||||
|  | ||||
|     static void menuSelected(void* ctx) { | ||||
| @@ -351,6 +348,7 @@ private: | ||||
|         SmGui::ForceSync(); | ||||
|         if (SmGui::Combo("##plutosdr_dev_sel", &_this->devId, _this->devices.txt)) { | ||||
|             _this->select(_this->devices.key(_this->devId)); | ||||
|             core::setInputSampleRate(_this->samplerate); | ||||
|             config.acquire(); | ||||
|             config.conf["device"] = _this->devices.key(_this->devId); | ||||
|             config.release(true); | ||||
| @@ -373,7 +371,7 @@ private: | ||||
|         if (SmGui::Button(CONCAT("Refresh##_pluto_refr_", _this->name))) { | ||||
|             _this->refresh(); | ||||
|             _this->select(_this->devDesc); | ||||
|  | ||||
|             core::setInputSampleRate(_this->samplerate); | ||||
|         } | ||||
|         if (_this->running) { SmGui::EndDisabled(); } | ||||
|  | ||||
|   | ||||
| @@ -120,7 +120,6 @@ private: | ||||
|  | ||||
|         // Update samplerate | ||||
|         sampleRate = samplerates.key(srId); | ||||
|         core::setInputSampleRate(sampleRate); | ||||
|  | ||||
|         // Save serial number | ||||
|         selectedSerial = serial; | ||||
| @@ -226,6 +225,7 @@ private: | ||||
|         if (SmGui::Combo(CONCAT("##_rfnm_dev_sel_", _this->name), &_this->devId, _this->devices.txt)) { | ||||
|             // TODO: Select | ||||
|             // TODO: Save | ||||
|             core::setInputSampleRate(_this->sampleRate); | ||||
|         } | ||||
|  | ||||
|         if (SmGui::Combo(CONCAT("##_rfnm_sr_sel_", _this->name), &_this->srId, _this->samplerates.txt)) { | ||||
| @@ -240,6 +240,7 @@ private: | ||||
|         if (SmGui::Button(CONCAT("Refresh##_rfnm_refr_", _this->name))) { | ||||
|             _this->refresh(); | ||||
|             _this->select(_this->selectedSerial); | ||||
|             core::setInputSampleRate(_this->sampleRate); | ||||
|         } | ||||
|  | ||||
|         if (_this->running) { SmGui::EndDisabled(); } | ||||
|   | ||||
| @@ -411,8 +411,6 @@ public: | ||||
|             agcSetPoint = config.conf["devices"][selectedName]["agcSetPoint"]; | ||||
|         } | ||||
|  | ||||
|         core::setInputSampleRate(sampleRate); | ||||
|  | ||||
|         // Per device options | ||||
|         if (openDev.hwVer == SDRPLAY_RSP1_ID) { | ||||
|             // No config to load | ||||
| @@ -688,6 +686,7 @@ private: | ||||
|         SmGui::ForceSync(); | ||||
|         if (SmGui::Combo(CONCAT("##sdrplay_dev", _this->name), &_this->devId, _this->devListTxt.c_str())) { | ||||
|             _this->selectById(_this->devId); | ||||
|             core::setInputSampleRate(_this->sampleRate); | ||||
|             config.acquire(); | ||||
|             config.conf["device"] = _this->devNameList[_this->devId]; | ||||
|             config.release(true); | ||||
| @@ -711,6 +710,7 @@ private: | ||||
|             if (SmGui::Button(CONCAT("Refresh##sdrplay_refresh", _this->name))) { | ||||
|                 _this->refresh(); | ||||
|                 _this->selectByName(_this->selectedName); | ||||
|                 core::setInputSampleRate(_this->sampleRate); | ||||
|             } | ||||
|  | ||||
|             SmGui::LeftLabel("Bandwidth"); | ||||
|   | ||||
| @@ -194,7 +194,6 @@ public: | ||||
|  | ||||
|         // Set samplerate | ||||
|         samplerate = sampleRateList.value(srId); | ||||
|         core::setInputSampleRate(samplerate.effective); | ||||
|  | ||||
|         // Close device | ||||
|         AARTSAAPI_CloseDevice(&api, &dev); | ||||
| @@ -334,9 +333,10 @@ private: | ||||
|         SmGui::FillWidth(); | ||||
|         SmGui::ForceSync(); | ||||
|         if (SmGui::Combo(CONCAT("##_spectran_dev_", _this->name), &_this->devId, _this->devList.txt)) { | ||||
|              | ||||
|             _this->selectSerial(_this->devList.key(_this->devId)); | ||||
|             core::setInputSampleRate(_this->samplerate.effective); | ||||
|         } | ||||
|         // TODO: SR sel | ||||
|          | ||||
|         if (SmGui::Combo(CONCAT("##_spectran_sr_", _this->name), &_this->srId, _this->sampleRateList.txt)) { | ||||
|             _this->samplerate = _this->sampleRateList.value(_this->srId); | ||||
|             core::setInputSampleRate(_this->samplerate.effective); | ||||
|   | ||||
| @@ -211,7 +211,6 @@ public: | ||||
|  | ||||
|         // Apply samplerate | ||||
|         sampleRate = samplerates.key(srId); | ||||
|         core::setInputSampleRate(sampleRate); | ||||
|     } | ||||
|  | ||||
|     void setBandwidth(double bw) { | ||||
| @@ -335,6 +334,7 @@ private: | ||||
|         SmGui::ForceSync(); | ||||
|         if (SmGui::Combo(CONCAT("##_usrp_dev_sel_", _this->name), &_this->devId, _this->devices.txt)) { | ||||
|             _this->select(_this->devices.key(_this->devId)); | ||||
|             core::setInputSampleRate(_this->sampleRate); | ||||
|             if (!_this->selectedSer.empty()) { | ||||
|                 config.acquire(); | ||||
|                 config.conf["device"] = _this->devices.key(_this->devId); | ||||
| @@ -357,10 +357,8 @@ private: | ||||
|         SmGui::ForceSync(); | ||||
|         if (SmGui::Button(CONCAT("Refresh##_usrp_refr_", _this->name))) { | ||||
|             _this->refresh(); | ||||
|             config.acquire(); | ||||
|             std::string ser = config.conf["device"]; | ||||
|             config.release(); | ||||
|             _this->select(ser); | ||||
|             _this->select(_this->selectedSer); | ||||
|             core::setInputSampleRate(_this->sampleRate); | ||||
|         } | ||||
|  | ||||
|         if (_this->channels.size() > 1) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user