WAV: Fix Issues with Per Call;

Fix Per Call Issue introduced with commit re-enabling single static wav file where single channel audio decode types would not write to per call temp wav files and be deleted after event history cycled them;

Fix Issue with YSF where double writes would occur in .wav files;

Fix Issue with M17 where incorrect rate audio would write to static .wav file by converting to stereo output;

Seperate Per Call and Create Method to Allow EDACS Analog Calls to be written to static wav file by downsampling and stereo interleaving audio to proper spec;

Issues were introduced in commit # c7b25c60af
This commit is contained in:
lwvmobile
2025-08-19 02:35:17 -04:00
parent 79084f26c6
commit 7428a87d80
4 changed files with 83 additions and 22 deletions

View File

@@ -425,11 +425,25 @@ void M17processCodec2_1600(dsd_opts * opts, dsd_state * state, uint8_t * payload
}
//WIP: Wav file saving -- still need a way to open/close/label wav files similar to call history
if(opts->wav_out_f != NULL && state->m17_enc == 0) //WAV
//Wav file saving
if(opts->wav_out_f != NULL && state->m17_enc == 0 && opts->dmr_stereo_wav == 1) //Per Call
{
sf_write_short(opts->wav_out_f, samp1, nsam);
}
else if (opts->wav_out_f != NULL && state->m17_enc == 0 && opts->static_wav_file == 1) //Static Wav File
{
//convert to stereo for new static wav file setup
short ss[nsam*2];
memset (ss, 0, sizeof(ss));
for (i = 0; i < nsam; i++)
{
ss[(i*2)+0] = samp1[i];
ss[(i*2)+1] = samp1[i];
}
sf_write_short(opts->wav_out_f, ss, nsam*2);
}
//TODO: Codec2 Raw file saving
// if(mbe_out_dir)
@@ -559,12 +573,37 @@ void M17processCodec2_3200(dsd_opts * opts, dsd_state * state, uint8_t * payload
}
//WIP: Wav file saving -- still need a way to open/close/label wav files similar to call history
if(opts->wav_out_f != NULL && state->m17_enc == 0) //WAV
//Wav file saving
if(opts->wav_out_f != NULL && state->m17_enc == 0 && opts->dmr_stereo_wav == 1) //WAV
{
sf_write_short(opts->wav_out_f, samp1, nsam);
sf_write_short(opts->wav_out_f, samp2, nsam);
}
else if (opts->wav_out_f != NULL && state->m17_enc == 0 && opts->static_wav_file == 1) //Static Wav File
{
//convert to stereo for new static wav file setup
short ss[nsam*2];
memset (ss, 0, sizeof(ss));
for (i = 0; i < nsam; i++)
{
ss[(i*2)+0] = samp1[i];
ss[(i*2)+1] = samp1[i];
}
sf_write_short(opts->wav_out_f, ss, nsam*2);
memset (ss, 0, sizeof(ss));
for (i = 0; i < nsam; i++)
{
ss[(i*2)+0] = samp2[i];
ss[(i*2)+1] = samp2[i];
}
sf_write_short(opts->wav_out_f, ss, nsam*2);
}
//TODO: Codec2 Raw file saving
// if(mbe_out_dir)