diff --git a/include/dsd.h b/include/dsd.h index 9895867..aefe2b4 100644 --- a/include/dsd.h +++ b/include/dsd.h @@ -374,7 +374,7 @@ typedef struct uint8_t trunk_tune_enc_calls; //OSS audio - slot preference - uint8_t slot_preference; + int slot_preference; //'DSP' Format Output uint8_t use_dsp_output; diff --git a/src/dsd_main.c b/src/dsd_main.c index 428442f..e7b9a88 100644 --- a/src/dsd_main.c +++ b/src/dsd_main.c @@ -1365,7 +1365,7 @@ main (int argc, char **argv) } #ifdef AERO_BUILD - fprintf (stderr, "Build Version: v2.1 Win32 \n"); + fprintf (stderr, "Build Version: v2.1 Win32 \n"); #else fprintf (stderr, "Build Version: %s \n", GIT_TAG); #endif @@ -1452,14 +1452,13 @@ main (int argc, char **argv) break; case 'z': - sscanf (optarg, "%c", &opts.slot_preference); - opts.slot_preference--; //user inputs 1 or 2, internally we want 0 and 1 + sscanf (optarg, "%d", &opts.slot_preference); + if (opts.slot_preference > 0) opts.slot_preference--; //user inputs 1 or 2, internally we want 0 and 1 if (opts.slot_preference > 1) opts.slot_preference = 1; fprintf (stderr, "TDMA (DMR and P2) Slot Voice Preference is Slot %d. \n", opts.slot_preference+1); break; //Enable Audio Smoothing for Upsampled Audio - case '0': case 'V': state.audio_smoothing = 1; break; @@ -2491,58 +2490,60 @@ main (int argc, char **argv) opts.playoffset = 0; opts.playoffsetR = 0; opts.delay = 0; - if (strlen(opts.wav_out_file) > 0 && opts.dmr_stereo_wav == 0) - { - openWavOutFile (&opts, &state); - } + + //open wav file should be handled directly by the -w switch now + // if (strlen(opts.wav_out_file) > 0 && opts.dmr_stereo_wav == 0) + // { + // openWavOutFile (&opts, &state); + // } + opts.pulse_digi_rate_out = 48000; opts.pulse_digi_out_channels = 1; if (opts.audio_out_type == 0) openPulseOutput(&opts); if (opts.audio_out_type == 5) openAudioOutDevice (&opts, SAMPLE_RATE_OUT); } + //this particular if-elseif-else could be rewritten to be a lot neater and simpler else if (strcmp (opts.audio_in_dev, opts.audio_out_dev) != 0) { opts.split = 1; opts.playoffset = 0; opts.playoffsetR = 0; opts.delay = 0; - if (strlen(opts.wav_out_file) > 0 && opts.dmr_stereo_wav == 0) - { - openWavOutFile (&opts, &state); - } - else - { - openAudioOutDevice (&opts, SAMPLE_RATE_OUT); - } + + //open wav file should be handled directly by the -w switch now + // if (strlen(opts.wav_out_file) > 0 && opts.dmr_stereo_wav == 0) + // openWavOutFile (&opts, &state); + + // else + openAudioInDevice (&opts); - - fprintf (stderr,"Press CTRL + C to close.\n"); + // fprintf (stderr,"Press CTRL + C to close.\n"); } - else + else { opts.split = 0; - opts.playoffset = 25; - opts.playoffsetR = 25; + opts.playoffset = 0; //not sure what the playoffset actually does for us + opts.playoffsetR = 0; opts.delay = 0; openAudioInDevice (&opts); - opts.audio_out_fd = opts.audio_in_fd; + // opts.audio_out_fd = opts.audio_in_fd; //not sure that this really does much anymore, other than cause problems } - if (opts.playfiles == 1) + if (opts.playfiles == 1) { state.aout_gain = 25; //BUGFIX: No audio output when playing back .amb/.imb files playMbeFiles (&opts, &state, argc, argv); } - else + else { liveScanner (&opts, &state); } - cleanupAndExit (&opts, &state); + cleanupAndExit (&opts, &state); - return (0); + return (0); } diff --git a/src/dsd_mbe.c b/src/dsd_mbe.c index a9bfa0a..a491d10 100644 --- a/src/dsd_mbe.c +++ b/src/dsd_mbe.c @@ -1037,7 +1037,7 @@ processMbeFrame (dsd_opts * opts, dsd_state * state, char imbe_fr[8][23], char a #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) + if (opts->slot_preference == 1 && opts->audio_out_type == 5 && opts->audio_out == 1 && (state->dmrburstR == 16 || state->dmrburstR == 21) ) { opts->audio_out = 0; preempt = 1; @@ -1107,7 +1107,7 @@ processMbeFrame (dsd_opts * opts, dsd_state * state, char imbe_fr[8][23], char a #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) + if (opts->slot_preference == 0 && opts->audio_out_type == 5 && opts->audio_out == 1 && (state->dmrburstL == 16 || state->dmrburstL == 21) ) { opts->audio_out = 0; preempt = 1; diff --git a/src/dsd_ncurses.c b/src/dsd_ncurses.c index 6f99240..0be7111 100644 --- a/src/dsd_ncurses.c +++ b/src/dsd_ncurses.c @@ -114,22 +114,22 @@ char * DMRBusrtTypes[32] = { "R-S ERR ", "CRC ERR ", "NULL ", - "Voice ", + "VOICE", " ", "INIT ", "INIT ", - "MAC PTT", //20 - "MAC ACTIVE", //21 - "MAC HANGTIME", //22 - "MAC PTT END", //23 - "MAC IDLE", //24 + "PTT", //20 MAC + "VOICE", //21 MAC_ACTIVE + "HANGTIME", //22 MAC + "PTT END", //23 MAC + "IDLE", //24 MAC "HDU", - "VOICE LDU", //26 - "VOICE LDU", - "TDU/TDULC", + "VOICE", //26 LDU1 + "VOICE", //27 LDU2 + "TDU/LC", "TSBK", - "MAC SIGNAL", - "MAC SIGNAL" + "SIGNAL", //MAC_SIGNAL + "SIGNAL" //MAC_SIGNAL }; @@ -2218,7 +2218,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) } if (opts->audio_in_type == 5) { - printw ("| OSS Audio Input: [%2i] kHz [1] Channel\n", SAMPLE_RATE_IN); + printw ("| OSS Audio Input: [%2i] kHz [1] Channel\n", SAMPLE_RATE_IN/1000); } if (opts->audio_in_type == 4) { @@ -2262,7 +2262,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) } if (opts->audio_out_type == 5) { - printw ("| OSS Audio Output: [%2i] kHz [1] Channel", SAMPLE_RATE_IN); + printw ("| OSS Audio Output: [%2i] kHz [1] Channel", SAMPLE_RATE_OUT/1000); if (state->audio_smoothing == 1) printw (" - Smoothing On"); printw (" \n"); } @@ -2651,7 +2651,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) #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*"); + if (opts->slot_preference == 1 && opts->audio_out_type == 5 && opts->audio_out == 1 && ( state->dmrburstL == 16 || state->dmrburstL == 21) && (state->dmrburstR == 16 || state->dmrburstR == 21)) printw ("*M*"); // #endif @@ -2853,7 +2853,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) 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*"); + if (opts->slot_preference == 0 && opts->audio_out_type == 5 && opts->audio_out == 1 && ( state->dmrburstL == 16 || state->dmrburstL == 21) && (state->dmrburstR == 16 || state->dmrburstR == 21) ) printw ("*M*"); // #endif printw ("\n"); diff --git a/src/p25p2_frame.c b/src/p25p2_frame.c index 8011ce9..bf1af3d 100644 --- a/src/p25p2_frame.c +++ b/src/p25p2_frame.c @@ -479,9 +479,9 @@ void process_4V (dsd_opts * opts, dsd_state * state) //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; + //set to 21 for MBE OSS shim to preempt audio + if (state->currentslot == 0) state->dmrburstL = 21; + else state->dmrburstR = 21; } #endif @@ -646,9 +646,9 @@ void process_2V (dsd_opts * opts, dsd_state * state) //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; + //set to 21 for MBE OSS shim to preempt audio + if (state->currentslot == 0) state->dmrburstL = 21; + else state->dmrburstR = 21; } #endif @@ -885,16 +885,5 @@ void processP2 (dsd_opts * opts, dsd_state * state) state->dmr_stereo = 0; state->p2_is_lcch = 0; - //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 95211cb..ca030d0 100644 --- a/src/p25p2_xcch.c +++ b/src/p25p2_xcch.c @@ -276,13 +276,13 @@ void process_SACCH_MAC_PDU (dsd_opts * opts, dsd_state * state, int payload[180] { if (state->currentslot == 1) { - state->dmrburstL = 21; + state->dmrburstL = 22; //close any open MBEout files if (opts->mbe_out_f != NULL) closeMbeOutFile (opts, state); } else { - state->dmrburstR = 21; + state->dmrburstR = 22; //close any open MBEout files if (opts->mbe_out_fR != NULL) closeMbeOutFileR (opts, state); }