From ffc692c17c8d53bebafec8545a3c633bb1fcfe56 Mon Sep 17 00:00:00 2001 From: Stelios Bounanos Date: Sun, 11 May 2008 00:59:51 +0100 Subject: [PATCH] Upstream version 2.11AB --- ChangeLog | 11 ++++- configure.ac | 2 +- src/dex/dex.cxx | 2 +- src/dialogs/confdialog.cxx | 4 +- src/dialogs/confdialog.fl | 10 ++-- src/dialogs/fl_digi.cxx | 9 +++- src/dominoex/dominoex.cxx | 96 +++++++++++++++++++++----------------- src/include/dominoex.h | 3 +- src/include/main.h | 9 ++-- src/include/mixer.h | 7 +-- src/main.cxx | 3 ++ src/mfsk/mfsk.cxx | 3 ++ src/misc/status.cxx | 5 +- src/mt63/mt63base.cxx | 2 +- src/psk/psk.cxx | 2 +- 15 files changed, 100 insertions(+), 68 deletions(-) diff --git a/ChangeLog b/ChangeLog index cec820b7..627341ab 100644 --- a/ChangeLog +++ b/ChangeLog @@ -70,8 +70,15 @@ Change Log: the filename suffix in the generate/capture/playback code; uses the fileselector filter value instead. 30) Update fileselector - Fileselector now remembers previous directory. - - + 31) MFSK bug fixes. The "broken image transmit" was due to stopflag not + being initialised in the mfsk ctor. Image window processing changed + to clearing the widget before redrawing the window. + 32) Fix crash with missing mixer device - Call OpenMixer in a try block + and handle the exception. + 33) Changed DominoEX-FEC secondary char lookup to a std::map type. + 34) Corrected two coding errors which produced compile warnings in + dominoex.cxx and mt63base.cxx + 2.10.3) 1) Corrected memory leak bug. 2.10.2 diff --git a/configure.ac b/configure.ac index 58b44f0b..e5b0f308 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, [AA]) +m4_define(FLDIGI_PATCH, [AB]) AC_INIT([fldigi], FLDIGI_MAJOR.FLDIGI_MINOR[FLDIGI_PATCH], [w1hkj AT w1hkj DOT com]) diff --git a/src/dex/dex.cxx b/src/dex/dex.cxx index 79574eb9..e14e1e96 100644 --- a/src/dex/dex.cxx +++ b/src/dex/dex.cxx @@ -296,7 +296,7 @@ void dex::decodeEX(int ch) int c = ch; for (int i = 0; i < 4; i++) { - if (c & 1 == 1) symbols[3-i] = 255; + if ((c & 1) == 1) symbols[3-i] = 255; else symbols[3-i] = 1; c = c / 2; } diff --git a/src/dialogs/confdialog.cxx b/src/dialogs/confdialog.cxx index 17eab7ad..7eb59dae 100644 --- a/src/dialogs/confdialog.cxx +++ b/src/dialogs/confdialog.cxx @@ -1739,7 +1739,6 @@ static const char szBaudRates[] = "300|600|1200|2400|4800|9600|19200|38400|57600 { tabSoundCard = new Fl_Group(0, 25, 400, 195, "SndCrd"); tabSoundCard->color((Fl_Color)51); tabSoundCard->selection_color((Fl_Color)51); - tabSoundCard->hide(); { tabsSoundCard = new Fl_Tabs(0, 25, 400, 195); tabsSoundCard->selection_color((Fl_Color)10); { tabAudio = new Fl_Group(0, 50, 400, 170, "Audio devices"); @@ -1840,6 +1839,7 @@ l with your sound hardware."); menuOutSampleRate->align(FL_ALIGN_RIGHT); //extern Fl_Menu_Item sample_rate_menu[]; //o->menu(sample_rate_menu); + o->clear_changed(); } // Fl_Choice* menuOutSampleRate { Fl_Choice* o = menuInSampleRate = new Fl_Choice(8, 62, 85, 25, "Capture"); menuInSampleRate->tooltip("Force a specific sample rate. Select \"Native\" if \"Auto\" does not work wel\ @@ -1849,6 +1849,7 @@ l with your sound hardware."); menuInSampleRate->align(FL_ALIGN_RIGHT); //extern Fl_Menu_Item sample_rate_menu[]; //o->menu(sample_rate_menu); + o->clear_changed(); } // Fl_Choice* menuInSampleRate { menuSampleConverter = new Fl_Choice(174, 91, 216, 25, "Converter"); menuSampleConverter->down_box(FL_BORDER_BOX); @@ -1939,6 +1940,7 @@ l with your sound hardware."); { tabModems = new Fl_Group(0, 25, 401, 195, "Modem"); tabModems->color((Fl_Color)51); tabModems->selection_color((Fl_Color)51); + tabModems->hide(); { tabsModems = new Fl_Tabs(0, 25, 401, 195); tabsModems->color((Fl_Color)51); tabsModems->selection_color((Fl_Color)10); diff --git a/src/dialogs/confdialog.fl b/src/dialogs/confdialog.fl index c0699f77..87c278ba 100644 --- a/src/dialogs/confdialog.fl +++ b/src/dialogs/confdialog.fl @@ -671,7 +671,7 @@ o->label((inpQRZuserpassword->type() & FL_SECRET_INPUT) ? "Show" : "Hide");} } Fl_Group tabSoundCard { label SndCrd open - xywh {0 25 400 195} color 51 selection_color 51 hide + xywh {0 25 400 195} color 51 selection_color 51 } { Fl_Tabs tabsSoundCard {open xywh {0 25 400 195} selection_color 10 @@ -802,15 +802,17 @@ progdefaults.changed = true;} open tooltip {Force a specific sample rate. Select "Native" if "Auto" does not work well with your sound hardware.} xywh {8 91 85 25} down_box BORDER_BOX align 8 code0 {//extern Fl_Menu_Item sample_rate_menu[];} code1 {//o->menu(sample_rate_menu);} + code2 {o->clear_changed();} } {} Fl_Choice menuInSampleRate { label Capture callback {progdefaults.in_sample_rate = o->value() > 1 ? strtol(o->mvalue()->text, 0, 10) : o->value(); resetSoundCard(); -progdefaults.changed = true;} open +progdefaults.changed = true;} open selected tooltip {Force a specific sample rate. Select "Native" if "Auto" does not work well with your sound hardware.} xywh {8 62 85 25} down_box BORDER_BOX align 8 code0 {//extern Fl_Menu_Item sample_rate_menu[];} code1 {//o->menu(sample_rate_menu);} + code2 {o->clear_changed();} } {} Fl_Choice menuSampleConverter { label Converter @@ -922,7 +924,7 @@ progdefaults.changed = true;} } Fl_Group tabModems { label Modem open - xywh {0 25 401 195} color 51 selection_color 51 + xywh {0 25 401 195} color 51 selection_color 51 hide } { Fl_Tabs tabsModems {open xywh {0 25 401 195} color 51 selection_color 10 align 9 @@ -1081,7 +1083,7 @@ progdefaults.changed = true;} Fl_Counter valDEX_PATHS { label Paths callback {progdefaults.DEX_PATHS = (int)o->value(); -progdefaults.changed = true;} selected +progdefaults.changed = true;} xywh {20 174 63 21} type Simple minimum 4 maximum 8 step 1 value 5 code0 {o->value(progdefaults.DEX_PATHS);} } diff --git a/src/dialogs/fl_digi.cxx b/src/dialogs/fl_digi.cxx index 6f06b036..181fbefa 100644 --- a/src/dialogs/fl_digi.cxx +++ b/src/dialogs/fl_digi.cxx @@ -1993,7 +1993,13 @@ void enableMixer(bool on) #else mixer = new MixerBase; #endif - mixer->openMixer(progdefaults.MXdevice.c_str()); + try { + mixer->openMixer(progdefaults.MXdevice.c_str()); + } + catch (const MixerException& e) { + put_status(e.what(), 5); + goto ret; + } mixer->PCMVolume(progdefaults.PCMvolume); mixer->setXmtLevel(progStatus.XmtMixer); //valXmtMixer->value()); @@ -2011,6 +2017,7 @@ void enableMixer(bool on) delete mixer; mixer = 0; } +ret: resetMixerControls(); FL_UNLOCK_D(); } diff --git a/src/dominoex/dominoex.cxx b/src/dominoex/dominoex.cxx index a657c634..a5810f4b 100644 --- a/src/dominoex/dominoex.cxx +++ b/src/dominoex/dominoex.cxx @@ -26,6 +26,7 @@ #include #include +#include #include "confdialog.h" #include "status.h" @@ -41,6 +42,7 @@ using namespace std; char dommsg[80]; +static map mupsksec2pri; void dominoex::tx_init(SoundBase *sc) { @@ -90,6 +92,9 @@ void dominoex::restart() void dominoex::init() { + if (mupsksec2pri.empty()) + MuPsk_sec2pri_init(); + modem::init(); reset_filters(); rx_init(); @@ -101,6 +106,49 @@ void dominoex::init() set_scope_mode(Digiscope::DOMDATA); } +void dominoex::MuPsk_sec2pri_init(void) +{ + int chars[] = { 'A', 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, // À, Á, Â, Ã, Ä, Å + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, -1, // à, á, â, ã, ä, å + 'B', 0xdf, -1, // ß + 'C', 0xc7, 0xe7, 0xa9, -1, // Ç, ç, ©, + 'D', 0xd0, 0xb0, -1, // Ð, ° + 'E', 0xc6, 0xe6, 0xc8, 0xc9, 0xca, 0xcb, // Æ, æ, È, É, Ê, Ë + 0xe8, 0xe9, 0xea, 0xeb, -1, // è, é, ê, ë + 'F', 0x192, -1, // ƒ + 'I', 0xcc, 0xcd, 0xce, 0xcf, 0xec, 0xed, // Ì, Í, Î, Ï, ì, í + 0xee, 0xef, 0xa1, -1, // î, ï, ¡ + 'L', 0xa3, -1, // £ + 'N', 0xd1, 0xf1, -1, // Ñ, ñ + 'O', 0xf4, 0xf6, 0xf2, 0xd6, 0xf3, 0xd3, // ô, ö, ò, Ö, ó, Ó + 0xd4, 0xd2, 0xf5, 0xd5, -1, // Ô, Ò, õ, Õ + 'R', 0xae, -1, // ® + 'U', 0xd9, 0xda, 0xdb, 0xdc, 0xf9, 0xfa, // Ù, Ú, Û, Ü, ù, ú + 0xfb, 0xfc, -1, // û, ü + 'X', 0xd7, -1, // × + 'Y', 0xff, 0xfd, 0xdd, -1, // ÿ, ý, Ý + '0', 0xd8, -1, // Ø + '1', 0xb9, -1, // ¹ + '2', 0xb2, -1, // ² + '3', 0xb3, -1, // ³ + '?', 0xbf, -1, // ¿ + '!', 0xa1, -1, // ¡ + '<', 0xab, -1, // « + '>', 0xbb, -1, // » + '{', '(', -1, + '}', ')', -1, + '|', '\\' + }; + + int c = chars[0]; + for (size_t i = 1; i < sizeof(chars)/sizeof(*chars); i++) { + if (chars[i] != -1) + mupsksec2pri[chars[i]] = c; + else + c = chars[++i]; + } +} + dominoex::~dominoex() { if (hilbert) delete hilbert; @@ -609,43 +657,8 @@ int dominoex::tx_process() unsigned char dominoex::MuPskSec2Pri(int c) { if (c >= 'a' && c <= 'z') c -= 32; - if (c == 'À' || c == 'Á' || c == 'Â' || c == 'Ã' || c == 'Ä' || c == 'Å' || - c == 'à' || c == 'á' || c == 'â' || c == 'ã' || c == 'ä' || c == 'å') - c = 'A'; - if (c == 'ß') c = 'B'; - if (c == 'Ç' || c == 'ç' || c == '©') c = 'C'; - if (c == 'Ð' || c == '°') c = 'D'; - if (c == 'Æ' || c == 'æ' || c == 'È' || c == 'É' || c == 'Ê' || c == 'Ë' || - c == 'è' || c == 'é' || c == 'ê' || c == 'ë') - c = 'E'; - if (c == 'ƒ') c = 'F'; - if (c == 'Ì' || c == 'Í' || c == 'Î' || c == 'Ï' || c == 'ì' || c == 'í' || - c == 'î' || c == 'ï' || c == '¡') - c = 'I'; - if (c == '£') c = 'L'; - if (c == 'Ñ' || c == 'ñ') c = 'N'; - if (c == 'ô' || c == 'ö' || c == 'ò' || c == 'Ö' || c == 'ó' || - c == 'Ó' || c == 'Ô' || c == 'Ò' || c == 'õ' || c == 'Õ') - c = 'O'; - if (c == '®') c = 'R'; - if (c == 'Ù' || c == 'Ú' || c == 'Û' || c == 'Ü' || - c == 'ù' || c == 'ú' || c == 'û' || c == 252) - if (c == 'ü' || c == 'û' || c == 'ù' || c == 'Ü' || - c == 'ú' || c == 'Ú' || c == 'Û' || c == 'Ù') - c = 'U'; - if (c == '×') c = 'X'; - if (c == 'ÿ' || c == 'ý' || c == 'Ý') c = 'Y'; - if (c == 'Ø') c = '0'; - if (c == '¹') c = '1'; - if (c == '²') c = '2'; - if (c == '³') c = '3'; - if (c == '¿') c = '?'; - if (c == '¡') c = '!'; - if (c == '«') c = '<'; - if (c == '»') c = '>'; - if (c == '{') c = '('; - if (c == '}') c = ')'; - if (c == '|') c = '\\'; + + c = mupsksec2pri.find(c) != mupsksec2pri.end() ? mupsksec2pri[c] : c; if (c >= 'A' && c <= 'Z') c = c - 'A' + 127; else if (c >= '0' && c <= '9') c = c - '0' + 14; @@ -710,19 +723,14 @@ void dominoex::decodeMuPskSymbol(unsigned char symbol) } } -void dominoex::MuPskSoftdecode(complex *bins) -{ -} - - void dominoex::decodeMuPskEX(int ch) { unsigned char symbols[4]; int c = ch; for (int i = 0; i < 4; i++) { - if (c & 1 == 1) symbols[3-i] = 255; - else symbols[3-i] = -255; + if ((c & 1) == 1) symbols[3-i] = 255; + else symbols[3-i] = 1;//-255; c = c / 2; } diff --git a/src/include/dominoex.h b/src/include/dominoex.h index 6befe102..a3e97b1c 100644 --- a/src/include/dominoex.h +++ b/src/include/dominoex.h @@ -154,14 +154,13 @@ private: // Rx unsigned int MuPskPriSecChar(unsigned int c); void decodeMuPskSymbol(unsigned char symbol); - void MuPskSoftdecode(complex *bins); void decodeMuPskEX(int c); // Tx unsigned char MuPskSec2Pri(int c); void sendMuPskEX(unsigned char c, int secondary); void MuPskClearbits(); void MuPskFlushTx(); - + void MuPsk_sec2pri_init(void); public: dominoex (trx_mode md); ~dominoex (); diff --git a/src/include/main.h b/src/include/main.h index efcb097b..04bfcb1f 100644 --- a/src/include/main.h +++ b/src/include/main.h @@ -21,6 +21,7 @@ #include "rigclass.h" #endif +extern string appname; extern string HomeDir; extern string xmlfname; @@ -40,10 +41,10 @@ extern bool mailclient; extern bool mailserver; extern bool pskmail_text_available; extern char pskmail_get_char(); -extern void pskmail_loop(void *); - -#ifdef __CYGWIN__ -extern void writeToARQfile(unsigned int); +extern void pskmail_loop(void *); + +#ifdef __CYGWIN__ +extern void writeToARQfile(unsigned int); #endif struct RXMSGSTRUC { diff --git a/src/include/mixer.h b/src/include/mixer.h index 51a8fba2..2540a69d 100644 --- a/src/include/mixer.h +++ b/src/include/mixer.h @@ -37,18 +37,19 @@ #endif class MixerException { -public: char szError[80]; int error; +public: MixerException() { *szError = 0; error = 0; } MixerException(int e) { - snprintf(szError, sizeof(szError), "Error: %d, %s", e, strerror(e)); + snprintf(szError, sizeof(szError), "Mixer error %d: %s", e, strerror(e)); error = e; } MixerException(char *s) { - snprintf(szError, sizeof(szError), "Error: %s", s); + snprintf(szError, sizeof(szError), "Mixer error: %s", s); error = 1; } + const char* what(void) const { return szError; } }; class MixerBase diff --git a/src/main.cxx b/src/main.cxx index b684acd6..04ecd1a0 100644 --- a/src/main.cxx +++ b/src/main.cxx @@ -74,6 +74,8 @@ using namespace std; +string appname; + string scDevice[2]; char szHomedir[120] = ""; @@ -123,6 +125,7 @@ void restore_streams(void); int main(int argc, char ** argv) { + appname = argv[0]; debug_exec(argv); CREATE_THREAD_ID(); // only call this once SET_THREAD_ID(FLMAIN_TID); diff --git a/src/mfsk/mfsk.cxx b/src/mfsk/mfsk.cxx index f477e0d9..3d01b714 100644 --- a/src/mfsk/mfsk.cxx +++ b/src/mfsk/mfsk.cxx @@ -175,6 +175,7 @@ mfsk::mfsk(trx_mode mfsk_mode) : modem() startpic = false; abortxmt = false; + stopflag = false; bitshreg = 0; bitstate = 0; @@ -1019,6 +1020,8 @@ void load_file(const char *n) { // load the picture widget with the rgb image FL_LOCK_D(); + picTx->clear(); + picTxWin->redraw(); picTx->video(xmtimg, W * H * 3); if (print_time_left(W * H * 3, txclr_tooltip, sizeof(txclr_tooltip), "Time needed: ") > 0) btnpicTxSendColor->tooltip(txclr_tooltip); diff --git a/src/misc/status.cxx b/src/misc/status.cxx index bd9aaf81..3db69fe3 100644 --- a/src/misc/status.cxx +++ b/src/misc/status.cxx @@ -109,7 +109,7 @@ void status::saveLastState() scopeH = scopeview->h(); } - Fl_Preferences spref(string(HomeDir).append(STATUS_FILENAME).c_str(), "w1hkj.com", 0); + Fl_Preferences spref(HomeDir.c_str(), "w1hkj.com", PACKAGE_TARNAME); spref.set("version", PACKAGE_VERSION); @@ -152,8 +152,7 @@ void status::saveLastState() void status::loadLastState() { - Fl_Preferences spref(string(HomeDir).append(STATUS_FILENAME).c_str(), "w1hkj.com", 0); - + Fl_Preferences spref(HomeDir.c_str(), "w1hkj.com", PACKAGE_TARNAME); char version[64]; version[sizeof(version)-1] = '\0'; bLastStateRead = spref.get("version", version, "", sizeof(version)-1); // Skip loading the rest of the status variables if we didn't read a diff --git a/src/mt63/mt63base.cxx b/src/mt63/mt63base.cxx index 9df5c2eb..223419da 100644 --- a/src/mt63/mt63base.cxx +++ b/src/mt63/mt63base.cxx @@ -331,7 +331,7 @@ int MT63encoder::Process(char code) // encode an ASCII character "code" { int i,k; code&=CodeMask; for(i=0; i