Fixes For Cygwin Builds:

Remove AERO Build Define; Replace with __CYGWIN__;

Fix extern optarg,optind on __CYGWIN__;

Fix GIT_TAG versioning for __CYGWIN__;

Add Experimental Install sh script;
This commit is contained in:
lwvmobile
2025-02-11 19:17:30 -05:00
parent 35bd5ccc55
commit 8d21574a93
8 changed files with 123 additions and 87 deletions

View File

@@ -107,12 +107,6 @@ void
noCarrier (dsd_opts * opts, dsd_state * state)
{
// #ifdef AERO_BUILD //NOTE: Blame seems to be synctest8 not being initialized (will continue to test)
// //TODO: Investigate why getSymbol needs to be run first in this context...truly confused here
// if(opts->frame_m17 == 1) //&& opts->audio_in_type == 5
// for (int i = 0; i < 960; i++) getSymbol(opts, state, 1); //I think this is actually just framesync being a pain
// #endif
if (opts->floating_point == 1)
{
state->aout_gain = opts->audio_gain;
@@ -569,7 +563,7 @@ initOpts (dsd_opts * opts)
opts->p25status = 0;
opts->p25tg = 0;
opts->scoperate = 15;
#ifdef AERO_BUILD
#ifdef __CYGWIN__
sprintf (opts->audio_in_dev, "/dev/dsp");
sprintf (opts->audio_out_dev, "/dev/dsp");
#else
@@ -690,7 +684,7 @@ initOpts (dsd_opts * opts)
//this may not matter so much, since its already checked later on
//but better safe than sorry I guess
#ifdef AERO_BUILD
#ifdef __CYGWIN__
opts->audio_in_type = 9; //only assign when configured
opts->audio_out_type = 9; //only assign when configured
#else
@@ -774,7 +768,7 @@ initOpts (dsd_opts * opts)
//slot preference is used during OSS audio playback to
//prefer one tdma voice slot over another when both are playing back
//this is a fix to OSS 48k/1 output
#ifdef AERO_BUILD
#ifdef __CYGWIN__
opts->slot_preference = 0; //default prefer slot 1 -- state->currentslot = 0;
#else
opts->slot_preference = 2; //use 2 since integrating the Stereo Channel Patch;
@@ -790,7 +784,7 @@ initOpts (dsd_opts * opts)
opts->use_hpf_d = 1;
//this is a quick bugfix for issues with OSS and TDMA slot 1/2 audio level mismatch
#ifdef AERO_BUILD
#ifdef __CYGWIN__
opts->use_hpf_d = 0;
#endif
@@ -1275,7 +1269,7 @@ usage ()
printf (" -O List All Pulse Audio Input Sources and Output Sinks (devices).\n");
printf ("\n");
printf ("Input/Output options:\n");
#ifdef AERO_BUILD
#ifdef __CYGWIN__
printf (" -i <device> Audio input device (default is /dev/dsp)\n");
printf (" pulse for pulse audio (will require pactl running in Cygwin)\n");
#else
@@ -1293,14 +1287,14 @@ usage ()
printf (" filename.bin for OP25/FME capture bin files\n");
printf (" filename.wav for 48K/1 wav files (SDR++, GQRX)\n");
printf (" filename.wav -s 96000 for 96K/1 wav files (DSDPlus)\n");
#ifdef AERO_BUILD
#ifdef __CYGWIN__
printf (" (Use single quotes '\\directory\\audio file.wav' when directories/spaces are present)\n");
#else
printf (" (Use single quotes '/directory/audio file.wav' when directories/spaces are present)\n");
#endif
// printf (" (Windows - '\directory\audio file.wav' backslash, not forward slash)\n");
printf (" -s <rate> Sample Rate of wav input files (48000 or 96000) Mono only!\n");
#ifdef AERO_BUILD
#ifdef __CYGWIN__
printf (" -o <device> Audio output device (default is /dev/dsp)\n");
printf (" pulse for pulse audio (will require pactl running in Cygwin)\n");
#else
@@ -1338,7 +1332,7 @@ usage ()
printf (" -c <file> Output symbol capture to .bin file\n");
printf (" -q Reverse Mute - Mute Unencrypted Voice and Unmute Encrypted Voice\n");
printf (" -V <num> Enable TDMA Voice Synthesis on Slot 1 (1), Slot 2 (2), or Both (3); Default is 3; \n");
// #ifdef AERO_BUILD
// #ifdef __CYGWIN__
printf (" If using /dev/dsp input and output at 48k1, launch two instances of DSD-FME w -V 1 and -V 2 if needed");
// #endif
// printf (" (Audio Smoothing is now disabled on all upsampled output by default -- fix crackle/buzz bug)\n");
@@ -1678,8 +1672,12 @@ int
main (int argc, char **argv)
{
int c;
//optarg and optind already defined when using Cygwin, no need to do so again
#ifdef __CYGWIN__
#else
extern char *optarg;
extern int optind, opterr, optopt;
extern int optind;
#endif
dsd_opts opts;
dsd_state state;
char versionstr[25];
@@ -1694,8 +1692,8 @@ main (int argc, char **argv)
fprintf (stderr,"%s\n", FM_banner[i]);
}
#ifdef AERO_BUILD
fprintf (stderr, "Build Version: AW (20231015) \n");
#ifdef __CYGWIN__
fprintf (stderr, "Build Version: AW %s (CYGWIN)\n", GIT_TAG);
#else
fprintf (stderr, "Build Version: AW %s \n", GIT_TAG);
#endif
@@ -1716,7 +1714,7 @@ main (int argc, char **argv)
while ((c = getopt (argc, argv, "yhaepPqs:t:v:z:i:o:d:c:g:n:w:B:C:R:f:m:u:x:A:S:M:G:D:L:V:U:YK:b:H:X:NQ:WrlZTF01:2:345:6:7:89Ek:I:JO")) != -1)
{
opterr = 0;
switch (c)
{
case 'h':
@@ -3019,7 +3017,7 @@ main (int argc, char **argv)
}
else
{
#ifdef AERO_BUILD
#ifdef __CYGWIN__
sprintf (opts.audio_in_dev, "%s", "/dev/dsp");
opts.audio_in_type = 5;
#else
@@ -3150,7 +3148,7 @@ main (int argc, char **argv)
rtl_ok = 1;
#endif
#ifdef AERO_BUILD
#ifdef __CYGWIN__
if (rtl_ok == 0) //not set, means rtl support isn't compiled/available
{
fprintf (stderr, "RTL Support not enabled/compiled, falling back to OSS /dev/dsp Audio Input.\n");
@@ -3205,7 +3203,7 @@ main (int argc, char **argv)
if (err < 0)
{
fprintf (stderr, "Error Configuring UDP Socket for UDP Blaster Audio :( \n");
#ifdef AERO_BUILD
#ifdef __CYGWIN__
sprintf (opts.audio_in_dev, "%s", "/dev/dsp");
opts.audio_in_type = 5;
//since I can't determine what the configuration will be for 48k1 or 8k2 here(lazy), need to exit

View File

@@ -917,7 +917,7 @@ processMbeFrame (dsd_opts * opts, dsd_state * state, char imbe_fr[8][23], char a
{
if ( opts->floating_point == 0 ) //opts->audio_out == 1 && //needed to remove for AERO OSS so we could still save wav files during dual voices
{
#ifdef AERO_BUILD
#ifdef __CYGWIN__
if(opts->audio_out == 1 && opts->slot1_on == 1) //add conditional check here, otherwise some lag occurs on dual voices with OSS48k/1 input due to buffered audio
#endif
processAudio(opts, state);
@@ -994,7 +994,7 @@ processMbeFrame (dsd_opts * opts, dsd_state * state, char imbe_fr[8][23], char a
{
if ( opts->floating_point == 0) //opts->audio_out == 1 && //needed to remove for AERO OSS so we could still save wav files during dual voices
{
#ifdef AERO_BUILD
#ifdef __CYGWIN__
if(opts->audio_out == 1 && opts->slot2_on == 1) //add conditional check here, otherwise some lag occurs on dual voices with OSS48k/1 input due to buffered audio
#endif
processAudioR(opts, state);

View File

@@ -2419,35 +2419,12 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
//Start Printing Section
erase();
#ifdef AERO_BUILD
if (opts->ncurses_compact == 1)
{
printw ("------------------------------------------------------------------------------\n");
printw ("| Digital Speech Decoder: Florida Man Edition - Aero %s \n", "AW (20231015)");
printw ("------------------------------------------------------------------------------\n");
}
#elif LIMAZULUTWEAKS
if (opts->ncurses_compact == 1)
{
printw ("------------------------------------------------------------------------------\n");
printw ("| Digital Speech Decoder: LimaZulu Edition VI: Return of the Zulu \n");
printw ("------------------------------------------------------------------------------\n");
}
#elif ZDEV_BUILD
if (opts->ncurses_compact == 1)
{
printw ("------------------------------------------------------------------------------\n");
printw ("| Digital Speech Decoder: Florida Man Edition - zDEV %s \n", GIT_TAG);
printw ("------------------------------------------------------------------------------\n");
}
#else
if (opts->ncurses_compact == 1)
{
printw ("------------------------------------------------------------------------------\n");
printw ("| Digital Speech Decoder: Florida Man Edition - AW %s \n", GIT_TAG);
printw ("------------------------------------------------------------------------------\n");
}
#endif
if (opts->ncurses_compact == 0)
{
attron(COLOR_PAIR(6));
@@ -2461,16 +2438,12 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
#ifdef USE_CODEC2
if (i == 4 && opts->frame_m17 == 1) printw (" CODEC2");
#endif
#ifdef AERO_BUILD
if (i == 5) printw (" %s ", "Aero Build");
if (i == 6) printw (" AW (20231015) \n");
#elif ZDEV_BUILD
if (i == 5) printw (" %s ", "AW ");
if (i == 6) printw (" %s \n", GIT_TAG);
#ifdef __CYGWIN__
if (i == 5) printw (" %s ", "AW (CYGWIN)");
#else
if (i == 5) printw (" %s ", "AW ");
if (i == 6) printw (" %s \n", GIT_TAG);
#endif
if (i == 6) printw (" %s \n", GIT_TAG);
else printw ("\n");
}
attroff(COLOR_PAIR(6)); //6
@@ -2865,12 +2838,12 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
printw ("| Voice Error: [%X][%X] Slot 1 (1)", state->errs&0xF, state->errs2&0xF);
if (opts->slot1_on == 0) printw (" OFF");
if (opts->slot1_on == 1) printw (" ON");
if (opts->slot_preference == 0) printw (" *Preferred");
if (opts->slot_preference == 0) printw (" *Preferred (3)");
printw ("\n");
printw ("| Voice Error: [%X][%X] Slot 2 (2)", state->errsR&0xF, state->errs2R&0xF);
if (opts->slot2_on == 0) printw (" OFF");
if (opts->slot2_on == 1) printw (" ON");
if (opts->slot_preference == 1) printw (" *Preferred");
if (opts->slot_preference == 1) printw (" *Preferred (3)");
printw ("\n");
}
printw ("------------------------------------------------------------------------------\n");
@@ -4421,7 +4394,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
}
}
#ifdef AERO_BUILD
#ifdef __CYGWIN__
//do nothing
#else
if (c == 32) //'space bar' replay last bin file (rework to do wav files too?)
@@ -4475,7 +4448,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
}
//
#ifdef AERO_BUILD //this might be okay on Aero as well, will need to look into and/or test
#ifdef __CYGWIN__ //this might be okay on Aero as well, will need to look into and/or test
//
#else
if (c == 115) //'s' key, stop playing wav or symbol in files

View File

@@ -141,7 +141,7 @@ getSymbol (dsd_opts * opts, dsd_state * state, int have_sync)
//tcp socket input from SDR++ -- now with 1 retry if connection is broken
else if (opts->audio_in_type == 8)
{
#ifdef AERO_BUILD
#ifdef __CYGWIN__
result = sf_read_short(opts->tcp_file_in, &sample, 1);
if(result == 0) {
fprintf (stderr, "\nConnection to TCP Server Interrupted. Trying again in 3 seconds.\n");

View File

@@ -481,16 +481,6 @@ void process_4V (dsd_opts * opts, dsd_state * state)
fprintf (stderr, "\n");
}
// #ifdef AERO_BUILD //FUN FACT: OSS stutters only on Cygwin, using padsp in linux, it actually opens two virtual /dev/dsp audio streams for output
// //Cygwin OSS Slot Preference Pre-emption shim
// if (opts->audio_out_type == 5)
// {
// //set to 21 for MBE OSS shim to preempt audio
// if (state->currentslot == 0) state->dmrburstL = 21;
// else state->dmrburstR = 21;
// }
// #endif
//unsure of the best location for these counter resets
if (state->voice_counter[0] >= 18)
state->voice_counter[0] = 0;
@@ -778,16 +768,6 @@ void process_2V (dsd_opts * opts, dsd_state * state)
fprintf (stderr, "\n");
}
// #ifdef AERO_BUILD //FUN FACT: OSS stutters only on Cygwin, using padsp in linux, it actually opens two virtual /dev/dsp audio streams for output
// //Cygwin OSS Slot Preference Pre-emption shim
// if (opts->audio_out_type == 5)
// {
// //set to 21 for MBE OSS shim to preempt audio
// if (state->currentslot == 0) state->dmrburstL = 21;
// else state->dmrburstR = 21;
// }
// #endif
//unsure of the best location for these counter resets
if (state->voice_counter[0] >= 18)
state->voice_counter[0] = 0;

View File

@@ -395,7 +395,7 @@ void process_SACCH_MAC_PDU (dsd_opts * opts, dsd_state * state, int payload[180]
if (opcode == 0x4 && err == 0)
{
//disable to prevent blinking in ncurses terminal due to OSS preemption shim
#ifdef AERO_BUILD
#ifdef __CYGWIN__
if (opts->audio_out_type != 5)
{
if (state->currentslot == 1) state->dmrburstL = 21;
@@ -787,7 +787,7 @@ void process_FACCH_MAC_PDU (dsd_opts * opts, dsd_state * state, int payload[156]
if (opcode == 0x4 && err == 0)
{
//disable to prevent blinking in ncurses terminal due to OSS preemption shim
#ifdef AERO_BUILD
#ifdef __CYGWIN__
if (opts->audio_out_type != 5)
{
if (state->currentslot == 0) state->dmrburstL = 21;