more stuff

This commit is contained in:
Ryzerth 2021-04-22 05:58:20 +02:00
parent a4c25280b3
commit 89e805b1a0
3 changed files with 23 additions and 20 deletions

View File

@ -75,24 +75,24 @@ private:
void updatePresence() { void updatePresence() {
double selectedFreq = gui::freqSelect.frequency; double selectedFreq = gui::freqSelect.frequency;
std::string selectedName = gui::waterfall.selectedVFO; std::string selectedName = gui::waterfall.selectedVFO;
if (selectedFreq != lastFreq) { strcpy(mode, "Raw");
lastFreq = selectedFreq; if (core::modComManager.interfaceExists(selectedName)) {
if (core::modComManager.getModuleName(selectedName) == "radio") {
strcpy(mode, "Raw"); int modeNum;
core::modComManager.callInterface(selectedName, RADIO_IFACE_CMD_GET_MODE, NULL, &modeNum);
if (core::modComManager.interfaceExists(selectedName)) { if (modeNum == RADIO_IFACE_MODE_NFM) { strcpy(mode, "NFM"); }
if (core::modComManager.getModuleName(selectedName) == "radio") { else if (modeNum == RADIO_IFACE_MODE_WFM) { strcpy(mode, "FM"); }
int modeNum; else if (modeNum == RADIO_IFACE_MODE_AM) { strcpy(mode, "AM"); }
core::modComManager.callInterface(selectedName, RADIO_IFACE_CMD_GET_MODE, NULL, &modeNum); else if (modeNum == RADIO_IFACE_MODE_DSB) { strcpy(mode, "DSB"); }
if (modeNum == RADIO_IFACE_MODE_NFM) { strcpy(mode, "NFM"); } else if (modeNum == RADIO_IFACE_MODE_USB) { strcpy(mode, "USB"); }
else if (modeNum == RADIO_IFACE_MODE_WFM) { strcpy(mode, "FM"); } else if (modeNum == RADIO_IFACE_MODE_CW) { strcpy(mode, "CW"); }
else if (modeNum == RADIO_IFACE_MODE_AM) { strcpy(mode, "AM"); } else if (modeNum == RADIO_IFACE_MODE_LSB) { strcpy(mode, "LSB"); }
else if (modeNum == RADIO_IFACE_MODE_DSB) { strcpy(mode, "DSB"); }
else if (modeNum == RADIO_IFACE_MODE_USB) { strcpy(mode, "USB"); }
else if (modeNum == RADIO_IFACE_MODE_CW) { strcpy(mode, "CW"); }
else if (modeNum == RADIO_IFACE_MODE_LSB) { strcpy(mode, "LSB"); }
}
} }
}
if (selectedFreq != lastFreq || mode != lastMode) {
lastFreq = selectedFreq;
lastMode = mode;
// Print out frequency to buffer // Print out frequency to buffer
if (selectedFreq >= 1000000.0) { if (selectedFreq >= 1000000.0) {
@ -134,6 +134,7 @@ private:
double lastFreq; double lastFreq;
char* freq = new char[1024]; char* freq = new char[1024];
char* mode = new char[1024]; char* mode = new char[1024];
std::string lastMode = "";
// Threading // Threading
int workerCounter = 0; int workerCounter = 0;

View File

@ -71,7 +71,8 @@ public:
} }
void enable() { void enable() {
vfo = sigpath::vfoManager.createVFO(name, ImGui::WaterfallVFO::REF_CENTER, 0, 150000, INPUT_SAMPLE_RATE, 150000, 150000, true); double bw = gui::waterfall.getBandwidth();
vfo = sigpath::vfoManager.createVFO(name, ImGui::WaterfallVFO::REF_CENTER, std::clamp<double>(savedOffset, -bw/2.0, bw/2.0), 150000, INPUT_SAMPLE_RATE, 150000, 150000, true);
demod.setInput(vfo->output); demod.setInput(vfo->output);
@ -91,6 +92,7 @@ public:
symSink.stop(); symSink.stop();
sink.stop(); sink.stop();
savedOffset = vfo->getOffset();
sigpath::vfoManager.deleteVFO(vfo); sigpath::vfoManager.deleteVFO(vfo);
enabled = false; enabled = false;
} }
@ -167,7 +169,7 @@ private:
std::string name; std::string name;
bool enabled = true; bool enabled = true;
double savedOffset = 0;
// DSP Chain // DSP Chain

View File

@ -194,7 +194,7 @@ private:
bool enabled = true; bool enabled = true;
int demodId = 0; int demodId = 0;
float audioSampRate = 48000; float audioSampRate = 48000;
double savedOffset; double savedOffset = 0;
Demodulator* currentDemod = NULL; Demodulator* currentDemod = NULL;
VFOManager::VFO* vfo; VFOManager::VFO* vfo;