mirror of
				https://github.com/AlexandreRouma/SDRPlusPlus.git
				synced 2025-10-29 16:08:10 +01:00 
			
		
		
		
	Added start/stop commands to the rigctl server
This commit is contained in:
		| @@ -362,21 +362,14 @@ void MainWindow::draw() { | ||||
|     if (playing) { | ||||
|         ImGui::PushID(ImGui::GetID("sdrpp_stop_btn")); | ||||
|         if (ImGui::ImageButton(icons::STOP, ImVec2(30, 30), ImVec2(0, 0), ImVec2(1, 1), 5) || ImGui::IsKeyPressed(GLFW_KEY_END, false)) { | ||||
|             playing = false; | ||||
|             onPlayStateChange.emit(false); | ||||
|             sigpath::sourceManager.stop(); | ||||
|             sigpath::signalPath.inputBuffer.flush(); | ||||
|             setPlayState(false); | ||||
|         } | ||||
|         ImGui::PopID(); | ||||
|     } | ||||
|     else { // TODO: Might need to check if there even is a device | ||||
|         ImGui::PushID(ImGui::GetID("sdrpp_play_btn")); | ||||
|         if (ImGui::ImageButton(icons::PLAY, ImVec2(30, 30), ImVec2(0, 0), ImVec2(1, 1), 5) || ImGui::IsKeyPressed(GLFW_KEY_END, false)) { | ||||
|             sigpath::signalPath.inputBuffer.flush(); | ||||
|             sigpath::sourceManager.start(); | ||||
|             sigpath::sourceManager.tune(gui::waterfall.getCenterFrequency()); | ||||
|             playing = true; | ||||
|             onPlayStateChange.emit(true); | ||||
|             setPlayState(true); | ||||
|         } | ||||
|         ImGui::PopID(); | ||||
|     } | ||||
| @@ -659,6 +652,23 @@ void MainWindow::draw() { | ||||
|     } | ||||
| } | ||||
|  | ||||
| void MainWindow::setPlayState(bool _playing) { | ||||
|     if (_playing == playing) { return; } | ||||
|     if (_playing) { | ||||
|         sigpath::signalPath.inputBuffer.flush(); | ||||
|         sigpath::sourceManager.start(); | ||||
|         sigpath::sourceManager.tune(gui::waterfall.getCenterFrequency()); | ||||
|         playing = true; | ||||
|         onPlayStateChange.emit(true); | ||||
|     } | ||||
|     else { | ||||
|         playing = false; | ||||
|         onPlayStateChange.emit(false); | ||||
|         sigpath::sourceManager.stop(); | ||||
|         sigpath::signalPath.inputBuffer.flush(); | ||||
|     } | ||||
| } | ||||
|  | ||||
| void MainWindow::setViewBandwidthSlider(float bandwidth) { | ||||
|     bw = bandwidth; | ||||
| } | ||||
|   | ||||
| @@ -23,6 +23,7 @@ public: | ||||
|     // TODO: Replace with it's own class  | ||||
|     void setVFO(double freq); | ||||
|  | ||||
|     void setPlayState(bool _playing); | ||||
|     bool isPlaying(); | ||||
|  | ||||
|     bool lockWaterfallControls = false; | ||||
|   | ||||
| @@ -613,6 +613,12 @@ private: | ||||
|         else if (parts[0] == "q" || parts[0] == "\\quit") { | ||||
|             // Will close automatically | ||||
|         } | ||||
|         else if (parts[0] == "\\start") { | ||||
|             gui::mainWindow.setPlayState(true); | ||||
|         } | ||||
|         else if (parts[0] == "\\stop") { | ||||
|             gui::mainWindow.setPlayState(false); | ||||
|         } | ||||
|         else if (parts[0] == "\\dump_state") { | ||||
|             std::lock_guard lck(vfoMtx); | ||||
|             resp = | ||||
|   | ||||
		Reference in New Issue
	
	Block a user