diff --git a/configure.ac b/configure.ac index a467a799..d74f99d6 100644 --- a/configure.ac +++ b/configure.ac @@ -9,7 +9,7 @@ dnl major and minor must be integers; patch may dnl contain other characters or be empty m4_define(FLDIGI_MAJOR, [2]) m4_define(FLDIGI_MINOR, [11]) -m4_define(FLDIGI_PATCH, [AC]) +m4_define(FLDIGI_PATCH, [AD]) AC_INIT([fldigi], FLDIGI_MAJOR.FLDIGI_MINOR[FLDIGI_PATCH], [w1hkj AT w1hkj DOT com]) diff --git a/m4/pkg-config.m4 b/m4/pkg-config.m4 index 082b9a97..f4ca7ef6 100644 --- a/m4/pkg-config.m4 +++ b/m4/pkg-config.m4 @@ -11,7 +11,7 @@ m4_if([$3], [yes], esac], [ac_cv_want_[]$1=check]) ]) -m4_if([$4], [yes], [ac_cv_want_[]$1=check], [ac_cv_want_[]$1=yes]) +m4_if([$4], [no], [ac_cv_want_[]$1=yes]) if test "x$ac_cv_want_[]$1" = "xno"; then AC_DEFINE([USE_]PKG_NAME_UC, 0) diff --git a/src/dex/dex.cxx b/src/dex/dex.cxx index e14e1e96..00f89028 100644 --- a/src/dex/dex.cxx +++ b/src/dex/dex.cxx @@ -63,6 +63,7 @@ void dex::rx_init() met2 = 0.0; counter = 0; phase[0] = 0.0; + currmag = prev1mag = prev2mag = 0.0; for (int i = 0; i < DEXMAXFFTS; i++) phase[i+1] = 0.0; put_MODEstatus(mode); @@ -321,7 +322,29 @@ void dex::decodesymbol() c = (int)floor(fdiff + .5) - 2; if (c < 0) c += DEXNUMMTONES; - decodeEX(c); +// decodeEX(c); + + unsigned char symbols[4]; + double avg = (currmag + prev1mag + prev2mag) / 3.0; + if (avg == 0.0) avg = 1e-20; + double softmag = currmag / avg; + + for (int i = 0; i < 4; i++) { +// hard symbol decode + if (progdefaults.DEXsoft == false) { + if ((c & 1) == 1) symbols[3-i] = 255; + else symbols[3-i] = 1; +// soft symbol decode + } else + symbols[3-i] = (unsigned char)clamp(256.0 * (c & 1) * softmag, 1, 255); + + c = c / 2; + } + + Rxinlv->symbols(symbols); + + for (int i = 0; i < 4; i++) decodePairs(symbols[i]); + } int dex::harddecode() @@ -416,7 +439,8 @@ void dex::eval_s2n() } noise /= (paths * DEXNUMMTONES * 2 * (doublespaced?2:1) - 1); - s2n = decayavg( s2n, sig / noise, 8); + if (noise) + s2n = decayavg( s2n, sig / noise, 8); metric = 3*(20*log10(s2n) - 9.0); @@ -463,12 +487,15 @@ int dex::rx_process(const double *buf, int len) if (--synccounter <= 0) { synccounter = symlen; currsymbol = harddecode(); + currmag = pipe[pipeptr].vector[currsymbol].mag(); + eval_s2n(); decodesymbol(); synchronize(); update_syncscope(); - eval_s2n(); prev2symbol = prev1symbol; prev1symbol = currsymbol; + prev2mag = prev1mag; + prev1mag = currmag; } pipeptr++; if (pipeptr >= twosym) diff --git a/src/dialogs/confdialog.cxx b/src/dialogs/confdialog.cxx index cd38bedb..9af58bbc 100644 --- a/src/dialogs/confdialog.cxx +++ b/src/dialogs/confdialog.cxx @@ -916,6 +916,13 @@ static void cb_valDEX_PATHS(Fl_Counter* o, void*) { progdefaults.changed = true; } +Fl_Check_Button *valDEXSoft=(Fl_Check_Button *)0; + +static void cb_valDEXSoft(Fl_Check_Button* o, void*) { + progdefaults.DEXsoft = o->value(); +progdefaults.changed = true; +} + Fl_Group *tabDomEX=(Fl_Group *)0; Fl_Input *txtSecondary=(Fl_Input *)0; @@ -2096,7 +2103,6 @@ l with your sound hardware."); { tabDEX = new Fl_Group(0, 44, 400, 170, "Dex"); tabDEX->color((Fl_Color)51); tabDEX->selection_color((Fl_Color)51); - tabDEX->hide(); { txtDEXSecondary = new Fl_Input(20, 75, 360, 44, "Secondary Text"); txtDEXSecondary->type(4); txtDEXSecondary->callback((Fl_Callback*)cb_txtDEXSecondary); @@ -2127,6 +2133,11 @@ l with your sound hardware."); valDEX_PATHS->callback((Fl_Callback*)cb_valDEX_PATHS); o->value(progdefaults.DEX_PATHS); } // Fl_Counter* valDEX_PATHS + { Fl_Check_Button* o = valDEXSoft = new Fl_Check_Button(110, 177, 70, 15, "Soft decode"); + valDEXSoft->down_box(FL_DOWN_BOX); + valDEXSoft->callback((Fl_Callback*)cb_valDEXSoft); + o->value(progdefaults.DEXsoft); + } // Fl_Check_Button* valDEXSoft tabDEX->end(); } // Fl_Group* tabDEX { tabDomEX = new Fl_Group(0, 50, 400, 170, "Dom"); @@ -2173,6 +2184,7 @@ l with your sound hardware."); { tabFeld = new Fl_Group(0, 50, 400, 170, "Feld"); tabFeld->color((Fl_Color)51); tabFeld->selection_color((Fl_Color)51); + tabFeld->hide(); { Fl_Choice* o = selHellFont = new Fl_Choice(175, 62, 122, 20, "Feld Hell Font:"); selHellFont->down_box(FL_BORDER_BOX); selHellFont->labelfont(4); diff --git a/src/dialogs/confdialog.fl b/src/dialogs/confdialog.fl index 911bfb2d..a25a902f 100644 --- a/src/dialogs/confdialog.fl +++ b/src/dialogs/confdialog.fl @@ -1056,7 +1056,7 @@ progdefaults.changed = true;} } Fl_Group tabDEX { label Dex open - xywh {0 44 400 170} color 51 selection_color 51 hide + xywh {0 44 400 170} color 51 selection_color 51 } { Fl_Input txtDEXSecondary { label {Secondary Text} @@ -1087,6 +1087,13 @@ progdefaults.changed = true;} xywh {20 174 63 21} type Simple minimum 4 maximum 8 step 1 value 5 code0 {o->value(progdefaults.DEX_PATHS);} } + Fl_Check_Button valDEXSoft { + label {Soft decode} + callback {progdefaults.DEXsoft = o->value(); +progdefaults.changed = true;} selected + xywh {110 177 70 15} down_box DOWN_BOX + code0 {o->value(progdefaults.DEXsoft);} + } } Fl_Group tabDomEX { label Dom open @@ -1131,7 +1138,7 @@ progdefaults.changed = true;} } Fl_Group tabFeld { label Feld open - xywh {0 50 400 170} color 51 selection_color 51 + xywh {0 50 400 170} color 51 selection_color 51 hide } { Fl_Choice selHellFont { label {Feld Hell Font:} @@ -1144,7 +1151,7 @@ progdefaults.changed = true;} open } {} Fl_Value_Slider sldrHellBW { label {Filter BW} - callback {progdefaults.HELL_BW = sldrHellBW->value();} selected + callback {progdefaults.HELL_BW = sldrHellBW->value();} xywh {30 190 345 20} type Horizontal color 215 align 5 minimum 10 maximum 2400 step 5 value 400 textsize 14 code0 {o->value(progdefaults.HELL_BW);} } diff --git a/src/include/confdialog.h b/src/include/confdialog.h index 42ee0c15..2ce5a40d 100644 --- a/src/include/confdialog.h +++ b/src/include/confdialog.h @@ -142,6 +142,7 @@ extern Fl_Input *txtDEXSecondary; extern Fl_Counter *valDEX_BW; extern Fl_Check_Button *valDEX_FILTER; extern Fl_Counter *valDEX_PATHS; +extern Fl_Check_Button *valDEXSoft; extern Fl_Group *tabDomEX; extern Fl_Input *txtSecondary; extern Fl_Counter *valDominoEX_BW; diff --git a/src/include/configuration.h b/src/include/configuration.h index 895e3f6a..d8df2061 100644 --- a/src/include/configuration.h +++ b/src/include/configuration.h @@ -79,6 +79,7 @@ struct configuration { bool DEX_FILTER; string DEXsecText; int DEX_PATHS; + bool DEXsoft; // DOMINOEX double DOMINOEX_BW; bool DOMINOEX_FILTER; diff --git a/src/include/dex.h b/src/include/dex.h index a5b2b048..ff99fc47 100644 --- a/src/include/dex.h +++ b/src/include/dex.h @@ -93,6 +93,10 @@ protected: int currsymbol; int prev1symbol; int prev2symbol; + + double currmag; + double prev1mag; + double prev2mag; double met1; double met2; diff --git a/src/misc/configuration.cxx b/src/misc/configuration.cxx index f02d3609..ee66a2fe 100644 --- a/src/misc/configuration.cxx +++ b/src/misc/configuration.cxx @@ -84,6 +84,7 @@ configuration progdefaults = { true, // bool DEX_FILTER; "fldigi-dex ", // string DEXsecText; 5, // int DEX_PATHS; + false, // bool DEX_soft; // DOMINOEX 2.0, // double DOMINOEX_BW; true, // bool DOMINOEX_FILTER diff --git a/src/widgets/FTextView.cxx b/src/widgets/FTextView.cxx index a85af0a3..6903c858 100644 --- a/src/widgets/FTextView.cxx +++ b/src/widgets/FTextView.cxx @@ -187,7 +187,18 @@ void FTextBase::readFile(void) { const char *fn = file_select("Append text", "Text\t*.txt"); if (fn) { +#ifdef WIN32 + string text; + ifstream tfile(fn); + char ch; + while (tfile) { + tfile.get(ch); + if (ch != '\r') text += ch; + } + tbuf->append(text.c_str()); +#else tbuf->appendfile(fn); +#endif insert_position(tbuf->length()); show_insert_position(); }