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() {
double selectedFreq = gui::freqSelect.frequency;
std::string selectedName = gui::waterfall.selectedVFO;
if (selectedFreq != lastFreq) {
lastFreq = selectedFreq;
strcpy(mode, "Raw");
if (core::modComManager.interfaceExists(selectedName)) {
if (core::modComManager.getModuleName(selectedName) == "radio") {
int modeNum;
core::modComManager.callInterface(selectedName, RADIO_IFACE_CMD_GET_MODE, NULL, &modeNum);
if (modeNum == RADIO_IFACE_MODE_NFM) { strcpy(mode, "NFM"); }
else if (modeNum == RADIO_IFACE_MODE_WFM) { strcpy(mode, "FM"); }
else if (modeNum == RADIO_IFACE_MODE_AM) { strcpy(mode, "AM"); }
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"); }
}
strcpy(mode, "Raw");
if (core::modComManager.interfaceExists(selectedName)) {
if (core::modComManager.getModuleName(selectedName) == "radio") {
int modeNum;
core::modComManager.callInterface(selectedName, RADIO_IFACE_CMD_GET_MODE, NULL, &modeNum);
if (modeNum == RADIO_IFACE_MODE_NFM) { strcpy(mode, "NFM"); }
else if (modeNum == RADIO_IFACE_MODE_WFM) { strcpy(mode, "FM"); }
else if (modeNum == RADIO_IFACE_MODE_AM) { strcpy(mode, "AM"); }
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
if (selectedFreq >= 1000000.0) {
@ -134,6 +134,7 @@ private:
double lastFreq;
char* freq = new char[1024];
char* mode = new char[1024];
std::string lastMode = "";
// Threading
int workerCounter = 0;

View File

@ -71,7 +71,8 @@ public:
}
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);
@ -91,6 +92,7 @@ public:
symSink.stop();
sink.stop();
savedOffset = vfo->getOffset();
sigpath::vfoManager.deleteVFO(vfo);
enabled = false;
}
@ -167,7 +169,7 @@ private:
std::string name;
bool enabled = true;
double savedOffset = 0;
// DSP Chain

View File

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