mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2025-09-04 22:27:49 -04: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("bandwidth") = (*instance_i)->getBandwidth();
|
||||||
*demod->newChild("frequency") = (*instance_i)->getFrequency();
|
*demod->newChild("frequency") = (*instance_i)->getFrequency();
|
||||||
*demod->newChild("type") = (*instance_i)->getDemodulatorType();
|
*demod->newChild("type") = (*instance_i)->getDemodulatorType();
|
||||||
|
*demod->newChild("user_label") = (*instance_i)->getDemodulatorUserLabel();
|
||||||
*demod->newChild("squelch_level") = (*instance_i)->getSquelchLevel();
|
*demod->newChild("squelch_level") = (*instance_i)->getSquelchLevel();
|
||||||
*demod->newChild("squelch_enabled") = (*instance_i)->isSquelchEnabled() ? 1 : 0;
|
*demod->newChild("squelch_enabled") = (*instance_i)->isSquelchEnabled() ? 1 : 0;
|
||||||
*demod->newChild("output_device") = outputDevices[(*instance_i)->getOutputDevice()].name;
|
*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;
|
float gain = demod->hasAnother("gain") ? (float) *demod->getNext("gain") : 1.0;
|
||||||
|
|
||||||
std::string type = "FM";
|
std::string type = "FM";
|
||||||
|
|
||||||
|
|
||||||
DataNode *demodTypeNode = demod->hasAnother("type")?demod->getNext("type"):nullptr;
|
DataNode *demodTypeNode = demod->hasAnother("type")?demod->getNext("type"):nullptr;
|
||||||
|
|
||||||
@ -1688,6 +1690,16 @@ bool AppFrame::loadSession(std::string fileName) {
|
|||||||
demodTypeNode->element()->get(type);
|
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;
|
ModemSettings mSettings;
|
||||||
|
|
||||||
if (demod->hasAnother("settings")) {
|
if (demod->hasAnother("settings")) {
|
||||||
@ -1702,6 +1714,8 @@ bool AppFrame::loadSession(std::string fileName) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
newDemod = wxGetApp().getDemodMgr().newThread();
|
newDemod = wxGetApp().getDemodMgr().newThread();
|
||||||
|
|
||||||
@ -1711,6 +1725,7 @@ bool AppFrame::loadSession(std::string fileName) {
|
|||||||
|
|
||||||
numDemodulators++;
|
numDemodulators++;
|
||||||
newDemod->setDemodulatorType(type);
|
newDemod->setDemodulatorType(type);
|
||||||
|
newDemod->setDemodulatorUserLabel(user_label);
|
||||||
newDemod->writeModemSettings(mSettings);
|
newDemod->writeModemSettings(mSettings);
|
||||||
newDemod->setBandwidth(bandwidth);
|
newDemod->setBandwidth(bandwidth);
|
||||||
newDemod->setFrequency(freq);
|
newDemod->setFrequency(freq);
|
||||||
|
@ -30,8 +30,7 @@ void DemodVisualCue::step() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DemodulatorInstance::DemodulatorInstance() :
|
DemodulatorInstance::DemodulatorInstance() {
|
||||||
t_PreDemod(nullptr), t_Demod(nullptr), t_Audio(nullptr) {
|
|
||||||
|
|
||||||
#if ENABLE_DIGITAL_LAB
|
#if ENABLE_DIGITAL_LAB
|
||||||
activeOutput = nullptr;
|
activeOutput = nullptr;
|
||||||
@ -50,7 +49,9 @@ DemodulatorInstance::DemodulatorInstance() :
|
|||||||
follow.store(false);
|
follow.store(false);
|
||||||
tracking.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;
|
pipeIQInputData = new DemodulatorThreadInputQueue;
|
||||||
pipeIQDemodData = new DemodulatorThreadPostInputQueue;
|
pipeIQDemodData = new DemodulatorThreadPostInputQueue;
|
||||||
pipeDemodNotify = new DemodulatorThreadCommandQueue;
|
pipeDemodNotify = new DemodulatorThreadCommandQueue;
|
||||||
@ -149,12 +150,8 @@ std::string DemodulatorInstance::getLabel() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DemodulatorInstance::setLabel(std::string labelStr) {
|
void DemodulatorInstance::setLabel(std::string labelStr) {
|
||||||
std::string *newLabel = new std::string;
|
|
||||||
newLabel->append(labelStr);
|
delete label.exchange(new std::string(labelStr));
|
||||||
std::string *oldLabel;
|
|
||||||
oldLabel = label;
|
|
||||||
label = newLabel;
|
|
||||||
delete oldLabel;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DemodulatorInstance::isTerminated() {
|
bool DemodulatorInstance::isTerminated() {
|
||||||
@ -330,6 +327,15 @@ std::string DemodulatorInstance::getDemodulatorType() {
|
|||||||
return demodulatorPreThread->getDemodType();
|
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) {
|
void DemodulatorInstance::setDemodulatorLock(bool demod_lock_in) {
|
||||||
Modem *cModem = demodulatorPreThread->getModem();
|
Modem *cModem = demodulatorPreThread->getModem();
|
||||||
if (cModem && cModem->getType() == "digital") {
|
if (cModem && cModem->getType() == "digital") {
|
||||||
|
@ -35,12 +35,12 @@ public:
|
|||||||
pthread_t t_PreDemod;
|
pthread_t t_PreDemod;
|
||||||
pthread_t t_Demod;
|
pthread_t t_Demod;
|
||||||
#else
|
#else
|
||||||
std::thread *t_PreDemod;
|
std::thread *t_PreDemod = nullptr;
|
||||||
std::thread *t_Demod;
|
std::thread *t_Demod = nullptr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
AudioThread *audioThread;
|
AudioThread *audioThread = nullptr;
|
||||||
std::thread *t_Audio;
|
std::thread *t_Audio = nullptr;
|
||||||
|
|
||||||
DemodulatorInstance();
|
DemodulatorInstance();
|
||||||
~DemodulatorInstance();
|
~DemodulatorInstance();
|
||||||
@ -73,7 +73,10 @@ public:
|
|||||||
|
|
||||||
void setDemodulatorType(std::string demod_type_in);
|
void setDemodulatorType(std::string demod_type_in);
|
||||||
std::string getDemodulatorType();
|
std::string getDemodulatorType();
|
||||||
|
|
||||||
|
std::string getDemodulatorUserLabel();
|
||||||
|
void setDemodulatorUserLabel(const std::string& demod_user_label);
|
||||||
|
|
||||||
void setDemodulatorLock(bool demod_lock_in);
|
void setDemodulatorLock(bool demod_lock_in);
|
||||||
int getDemodulatorLock();
|
int getDemodulatorLock();
|
||||||
|
|
||||||
@ -136,6 +139,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
std::atomic<std::string *> label; //
|
std::atomic<std::string *> label; //
|
||||||
|
std::atomic<std::string *> user_label; //
|
||||||
std::atomic_bool terminated; //
|
std::atomic_bool terminated; //
|
||||||
std::atomic_bool demodTerminated; //
|
std::atomic_bool demodTerminated; //
|
||||||
std::atomic_bool audioTerminated; //
|
std::atomic_bool audioTerminated; //
|
||||||
|
@ -91,7 +91,7 @@ public:
|
|||||||
void doCacheGC();
|
void doCacheGC();
|
||||||
private:
|
private:
|
||||||
std::map<std::string, GLFontStringCache * > stringCache;
|
std::map<std::string, GLFontStringCache * > stringCache;
|
||||||
|
|
||||||
std::string nextParam(std::istringstream &str);
|
std::string nextParam(std::istringstream &str);
|
||||||
std::string getParamKey(std::string param_str);
|
std::string getParamKey(std::string param_str);
|
||||||
std::string getParamValue(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);
|
glEnable(GL_BLEND);
|
||||||
|
|
||||||
std::string demodStr = "";
|
|
||||||
GLFont::Align demodAlign = GLFont::GLFONT_ALIGN_CENTER;
|
GLFont::Align demodAlign = GLFont::GLFONT_ALIGN_CENTER;
|
||||||
|
|
||||||
demodStr = demod->getDemodulatorType();
|
std::string demodStr = demod->getDemodulatorType();
|
||||||
|
|
||||||
demodAlign = GLFont::GLFONT_ALIGN_CENTER;
|
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
|
// add lock to string if we have an lock
|
||||||
if(demod->getDemodulatorLock()) {
|
if(demod->getDemodulatorLock()) {
|
||||||
demodStr = demodStr + " Lock";
|
demodStr += " Lock";
|
||||||
}
|
}
|
||||||
|
|
||||||
// else {
|
// else {
|
||||||
// demodStr = demodStr + " UnLock";
|
// demodStr = demodStr + " UnLock";
|
||||||
// }
|
// }
|
||||||
|
|
||||||
glColor3f(0, 0, 0);
|
//demodulator user label if present: type is displayed above the label, which is at the bottom of the screen.
|
||||||
GLFont::getFont(GLFont::GLFONT_SIZE16).drawString(demodStr, 2.0 * (uxPos - 0.5) + xOfs, -1.0 + hPos - yOfs, 16, demodAlign,
|
if (!demod->getDemodulatorUserLabel().empty()) {
|
||||||
GLFont::GLFONT_ALIGN_CENTER, 0, 0, true);
|
hPos += 2 * labelHeight;
|
||||||
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);
|
|
||||||
|
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);
|
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) {
|
void PrimaryGLContext::DrawFreqSelector(float uxPos, RGBA4f color, float w, long long /* center_freq */, long long srate) {
|
||||||
DemodulatorInstance *demod = wxGetApp().getDemodMgr().getLastActiveDemodulator();
|
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 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 DrawRangeSelector(float uxPos1, float uxPos2, RGBA4f color);
|
||||||
void DrawDemod(DemodulatorInstance *demod, RGBA4f color, long long center_freq = -1, long long srate = 0);
|
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 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);
|
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:
|
private:
|
||||||
float hoverAlpha;
|
float hoverAlpha;
|
||||||
|
void drawSingleDemodLabel(std::string demodStr, float uxPos, float hPos, float xOfs, float yOfs, GLFont::Align demodAlign);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user