diff --git a/dsd.h b/dsd.h index 4290434..ebe0ac4 100644 --- a/dsd.h +++ b/dsd.h @@ -76,6 +76,7 @@ typedef struct int playoffset; char mbe_out_dir[1024]; char mbe_out_file[1024]; + char mbe_out_path[1024]; FILE *mbe_out_f; float audio_gain; int audio_out; diff --git a/dsd_file.c b/dsd_file.c index 25fcbc9..2286744 100644 --- a/dsd_file.c +++ b/dsd_file.c @@ -168,7 +168,7 @@ void closeMbeOutFile (dsd_opts * opts, dsd_state * state) { - char shell[255], newfilename[64], ext[5], datestr[32]; + char shell[255], newfilename[64], ext[5], datestr[32], new_path[1024]; char tgid[17]; int sum, i, j; int talkgroup; @@ -212,7 +212,8 @@ closeMbeOutFile (dsd_opts * opts, dsd_state * state) opts->mbe_out_f = NULL; strftime (datestr, 31, "%Y-%m-%d-%H%M%S", &timep); sprintf (newfilename, "nac%X-%s-tg%i%s", state->nac, datestr, talkgroup, ext); - sprintf (shell, "mv %s %s", opts->mbe_out_file, newfilename); + sprintf (new_path, "%s%s", opts->mbe_out_dir, newfilename); + sprintf (shell, "mv %s %s", opts->mbe_out_path, new_path); result = system (shell); state->tgcount = 0; @@ -256,10 +257,13 @@ openMbeOutFile (dsd_opts * opts, dsd_state * state) gettimeofday (&tv, NULL); sprintf (opts->mbe_out_file, "%i%s", (int) tv.tv_sec, ext); - opts->mbe_out_f = fopen (opts->mbe_out_file, "w"); + + sprintf(opts->mbe_out_path, "%s%s", opts->mbe_out_dir, opts->mbe_out_file); + + opts->mbe_out_f = fopen (opts->mbe_out_path, "w"); if (opts->mbe_out_f == NULL) { - printf ("Error, couldn't open %s\n", opts->mbe_out_file); + printf ("Error, couldn't open %s\n", opts->mbe_out_path); } // write magic @@ -273,7 +277,7 @@ openWavOutFile (dsd_opts * opts, dsd_state * state) { // opts->wav_out_f = fopen (opts->wav_out_file, "w"); - + SF_INFO info; info.samplerate = 8000; info.channels = 1; @@ -287,7 +291,7 @@ openWavOutFile (dsd_opts * opts, dsd_state * state) } // state->wav_out_bytes = 0; - + } void diff --git a/dsd_main.c b/dsd_main.c index 74dca94..730f34f 100644 --- a/dsd_main.c +++ b/dsd_main.c @@ -103,6 +103,7 @@ initOpts (dsd_opts * opts) opts->playoffset = 0; opts->mbe_out_dir[0] = 0; opts->mbe_out_file[0] = 0; + opts->mbe_out_path[0] = 0; opts->mbe_out_f = NULL; opts->audio_gain = 0; opts->audio_out = 1;