posix/wav_util: reset wav file pointer after closing it

This commit is contained in:
Matthias Ringwald 2021-04-13 09:55:55 +02:00
parent 14dd575830
commit 90af00b83e

View File

@ -133,11 +133,12 @@ int wav_writer_open(const char * filepath, int num_channels, int sampling_freque
}
int wav_writer_close(void){
if (!wav_writer_state.wav_file) return 0;
if (wav_writer_state.wav_file == NULL) return 0;
rewind(wav_writer_state.wav_file);
write_wav_header(wav_writer_state.wav_file, wav_writer_state.total_num_samples,
wav_writer_state.num_channels, wav_writer_state.sampling_frequency);
fclose(wav_writer_state.wav_file);
wav_writer_state.wav_file = NULL;
return 0;
}