From 8d5c82356ebfdf3f75e10edf3fcc55d783f66543 Mon Sep 17 00:00:00 2001 From: lwvmobile Date: Mon, 15 May 2023 15:06:34 -0400 Subject: [PATCH] Initial Main/Aero Code Consolidation; #127 --- CMakeLists.txt | 23 ++++++---- README.md | 4 +- src/dsd_main.c | 74 +++++++++++++++++++++--------- src/dsd_mbe.c | 10 +++- src/dsd_ncurses.c | 113 ++++++++++++++++++++++++++++------------------ src/dsd_symbol.c | 57 ++++++++++++++++++++++- src/p25p2_frame.c | 34 ++++++++++---- src/p25p2_xcch.c | 26 +++++++++-- 8 files changed, 248 insertions(+), 93 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e9896e5..cf0885f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,13 +3,20 @@ #Arch currently on 3.26.3 #Cygwin currently using 3.23.2 (or newer) cmake_minimum_required(VERSION 3.10.2) -project(dsd-fme-aero) +project(dsd-fme-zdev) SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake/") #Set curses to ncurses, and wide true for ascii set(CURSES_NEED_NCURSES TRUE) set(CURSES_NEED_WIDE TRUE) +#use cmake option -DAERO=ON to enable Aero Builds (OSS support and specific tweaks) +option(AERO + "Build for Aero Environments (Cygwin)" OFF) +if (AERO) + add_definitions(-DAERO_BUILD) +endif () + #use cmake option -DCOLORS=OFF to disable color output option(COLORS "Build with Colors Enabled" ON) @@ -70,24 +77,24 @@ list(APPEND SRCS "${CMAKE_CURRENT_BINARY_DIR}/git_ver.c") include_directories("${PROJECT_SOURCE_DIR}/include") -ADD_EXECUTABLE(dsd-fme-aero ${SRCS} ${HEADERS}) -TARGET_LINK_LIBRARIES(dsd-fme-aero ${LIBS}) +ADD_EXECUTABLE(dsd-fme-zdev ${SRCS} ${HEADERS}) +TARGET_LINK_LIBRARIES(dsd-fme-zdev ${LIBS}) include(GNUInstallDirs) -install(TARGETS dsd-fme-aero DESTINATION ${CMAKE_INSTALL_BINDIR}) +install(TARGETS dsd-fme-zdev DESTINATION ${CMAKE_INSTALL_BINDIR}) # man page find_program(HELP2MAN_FOUND help2man) if (HELP2MAN_FOUND) - add_custom_command(TARGET dsd-fme-aero POST_BUILD + add_custom_command(TARGET dsd-fme-zdev POST_BUILD COMMAND help2man ARGS -n "Digital Speech Decoder" --version-string=${GIT_TAG} - -o ${CMAKE_CURRENT_BINARY_DIR}/dsd-fme-aero.1 + -o ${CMAKE_CURRENT_BINARY_DIR}/dsd-fme-zdev.1 --no-info - $ + $ ) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/dsd-fme-aero.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/dsd-fme-zdev.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) endif() # uninstall target diff --git a/README.md b/README.md index 09f45a2..3b655d7 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ ## Notice -This branch is for modifications to make a Windows 32-bit binary to be precompiled, please DO NOT use this branch if you are a Linux User, or copy any contents out of here to modify your existing setup! +This branch is for development and experimentation. Results are not gauranteed to be stable. +This branch will also attempt to consolidate the code bases for 'Main' and 'Aero' into one codeset +with the differences needed for Aero (Cygwin) handled by cmake option `cmake -DAERO=ON ..` when building. ## License Copyright (C) 2010 DSD Author diff --git a/src/dsd_main.c b/src/dsd_main.c index afc4f67..b7d915e 100644 --- a/src/dsd_main.c +++ b/src/dsd_main.c @@ -64,7 +64,7 @@ char * FM_banner[9] = { " ██║ ██║ ╚═══██╗██║ ██║   ██╔══╝ ██║╚██╔╝██║██╔══╝ ", " ██████╔╝██████╔╝██████╔╝   ██║ ██║ ╚═╝ ██║███████╗", " ╚═════╝ ╚═════╝ ╚═════╝    ╚═╝ ╚═╝ ╚═╝╚══════╝", - " 'Aero' Edition v2.0.0-99-ge390251 Windows 32-bit " + " " }; #endif @@ -436,10 +436,14 @@ initOpts (dsd_opts * opts) opts->p25status = 0; opts->p25tg = 0; opts->scoperate = 15; + #ifdef AERO_BUILD sprintf (opts->audio_in_dev, "/dev/dsp"); - opts->audio_in_fd = -1; - sprintf (opts->audio_out_dev, "/dev/dsp"); + #else + sprintf (opts->audio_in_dev, "pulse"); + sprintf (opts->audio_out_dev, "pulse"); + #endif + opts->audio_in_fd = -1; opts->audio_out_fd = -1; opts->audio_out_fdR = -1; @@ -976,20 +980,36 @@ usage () printf (" -Z Log MBE/PDU Payloads to console\n"); printf ("\n"); printf ("Input/Output options:\n"); + #ifdef AERO_BUILD printf (" -i Audio input device (default is /dev/dsp)\n"); - printf (" pulse for pulse audio \n"); + printf (" pulse for pulse audio (will require pactl running in Cygwin)\n"); + #else + printf (" -i Audio input device (default is pulse)\n"); + //NOTE: Fix some inputs to /dev/audio if required for linux, or just leave it as the more annoying /dev/dsp -- padsp bug opens multiple input streams...sometimes + printf (" /dev/dsp for OSS audio (Depreciated: Will require padsp wrapper in Linux) \n"); + #endif printf (" rtl:dev:freq:gain:ppm:bw:sq:udp for rtl dongle (see below)\n"); printf (" tcp for tcp client SDR++/GNURadio Companion/Other (Port 7355)\n"); printf (" tcp:192.168.7.5:7355 for custom address and port \n"); 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 + 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 Sample Rate of wav input files (48000 or 96000) Mono only!\n"); + #ifdef AERO_BUILD printf (" -o Audio output device (default is /dev/dsp)\n"); + printf (" pulse for pulse audio (will require pactl running in Cygwin)\n"); + #else + printf (" -o Audio output device (default is pulse)\n"); + printf (" /dev/dsp for OSS audio (Depreciated: Will require padsp wrapper in Linux) \n"); + #endif printf (" null for no audio output\n"); - printf (" pulse for pulse audio \n"); + // printf (" pulse for pulse audio \n"); printf (" -d Create mbe data files, use this directory (TDMA version is experimental)\n"); printf (" -r Read/Play saved mbe data from file(s)\n"); printf (" -g Audio output gain (default = 0 = auto, disable = -1)\n"); @@ -1282,15 +1302,12 @@ main (int argc, char **argv) mbe_printVersion (versionstr); fprintf (stderr," Digital Speech Decoder: Florida Man Edition\n"); - for (short int i = 1; i < 8; i++) { - //fprintf (stderr,"%s%s \n", FM_banner[i], KGRN); //cyan/blue text - fprintf (stderr,"%s\n", FM_banner[i]); //cyan/blue tex + for (short int i = 1; i < 7; i++) { + fprintf (stderr,"%s\n", FM_banner[i]); } - //fprintf (stderr,"%s", KNRM); //change back to normal - // git_tag not working in 32-bit cygwin? or issue with copy and paste, even with the .git folder? - // fprintf (stderr, "Github Build Version: %s \n", GIT_TAG); - // fprintf (stderr,"MBElib version %s\n", versionstr); + fprintf (stderr, "Github Build Version: %s%s \n", GIT_TAG); + fprintf (stderr,"MBElib version %s\n", versionstr); initOpts (&opts); initState (&state); @@ -2135,9 +2152,14 @@ main (int argc, char **argv) } else { - opts.audio_in_type = 5; - fprintf (stderr, "TCP Connection Failure - Using Pulse Audio Input.\n"); + #ifdef AERO_BUILD sprintf (opts.audio_in_dev, "%s", "/dev/dsp"); + opts.audio_in_type = 5; + #else + sprintf (opts.audio_in_dev, "%s", "pulse"); + fprintf (stderr, "TCP Connection Failure - Using %s Audio Input.\n", opts.audio_in_dev); + opts.audio_in_type = 0; + #endif } } @@ -2217,25 +2239,35 @@ main (int argc, char **argv) rtl_ok = 1; #endif + #ifdef AERO_BUILD 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"); sprintf (opts.audio_in_dev, "%s", "/dev/dsp"); opts.audio_in_type = 5; } + #else + if (rtl_ok == 0) //not set, means rtl support isn't compiled/available + { + fprintf (stderr, "RTL Support not enabled/compiled, falling back to Pulse Audio Audio Input.\n"); + sprintf (opts.audio_in_dev, "%s", "pulse"); + opts.audio_in_type = 0; + } + #endif } //doesn't work correctly, so just going to reroute to /dev/dsp instead - if((strncmp(opts.audio_in_dev, "udp", 3) == 0)) //udp socket input from SDR++, GQRX, and others - { - fprintf (stderr, "UDP Input not working, falling back to OSS /dev/dsp Audio Input.\n"); - sprintf (opts.audio_in_dev, "%s", "/dev/dsp"); - opts.audio_in_type = 5; - } + // if((strncmp(opts.audio_in_dev, "udp", 3) == 0)) //udp socket input from SDR++, GQRX, and others + // { + // fprintf (stderr, "UDP Input not working, falling back to OSS /dev/dsp Audio Input.\n"); + // sprintf (opts.audio_in_dev, "%s", "/dev/dsp"); + // opts.audio_in_type = 5; + // } int fmt; int speed = 48000; + //NOTE: Might can use this code in an ifdef to be able to use /dev/audio under padsp in Linux if((strncmp(opts.audio_in_dev, "/dev/audio", 10) == 0)) { sprintf (opts.audio_in_dev, "%s", "/dev/dsp"); @@ -2380,7 +2412,7 @@ main (int argc, char **argv) } opts.pulse_digi_rate_out = 48000; opts.pulse_digi_out_channels = 1; - if (opts.audio_out_type == 0) openPulseOutput(&opts); //need to open it up for output? + if (opts.audio_out_type == 0) openPulseOutput(&opts); if (opts.audio_out_type == 5) openAudioOutDevice (&opts, SAMPLE_RATE_OUT); } diff --git a/src/dsd_mbe.c b/src/dsd_mbe.c index 0032604..f3cdd17 100644 --- a/src/dsd_mbe.c +++ b/src/dsd_mbe.c @@ -611,13 +611,16 @@ processMbeFrame (dsd_opts * opts, dsd_state * state, char imbe_fr[8][23], char a } //end reverse mute test + #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 //OSS Specific Voice Preemption if dual voices on TDMA and one slot has preference over the other if (opts->slot_preference == 1 && opts->audio_out_type == 5 && opts->audio_out == 1 && state->dmrburstR == 16) { opts->audio_out = 0; preempt = 1; - if (opts->payload == 0) fprintf (stderr, " *MUTED*"); + if (opts->payload == 0) + fprintf (stderr, " *MUTED*"); } + #endif if (state->dmr_encL == 0 || opts->dmr_mute_encL == 0) { @@ -675,13 +678,16 @@ processMbeFrame (dsd_opts * opts, dsd_state * state, char imbe_fr[8][23], char a } //end reverse mute test + #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 //OSS Specific Voice Preemption if dual voices on TDMA and one slot has preference over the other if (opts->slot_preference == 0 && opts->audio_out_type == 5 && opts->audio_out == 1 && state->dmrburstL == 16) { opts->audio_out = 0; preempt = 1; - if (opts->payload == 0) fprintf (stderr, " *MUTED*"); + if (opts->payload == 0) + fprintf (stderr, " *MUTED*"); } + #endif if (state->dmr_encR == 0 || opts->dmr_mute_encR == 0) { diff --git a/src/dsd_ncurses.c b/src/dsd_ncurses.c index 79a7db1..db1a64c 100644 --- a/src/dsd_ncurses.c +++ b/src/dsd_ncurses.c @@ -1506,7 +1506,7 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state) src = 0; rn = 0; tgn = 0; - dcc = 0; + dcc = -1; tg = 0; tgR = 0; rd = 0; @@ -2082,17 +2082,18 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) //Start Printing Section erase(); -#ifdef LIMAZULUTWEAKS +#ifdef AERO_BUILD if (opts->ncurses_compact == 1) { printw ("------------------------------------------------------------------------------\n"); - printw ("| Digital Speech Decoder: LimaZulu Edition - Aero %s \n", "v2.0.0-99-ge390251 Win32"); + printw ("| Digital Speech Decoder: Florida Man Edition - Aero %s \n", GIT_TAG); + // printw ("| Digital Speech Decoder: Florida Man Edition - zDEV %s \n", "v2.0.0-100-gae58fab Win32"); } #else if (opts->ncurses_compact == 1) { printw ("------------------------------------------------------------------------------\n"); - printw ("| Digital Speech Decoder: Florida Man Edition - Aero %s \n", "v2.0.0-99-ge390251 Win32"); + printw ("| Digital Speech Decoder: Florida Man Edition - zDEV %s \n", GIT_TAG); } #endif if (opts->ncurses_compact == 0) @@ -2104,8 +2105,14 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) if (i == 1) printw (" ESC to Menu"); if (i == 2) printw (" 'q' to Quit "); if (i == 4) printw (" MBElib %s", versionstr); - if (i == 5) printw (" %s ", "Aero Win32"); //printw (" %s \n", GIT_TAG); - if (i == 6) printw (" %s \n", "v2.0.0-99-ge390251"); //printw (" %s \n", GIT_TAG); + #ifdef AERO_BUILD + if (i == 5) printw (" %s ", "Aero Win32"); + if (i == 6) printw (" %s \n", GIT_TAG); //don't have the git dev package on my cygwin32 bit environment and can't get it now (32-bit no longer supported) + // if (i == 6) printw (" v2.0.0-100-gae58fab \n"); //put appropriate version in here later, or find the GIT_TAG package (git_revision) to build in cygwin + #else + if (i == 5) printw (" %s ", "zDEV BUILD"); + if (i == 6) printw (" %s \n", GIT_TAG); + #endif else printw ("\n"); } attroff(COLOR_PAIR(6)); //6 @@ -2539,7 +2546,13 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) //This is the new one printw ("%s | ", state->call_string[0]); printw ("%s ", DMRBusrtTypes[state->dmrburstL]); - if (opts->slot_preference == 1 && opts->audio_out_type == 5 && opts->audio_out == 1 && state->dmrburstR == 16 && state->dmrburstL == 16) printw ("*M*"); + + #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 + // + if (opts->slot_preference == 1 && opts->audio_out_type == 5 && opts->audio_out == 1 && state->dmrburstR == 16 && state->dmrburstL == 16) printw ("*M*"); + // + #endif + printw ("\n"); printw ("| V XTRA | "); //10 spaces @@ -2735,7 +2748,11 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) //THIS IS THE NEW ONE printw ("%s | ", state->call_string[1]); printw ("%s ", DMRBusrtTypes[state->dmrburstR]); + #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 + // if (opts->slot_preference == 0 && opts->audio_out_type == 5 && opts->audio_out == 1 && state->dmrburstR == 16 && state->dmrburstL == 16) printw ("*M*"); + // + #endif printw ("\n"); printw ("| V XTRA | "); //10 spaces @@ -3273,23 +3290,26 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) } } -// -// if (c == 32) //'space bar' replay last bin file (rework to do wav files too?) -// { -// struct stat stat_buf; -// if (stat(opts->audio_in_dev, &stat_buf) != 0) -// { -// fprintf (stderr,"Error, couldn't open %s\n", opts->audio_in_dev); -// goto SKIPR; -// } -// if (S_ISREG(stat_buf.st_mode)) -// { -// opts->symbolfile = fopen(opts->audio_in_dev, "r"); -// opts->audio_in_type = 4; //symbol capture bin files -// } -// SKIPR: ; //do nothing -// } -// + #ifdef AERO_BUILD + //do nothing + #else + if (c == 32) //'space bar' replay last bin file (rework to do wav files too?) + { + struct stat stat_buf; + if (stat(opts->audio_in_dev, &stat_buf) != 0) + { + fprintf (stderr,"Error, couldn't open %s\n", opts->audio_in_dev); + goto SKIPR; + } + if (S_ISREG(stat_buf.st_mode)) + { + opts->symbolfile = fopen(opts->audio_in_dev, "r"); + opts->audio_in_type = 4; //symbol capture bin files + } + SKIPR: ; //do nothing + } + #endif + if (c == 80) //'P' key - start per call wav files @@ -3324,30 +3344,33 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) } // - // if (c == 115) //'s' key, stop playing wav or symbol in files - // { - // if (opts->symbolfile != NULL) - // { - // if (opts->audio_in_type == 4) - // { - // fclose(opts->symbolfile); - // } - // } + #ifdef AERO_BUILD //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 + { + if (opts->symbolfile != NULL) + { + if (opts->audio_in_type == 4) + { + fclose(opts->symbolfile); + } + } - // if (opts->audio_in_type == 2) //wav input file - // { - // sf_close(opts->audio_in_file); - // } + if (opts->audio_in_type == 2) //wav input file + { + sf_close(opts->audio_in_file); + } - // if (opts->audio_out_type == 0) - // { - // opts->audio_in_type = 0; - // openPulseInput(opts); - // } - // else opts->audio_in_type = 5;//cleanupAndExit(opts, state); + if (opts->audio_out_type == 0) + { + opts->audio_in_type = 0; + openPulseInput(opts); + } + else opts->audio_in_type = 5;//cleanupAndExit(opts, state); - // } - // + } + #endif //test jumping back to CC on group lockout instead of random frequency to break framesync if (state->lasttg != 0 && opts->frame_provoice != 1 && c == 49) //'1' key, lockout slot 1 or conventional tg from tuning/playback during session diff --git a/src/dsd_symbol.c b/src/dsd_symbol.c index 278cfea..d3bcd59 100644 --- a/src/dsd_symbol.c +++ b/src/dsd_symbol.c @@ -119,7 +119,11 @@ getSymbol (dsd_opts * opts, dsd_state * state, int have_sync) openPulseInput(opts); //open pulse input } //else cleanup and exit - else cleanupAndExit(opts, state); + else + { + if (opts->use_ncurses_terminal == 1) ncursesClose(opts); + cleanupAndExit(opts, state); + } } } else if (opts->audio_in_type == 3) @@ -140,6 +144,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 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"); @@ -189,12 +194,56 @@ getSymbol (dsd_opts * opts, dsd_state * state, int have_sync) { fprintf (stderr, "Connection to TCP Server Disconnected.\n"); fprintf (stderr, "Closing DSD-FME.\n"); + if (opts->use_ncurses_terminal == 1) ncursesClose(opts); cleanupAndExit(opts, state); } } } + #else + 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"); + sample = 0; + sf_close(opts->tcp_file_in); //close current connection on this end + sleep (3); //halt all processing and wait 3 seconds + + //attempt to reconnect to socket + opts->tcp_sockfd = 0; + opts->tcp_sockfd = Connect(opts->tcp_hostname, opts->tcp_portno); + if (opts->tcp_sockfd != 0) + { + //reset audio input stream + opts->audio_in_file_info = calloc(1, sizeof(SF_INFO)); + opts->audio_in_file_info->samplerate=opts->wav_sample_rate; + opts->audio_in_file_info->channels=1; + opts->audio_in_file_info->seekable=0; + opts->audio_in_file_info->format=SF_FORMAT_RAW|SF_FORMAT_PCM_16|SF_ENDIAN_LITTLE; + opts->tcp_file_in = sf_open_fd(opts->tcp_sockfd, SFM_READ, opts->audio_in_file_info, 0); + + if(opts->tcp_file_in == NULL) + { + fprintf(stderr, "Error, couldn't Reconnect to TCP with libsndfile: %s\n", sf_strerror(NULL)); + } + else fprintf (stderr, "TCP Socket Reconnected Successfully.\n"); + } + else fprintf (stderr, "TCP Socket Connection Error.\n"); + + //now retry reading sample + result = sf_read_short(opts->tcp_file_in, &sample, 1); + if (result == 0) { + sf_close(opts->tcp_file_in); + opts->audio_in_type = 0; //set input type + opts->tcp_sockfd = 0; //added this line so we will know if it connected when using ncurses terminal keyboard shortcut + openPulseInput(opts); //open pulse inpput + sample = 0; //zero sample on bad result, keep the ball rolling + fprintf (stderr, "Connection to TCP Server Disconnected.\n"); + } + + } + #endif + } //tcp socket input from SDR++ -- old method to open pulse or quit right away @@ -480,7 +529,11 @@ getSymbol (dsd_opts * opts, dsd_state * state, int have_sync) openPulseInput(opts); //open pulse input } //else cleanup and exit - else cleanupAndExit(opts, state); + else + { + if (opts->use_ncurses_terminal == 1) ncursesClose(opts); + cleanupAndExit(opts, state); + } } //assign symbol/dibit values based on modulation type diff --git a/src/p25p2_frame.c b/src/p25p2_frame.c index d094e2a..ebad497 100644 --- a/src/p25p2_frame.c +++ b/src/p25p2_frame.c @@ -475,10 +475,16 @@ void process_4V (dsd_opts * opts, dsd_state * state) fprintf (stderr, "\n"); } - //set to 16 for MBE OSS shim to preempt audio - if (state->currentslot == 0) state->dmrburstL = 16; - else state->dmrburstR = 16; - + #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 16 for MBE OSS shim to preempt audio + if (state->currentslot == 0) state->dmrburstL = 16; + else state->dmrburstR = 16; + } + #endif + processMbeFrame (opts, state, NULL, ambe_fr1, NULL); processMbeFrame (opts, state, NULL, ambe_fr2, NULL); processMbeFrame (opts, state, NULL, ambe_fr3, NULL); @@ -630,9 +636,15 @@ void process_2V (dsd_opts * opts, dsd_state * state) fprintf (stderr, "\n"); } - //set to 16 for MBE OSS shim to preempt audio - if (state->currentslot == 0) state->dmrburstL = 16; - else state->dmrburstR = 16; + #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 16 for MBE OSS shim to preempt audio + if (state->currentslot == 0) state->dmrburstL = 16; + else state->dmrburstR = 16; + } + #endif processMbeFrame (opts, state, NULL, ambe_fr1, NULL); processMbeFrame (opts, state, NULL, ambe_fr2, NULL); @@ -860,14 +872,16 @@ void processP2 (dsd_opts * opts, dsd_state * state) state->dmr_stereo = 0; state->p2_is_lcch = 0; - //bugfix for OSS dmrbust 16 shim, reset both to 0 upon exit - //in case or marginal signal and both get stuck on 16, indefinitely muting the non-preferred slot - //but...this can also cause at least one 4v/2v to get through on the other slot if the sync lines up that way + //bugfix for OSS slot preferred pre-emption on dual voices + //in case or marginal signal or bad decoding and both get stuck on 16, indefinitely muting the non-preferred slot + //BUG: This causes an annoying blink blink in ncurses, just FYI -- find a better workaround + #ifdef AERO_BUILD if (opts->audio_out_type == 5) { //set both to blank value state->dmrburstL = 17; state->dmrburstR = 17; } + #endif fprintf (stderr, "\n"); } diff --git a/src/p25p2_xcch.c b/src/p25p2_xcch.c index ea3ea98..64b0aa7 100644 --- a/src/p25p2_xcch.c +++ b/src/p25p2_xcch.c @@ -250,8 +250,17 @@ 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 - //if (state->currentslot == 1) state->dmrburstL = 21; - //else state->dmrburstR = 21; + #ifdef AERO_BUILD + if (opts->audio_out_type != 5) + { + if (state->currentslot == 1) state->dmrburstL = 21; + else state->dmrburstR = 21; + } + #else + if (state->currentslot == 1) state->dmrburstL = 21; + else state->dmrburstR = 21; + #endif + fprintf (stderr, " MAC_ACTIVE "); fprintf (stderr, "%s", KYEL); process_MAC_VPDU(opts, state, 1, SMAC); @@ -508,8 +517,17 @@ 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 - //if (state->currentslot == 0) state->dmrburstL = 21; - //else state->dmrburstR = 21; + #ifdef AERO_BUILD + if (opts->audio_out_type != 5) + { + if (state->currentslot == 0) state->dmrburstL = 21; + else state->dmrburstR = 21; + } + #else + if (state->currentslot == 0) state->dmrburstL = 21; + else state->dmrburstR = 21; + #endif + fprintf (stderr, " MAC_ACTIVE "); fprintf (stderr, "%s", KYEL); process_MAC_VPDU(opts, state, 0, FMAC);