mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-13 23:51:46 -05:00
LABEL: first attempt, <user_label> is read from session XML, apparently also saved.
This commit is contained in:
parent
02034a8817
commit
00e241a784
@ -1561,6 +1561,7 @@ void AppFrame::saveSession(std::string fileName) {
|
||||
*demod->newChild("bandwidth") = (*instance_i)->getBandwidth();
|
||||
*demod->newChild("frequency") = (*instance_i)->getFrequency();
|
||||
*demod->newChild("type") = (*instance_i)->getDemodulatorType();
|
||||
*demod->newChild("user_label") = (*instance_i)->getDemodulatorUserLabel();
|
||||
*demod->newChild("squelch_level") = (*instance_i)->getSquelchLevel();
|
||||
*demod->newChild("squelch_enabled") = (*instance_i)->isSquelchEnabled() ? 1 : 0;
|
||||
*demod->newChild("output_device") = outputDevices[(*instance_i)->getOutputDevice()].name;
|
||||
@ -1659,6 +1660,7 @@ bool AppFrame::loadSession(std::string fileName) {
|
||||
float gain = demod->hasAnother("gain") ? (float) *demod->getNext("gain") : 1.0;
|
||||
|
||||
std::string type = "FM";
|
||||
|
||||
|
||||
DataNode *demodTypeNode = demod->hasAnother("type")?demod->getNext("type"):nullptr;
|
||||
|
||||
@ -1688,6 +1690,16 @@ bool AppFrame::loadSession(std::string fileName) {
|
||||
demodTypeNode->element()->get(type);
|
||||
}
|
||||
|
||||
//read the user label associated with the demodulator
|
||||
//manage other languages than English if you please...
|
||||
std::string user_label = "";
|
||||
|
||||
DataNode *demodUserLabel = demod->hasAnother("user_label") ? demod->getNext("user_label") : nullptr;
|
||||
|
||||
if (demodUserLabel && demodUserLabel->element()->getDataType() == DATA_STRING) {
|
||||
demodUserLabel->element()->get(user_label);
|
||||
}
|
||||
|
||||
ModemSettings mSettings;
|
||||
|
||||
if (demod->hasAnother("settings")) {
|
||||
@ -1702,6 +1714,8 @@ bool AppFrame::loadSession(std::string fileName) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
newDemod = wxGetApp().getDemodMgr().newThread();
|
||||
|
||||
@ -1711,6 +1725,7 @@ bool AppFrame::loadSession(std::string fileName) {
|
||||
|
||||
numDemodulators++;
|
||||
newDemod->setDemodulatorType(type);
|
||||
newDemod->setDemodulatorUserLabel(user_label);
|
||||
newDemod->writeModemSettings(mSettings);
|
||||
newDemod->setBandwidth(bandwidth);
|
||||
newDemod->setFrequency(freq);
|
||||
|
@ -30,8 +30,7 @@ void DemodVisualCue::step() {
|
||||
}
|
||||
}
|
||||
|
||||
DemodulatorInstance::DemodulatorInstance() :
|
||||
t_PreDemod(nullptr), t_Demod(nullptr), t_Audio(nullptr) {
|
||||
DemodulatorInstance::DemodulatorInstance() {
|
||||
|
||||
#if ENABLE_DIGITAL_LAB
|
||||
activeOutput = nullptr;
|
||||
@ -50,7 +49,9 @@ DemodulatorInstance::DemodulatorInstance() :
|
||||
follow.store(false);
|
||||
tracking.store(false);
|
||||
|
||||
label = new std::string("Unnamed");
|
||||
label.store(new std::string("Unnamed"));
|
||||
user_label.store(new std::string());
|
||||
|
||||
pipeIQInputData = new DemodulatorThreadInputQueue;
|
||||
pipeIQDemodData = new DemodulatorThreadPostInputQueue;
|
||||
pipeDemodNotify = new DemodulatorThreadCommandQueue;
|
||||
@ -149,12 +150,8 @@ std::string DemodulatorInstance::getLabel() {
|
||||
}
|
||||
|
||||
void DemodulatorInstance::setLabel(std::string labelStr) {
|
||||
std::string *newLabel = new std::string;
|
||||
newLabel->append(labelStr);
|
||||
std::string *oldLabel;
|
||||
oldLabel = label;
|
||||
label = newLabel;
|
||||
delete oldLabel;
|
||||
|
||||
delete label.exchange(new std::string(labelStr));
|
||||
}
|
||||
|
||||
bool DemodulatorInstance::isTerminated() {
|
||||
@ -330,6 +327,15 @@ std::string DemodulatorInstance::getDemodulatorType() {
|
||||
return demodulatorPreThread->getDemodType();
|
||||
}
|
||||
|
||||
std::string DemodulatorInstance::getDemodulatorUserLabel() {
|
||||
return *(user_label.load());
|
||||
}
|
||||
|
||||
void DemodulatorInstance::setDemodulatorUserLabel(const std::string& demod_user_label) {
|
||||
|
||||
delete user_label.exchange(new std::string(demod_user_label));
|
||||
}
|
||||
|
||||
void DemodulatorInstance::setDemodulatorLock(bool demod_lock_in) {
|
||||
Modem *cModem = demodulatorPreThread->getModem();
|
||||
if (cModem && cModem->getType() == "digital") {
|
||||
|
@ -35,12 +35,12 @@ public:
|
||||
pthread_t t_PreDemod;
|
||||
pthread_t t_Demod;
|
||||
#else
|
||||
std::thread *t_PreDemod;
|
||||
std::thread *t_Demod;
|
||||
std::thread *t_PreDemod = nullptr;
|
||||
std::thread *t_Demod = nullptr;
|
||||
#endif
|
||||
|
||||
AudioThread *audioThread;
|
||||
std::thread *t_Audio;
|
||||
AudioThread *audioThread = nullptr;
|
||||
std::thread *t_Audio = nullptr;
|
||||
|
||||
DemodulatorInstance();
|
||||
~DemodulatorInstance();
|
||||
@ -73,7 +73,10 @@ public:
|
||||
|
||||
void setDemodulatorType(std::string demod_type_in);
|
||||
std::string getDemodulatorType();
|
||||
|
||||
|
||||
std::string getDemodulatorUserLabel();
|
||||
void setDemodulatorUserLabel(const std::string& demod_user_label);
|
||||
|
||||
void setDemodulatorLock(bool demod_lock_in);
|
||||
int getDemodulatorLock();
|
||||
|
||||
@ -136,6 +139,7 @@ protected:
|
||||
private:
|
||||
|
||||
std::atomic<std::string *> label; //
|
||||
std::atomic<std::string *> user_label; //
|
||||
std::atomic_bool terminated; //
|
||||
std::atomic_bool demodTerminated; //
|
||||
std::atomic_bool audioTerminated; //
|
||||
|
@ -91,7 +91,7 @@ public:
|
||||
void doCacheGC();
|
||||
private:
|
||||
std::map<std::string, GLFontStringCache * > stringCache;
|
||||
|
||||
|
||||
std::string nextParam(std::istringstream &str);
|
||||
std::string getParamKey(std::string param_str);
|
||||
std::string getParamValue(std::string param_str);
|
||||
|
@ -351,10 +351,9 @@ void PrimaryGLContext::DrawDemod(DemodulatorInstance *demod, RGBA4f color, long
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
std::string demodStr = "";
|
||||
GLFont::Align demodAlign = GLFont::GLFONT_ALIGN_CENTER;
|
||||
|
||||
demodStr = demod->getDemodulatorType();
|
||||
std::string demodStr = demod->getDemodulatorType();
|
||||
|
||||
demodAlign = GLFont::GLFONT_ALIGN_CENTER;
|
||||
|
||||
@ -373,22 +372,42 @@ void PrimaryGLContext::DrawDemod(DemodulatorInstance *demod, RGBA4f color, long
|
||||
|
||||
// add lock to string if we have an lock
|
||||
if(demod->getDemodulatorLock()) {
|
||||
demodStr = demodStr + " Lock";
|
||||
}
|
||||
demodStr += " Lock";
|
||||
}
|
||||
|
||||
// else {
|
||||
// demodStr = demodStr + " UnLock";
|
||||
// }
|
||||
|
||||
glColor3f(0, 0, 0);
|
||||
GLFont::getFont(GLFont::GLFONT_SIZE16).drawString(demodStr, 2.0 * (uxPos - 0.5) + xOfs, -1.0 + hPos - yOfs, 16, demodAlign,
|
||||
GLFont::GLFONT_ALIGN_CENTER, 0, 0, true);
|
||||
glColor3f(1, 1, 1);
|
||||
GLFont::getFont(GLFont::GLFONT_SIZE16).drawString(demodStr, 2.0 * (uxPos - 0.5), -1.0 + hPos, 16, demodAlign, GLFont::GLFONT_ALIGN_CENTER, 0, 0, true);
|
||||
//demodulator user label if present: type is displayed above the label, which is at the bottom of the screen.
|
||||
if (!demod->getDemodulatorUserLabel().empty()) {
|
||||
hPos += 2 * labelHeight;
|
||||
}
|
||||
|
||||
drawSingleDemodLabel(demodStr, uxPos, hPos, xOfs, yOfs, GLFont::GLFONT_ALIGN_CENTER);
|
||||
|
||||
//revert...
|
||||
if (!demod->getDemodulatorUserLabel().empty()) {
|
||||
hPos -= 2 * labelHeight;
|
||||
drawSingleDemodLabel(demod->getDemodulatorUserLabel(), uxPos, hPos, xOfs, yOfs, GLFont::GLFONT_ALIGN_CENTER);
|
||||
}
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
|
||||
}
|
||||
|
||||
void PrimaryGLContext::drawSingleDemodLabel(std::string demodStr, float uxPos, float hPos, float xOfs, float yOfs, GLFont::Align demodAlign) {
|
||||
|
||||
glColor3f(0, 0, 0);
|
||||
GLFont::getFont(GLFont::GLFONT_SIZE16).drawString(demodStr, 2.0 * (uxPos - 0.5) + xOfs,
|
||||
-1.0 + hPos - yOfs, 16, demodAlign,
|
||||
GLFont::GLFONT_ALIGN_CENTER, 0, 0, true);
|
||||
glColor3f(1, 1, 1);
|
||||
GLFont::getFont(GLFont::GLFONT_SIZE16).drawString(demodStr, 2.0 * (uxPos - 0.5),
|
||||
-1.0 + hPos, 16, demodAlign,
|
||||
GLFont::GLFONT_ALIGN_CENTER, 0, 0, true);
|
||||
}
|
||||
|
||||
void PrimaryGLContext::DrawFreqSelector(float uxPos, RGBA4f color, float w, long long /* center_freq */, long long srate) {
|
||||
DemodulatorInstance *demod = wxGetApp().getDemodMgr().getLastActiveDemodulator();
|
||||
|
||||
|
@ -24,6 +24,7 @@ public:
|
||||
void DrawFreqSelector(float uxPos, RGBA4f color, float w = 0, long long center_freq = -1, long long srate = 0);
|
||||
void DrawRangeSelector(float uxPos1, float uxPos2, RGBA4f color);
|
||||
void DrawDemod(DemodulatorInstance *demod, RGBA4f color, long long center_freq = -1, long long srate = 0);
|
||||
|
||||
void DrawDemodInfo(DemodulatorInstance *demod, RGBA4f color, long long center_freq = -1, long long srate = 0, bool centerline = false);
|
||||
void DrawFreqBwInfo(long long freq, int bw, RGBA4f color, long long center_freq = - 1, long long srate = 0, bool stack = false, bool centerline = false);
|
||||
|
||||
@ -31,4 +32,5 @@ public:
|
||||
|
||||
private:
|
||||
float hoverAlpha;
|
||||
void drawSingleDemodLabel(std::string demodStr, float uxPos, float hPos, float xOfs, float yOfs, GLFont::Align demodAlign);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user