diff --git a/CMakeLists.txt b/CMakeLists.txt index 7ce21d3..f4c10a2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,11 +31,11 @@ if (PVC) add_definitions(-DPVCONVENTIONAL) endif () -#use cmake option -DNXDN=ON to enable new NXDN Sync Pattern Testing +#use cmake option -DNXDN=ON to enable the old NXDN Sync Pattern option(NXDN - "Build with new NXDN Sync Pattern Testing Enabled" OFF) + "Build with Old NXDN Sync Pattern Enabled" OFF) if (NXDN) - add_definitions(-DNXDNTESTSYNC) + add_definitions(-DNXDNOLDSYNC) endif () #use cmake option -DLZ=ON to enable LimaZulu Requested NXDN Tweaks @@ -45,6 +45,13 @@ if (LZ) add_definitions(-DLIMAZULUTWEAKS) endif () +#use cmake option -DTONES to change default location of the tones.wav files (lwvmobile precompiled 'Aero' releases only) +option(NXDN + "Build with tone wav files in the dsd-fme folder and not in /usr/share/" OFF) +if (TN) + add_definitions(-DTONES) +endif () + include(git_revision) git_describe(GIT_TAG) diff --git a/src/dsd_ncurses.c b/src/dsd_ncurses.c index ccf314e..9010489 100644 --- a/src/dsd_ncurses.c +++ b/src/dsd_ncurses.c @@ -133,16 +133,16 @@ char * DMRBusrtTypes[32] = { }; - +#ifdef TONES //NOTE: This option is purely for the precompiled version that gets distributed, not other user Cygwin builds void beeper (dsd_opts * opts, dsd_state * state, int type) { FILE *beep; char wav_name[1024] = {0}; - if (opts->pulse_digi_rate_out == 8000) strncpy(wav_name, "tone8.wav", 1023); if (opts->pulse_digi_rate_out == 48000) strncpy(wav_name, "tone48.wav", 1023); if (opts->pulse_digi_rate_out == 24000) strncpy(wav_name, "tone24.wav", 1023); if (opts->audio_out_type == 5) strncpy(wav_name, "tone48.wav", 1023); + wav_name[1023] = '\0'; struct stat stat_buf; if (stat(wav_name, &stat_buf) == 0) @@ -191,6 +191,61 @@ void beeper (dsd_opts * opts, dsd_state * state, int type) } +#else +void beeper (dsd_opts * opts, dsd_state * state, int type) +{ + FILE *beep; + char wav_name[1024] = {0}; + + if (opts->pulse_digi_rate_out == 8000) strncpy(wav_name, "/usr/share/tone8.wav", 1023); + if (opts->pulse_digi_rate_out == 48000) strncpy(wav_name, "/usr/share/tone48.wav", 1023); + if (opts->pulse_digi_rate_out == 24000) strncpy(wav_name, "/usr/share/tone24.wav", 1023); + wav_name[1023] = '\0'; + struct stat stat_buf; + if (stat(wav_name, &stat_buf) == 0) + { + beep = fopen (wav_name, "ro"); + uint8_t buf[1024]; + memset (buf, 0, sizeof(buf)); + short blip = 0; + int loop = 1; + while (loop == 1) + { + fread(buf, sizeof(buf), 1, beep); + if ( feof (beep) ) + { + loop = 0; + } + if (loop == 1) + { + //only beep on R if dmr_stereo is active and slot 2, else beep on L + if (type == 0 && opts->dmr_stereo == 1 && opts->audio_out == 1) + { + pa_simple_write(opts->pulse_digi_dev_out, buf, sizeof(buf), NULL); + //fprintf (stderr, "BEEP 0 24\n"); + } + if (type == 1 && opts->dmr_stereo == 1 && opts->audio_out == 1) + { + pa_simple_write(opts->pulse_digi_dev_outR, buf, sizeof(buf), NULL); + //fprintf (stderr, "BEEP 1 24\n"); + } + if (opts->dmr_stereo == 0 && opts->audio_out == 1) + { + pa_simple_write(opts->pulse_digi_dev_out, buf, sizeof(buf), NULL); + //fprintf (stderr, "BEEP 0 8\n"); + } + + + } + + } + + fclose (beep); + } + +} +#endif + char * getDateN(void) { char datename[80]; //bug in 32-bit Ubuntu when using date in filename, date is garbage text char * curr2;