mackron / dr_libs

Audio decoding libraries for C/C++, each in a single source file.
Other
1.24k stars 205 forks source link

How to update wav size info when I generating a wav file? #245

Closed maxxfire closed 1 year ago

maxxfire commented 1 year ago

When I create and write to a wav file. Is there a way to update wav file size periodically? Because the upper level user may not invoke the drwav_close() at last. The writting process may interrupted at any time. And finally the wav size will not be correclty setted. So does there has a API which can update the wav size, for example: drwav_update_chunk_size(...), or something like that. Thanks.

maxxfire commented 1 year ago

It just like sync/flush data size to the wav file.

mackron commented 1 year ago

No, no there's no way to do that. You would have to detect the interruption and call drwav_close().

The writing functionality in dr_wav is only basic. It was never really intended on being a full featured and robust writer. I added it so I had a simple way of writing out audio data for testing purposes for my other audio work. However, I think the suggestion mentioned in this ticket addresses this particular issue so it might make it in at some point (no promises): https://github.com/mackron/dr_libs/issues/211.

(Moving to the discussion section.)