R-L channel input

* read from either left (default) or right channel
pull/1/head
David Freese 2015-03-05 12:50:17 -06:00
rodzic e5148c0be3
commit 2424904eea
10 zmienionych plików z 211 dodań i 292 usunięć

Wyświetl plik

@ -356,7 +356,6 @@ static int create_default_script(char *file_name)
// AUDIO RIGHT CHANNEL
if(add_command(fd, (char *)CMD_AUDIO_RT_CHANNEL, 0)) return fclose(fd);
if(add_command(fd, (char *)CMD_MONO_AUDIO, (bool) chkForceMono->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_AUDIO_L_R, (bool) chkAudioStereoOut->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_AUDIO_REV_L_R, (bool) chkReverseAudio->value(), 1)) return fclose(fd);
if(add_command(fd, (char *)CMD_PTT_RIGHT_CHAN, (bool) btnPTTrightchannel2->value(), 1)) return fclose(fd);

Wyświetl plik

@ -42,7 +42,6 @@ extern int process_rx_ppm(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_tx_ppm(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_tx_offset(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_mono_audio_output(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_modem_signal_left_right(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_reverse_left_right(ScriptParsing *sp, SCRIPT_COMMANDS *sc);
extern int process_ptt_tone_right_channel(ScriptParsing *sp, SCRIPT_COMMANDS *sc);

Wyświetl plik

@ -1399,6 +1399,7 @@ int process_oss_audio_device_path(ScriptParsing *sp, SCRIPT_COMMANDS *sc)
menuOSSDev->value(index);
menuOSSDev->do_callback();
return script_no_errors;
#else
return script_no_errors;
@ -1690,17 +1691,6 @@ int process_tx_offset(ScriptParsing *sp, SCRIPT_COMMANDS *sc)
return assign_integer(cntTxOffset, sp, sc);
}
/** ********************************************************
* \brief
* \param sp Access to ScritpParsing members.
* \param sc Access to SCRIPT_COMMANDS structure variables.
* \return 0 (no error) Other (error)
***********************************************************/
int process_mono_audio_output(ScriptParsing *sp, SCRIPT_COMMANDS *sc)
{
return assign_bool(chkForceMono, sp, sc);
}
/** ********************************************************
* \brief
* \param sp Access to ScritpParsing members.

Wyświetl plik

@ -71,7 +71,6 @@ static const SCRIPT_COMMANDS default_audio_settings_command_table[] = {
};
static const SCRIPT_COMMANDS default_audio_rt_channel_command_table[] = {
{ CMD_MONO_AUDIO, SCRIPT_COMMAND, 0, 1, {0}, { p_bool }, 0, 0, 0, process_mono_audio_output, 0, 0},
{ CMD_AUDIO_L_R, SCRIPT_COMMAND, 0, 1, {0}, { p_bool }, 0, 0, 0, process_modem_signal_left_right, 0, 0},
{ CMD_AUDIO_REV_L_R, SCRIPT_COMMAND, 0, 1, {0}, { p_bool }, 0, 0, 0, process_reverse_left_right, 0, 0},
{ CMD_PTT_RIGHT_CHAN, SCRIPT_COMMAND, 0, 1, {0}, { p_bool }, 0, 0, 0, process_ptt_tone_right_channel, 0, 0},

Wyświetl plik

@ -2521,11 +2521,6 @@ if (o->value()) {
chkAudioStereoOut->value(0);
progdefaults.PTTrightchannel = false;
btnPTTrightchannel->value(0);
if (progdefaults.mono_audio) {
progdefaults.mono_audio = false;
chkForceMono->value(0);
resetSoundCard();
}
};
}
@ -3071,11 +3066,6 @@ if (o->value()) {
chkAudioStereoOut->value(0);
progdefaults.PTTrightchannel = false;
btnPTTrightchannel->value(0);
if (progdefaults.mono_audio) {
progdefaults.mono_audio = false;
chkForceMono->value(0);
resetSoundCard();
}
};
}
@ -3363,11 +3353,6 @@ if (o->value()) {
chkPseudoFSK->value(0);
progdefaults.sig_on_right_channel = false;
chkAudioStereoOut->value(0);
if (progdefaults.mono_audio) {
progdefaults.mono_audio = false;
chkForceMono->value(0);
resetSoundCard();
}
}
progdefaults.changed = true;
}
@ -4010,29 +3995,6 @@ progdefaults.changed = true;
Fl_Group *tabAudioRightChannel=(Fl_Group *)0;
Fl_Check_Button *chkForceMono=(Fl_Check_Button *)0;
static void cb_chkForceMono(Fl_Check_Button* o, void*) {
progdefaults.mono_audio = 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);
progdefaults.sig_on_right_channel = false;
chkAudioStereoOut->value(0);
progdefaults.ReverseAudio = false;
chkReverseAudio->value(0);
}
resetSoundCard();
}
Fl_Check_Button *chkAudioStereoOut=(Fl_Check_Button *)0;
static void cb_chkAudioStereoOut(Fl_Check_Button* o, void*) {
@ -4048,11 +4010,6 @@ if (o->value()) {
progdefaults.PTTrightchannel = false;
btnPTTrightchannel->value(0);
btnPTTrightchannel2->value(0);
if (progdefaults.mono_audio) {
progdefaults.mono_audio = false;
chkForceMono->value(0);
resetSoundCard();
}
};
}
@ -4061,11 +4018,6 @@ Fl_Check_Button *chkReverseAudio=(Fl_Check_Button *)0;
static void cb_chkReverseAudio(Fl_Check_Button* o, void*) {
progdefaults.ReverseAudio = o->value();
progdefaults.changed = true;
if (progdefaults.mono_audio) {
progdefaults.mono_audio = false;
chkForceMono->value(0);
resetSoundCard();
};
}
Fl_Check_Button *btnPTTrightchannel2=(Fl_Check_Button *)0;
@ -4083,11 +4035,6 @@ if (o->value()) {
chkPseudoFSK2->value(0);
progdefaults.sig_on_right_channel = false;
chkAudioStereoOut->value(0);
if (progdefaults.mono_audio) {
progdefaults.mono_audio = false;
chkForceMono->value(0);
resetSoundCard();
}
};
}
@ -4103,11 +4050,6 @@ if (o->value()) {
progdefaults.PTTrightchannel = false;
btnPTTrightchannel->value(0);
btnPTTrightchannel2->value(0);
if (progdefaults.mono_audio) {
progdefaults.mono_audio = false;
chkForceMono->value(0);
resetSoundCard();
}
};
}
@ -4123,14 +4065,16 @@ if (o->value()) {
progdefaults.PTTrightchannel = false;
btnPTTrightchannel->value(0);
btnPTTrightchannel2->value(0);
if (progdefaults.mono_audio) {
progdefaults.mono_audio = false;
chkForceMono->value(0);
resetSoundCard();
}
};
}
Fl_Check_Button *chkReverseRxAudio=(Fl_Check_Button *)0;
static void cb_chkReverseRxAudio(Fl_Check_Button* o, void*) {
progdefaults.ReverseRxAudio = o->value();
progdefaults.changed = true;
}
Fl_Group *tabWavFile=(Fl_Group *)0;
Fl_ListBox *listbox_wav_samplerate=(Fl_ListBox *)0;
@ -7045,6 +6989,7 @@ i on a\ntouch screen device such as a tablet."));
tabsModems->selection_color(FL_LIGHT1);
tabsModems->align(Fl_Align(FL_ALIGN_TOP_RIGHT));
{ tabCW = new Fl_Group(0, 50, 600, 330, _("CW"));
tabCW->hide();
{ tabsCW = new Fl_Tabs(0, 50, 600, 330);
tabsCW->selection_color(FL_LIGHT1);
{ Fl_Group* o = new Fl_Group(0, 75, 600, 305, _("General"));
@ -8186,7 +8131,6 @@ i on a\ntouch screen device such as a tablet."));
tabPSK->end();
} // Fl_Group* tabPSK
{ tabRTTY = new Fl_Group(0, 50, 600, 330, _("RTTY"));
tabRTTY->hide();
{ tabsRTTY = new Fl_Tabs(0, 50, 600, 330);
tabsRTTY->selection_color(FL_LIGHT1);
{ Fl_Group* o = new Fl_Group(0, 75, 600, 305, _("Tx"));
@ -9476,47 +9420,57 @@ ll with your audio device."));
} // Fl_Group* tabAudioOpt
{ tabAudioRightChannel = new Fl_Group(0, 50, 600, 330, _("Right channel"));
tabAudioRightChannel->hide();
{ chkForceMono = new Fl_Check_Button(160, 63, 280, 20, _("Mono audio output"));
chkForceMono->tooltip(_("Force output audio to single channel"));
chkForceMono->down_box(FL_DOWN_BOX);
chkForceMono->callback((Fl_Callback*)cb_chkForceMono);
chkForceMono->value(progdefaults.mono_audio);
} // Fl_Check_Button* chkForceMono
{ chkAudioStereoOut = new Fl_Check_Button(160, 95, 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(160, 127, 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_Group* o = new Fl_Group(73, 165, 454, 187, _("...\nThese controls are on other tabs.\nThey are replicated here for convenie\
nce.\nYou may change the state from either location.\n..."));
{ Fl_Group* o = new Fl_Group(25, 61, 550, 246, _("Transmit Usage"));
o->box(FL_ENGRAVED_FRAME);
o->align(Fl_Align(FL_ALIGN_BOTTOM|FL_ALIGN_INSIDE));
{ Fl_Check_Button* o = btnPTTrightchannel2 = new Fl_Check_Button(146, 175, 250, 20, _("PTT tone on right audio channel "));
o->align(Fl_Align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE));
{ chkAudioStereoOut = new Fl_Check_Button(165, 82, 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(165, 112, 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_Group* o = new Fl_Group(75, 135, 454, 162, _("...\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(FL_ALIGN_BOTTOM|FL_ALIGN_INSIDE));
{ Fl_Check_Button* o = btnPTTrightchannel2 = new Fl_Check_Button(165, 142, 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(146, 213, 211, 20, _("CW QSK signal on right channel"));
} // Fl_Check_Button* btnPTTrightchannel2
{ Fl_Check_Button* o = btnQSK2 = new Fl_Check_Button(165, 172, 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(146, 251, 270, 20, _("Pseudo-FSK on right audio channel"));
} // Fl_Check_Button* btnQSK2
{ Fl_Check_Button* o = chkPseudoFSK2 = new Fl_Check_Button(165, 203, 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_Check_Button* chkPseudoFSK2
o->end();
} // Fl_Group* o
o->end();
} // Fl_Group* o
{ Fl_Group* o = new Fl_Group(25, 310, 550, 60, _("Receive Usage"));
o->box(FL_ENGRAVED_FRAME);
o->align(Fl_Align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE));
{ Fl_Check_Button* o = chkReverseRxAudio = new Fl_Check_Button(165, 328, 270, 20, _("Reverse Left/Right channels"));
chkReverseRxAudio->tooltip(_("Software reversal of left-right audio channels"));
chkReverseRxAudio->down_box(FL_DOWN_BOX);
chkReverseRxAudio->callback((Fl_Callback*)cb_chkReverseRxAudio);
o->value(progdefaults.ReverseRxAudio);
} // Fl_Check_Button* chkReverseRxAudio
o->end();
} // Fl_Group* o
tabAudioRightChannel->end();

Wyświetl plik

@ -2821,7 +2821,7 @@ behaves inside the waterfall} xywh {65 207 150 22} box DOWN_BOX color 7 align 8
} {
Fl_Group tabCW {
label CW open
xywh {0 50 600 330}
xywh {0 50 600 330} hide
} {
Fl_Tabs tabsCW {open
xywh {0 50 600 330} selection_color 50
@ -3060,11 +3060,6 @@ if (o->value()) {
chkAudioStereoOut->value(0);
progdefaults.PTTrightchannel = false;
btnPTTrightchannel->value(0);
if (progdefaults.mono_audio) {
progdefaults.mono_audio = false;
chkForceMono->value(0);
resetSoundCard();
}
}}
tooltip {Generate square wave signal on right channel} xywh {16 245 233 20} down_box DOWN_BOX
code0 {o->value(progdefaults.QSK);}
@ -3707,7 +3702,7 @@ progdefaults.changed = true;}
}
Fl_Group tabRTTY {
label RTTY open
xywh {0 50 600 330} hide
xywh {0 50 600 330}
} {
Fl_Tabs tabsRTTY {open
xywh {0 50 600 330} selection_color 50
@ -3830,11 +3825,6 @@ if (o->value()) {
chkAudioStereoOut->value(0);
progdefaults.PTTrightchannel = false;
btnPTTrightchannel->value(0);
if (progdefaults.mono_audio) {
progdefaults.mono_audio = false;
chkForceMono->value(0);
resetSoundCard();
}
}}
tooltip {Create keyed square wave on right audio channel} xywh {316 202 212 22} down_box DOWN_BOX
code0 {o->value(progdefaults.PseudoFSK);}
@ -4199,7 +4189,7 @@ progdefaults.changed = true;}
label {Hardware PTT} open
xywh {0 50 600 330}
} {
Fl_Group {} {
Fl_Group {} {open
xywh {55 57 490 38} box ENGRAVED_FRAME
} {
Fl_Check_Button btnPTTrightchannel {
@ -4213,11 +4203,6 @@ if (o->value()) {
chkPseudoFSK->value(0);
progdefaults.sig_on_right_channel = false;
chkAudioStereoOut->value(0);
if (progdefaults.mono_audio) {
progdefaults.mono_audio = false;
chkForceMono->value(0);
resetSoundCard();
}
}
progdefaults.changed = true;}
tooltip {Can be used in lieu of or in addition to other PTT types} xywh {74 66 250 20} down_box DOWN_BOX
@ -4974,75 +4959,46 @@ progdefaults.changed = true;}
label {Right channel} open
xywh {0 50 600 330} hide
} {
Fl_Check_Button chkForceMono {
label {Mono audio output}
callback {progdefaults.mono_audio = 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);
progdefaults.sig_on_right_channel = false;
chkAudioStereoOut->value(0);
progdefaults.ReverseAudio = false;
chkReverseAudio->value(0);
}
resetSoundCard();}
tooltip {Force output audio to single channel} xywh {160 63 280 20} down_box DOWN_BOX
code0 {chkForceMono->value(progdefaults.mono_audio);}
}
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);
if (progdefaults.mono_audio) {
progdefaults.mono_audio = false;
chkForceMono->value(0);
resetSoundCard();
}
}}
tooltip {Left and right channels both contain modem audio} xywh {160 95 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;
if (progdefaults.mono_audio) {
progdefaults.mono_audio = false;
chkForceMono->value(0);
resetSoundCard();
}}
tooltip {Software reversal of left-right audio channels} xywh {160 127 270 20} down_box DOWN_BOX
code0 {o->value(progdefaults.ReverseAudio);}
}
Fl_Group {} {
label {...
label {Transmit Usage} open
xywh {25 61 550 246} box ENGRAVED_FRAME align 21
} {
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 {165 82 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 {165 112 270 20} down_box DOWN_BOX
code0 {o->value(progdefaults.ReverseAudio);}
}
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 {73 165 454 187} box ENGRAVED_FRAME align 18
} {
Fl_Check_Button btnPTTrightchannel2 {
label {PTT tone on right audio channel }
callback {progdefaults.PTTrightchannel = o->value();
xywh {75 135 454 162} box ENGRAVED_FRAME align 18
} {
Fl_Check_Button btnPTTrightchannel2 {
label {PTT tone on right audio channel }
callback {progdefaults.PTTrightchannel = o->value();
btnPTTrightchannel->value(o->value());
progdefaults.changed = true;
if (o->value()) {
@ -5054,19 +5010,14 @@ if (o->value()) {
chkPseudoFSK2->value(0);
progdefaults.sig_on_right_channel = false;
chkAudioStereoOut->value(0);
if (progdefaults.mono_audio) {
progdefaults.mono_audio = false;
chkForceMono->value(0);
resetSoundCard();
}
}}
tooltip {1000 Hz tone when PTT enabled
Can be used in lieu of or in addition to other PTT types} xywh {146 175 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();
tooltip {1000 Hz tone when PTT enabled
Can be used in lieu of or in addition to other PTT types} xywh {165 142 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();
btnQSK->value(o->value());
progdefaults.changed = true;
if (o->value()) {
@ -5075,18 +5026,13 @@ if (o->value()) {
progdefaults.PTTrightchannel = false;
btnPTTrightchannel->value(0);
btnPTTrightchannel2->value(0);
if (progdefaults.mono_audio) {
progdefaults.mono_audio = false;
chkForceMono->value(0);
resetSoundCard();
}
}}
tooltip {Generate 1000 Hz square wave signal on right channel} xywh {146 213 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();
tooltip {Generate 1000 Hz square wave signal on right channel} xywh {165 172 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();
chkPseudoFSK->value(o->value());
progdefaults.changed = true;
if (o->value()) {
@ -5095,14 +5041,22 @@ if (o->value()) {
progdefaults.PTTrightchannel = false;
btnPTTrightchannel->value(0);
btnPTTrightchannel2->value(0);
if (progdefaults.mono_audio) {
progdefaults.mono_audio = false;
chkForceMono->value(0);
resetSoundCard();
}
}}
tooltip {Create 1000 Hz square wave on right channel} xywh {146 251 270 20} down_box DOWN_BOX
code0 {o->value(progdefaults.PseudoFSK);}
tooltip {Create 1000 Hz square wave on right channel} xywh {165 203 270 20} down_box DOWN_BOX
code0 {o->value(progdefaults.PseudoFSK);}
}
}
}
Fl_Group {} {
label {Receive Usage} open
xywh {25 310 550 60} box ENGRAVED_FRAME align 21
} {
Fl_Check_Button chkReverseRxAudio {
label {Reverse Left/Right channels}
callback {progdefaults.ReverseRxAudio = o->value();
progdefaults.changed = true;}
tooltip {Software reversal of left-right audio channels} xywh {165 328 270 20} down_box DOWN_BOX
code0 {o->value(progdefaults.ReverseRxAudio);}
}
}
}

Wyświetl plik

@ -475,12 +475,12 @@ extern Fl_Spinner2 *cntRxRateCorr;
extern Fl_Spinner2 *cntTxRateCorr;
extern Fl_Spinner2 *cntTxOffset;
extern Fl_Group *tabAudioRightChannel;
extern Fl_Check_Button *chkForceMono;
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_Check_Button *chkReverseRxAudio;
extern Fl_Group *tabWavFile;
extern Fl_ListBox *listbox_wav_samplerate;
extern Fl_Group *tabID;

Wyświetl plik

@ -1012,17 +1012,14 @@
ELEM_(std::string, PulseServer, "PULSESERVER", \
"PulseAudio server string", \
"") \
ELEM_(int, in_channels, "INCHANNELS", \
"Number of audio input channels", \
1) \
ELEM_(bool, mono_audio, "MONOAUDIO", \
"Force use of mono audio output", \
false) \
ELEM_(bool, sig_on_right_channel, "SIGONRIGHTCHANNEL", \
"Duplicate modem signal on left & right", \
false) \
ELEM_(bool, ReverseAudio, "REVERSEAUDIO", \
"Reverse left-right audio channels", \
"Reverse left-right rx audio channels", \
false) \
ELEM_(bool, ReverseRxAudio, "REVERSERXAUDIO", \
"Reverse left-right rx audio channels", \
false) \
ELEM_(int, sample_rate, "SAMPLERATE", \
"For compatibility with older versions", \

Wyświetl plik

@ -238,7 +238,7 @@ private:
static std::vector<const PaDeviceInfo*> devs;
double req_sample_rate;
float* fbuf;
float* src_buffer;
float* src_buffer;
SRC_DATA *tx_src_data;
enum {
@ -317,6 +317,7 @@ private:
SRC_DATA* tx_src_data;
float* fbuf;
float* rbuf;
float* snd_buffer;
float* src_buffer;
};

Wyświetl plik

@ -557,7 +557,6 @@ int SoundOSS::Open(int md, int freq)
if (device_fd == -1)
throw SndException(errno);
Format(AFMT_S16_LE); // default: 16 bit little endian
// Channels(1); // 1 channel
Channels(2); // 2 channels
Frequency(freq);
setfragsize();
@ -689,7 +688,8 @@ size_t SoundOSS::Read(float *buffer, size_t buffersize)
src_buffer[i] = ibuff[i] / MAXSC;
for (size_t i = 0; i < buffersize; i++)
buffer[i] = src_buffer[2*i];
buffer[i] = src_buffer[2*i +
progdefaults.ReverseRxAudio ? 1 : 0];
#if USE_SNDFILE
if (capture)
@ -723,7 +723,8 @@ size_t SoundOSS::Read(float *buffer, size_t buffersize)
numread = rx_src_data->output_frames_gen;
for (int i = 0; i < numread; i++)
buffer[i] = snd_buffer[2*i];
buffer[i] = snd_buffer[2*i +
progdefaults.sig_on_right_channel ? 1 : 0];
return numread;
@ -953,16 +954,22 @@ const vector<double>& SoundPort::get_supported_rates(const string& name, unsigne
SoundPort::SoundPort(const char *in_dev, const char *out_dev) : req_sample_rate(0)
{
sd[0].device = in_dev;
sd[0].params.channelCount = 2;
sd[0].stream = 0;
sd[0].frames_per_buffer = paFramesPerBufferUnspecified;
sd[0].dev_sample_rate = 0;
sd[0].state = spa_continue;
sd[0].rb = 0;
sd[0].advance = 0;
sd[1].device = out_dev;
sd[0].params.channelCount = progdefaults.in_channels;
// # write channels always 2 unless mono output is selected
sd[1].params.channelCount = progdefaults.mono_audio ? 1 : 2;
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;
sd[0].state = sd[1].state = spa_continue;
sd[0].rb = sd[1].rb = 0;
sd[0].advance = sd[1].advance = 0;
sd[1].params.channelCount = 2;
sd[1].stream = 0;
sd[1].frames_per_buffer = paFramesPerBufferUnspecified;
sd[1].dev_sample_rate = 0;
sd[1].state = spa_continue;
sd[1].rb = 0;
sd[1].advance = 0;
sem_t** sems[] = { &sd[0].rwsem, &sd[1].rwsem };
#if USE_NAMED_SEMAPHORES
@ -1003,10 +1010,10 @@ SoundPort::SoundPort(const char *in_dev, const char *out_dev) : req_sample_rate(
tx_src_data = new SRC_DATA;
src_buffer = new float[sd[1].params.channelCount * SND_BUF_LEN];
fbuf = new float[MAX(sd[0].params.channelCount, sd[1].params.channelCount) * SND_BUF_LEN];
fbuf = new float[2 * SND_BUF_LEN];
memset(src_buffer, 0, sd[1].params.channelCount * SND_BUF_LEN * sizeof(*src_buffer));
memset(fbuf, 0, MAX(sd[0].params.channelCount, sd[1].params.channelCount) * SND_BUF_LEN * sizeof(*fbuf));
memset(fbuf, 0, 2 * SND_BUF_LEN * sizeof(*fbuf));
}
SoundPort::~SoundPort()
@ -1048,7 +1055,7 @@ SoundPort::~SoundPort()
delete tx_src_data;
delete [] src_buffer;
delete [] fbuf;
delete [] fbuf;
}
int SoundPort::Open(int mode, int freq)
@ -1069,9 +1076,9 @@ int SoundPort::Open(int mode, int freq)
if (mode == O_RDONLY && (idev = name_to_device(sd[1].device, 1)) != devs.end() &&
(device_type = Pa_GetHostApiInfo((*idev)->hostApi)->type) == paJACK)
mode = O_RDWR;
static char pa_open_str[200];
static char pa_open_str[500];
snprintf(pa_open_str, sizeof(pa_open_str),
"Port Audio open mode = %s, device type = %s, device name = %s",
"Port Audio open mode = %s\ndevice type = %s\ndevice name = %s\n# input channels %d\n# output channels %d",
mode == O_WRONLY ? "Write" : mode == O_RDONLY ? "Read" :
mode == O_RDWR ? "Read/Write" : "unknown",
device_type == 0 ? "paInDevelopment" :
@ -1089,7 +1096,9 @@ int SoundPort::Open(int mode, int freq)
device_type == 13 ? "paWASAPI" :
device_type == 14 ? "paAudioScienceHPI" : "unknown",
mode == O_WRONLY ? sd[1].device.c_str() :
mode == O_RDONLY ? sd[0].device.c_str() : "unknown" );
mode == O_RDONLY ? sd[0].device.c_str() : "unknown",
sd[0].params.channelCount,
sd[1].params.channelCount );
LOG_INFO( "%s", pa_open_str);
size_t start = (mode == O_RDONLY || mode == O_RDWR) ? 0 : 1,
@ -1281,19 +1290,19 @@ size_t SoundPort::Read(float *buf, size_t count)
sd[0].advance = vec[0].len;
}
else
sd[0].rb->read(fbuf, count * sd[0].params.channelCount);
sd[0].rb->read(rbuf, count * sd[0].params.channelCount);
}
if (sd[0].advance) {
sd[0].rb->read_advance(sd[0].advance);
sd[0].advance = 0;
}
if (sd[0].params.channelCount == 1)
memcpy(buf, rbuf, count * sizeof(float));
else {
// write first channel
for (size_t i = 0; i < count; i++)
buf[i] = rbuf[sd[0].params.channelCount * i];
// transfer active input channel; left == 0, right == 1
size_t n;
for (size_t i = 0; i < count; i++) {
n = sd[0].params.channelCount * i;
n += progdefaults.ReverseRxAudio;
buf[i] = rbuf[n];
}
#if USE_SNDFILE
@ -1317,18 +1326,14 @@ size_t SoundPort::Write(double *buf, size_t count)
// copy input to both channels if right channel enabled
for (size_t i = 0; i < count; i++)
if (progdefaults.mono_audio)
fbuf[i] = buf[i];
else if (progdefaults.sig_on_right_channel)
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) {
else if (progdefaults.ReverseAudio) {
fbuf[sd[1].params.channelCount * i + 1] = buf[i];
fbuf[sd[1].params.channelCount * i] = 0;
} else {
} else {
fbuf[sd[1].params.channelCount * i] = buf[i];
fbuf[sd[1].params.channelCount * i + 1] = 0;
}
}
return resample_write(fbuf, count);
@ -1620,8 +1625,8 @@ void SoundPort::init_stream(unsigned dir)
<< "\n";
}
// LOG_INFO("using %s (%d ch) device \"%s\":\n%s", dir_str[dir], sd[dir].params.channelCount,
// sd[dir].device.c_str(), device_text[dir].str().c_str());
LOG_INFO("using %s (%d ch) device \"%s\":\n%s", dir_str[dir], sd[dir].params.channelCount,
sd[dir].device.c_str(), device_text[dir].str().c_str());
sd[dir].dev_sample_rate = find_srate(dir);
if (sd[dir].dev_sample_rate != req_sample_rate)
@ -1784,9 +1789,8 @@ 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;
// # output channels always 2 unless mono audio is selected
params[1].channelCount = progdefaults.mono_audio ? 1 : 2;
params[0].channelCount = 2;
params[1].channelCount = 2;
params[0].sampleFormat = params[1].sampleFormat = paFloat32;
params[0].suggestedLatency = (*idev)->defaultHighInputLatency;
params[1].suggestedLatency = (*idev)->defaultHighOutputLatency;
@ -1853,28 +1857,39 @@ void SoundPort::init_hostapi_ext(void)
SoundPulse::SoundPulse(const char *dev)
{
sd[0].stream = sd[1].stream = 0;
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;
// # output channels always 2 unless mono audio is selected
sd[1].stream_params.channels = progdefaults.mono_audio ? 1 : 2;
sd[0].buffer_attrs.maxlength = sd[0].buffer_attrs.minreq = sd[0].buffer_attrs.prebuf =
sd[0].buffer_attrs.tlength = (uint32_t)-1;
sd[1].buffer_attrs.fragsize = sd[1].buffer_attrs.maxlength = sd[1].buffer_attrs.minreq =
sd[1].buffer_attrs.prebuf = (uint32_t)-1;
sd[0].stream = 0;
sd[0].stream_params.channels = 2;
sd[0].dir = PA_STREAM_RECORD;
sd[0].stream_params.format = PA_SAMPLE_FLOAT32LE;
sd[0].buffer_attrs.maxlength = (uint32_t)-1;
sd[0].buffer_attrs.minreq = (uint32_t)-1;
sd[0].buffer_attrs.prebuf = (uint32_t)-1;
sd[0].buffer_attrs.fragsize = SCBLOCKSIZE * sizeof(float);
sd[0].buffer_attrs.tlength = (uint32_t)-1;
sd[1].stream = 0;
sd[1].dir = PA_STREAM_PLAYBACK;
sd[1].stream_params.format = PA_SAMPLE_FLOAT32LE;
sd[1].stream_params.channels = 2;
sd[1].buffer_attrs.maxlength = (uint32_t)-1;
sd[1].buffer_attrs.minreq = (uint32_t)-1;
sd[1].buffer_attrs.prebuf = (uint32_t)-1;
sd[1].buffer_attrs.fragsize = (uint32_t)-1;
sd[1].buffer_attrs.tlength = SCBLOCKSIZE * sizeof(float);
tx_src_data = new SRC_DATA;
snd_buffer = new float[sd[0].stream_params.channels * SND_BUF_LEN];
rbuf = new float[sd[0].stream_params.channels * SND_BUF_LEN];
src_buffer = new float[sd[1].stream_params.channels * SND_BUF_LEN];
fbuf = new float[MAX(sd[0].stream_params.channels, sd[1].stream_params.channels) * SND_BUF_LEN];
fbuf = new float[sd[1].stream_params.channels * SND_BUF_LEN];
memset(snd_buffer, 0, sd[0].stream_params.channels * SND_BUF_LEN * sizeof(*snd_buffer));
memset(rbuf, 0, sd[0].stream_params.channels * SND_BUF_LEN * sizeof(*rbuf));
memset(src_buffer, 0, sd[1].stream_params.channels * SND_BUF_LEN * sizeof(*src_buffer));
memset(fbuf, 0, MAX(sd[0].stream_params.channels, sd[1].stream_params.channels) * SND_BUF_LEN * sizeof(*fbuf));
memset(fbuf, 0, sd[1].stream_params.channels * SND_BUF_LEN * sizeof(*fbuf));
}
SoundPulse::~SoundPulse()
@ -1890,6 +1905,7 @@ SoundPulse::~SoundPulse()
delete [] snd_buffer;
delete [] src_buffer;
delete [] fbuf;
delete [] rbuf;
}
int SoundPulse::Open(int mode, int freq)
@ -1992,18 +2008,14 @@ size_t SoundPulse::Write(double* buf, size_t count)
// copy input to both channels
for (size_t i = 0; i < count; i++)
if (progdefaults.mono_audio)
fbuf[i] = buf[i];
else if (progdefaults.sig_on_right_channel)
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;
}
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);
@ -2072,7 +2084,9 @@ long SoundPulse::src_read_cb(void* arg, float** data)
SoundPulse* p = reinterpret_cast<SoundPulse*>(arg);
int err;
if (pa_simple_read(p->sd[0].stream, p->snd_buffer, sizeof(float) * p->sd[0].blocksize, &err) == -1) {
int nread = 0;
if ((nread = pa_simple_read(p->sd[0].stream, p->snd_buffer,
p->sd[0].stream_params.channels * sizeof(float) * p->sd[0].blocksize, &err)) == -1) {
LOG_ERROR("%s", pa_strerror(err));
*data = 0;
return 0;
@ -2096,27 +2110,39 @@ size_t SoundPulse::Read(float *buf, size_t count)
}
#endif
size_t n = 0;
long r = 0;
if (progdefaults.RX_corr != 0) {
if (rxppm != progdefaults.RX_corr) {
rxppm = progdefaults.RX_corr;
sd[0].src_ratio = 1.0 / (1.0 + rxppm / 1e6);
src_set_ratio(rx_src_state, sd[0].src_ratio);
}
long r;
size_t n = 0;
sd[0].blocksize = SCBLOCKSIZE;
while (n < count) {
if ((r = src_callback_read(rx_src_state, sd[0].src_ratio, count - n, buf + n)) == 0)
return n;
if ((r = src_callback_read(rx_src_state, sd[0].src_ratio, count - n, rbuf + n)) == 0)
break;
n += r;
}
}
else {
int err;
if (pa_simple_read(sd[0].stream, buf, sizeof(float) * count, &err) == -1)
if ((r = pa_simple_read(sd[0].stream, rbuf,
sd[0].stream_params.channels * sizeof(float) * count, &err)) == -1)
throw SndPulseException(err);
}
// transfer active input channel; left == 0, right == 1
size_t i = 0;
if (sd[0].stream_params.channels == 2) n = progdefaults.ReverseRxAudio;
else n = 0;
while (i < count) {
buf[i] = rbuf[n];
i++;
n += sd[0].stream_params.channels;
}
#if USE_SNDFILE
if (capture)
write_file(ofCapture, buf, count);