mirror of
https://github.com/lwvmobile/dsd-fme.git
synced 2026-11-17 11:17:22 -05:00
Append WAV Files
Append to WAV files as opposed to overwriting them each time Minor Tweaks to NCURSES terminal in regards to NXDN, update call log on systems with RAN of 0
This commit is contained in:
@@ -89,7 +89,10 @@ saveAmbe2450Data (dsd_opts * opts, dsd_state * state, char *ambe_d)
|
|||||||
|
|
||||||
fputc (b, opts->mbe_out_f);
|
fputc (b, opts->mbe_out_f);
|
||||||
}
|
}
|
||||||
//fprintf(stderr, "\n");
|
if (opts->payload == 1)
|
||||||
|
{
|
||||||
|
fprintf(stderr, " err = [%X] [%X] ", state->errs, state->errs2);
|
||||||
|
}
|
||||||
b = ambe_d[48];
|
b = ambe_d[48];
|
||||||
fputc (b, opts->mbe_out_f);
|
fputc (b, opts->mbe_out_f);
|
||||||
fflush (opts->mbe_out_f);
|
fflush (opts->mbe_out_f);
|
||||||
@@ -237,8 +240,12 @@ closeMbeOutFile (dsd_opts * opts, dsd_state * state)
|
|||||||
fclose (opts->mbe_out_f);
|
fclose (opts->mbe_out_f);
|
||||||
opts->mbe_out_f = NULL;
|
opts->mbe_out_f = NULL;
|
||||||
strftime (datestr, 31, "%Y-%m-%d-%H%M%S", &timep);
|
strftime (datestr, 31, "%Y-%m-%d-%H%M%S", &timep);
|
||||||
//sprintf (newfilename, "nac%X-%s-tg%i%s", state->nac, datestr, talkgroup, ext);
|
|
||||||
sprintf (newfilename, "%s%s", datestr, ext); //this one
|
sprintf (newfilename, "%s%s", datestr, ext); //this one
|
||||||
|
if (state->lastsynctype == 0 || state->lastsynctype)
|
||||||
|
{
|
||||||
|
sprintf (newfilename, "%s-nac%X-tg%i%s", datestr, state->nac, talkgroup, ext);
|
||||||
|
}
|
||||||
sprintf (new_path, "%s%s", opts->mbe_out_dir, newfilename);
|
sprintf (new_path, "%s%s", opts->mbe_out_dir, newfilename);
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
sprintf (shell, "move %s %s", opts->mbe_out_path, new_path);
|
sprintf (shell, "move %s %s", opts->mbe_out_path, new_path);
|
||||||
@@ -307,13 +314,12 @@ void
|
|||||||
openWavOutFile (dsd_opts * opts, dsd_state * state)
|
openWavOutFile (dsd_opts * opts, dsd_state * state)
|
||||||
{
|
{
|
||||||
|
|
||||||
// opts->wav_out_f = fopen (opts->wav_out_file, "w");
|
|
||||||
|
|
||||||
SF_INFO info;
|
SF_INFO info;
|
||||||
info.samplerate = 8000; //8000
|
info.samplerate = 8000; //8000
|
||||||
info.channels = 1;
|
info.channels = 1;
|
||||||
info.format = SF_FORMAT_WAV | SF_FORMAT_PCM_16 | SF_ENDIAN_LITTLE;
|
info.format = SF_FORMAT_WAV | SF_FORMAT_PCM_16 | SF_ENDIAN_LITTLE;
|
||||||
opts->wav_out_f = sf_open (opts->wav_out_file, SFM_WRITE, &info);
|
//opts->wav_out_f = sf_open (opts->wav_out_file, SFM_WRITE, &info);
|
||||||
|
opts->wav_out_f = sf_open (opts->wav_out_file, SFM_RDWR, &info); //RDWR will append to file instead of overwrite file
|
||||||
|
|
||||||
if (opts->wav_out_f == NULL)
|
if (opts->wav_out_f == NULL)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -294,7 +294,7 @@ initState (dsd_state * state)
|
|||||||
state->debug_header_errors = 0;
|
state->debug_header_errors = 0;
|
||||||
state->debug_header_critical_errors = 0;
|
state->debug_header_critical_errors = 0;
|
||||||
|
|
||||||
state->nxdn_last_ran = 0;
|
state->nxdn_last_ran = -1;
|
||||||
|
|
||||||
#ifdef TRACE_DSD
|
#ifdef TRACE_DSD
|
||||||
state->debug_sample_index = 0;
|
state->debug_sample_index = 0;
|
||||||
@@ -328,17 +328,14 @@ usage ()
|
|||||||
fprintf (stderr," -z <num> Frame rate for datascope\n");
|
fprintf (stderr," -z <num> Frame rate for datascope\n");
|
||||||
fprintf (stderr,"\n");
|
fprintf (stderr,"\n");
|
||||||
fprintf (stderr,"Input/Output options:\n");
|
fprintf (stderr,"Input/Output options:\n");
|
||||||
//fprintf (stderr," -i <device> Audio input device (default is /dev/audio, - for piped stdin, rtl for rtl device)\n");
|
|
||||||
fprintf (stderr," -i <device> Audio input device (default is pulse audio, - for piped stdin, rtl for rtl device)\n");
|
fprintf (stderr," -i <device> Audio input device (default is pulse audio, - for piped stdin, rtl for rtl device)\n");
|
||||||
//fprintf (stderr," -o <device> Audio output device (default is /dev/audio)\n");
|
|
||||||
fprintf (stderr," -o <device> Audio output device (default is pulse audio)\n");
|
fprintf (stderr," -o <device> Audio output device (default is pulse audio)\n");
|
||||||
fprintf (stderr," -d <dir> Create mbe data files, use this directory\n");
|
fprintf (stderr," -d <dir> Create mbe data files, use this directory\n");
|
||||||
fprintf (stderr," -r <files> Read/Play saved mbe data from file(s)\n");
|
fprintf (stderr," -r <files> Read/Play saved mbe data from file(s)\n");
|
||||||
fprintf (stderr," -g <num> Audio output gain (default = 0 = auto, disable = -1)\n");
|
fprintf (stderr," -g <num> Audio output gain (default = 0 = auto, disable = -1)\n");
|
||||||
//fprintf (stderr," -n Do not send synthesized speech to audio output device\n");
|
|
||||||
fprintf (stderr," -w <file> Output synthesized speech to a .wav file\n");
|
fprintf (stderr," -w <file> Output synthesized speech to a .wav file\n");
|
||||||
fprintf (stderr," -a Display port audio devices\n");
|
//fprintf (stderr," -a Display port audio devices\n");
|
||||||
fprintf (stderr," -W Monitor Source Audio When No Sync Detected (WIP!)\n");
|
//fprintf (stderr," -W Monitor Source Audio When No Sync Detected (WIP!)\n");
|
||||||
fprintf (stderr,"\n");
|
fprintf (stderr,"\n");
|
||||||
fprintf (stderr,"RTL-SDR options:\n");
|
fprintf (stderr,"RTL-SDR options:\n");
|
||||||
fprintf (stderr," -c <hertz> RTL-SDR Frequency\n");
|
fprintf (stderr," -c <hertz> RTL-SDR Frequency\n");
|
||||||
@@ -382,8 +379,8 @@ usage ()
|
|||||||
fprintf (stderr," (default=36)\n");
|
fprintf (stderr," (default=36)\n");
|
||||||
fprintf (stderr," -M <num> Min/Max buffer size for QPSK decision point tracking\n");
|
fprintf (stderr," -M <num> Min/Max buffer size for QPSK decision point tracking\n");
|
||||||
fprintf (stderr," (default=15)\n");
|
fprintf (stderr," (default=15)\n");
|
||||||
fprintf (stderr," -n Reset P25 Heuristics and initState variables on mixed decoding signal\n");
|
fprintf (stderr," -n Reset P25 Heuristics and initState variables on mixed signal decoding\n");
|
||||||
fprintf (stderr," Helps when decoding multiple signal types at same time\n");
|
fprintf (stderr," Helps when decoding mixed signal types at same time\n");
|
||||||
fprintf (stderr," (WiP! May Cause Slow Memory Leak - Experimental)\n");
|
fprintf (stderr," (WiP! May Cause Slow Memory Leak - Experimental)\n");
|
||||||
fprintf (stderr," -Z Log MBE Payload to console\n");
|
fprintf (stderr," -Z Log MBE Payload to console\n");
|
||||||
fprintf (stderr,"\n");
|
fprintf (stderr,"\n");
|
||||||
@@ -786,7 +783,7 @@ main (int argc, char **argv)
|
|||||||
case 'w':
|
case 'w':
|
||||||
strncpy(opts.wav_out_file, optarg, 1023);
|
strncpy(opts.wav_out_file, optarg, 1023);
|
||||||
opts.wav_out_file[1023] = '\0';
|
opts.wav_out_file[1023] = '\0';
|
||||||
fprintf (stderr,"Writing audio to file %s\n", opts.wav_out_file);
|
fprintf (stderr,"Writing + Appending audio to file %s\n", opts.wav_out_file);
|
||||||
openWavOutFile (&opts, &state);
|
openWavOutFile (&opts, &state);
|
||||||
break;
|
break;
|
||||||
case 'B':
|
case 'B':
|
||||||
|
|||||||
@@ -106,6 +106,7 @@ void ncursesOpen ()
|
|||||||
init_pair(5, COLOR_MAGENTA, COLOR_BLACK); //Magenta for no frame sync/signal
|
init_pair(5, COLOR_MAGENTA, COLOR_BLACK); //Magenta for no frame sync/signal
|
||||||
noecho();
|
noecho();
|
||||||
cbreak();
|
cbreak();
|
||||||
|
|
||||||
//fprintf (stderr, "Opening NCurses Terminal. \n");
|
//fprintf (stderr, "Opening NCurses Terminal. \n");
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -164,7 +165,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
|
|||||||
|
|
||||||
//if ( (state->nxdn_last_rid != src && src > 0) || (state->nxdn_last_ran != rn && rn > 0) ) //find condition to make this work well, probably if last != local last variables
|
//if ( (state->nxdn_last_rid != src && src > 0) || (state->nxdn_last_ran != rn && rn > 0) ) //find condition to make this work well, probably if last != local last variables
|
||||||
//if ( (call_matrix[9][2] != src && src > 0) || (call_matrix[9][1] != rn && rn > 0) ) //NXDN working well now with this, updates immediately and only once
|
//if ( (call_matrix[9][2] != src && src > 0) || (call_matrix[9][1] != rn && rn > 0) ) //NXDN working well now with this, updates immediately and only once
|
||||||
if ( call_matrix[9][2] != src && src > 0 && rn > 0 ) //NXDN working well now with this, updates immediately and only once
|
if ( call_matrix[9][2] != src && src > 0 && rn > -1 ) //NXDN working well now with this, updates immediately and only once
|
||||||
{
|
{
|
||||||
for (short int k = 0; k < 9; k++)
|
for (short int k = 0; k < 9; k++)
|
||||||
{
|
{
|
||||||
@@ -260,7 +261,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
|
|||||||
}
|
}
|
||||||
if (opts->wav_out_file[0] != 0)
|
if (opts->wav_out_file[0] != 0)
|
||||||
{
|
{
|
||||||
printw ("| Writing Audio WAV to file %s\n", opts->wav_out_file);
|
printw ("| Appending Audio WAV to file %s\n", opts->wav_out_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
printw ("------------------------------------------------------------------------------\n");
|
printw ("------------------------------------------------------------------------------\n");
|
||||||
@@ -295,7 +296,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
|
|||||||
src = state->nxdn_last_rid;
|
src = state->nxdn_last_rid;
|
||||||
//rn = state->nxdn_last_ran;
|
//rn = state->nxdn_last_ran;
|
||||||
}
|
}
|
||||||
if (state->nxdn_last_ran > 0 && state->nxdn_last_rid != rn);
|
if (state->nxdn_last_ran > -1 && state->nxdn_last_rid != rn);
|
||||||
{
|
{
|
||||||
//src = state->nxdn_last_rid;
|
//src = state->nxdn_last_rid;
|
||||||
rn = state->nxdn_last_ran;
|
rn = state->nxdn_last_ran;
|
||||||
@@ -344,7 +345,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
|
|||||||
printw("| ALG: [0x%02X] ", state->payload_algid);
|
printw("| ALG: [0x%02X] ", state->payload_algid);
|
||||||
printw("KEY: [0x%04X] ", state->payload_keyid);
|
printw("KEY: [0x%04X] ", state->payload_keyid);
|
||||||
//printw("MFG: [0x%X] ", state->payload_mfid); //no way of knowing if this is accurate info yet
|
//printw("MFG: [0x%X] ", state->payload_mfid); //no way of knowing if this is accurate info yet
|
||||||
if (state->payload_keyid != 0 && state->carrier == 1)
|
if (state->payload_algid != 0x80 && state->carrier == 1)
|
||||||
{
|
{
|
||||||
attron(COLOR_PAIR(2));
|
attron(COLOR_PAIR(2));
|
||||||
printw("**ENC**");
|
printw("**ENC**");
|
||||||
|
|||||||
Reference in New Issue
Block a user