diff --git a/src/dialogs/confdialog.cxx b/src/dialogs/confdialog.cxx index 2f3c3c79..6e63cf8b 100644 --- a/src/dialogs/confdialog.cxx +++ b/src/dialogs/confdialog.cxx @@ -1165,12 +1165,15 @@ progdefaults.changed = true; Fl_Check_Button *btnQSK=(Fl_Check_Button *)0; static void cb_btnQSK(Fl_Check_Button* o, void*) { - if (o->value() && !sound_check_right_channel()) { - o->value(0); - return; -} -progdefaults.QSK = o->value(); + progdefaults.QSK = o->value(); progdefaults.changed = true; +if (o->value()) { + progdefaults.sig_on_right_channel = false; + chkAudioStereoOut->value(0); + progdefaults.PTTrightchannel = false; + btnPTTrightchannel->value(0); +} +btnQSK2->value(o->value()); } Fl_Counter2 *cntPreTiming=(Fl_Counter2 *)0; @@ -1729,12 +1732,15 @@ progdefaults.changed = true; Fl_Check_Button *chkPseudoFSK=(Fl_Check_Button *)0; static void cb_chkPseudoFSK(Fl_Check_Button* o, void*) { - if (o->value() && !sound_check_right_channel()) { - o->value(0); - return; -} -progdefaults.PseudoFSK = o->value(); + progdefaults.PseudoFSK = o->value(); progdefaults.changed = true; +if (o->value()) { + progdefaults.sig_on_right_channel = false; + chkAudioStereoOut->value(0); + progdefaults.PTTrightchannel = false; + btnPTTrightchannel->value(0); +} +chkPseudoFSK2->value(o->value()); } Fl_Choice *mnuRTTYAFCSpeed=(Fl_Choice *)0; @@ -1903,12 +1909,17 @@ progdefaults.changed = true; Fl_Check_Button *btnPTTrightchannel=(Fl_Check_Button *)0; static void cb_btnPTTrightchannel(Fl_Check_Button* o, void*) { - if (o->value() && !sound_check_right_channel()) { - o->value(0); - return; + progdefaults.PTTrightchannel = o->value(); +if (o->value()) { + progdefaults.QSK = false; + btnQSK->value(0); + progdefaults.PseudoFSK = false; + chkPseudoFSK->value(0); + progdefaults.sig_on_right_channel = false; + chkAudioStereoOut->value(0); } -progdefaults.PTTrightchannel = o->value(); progdefaults.changed = true; +btnPTTrightchannel2->value(o->value()); } Fl_Check_Button *chkUSERIGCAT=(Fl_Check_Button *)0; @@ -2454,17 +2465,6 @@ static void cb_cntTxOffset(Fl_Spinner2* o, void*) { progdefaults.changed = true; } -Fl_Check_Button *chkAudioStereoOut=(Fl_Check_Button *)0; - -static void cb_chkAudioStereoOut(Fl_Check_Button* o, void*) { - if (!o->value() && (progdefaults.PseudoFSK || progdefaults.QSK || progdefaults.PTTrightchannel)) - LOG_WARN("Disabling right audio channel while in use by the QSK, pseudo-FSK or audio PTT options"); - -progdefaults.out_channels = o->value() + 1; -resetSoundCard(); -progdefaults.changed = true; -} - Fl_Group *tabMixer=(Fl_Group *)0; Fl_Check_Button *btnMixer=(Fl_Check_Button *)0; @@ -2520,6 +2520,81 @@ static void cb_valPCMvolume(Fl_Value_Slider2* o, void*) { progdefaults.changed = true; } +Fl_Group *tabAudioRightChannel=(Fl_Group *)0; + +Fl_Check_Button *chkAudioStereoOut=(Fl_Check_Button *)0; + +static void cb_chkAudioStereoOut(Fl_Check_Button* o, void*) { + progdefaults.sig_on_right_channel = o->value(); +progdefaults.changed = true; +if (o->value()) { + progdefaults.QSK = false; + btnQSK->value(0); + btnQSK2->value(0); + progdefaults.PseudoFSK = false; + chkPseudoFSK->value(0); + chkPseudoFSK2->value(0); + progdefaults.PTTrightchannel = false; + btnPTTrightchannel->value(0); + btnPTTrightchannel2->value(0); +}; +} + +Fl_Check_Button *chkReverseAudio=(Fl_Check_Button *)0; + +static void cb_chkReverseAudio(Fl_Check_Button* o, void*) { + progdefaults.ReverseAudio = o->value(); +progdefaults.changed = true; +} + +Fl_Check_Button *btnPTTrightchannel2=(Fl_Check_Button *)0; + +static void cb_btnPTTrightchannel2(Fl_Check_Button* o, void*) { + progdefaults.PTTrightchannel = o->value(); +if (o->value()) { + progdefaults.QSK = false; + btnQSK->value(0); + btnQSK2->value(0); + progdefaults.PseudoFSK = false; + chkPseudoFSK->value(0); + chkPseudoFSK2->value(0); + progdefaults.sig_on_right_channel = false; + chkAudioStereoOut->value(0); +} +btnPTTrightchannel->value(o->value()); +progdefaults.changed = true; +} + +Fl_Check_Button *btnQSK2=(Fl_Check_Button *)0; + +static void cb_btnQSK2(Fl_Check_Button* o, void*) { + progdefaults.QSK = o->value(); +progdefaults.changed = true; +if (o->value()) { + progdefaults.sig_on_right_channel = false; + chkAudioStereoOut->value(0); + progdefaults.PTTrightchannel = false; + btnPTTrightchannel->value(0); + btnPTTrightchannel2->value(0); +} +btnQSK->value(o->value()); +} + +Fl_Check_Button *chkPseudoFSK2=(Fl_Check_Button *)0; + +static void cb_chkPseudoFSK2(Fl_Check_Button* o, void*) { + progdefaults.PseudoFSK = o->value(); +progdefaults.changed = true; +if (o->value()) { + progdefaults.sig_on_right_channel = false; + chkAudioStereoOut->value(0); + progdefaults.PTTrightchannel = false; + btnPTTrightchannel->value(0); + btnPTTrightchannel2->value(0); +} +chkPseudoFSK->value(o->value()); +} + Fl_Group *tabID=(Fl_Group *)0; Fl_Check_Button *btnsendid=(Fl_Check_Button *)0; @@ -4177,6 +4252,7 @@ an merging")); tabsCW->selection_color((Fl_Color)FL_LIGHT1); { Fl_Group* o = new Fl_Group(0, 75, 500, 295, _("General")); o->align(FL_ALIGN_TOP_LEFT); + o->hide(); { Fl_Group* o = new Fl_Group(5, 85, 490, 130, _("Receive")); o->box(FL_ENGRAVED_FRAME); o->align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE); @@ -4343,7 +4419,6 @@ an merging")); } // Fl_Group* o { Fl_Group* o = new Fl_Group(0, 75, 500, 295, _("Timing and QSK")); o->align(FL_ALIGN_TOP_LEFT); - o->hide(); { Fl_Group* o = new Fl_Group(5, 85, 490, 120, _("Timing")); o->box(FL_ENGRAVED_FRAME); o->align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE); @@ -5994,11 +6069,6 @@ ll with your audio device.")); } // Fl_Spinner2* cntTxOffset o->end(); } // Fl_Group* o - { chkAudioStereoOut = new Fl_Check_Button(15, 222, 220, 20, _("Enable right audio channel")); - chkAudioStereoOut->down_box(FL_DOWN_BOX); - chkAudioStereoOut->callback((Fl_Callback*)cb_chkAudioStereoOut); - chkAudioStereoOut->value(progdefaults.out_channels == 2); - } // Fl_Check_Button* chkAudioStereoOut tabAudioOpt->end(); } // Fl_Group* tabAudioOpt { tabMixer = new Fl_Group(0, 50, 500, 320, _("Mixer")); @@ -6047,6 +6117,47 @@ ll with your audio device.")); } // Fl_Group* o tabMixer->end(); } // Fl_Group* tabMixer + { tabAudioRightChannel = new Fl_Group(0, 50, 500, 320, _("Right channel")); + tabAudioRightChannel->hide(); + { chkAudioStereoOut = new Fl_Check_Button(98, 93, 280, 20, _("Modem signal on left and right channels")); + chkAudioStereoOut->tooltip(_("Left and right channels both contain modem audio")); + chkAudioStereoOut->down_box(FL_DOWN_BOX); + chkAudioStereoOut->callback((Fl_Callback*)cb_chkAudioStereoOut); + chkAudioStereoOut->value(progdefaults.sig_on_right_channel); + } // Fl_Check_Button* chkAudioStereoOut + { Fl_Check_Button* o = chkReverseAudio = new Fl_Check_Button(98, 130, 270, 20, _("Reverse Left/Right channels")); + chkReverseAudio->tooltip(_("Software reversal of left-right audio channels")); + chkReverseAudio->down_box(FL_DOWN_BOX); + chkReverseAudio->callback((Fl_Callback*)cb_chkReverseAudio); + o->value(progdefaults.ReverseAudio); + } // Fl_Check_Button* chkReverseAudio + { Fl_Check_Button* o = btnPTTrightchannel2 = new Fl_Check_Button(98, 178, 250, 20, _("PTT tone on right audio channel ")); + btnPTTrightchannel2->tooltip(_("1000 Hz tone when PTT enabled\nCan be used in lieu of or in addition to other\ + PTT types")); + btnPTTrightchannel2->down_box(FL_DOWN_BOX); + btnPTTrightchannel2->callback((Fl_Callback*)cb_btnPTTrightchannel2); + o->value(progdefaults.PTTrightchannel); + } // Fl_Check_Button* btnPTTrightchannel2 + { Fl_Check_Button* o = btnQSK2 = new Fl_Check_Button(98, 216, 211, 20, _("CW QSK signal on right channel")); + btnQSK2->tooltip(_("Generate 1000 Hz square wave signal on right channel")); + btnQSK2->down_box(FL_DOWN_BOX); + btnQSK2->callback((Fl_Callback*)cb_btnQSK2); + o->value(progdefaults.QSK); + } // Fl_Check_Button* btnQSK2 + { Fl_Check_Button* o = chkPseudoFSK2 = new Fl_Check_Button(98, 254, 270, 20, _("Pseudo-FSK on right audio channel")); + chkPseudoFSK2->tooltip(_("Create 1000 Hz square wave on right channel")); + chkPseudoFSK2->down_box(FL_DOWN_BOX); + chkPseudoFSK2->callback((Fl_Callback*)cb_chkPseudoFSK2); + o->value(progdefaults.PseudoFSK); + } // Fl_Check_Button* chkPseudoFSK2 + { Fl_Group* o = new Fl_Group(25, 168, 454, 187, _("...\nThese controls are on other tabs.\nThey are replicated here for convenie\ +nce.\nYou may change the state from either location.\n...")); + o->box(FL_ENGRAVED_FRAME); + o->align(FL_ALIGN_BOTTOM|FL_ALIGN_INSIDE); + o->end(); + } // Fl_Group* o + tabAudioRightChannel->end(); + } // Fl_Group* tabAudioRightChannel tabsSoundCard->end(); } // Fl_Tabs* tabsSoundCard tabSoundCard->end(); diff --git a/src/dialogs/confdialog.fl b/src/dialogs/confdialog.fl index cb142170..7aae7e0b 100644 --- a/src/dialogs/confdialog.fl +++ b/src/dialogs/confdialog.fl @@ -1280,22 +1280,22 @@ behaves inside the waterfall} xywh {15 196 150 22} down_box BORDER_BOX align 8 } } Fl_Group tabModems { - label Modems + label Modems open xywh {-4 25 521 347} hide } { Fl_Tabs tabsModems {open xywh {-4 25 521 347} selection_color 50 align 9 } { Fl_Group tabCW { - label CW + label CW open xywh {0 50 504 320} } { - Fl_Tabs tabsCW { + Fl_Tabs tabsCW {open xywh {0 50 504 320} selection_color 50 } { Fl_Group {} { label General open - xywh {0 75 500 295} align 5 + xywh {0 75 500 295} align 5 hide } { Fl_Group {} { label Receive open @@ -1411,7 +1411,7 @@ progdefaults.changed = true;} } Fl_Group {} { label {Timing and QSK} open - xywh {0 75 500 295} align 5 hide + xywh {0 75 500 295} align 5 } { Fl_Group {} { label Timing open @@ -1467,12 +1467,15 @@ progdefaults.changed = true;} } { Fl_Check_Button btnQSK { label {QSK on right audio channel} - callback {if (o->value() && !sound_check_right_channel()) { - o->value(0); - return; + callback {progdefaults.QSK = o->value(); +progdefaults.changed = true; +if (o->value()) { + progdefaults.sig_on_right_channel = false; + chkAudioStereoOut->value(0); + progdefaults.PTTrightchannel = false; + btnPTTrightchannel->value(0); } -progdefaults.QSK = o->value(); -progdefaults.changed = true;} +btnQSK2->value(o->value());} tooltip {Generate square wave signal on right channel} xywh {15 245 211 20} down_box DOWN_BOX code0 {o->value(progdefaults.QSK);} } @@ -2221,12 +2224,15 @@ progdefaults.changed = true;} } Fl_Check_Button chkPseudoFSK { label {Pseudo-FSK on right audio channel} - callback {if (o->value() && !sound_check_right_channel()) { - o->value(0); - return; + callback {progdefaults.PseudoFSK = o->value(); +progdefaults.changed = true; +if (o->value()) { + progdefaults.sig_on_right_channel = false; + chkAudioStereoOut->value(0); + progdefaults.PTTrightchannel = false; + btnPTTrightchannel->value(0); } -progdefaults.PseudoFSK = o->value(); -progdefaults.changed = true;} +chkPseudoFSK2->value(o->value());} tooltip {Create square wave on right channel} xywh {15 284 270 20} down_box DOWN_BOX code0 {o->value(progdefaults.PseudoFSK);} } @@ -2323,7 +2329,7 @@ progdefaults.changed = true;} } } Fl_Group tabRig { - label Rig + label Rig open tooltip {Transceiver control} xywh {0 25 500 345} hide } { Fl_Tabs tabsRig {open @@ -2424,12 +2430,17 @@ progdefaults.changed = true;} } { Fl_Check_Button btnPTTrightchannel { label {PTT tone on right audio channel } - callback {if (o->value() && !sound_check_right_channel()) { - o->value(0); - return; + callback {progdefaults.PTTrightchannel = o->value(); +if (o->value()) { + progdefaults.QSK = false; + btnQSK->value(0); + progdefaults.PseudoFSK = false; + chkPseudoFSK->value(0); + progdefaults.sig_on_right_channel = false; + chkAudioStereoOut->value(0); } -progdefaults.PTTrightchannel = o->value(); -progdefaults.changed = true;} +progdefaults.changed = true; +btnPTTrightchannel2->value(o->value());} tooltip {Can be used in lieu of or in addition to other PTT types} xywh {130 69 250 20} down_box DOWN_BOX code0 {o->value(progdefaults.PTTrightchannel);} } @@ -2910,7 +2921,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 @@ -3080,17 +3091,6 @@ progdefaults.changed = true;} class Fl_Spinner2 } } - Fl_Check_Button chkAudioStereoOut { - label {Enable right audio channel} - callback {if (!o->value() && (progdefaults.PseudoFSK || progdefaults.QSK || progdefaults.PTTrightchannel)) - LOG_WARN("Disabling right audio channel while in use by the QSK, pseudo-FSK or audio PTT options"); - -progdefaults.out_channels = o->value() + 1; -resetSoundCard(); -progdefaults.changed = true;} - xywh {15 222 220 20} down_box DOWN_BOX - code0 {chkAudioStereoOut->value(progdefaults.out_channels == 2);} - } } Fl_Group tabMixer { label Mixer open @@ -3157,6 +3157,93 @@ progdefaults.changed = true;} } } } + Fl_Group tabAudioRightChannel { + label {Right channel} open + xywh {0 50 500 320} hide + } { + Fl_Check_Button chkAudioStereoOut { + label {Modem signal on left and right channels} + callback {progdefaults.sig_on_right_channel = o->value(); +progdefaults.changed = true; +if (o->value()) { + progdefaults.QSK = false; + btnQSK->value(0); + btnQSK2->value(0); + progdefaults.PseudoFSK = false; + chkPseudoFSK->value(0); + chkPseudoFSK2->value(0); + progdefaults.PTTrightchannel = false; + btnPTTrightchannel->value(0); + btnPTTrightchannel2->value(0); +}} + tooltip {Left and right channels both contain modem audio} xywh {98 93 280 20} down_box DOWN_BOX + code0 {chkAudioStereoOut->value(progdefaults.sig_on_right_channel);} + } + Fl_Check_Button chkReverseAudio { + label {Reverse Left/Right channels} + callback {progdefaults.ReverseAudio = o->value(); +progdefaults.changed = true;} + tooltip {Software reversal of left-right audio channels} xywh {98 130 270 20} down_box DOWN_BOX + code0 {o->value(progdefaults.ReverseAudio);} + } + Fl_Check_Button btnPTTrightchannel2 { + label {PTT tone on right audio channel } + callback {progdefaults.PTTrightchannel = o->value(); +if (o->value()) { + progdefaults.QSK = false; + btnQSK->value(0); + btnQSK2->value(0); + progdefaults.PseudoFSK = false; + chkPseudoFSK->value(0); + chkPseudoFSK2->value(0); + progdefaults.sig_on_right_channel = false; + chkAudioStereoOut->value(0); +} +btnPTTrightchannel->value(o->value()); +progdefaults.changed = true;} + tooltip {1000 Hz tone when PTT enabled +Can be used in lieu of or in addition to other PTT types} xywh {98 178 250 20} down_box DOWN_BOX + code0 {o->value(progdefaults.PTTrightchannel);} + } + Fl_Check_Button btnQSK2 { + label {CW QSK signal on right channel} + callback {progdefaults.QSK = o->value(); +progdefaults.changed = true; +if (o->value()) { + progdefaults.sig_on_right_channel = false; + chkAudioStereoOut->value(0); + progdefaults.PTTrightchannel = false; + btnPTTrightchannel->value(0); + btnPTTrightchannel2->value(0); +} +btnQSK->value(o->value());} + tooltip {Generate 1000 Hz square wave signal on right channel} xywh {98 216 211 20} down_box DOWN_BOX + code0 {o->value(progdefaults.QSK);} + } + Fl_Check_Button chkPseudoFSK2 { + label {Pseudo-FSK on right audio channel} + callback {progdefaults.PseudoFSK = o->value(); +progdefaults.changed = true; +if (o->value()) { + progdefaults.sig_on_right_channel = false; + chkAudioStereoOut->value(0); + progdefaults.PTTrightchannel = false; + btnPTTrightchannel->value(0); + btnPTTrightchannel2->value(0); +} +chkPseudoFSK->value(o->value());} + tooltip {Create 1000 Hz square wave on right channel} xywh {98 254 270 20} down_box DOWN_BOX + code0 {o->value(progdefaults.PseudoFSK);} + } + Fl_Group {} { + label {... +These controls are on other tabs. +They are replicated here for convenience. +You may change the state from either location. +...} open + xywh {25 168 454 187} box ENGRAVED_FRAME align 18 + } {} + } } } Fl_Group tabID { diff --git a/src/include/confdialog.h b/src/include/confdialog.h index f5183d86..1d82f506 100644 --- a/src/include/confdialog.h +++ b/src/include/confdialog.h @@ -335,7 +335,6 @@ extern Fl_Choice *menuSampleConverter; extern Fl_Spinner2 *cntRxRateCorr; extern Fl_Spinner2 *cntTxRateCorr; extern Fl_Spinner2 *cntTxOffset; -extern Fl_Check_Button *chkAudioStereoOut; extern Fl_Group *tabMixer; extern void resetMixerControls(); extern Fl_Check_Button *btnMixer; @@ -345,6 +344,12 @@ extern void setMixerInput(int); extern Fl_Light_Button *btnLineIn; extern void setPCMvolume(double); extern Fl_Value_Slider2 *valPCMvolume; +extern Fl_Group *tabAudioRightChannel; +extern Fl_Check_Button *chkAudioStereoOut; +extern Fl_Check_Button *chkReverseAudio; +extern Fl_Check_Button *btnPTTrightchannel2; +extern Fl_Check_Button *btnQSK2; +extern Fl_Check_Button *chkPseudoFSK2; 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 35ab7843..77e46ba1 100644 --- a/src/include/configuration.h +++ b/src/include/configuration.h @@ -881,9 +881,12 @@ ELEM_(int, in_channels, "INCHANNELS", \ "Number of audio input channels", \ 1) \ - ELEM_(int, out_channels, "OUTCHANNELS", \ - "Number of audio output channels", \ - 2) \ + ELEM_(bool, sig_on_right_channel, "SIGONRIGHTCHANNEL", \ + "Duplicate modem signal on left & right", \ + false) \ + ELEM_(bool, ReverseAudio, "REVERSEAUDIO", \ + "Reverse left-right audio channels", \ + false) \ ELEM_(int, sample_rate, "SAMPLERATE", \ "For compatibility with older versions", \ SAMPLE_RATE_UNSET) \ diff --git a/src/include/soundconf.h b/src/include/soundconf.h index fe8bb222..8b6e7cd5 100644 --- a/src/include/soundconf.h +++ b/src/include/soundconf.h @@ -19,6 +19,5 @@ extern int sample_rate_converters[FLDIGI_NUM_SRC]; void sound_init(void); void sound_close(void); void sound_update(unsigned idx); -bool sound_check_right_channel(void); #endif // SOUNDCONF_H diff --git a/src/soundcard/sound.cxx b/src/soundcard/sound.cxx index 1e2f4146..15db96d3 100644 --- a/src/soundcard/sound.cxx +++ b/src/soundcard/sound.cxx @@ -663,8 +663,13 @@ size_t SoundOSS::Write_stereo(double *bufleft, double *bufright, size_t count) wbuff = new short int[2*count]; p = (unsigned char *)wbuff; for (size_t i = 0; i < count; i++) { - wbuff[2*i] = (short int)(bufleft[i] * maxsc); - wbuff[2*i + 1] = (short int)(bufright[i] * maxsc); + if (progdefaults.ReverseAudio) { + wbuff[2*i+1] = (short int)(bufleft[i] * maxsc); + wbuff[2*i] = (short int)(bufright[i] * maxsc); + } else { + wbuff[2*i] = (short int)(bufleft[i] * maxsc); + wbuff[2*i+1] = (short int)(bufright[i] * maxsc); + } } count *= sizeof(short int); retval = write(device_fd, p, 2*count); @@ -677,8 +682,13 @@ size_t SoundOSS::Write_stereo(double *bufleft, double *bufright, size_t count) inbuf = new float[2*count]; size_t bufsize; for (size_t i = 0; i < count; i++) { - inbuf[2*i] = bufleft[i]; - inbuf[2*i+1] = bufright[i]; + if (progdefaults.ReverseAudio) { + inbuf[2*i+1] = bufleft[i]; + inbuf[2*i] = bufright[i]; + } else { + inbuf[2*i] = bufleft[i]; + inbuf[2*i+1] = bufright[i]; + } } tx_src_data->data_in = inbuf; tx_src_data->input_frames = count; @@ -771,7 +781,7 @@ SoundPort::SoundPort(const char *in_dev, const char *out_dev) sd[0].device = in_dev; sd[1].device = out_dev; sd[0].params.channelCount = progdefaults.in_channels; - sd[1].params.channelCount = progdefaults.out_channels; + sd[1].params.channelCount = 2;//progdefaults.out_channels; sd[0].stream = sd[1].stream = 0; sd[0].frames_per_buffer = sd[1].frames_per_buffer = paFramesPerBufferUnspecified; sd[0].dev_sample_rate = sd[1].dev_sample_rate = 0; @@ -1070,11 +1080,21 @@ size_t SoundPort::Write(double *buf, size_t count) write_file(ofGenerate, buf, count); #endif - // copy input to both channels - for (size_t i = 0; i < count; i++) - fbuf[sd[1].params.channelCount * i] = fbuf[sd[1].params.channelCount * i + 1] = buf[i]; +// copy input to both channels if right channel enabled + for (size_t i = 0; i < count; i++) + if (progdefaults.sig_on_right_channel) + fbuf[sd[1].params.channelCount * i] = fbuf[sd[1].params.channelCount * i + 1] = buf[i]; + else { + if (progdefaults.ReverseAudio) { + fbuf[sd[1].params.channelCount *i + 1] = buf[i]; + fbuf[sd[1].params.channelCount * i] = 0; + } else { + fbuf[sd[1].params.channelCount *i] = buf[i]; + fbuf[sd[1].params.channelCount * i + 1] = 0; + } + } - return resample_write(fbuf, count); + return resample_write(fbuf, count); } size_t SoundPort::Write_stereo(double *bufleft, double *bufright, size_t count) @@ -1087,13 +1107,18 @@ size_t SoundPort::Write_stereo(double *bufleft, double *bufright, size_t count) write_file(ofCapture, bufleft, count); #endif - // interleave into fbuf - for (size_t i = 0; i < count; i++) { - fbuf[sd[1].params.channelCount * i] = bufleft[i]; - fbuf[sd[1].params.channelCount * i + 1] = bufright[i]; - } +// interleave into fbuf + for (size_t i = 0; i < count; i++) { + if (progdefaults.ReverseAudio) { + fbuf[sd[1].params.channelCount * i + 1] = bufleft[i]; + fbuf[sd[1].params.channelCount * i] = bufright[i]; + } else { + fbuf[sd[1].params.channelCount * i] = bufleft[i]; + fbuf[sd[1].params.channelCount * i + 1] = bufright[i]; + } + } - return resample_write(fbuf, count); + return resample_write(fbuf, count); } @@ -1500,7 +1525,7 @@ void SoundPort::probe_supported_rates(const device_iterator& idev) PaStreamParameters params[2]; params[0].device = params[1].device = idev - devs.begin(); params[0].channelCount = progdefaults.in_channels; - params[1].channelCount = progdefaults.out_channels; + params[1].channelCount = 2;//progdefaults.out_channels; params[0].sampleFormat = params[1].sampleFormat = paFloat32; params[0].suggestedLatency = (*idev)->defaultHighInputLatency; params[1].suggestedLatency = (*idev)->defaultHighOutputLatency; @@ -1571,7 +1596,7 @@ SoundPulse::SoundPulse(const char *dev) sd[0].dir = PA_STREAM_RECORD; sd[1].dir = PA_STREAM_PLAYBACK; sd[0].stream_params.format = sd[1].stream_params.format = PA_SAMPLE_FLOAT32LE; sd[0].stream_params.channels = progdefaults.in_channels; - sd[1].stream_params.channels = progdefaults.out_channels; + sd[1].stream_params.channels = 2;//progdefaults.out_channels; sd[0].buffer_attrs.maxlength = sd[0].buffer_attrs.minreq = sd[0].buffer_attrs.prebuf = sd[0].buffer_attrs.tlength = (uint32_t)-1; @@ -1700,8 +1725,19 @@ size_t SoundPulse::Write(double* buf, size_t count) write_file(ofGenerate, buf, count); #endif - for (size_t i = 0; i < count; i++) - fbuf[sd[1].stream_params.channels * i] = fbuf[sd[1].stream_params.channels * i + 1] = buf[i]; +// copy input to both channels + for (size_t i = 0; i < count; i++) + if (progdefaults.sig_on_right_channel) + fbuf[sd[1].stream_params.channels * i] = fbuf[sd[1].stream_params.channels * i + 1] = buf[i]; + else { + if (progdefaults.ReverseAudio) { + fbuf[sd[1].stream_params.channels * i + 1] = buf[i]; + fbuf[sd[1].stream_params.channels * i] = 0; + } else { + fbuf[sd[1].stream_params.channels * i] = buf[i]; + fbuf[sd[1].stream_params.channels * i + 1] = 0; + } + } return resample_write(fbuf, count); } @@ -1717,8 +1753,13 @@ size_t SoundPulse::Write_stereo(double* bufleft, double* bufright, size_t count) #endif for (size_t i = 0; i < count; i++) { - fbuf[sd[1].stream_params.channels * i] = bufleft[i]; - fbuf[sd[1].stream_params.channels * i + 1] = bufright[i]; + if (progdefaults.ReverseAudio) { + fbuf[sd[1].stream_params.channels * i + 1] = bufleft[i]; + fbuf[sd[1].stream_params.channels * i] = bufright[i]; + } else { + fbuf[sd[1].stream_params.channels * i] = bufleft[i]; + fbuf[sd[1].stream_params.channels * i + 1] = bufright[i]; + } } return resample_write(fbuf, count); diff --git a/src/soundcard/soundconf.cxx b/src/soundcard/soundconf.cxx index 8af7647d..dc867c09 100644 --- a/src/soundcard/soundconf.cxx +++ b/src/soundcard/soundconf.cxx @@ -518,17 +518,3 @@ void sound_update(unsigned idx) }; } -#include "icons.h" -#include "gettext.h" - -bool sound_check_right_channel(void) -{ - if (progdefaults.out_channels != 2) { - if (!fl_choice2(_("The right audio channel is disabled. Enable it now?"), _("Cancel"), _("OK"), NULL)) - return false; - chkAudioStereoOut->value(1); - chkAudioStereoOut->do_callback(); - } - - return true; -}