diff --git a/src/contestia/contestia.cxx b/src/contestia/contestia.cxx index 2fd78367..bdd5b78c 100644 --- a/src/contestia/contestia.cxx +++ b/src/contestia/contestia.cxx @@ -88,25 +88,26 @@ void contestia::tx_init(SoundBase *sc) void contestia::send_tones() { - if (tone_midfreq != txbasefreq || tone_bw != bandwidth) { - double freqa, freqb; - tone_bw = bandwidth; - tone_midfreq = txbasefreq; - if (reverse) { - freqa = tone_midfreq + (tone_bw / 2.0); - freqb = tone_midfreq - (tone_bw / 2.0); - } else { - freqa = tone_midfreq - (tone_bw / 2.0); - freqb = tone_midfreq + (tone_bw / 2.0); - } - preamblephase = 0; - for (int i = 0; i < SR4; i++) - tonebuff[2*SR4 + i] = tonebuff[i] = nco(freqa) * ampshape[i]; + double freqa, freqb; + tone_bw = bandwidth; + tone_midfreq = txbasefreq; - preamblephase = 0; - for (int i = 0; i < SR4; i++) - tonebuff[3*SR4 + i] = tonebuff[SR4 + i] = nco(freqb) * ampshape[i]; + if (reverse) { + freqa = tone_midfreq + (tone_bw / 2.0); + freqb = tone_midfreq - (tone_bw / 2.0); + } else { + freqa = tone_midfreq - (tone_bw / 2.0); + freqb = tone_midfreq + (tone_bw / 2.0); } + + preamblephase = 0; + for (int i = 0; i < SR4; i++) + tonebuff[2*SR4 + i] = tonebuff[i] = nco(freqa) * ampshape[i]; + + preamblephase = 0; + for (int i = 0; i < SR4; i++) + tonebuff[3*SR4 + i] = tonebuff[SR4 + i] = nco(freqb) * ampshape[i]; + for (int j = 0; j < TONE_DURATION; j += SCBLOCKSIZE) ModulateXmtr(&tonebuff[j], SCBLOCKSIZE); diff --git a/src/dialogs/confdialog.cxx b/src/dialogs/confdialog.cxx index be48938d..bd25796d 100644 --- a/src/dialogs/confdialog.cxx +++ b/src/dialogs/confdialog.cxx @@ -2417,6 +2417,14 @@ static void cb_valPCMvolume(Fl_Value_Slider2* o, void*) { progdefaults.changed = true; } +Fl_Group *tabTxLevel=(Fl_Group *)0; + +Fl_Counter *valTxLevel=(Fl_Counter *)0; + +static void cb_valTxLevel(Fl_Counter* o, void*) { + progdefaults.txlevel=o->value(); +} + Fl_Group *tabID=(Fl_Group *)0; Fl_Check_Button *btnsendid=(Fl_Check_Button *)0; @@ -4116,7 +4124,6 @@ an merging")); cntCWdash2dot->labelcolor((Fl_Color)FL_FOREGROUND_COLOR); cntCWdash2dot->minimum(2.5); cntCWdash2dot->maximum(4); - cntCWdash2dot->step(0.1); cntCWdash2dot->value(3); cntCWdash2dot->callback((Fl_Callback*)cb_cntCWdash2dot); cntCWdash2dot->align(FL_ALIGN_RIGHT); @@ -4136,7 +4143,6 @@ an merging")); cntCWrisetime->labelcolor((Fl_Color)FL_FOREGROUND_COLOR); cntCWrisetime->minimum(0); cntCWrisetime->maximum(15); - cntCWrisetime->step(0.1); cntCWrisetime->value(4); cntCWrisetime->callback((Fl_Callback*)cb_cntCWrisetime); cntCWrisetime->align(FL_ALIGN_RIGHT); @@ -4345,7 +4351,6 @@ an merging")); valDominoEX_BW->labelcolor((Fl_Color)FL_FOREGROUND_COLOR); valDominoEX_BW->minimum(1); valDominoEX_BW->maximum(2); - valDominoEX_BW->step(0.1); valDominoEX_BW->value(1.5); valDominoEX_BW->callback((Fl_Callback*)cb_valDominoEX_BW); valDominoEX_BW->align(FL_ALIGN_RIGHT); @@ -4369,7 +4374,6 @@ an merging")); valDomCWI->labelfont(0); valDomCWI->labelsize(14); valDomCWI->labelcolor((Fl_Color)FL_FOREGROUND_COLOR); - valDomCWI->step(0.01); valDomCWI->textsize(14); valDomCWI->callback((Fl_Callback*)cb_valDomCWI); valDomCWI->align(FL_ALIGN_TOP); @@ -5005,7 +5009,6 @@ an merging")); valTHOR_BW->labelcolor((Fl_Color)FL_FOREGROUND_COLOR); valTHOR_BW->minimum(1); valTHOR_BW->maximum(2); - valTHOR_BW->step(0.1); valTHOR_BW->value(1.5); valTHOR_BW->callback((Fl_Callback*)cb_valTHOR_BW); valTHOR_BW->align(FL_ALIGN_RIGHT); @@ -5023,7 +5026,6 @@ an merging")); valThorCWI->labelfont(0); valThorCWI->labelsize(14); valThorCWI->labelcolor((Fl_Color)FL_FOREGROUND_COLOR); - valThorCWI->step(0.01); valThorCWI->textsize(14); valThorCWI->callback((Fl_Callback*)cb_valThorCWI); valThorCWI->align(FL_ALIGN_TOP); @@ -5760,7 +5762,6 @@ ll with your audio device.")); valPCMvolume->labelfont(0); valPCMvolume->labelsize(14); valPCMvolume->labelcolor((Fl_Color)FL_FOREGROUND_COLOR); - valPCMvolume->step(0.01); valPCMvolume->value(0.8); valPCMvolume->textsize(14); valPCMvolume->callback((Fl_Callback*)cb_valPCMvolume); @@ -5772,6 +5773,23 @@ ll with your audio device.")); } // Fl_Group* o tabMixer->end(); } // Fl_Group* tabMixer + { tabTxLevel = new Fl_Group(0, 50, 500, 320, _("TxLevel")); + tabTxLevel->hide(); + { Fl_Group* o = new Fl_Group(5, 60, 490, 86, _("Tx Attenuator")); + o->box(FL_ENGRAVED_FRAME); + o->align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE); + { Fl_Counter* o = valTxLevel = new Fl_Counter(196, 85, 120, 21, _("Tx Atten (dB)")); + valTxLevel->minimum(-30); + valTxLevel->maximum(0); + valTxLevel->value(-6); + valTxLevel->callback((Fl_Callback*)cb_valTxLevel); + o->value(progdefaults.txlevel); + o->lstep(1.0); + } // Fl_Counter* valTxLevel + o->end(); + } // Fl_Group* o + tabTxLevel->end(); + } // Fl_Group* tabTxLevel tabsSoundCard->end(); } // Fl_Tabs* tabsSoundCard tabSoundCard->end(); @@ -5954,7 +5972,6 @@ d frequency")); val_pretone->tooltip(_("Use for triggering amplifier carrier detect")); val_pretone->minimum(0); val_pretone->maximum(10); - val_pretone->step(0.1); val_pretone->callback((Fl_Callback*)cb_val_pretone); o->value(progdefaults.pretone); } // Fl_Counter* val_pretone diff --git a/src/dialogs/confdialog.fl b/src/dialogs/confdialog.fl index fb51d48a..57af6479 100644 --- a/src/dialogs/confdialog.fl +++ b/src/dialogs/confdialog.fl @@ -188,7 +188,7 @@ progdefaults.changed = true;} label UI open xywh {0 25 502 346} hide } { - Fl_Tabs tabsUI {open + Fl_Tabs tabsUI { xywh {0 25 502 346} selection_color 50 } { Fl_Group tabUserInterface { @@ -1188,7 +1188,7 @@ behaves inside the waterfall} xywh {15 196 150 22} down_box BORDER_BOX align 8 } } Fl_Group tabModems { - label Modems open + label Modems xywh {-4 25 521 347} hide } { Fl_Tabs tabsModems {open @@ -2792,7 +2792,7 @@ progdefaults.changed = true;} } } Fl_Group tabSoundCard { - label Audio + label Audio open tooltip {Audio devices} xywh {0 25 500 345} hide } { Fl_Tabs tabsSoundCard {open @@ -3039,6 +3039,23 @@ progdefaults.changed = true;} } } } + Fl_Group tabTxLevel { + label TxLevel open + xywh {0 50 500 320} hide + } { + Fl_Group {} { + label {Tx Attenuator} open + xywh {5 60 490 86} box ENGRAVED_FRAME align 21 + } { + Fl_Counter valTxLevel { + label {Tx Atten (dB)} + callback {progdefaults.txlevel=o->value();} + xywh {196 85 120 21} minimum -30 maximum 0 value -6 + code0 {o->value(progdefaults.txlevel);} + code1 {o->lstep(1.0);} + } + } + } } } Fl_Group tabID { @@ -3230,7 +3247,7 @@ progdefaults.changed = true;} } } Fl_Group tabMisc { - label Misc open + label Misc xywh {0 25 500 345} hide } { Fl_Tabs tabsMisc {open diff --git a/src/dialogs/fl_digi.cxx b/src/dialogs/fl_digi.cxx index e506f95f..d31bee31 100644 --- a/src/dialogs/fl_digi.cxx +++ b/src/dialogs/fl_digi.cxx @@ -2298,6 +2298,26 @@ int default_handler(int event) w->take_focus(); // remove this to leave tx text focused return 1; } +#ifdef __APPLE__ + if ((key == '=') && (Fl::event_state() == FL_COMMAND)) { +#else + if (key == '=' && Fl::event_alt()) { +#endif + progdefaults.txlevel += 0.1; + if (progdefaults.txlevel > 0) progdefaults.txlevel = 0; + valTxLevel->value(progdefaults.txlevel); + return 1; + } +#ifdef __APPLE__ + if ((key == '-') && (Fl::event_state() == FL_COMMAND)) { +#else + if (key == '-' && Fl::event_alt()) { +#endif + progdefaults.txlevel -= 0.1; + if (progdefaults.txlevel < -30) progdefaults.txlevel = -30; + valTxLevel->value(progdefaults.txlevel); + return 1; + } } else if (w == dlgLogbook || w->window() == dlgLogbook) return log_search_handler(event); diff --git a/src/include/confdialog.h b/src/include/confdialog.h index 6ff43652..0d6c6688 100644 --- a/src/include/confdialog.h +++ b/src/include/confdialog.h @@ -329,6 +329,8 @@ extern void setMixerInput(int); extern Fl_Light_Button *btnLineIn; extern void setPCMvolume(double); extern Fl_Value_Slider2 *valPCMvolume; +extern Fl_Group *tabTxLevel; +extern Fl_Counter *valTxLevel; extern Fl_Group *tabID; extern Fl_Check_Button *btnsendid; extern Fl_Check_Button *btnsendvideotext; diff --git a/src/include/configuration.h b/src/include/configuration.h index 596c781d..b0ba9fdf 100644 --- a/src/include/configuration.h +++ b/src/include/configuration.h @@ -947,6 +947,9 @@ ELEM_(double, PCMvolume, "PCMVOLUME", \ "PCM channel level", \ 0.8) \ + ELEM_(double, txlevel, "TXATTEN", \ + "TX attenuator (db) -30 .. 0", \ + -3.0) \ ELEM_(bool, MuteInput, "MUTEINPUT", \ "This setting is currently unused", \ true) \ diff --git a/src/olivia/olivia.cxx b/src/olivia/olivia.cxx index 4a77789a..5cc800bb 100755 --- a/src/olivia/olivia.cxx +++ b/src/olivia/olivia.cxx @@ -89,25 +89,26 @@ void olivia::tx_init(SoundBase *sc) void olivia::send_tones() { - if (tone_midfreq != txbasefreq || tone_bw != bandwidth) { - double freqa, freqb; - tone_bw = bandwidth; - tone_midfreq = txbasefreq; - if (reverse) { - freqa = tone_midfreq + (tone_bw / 2.0); - freqb = tone_midfreq - (tone_bw / 2.0); - } else { - freqa = tone_midfreq - (tone_bw / 2.0); - freqb = tone_midfreq + (tone_bw / 2.0); - } - preamblephase = 0; - for (int i = 0; i < SR4; i++) - tonebuff[2*SR4 + i] = tonebuff[i] = nco(freqa) * ampshape[i]; + double freqa, freqb; + tone_bw = bandwidth; + tone_midfreq = txbasefreq; - preamblephase = 0; - for (int i = 0; i < SR4; i++) - tonebuff[3*SR4 + i] = tonebuff[SR4 + i] = nco(freqb) * ampshape[i]; + if (reverse) { + freqa = tone_midfreq + (tone_bw / 2.0); + freqb = tone_midfreq - (tone_bw / 2.0); + } else { + freqa = tone_midfreq - (tone_bw / 2.0); + freqb = tone_midfreq + (tone_bw / 2.0); } + + preamblephase = 0; + for (int i = 0; i < SR4; i++) + tonebuff[2*SR4 + i] = tonebuff[i] = nco(freqa) * ampshape[i]; + + preamblephase = 0; + for (int i = 0; i < SR4; i++) + tonebuff[3*SR4 + i] = tonebuff[SR4 + i] = nco(freqb) * ampshape[i]; + for (int j = 0; j < TONE_DURATION; j += SCBLOCKSIZE) ModulateXmtr(&tonebuff[j], SCBLOCKSIZE); diff --git a/src/trx/modem.cxx b/src/trx/modem.cxx index eeb5af94..11cd8ddb 100644 --- a/src/trx/modem.cxx +++ b/src/trx/modem.cxx @@ -376,7 +376,15 @@ void modem::ModulateXmtr(double *buffer, int len) ModulateStereo( buffer, PTTchannel, len); return; } + + if (progdefaults.viewXmtSignal) + trx_xmit_wfall_queue(samplerate, buffer, (size_t)len); + if (withnoise && progdefaults.noise) add_noise(buffer, len); + + double mult = pow(10, progdefaults.txlevel / 20.0); + for (int i = 0; i < len; i++) buffer[i] *= mult; + try { unsigned n = 4; while (scard->Write(buffer, len) == 0 && --n); @@ -388,15 +396,20 @@ void modem::ModulateXmtr(double *buffer, int len) return; } - if (progdefaults.viewXmtSignal) - trx_xmit_wfall_queue(samplerate, buffer, (size_t)len); } #include using namespace std; void modem::ModulateStereo(double *left, double *right, int len) { + if (progdefaults.viewXmtSignal) + trx_xmit_wfall_queue(samplerate, left, (size_t)len); + if (withnoise && progdefaults.noise) add_noise(left, len); + + double mult = pow(10, progdefaults.txlevel / 20.0); + for (int i = 0; i < len; i++) left[i] *= mult; + try { unsigned n = 4; while (scard->Write_stereo(left, right, len) == 0 && --n); @@ -408,8 +421,6 @@ void modem::ModulateStereo(double *left, double *right, int len) return; } - if (progdefaults.viewXmtSignal) - trx_xmit_wfall_queue(samplerate, left, (size_t)len); }