summaryrefslogtreecommitdiff
path: root/Libraries/LibAudio/WavWriter.h
AgeCommit message (Collapse)Author
2020-02-06LibAudio: Implement Audio::WavWriterWilliam McPherson
This class mirrors WavLoader and uses the same variable names so they can be read side-by-side. In a simple use-case, you construct a WavWriter object with your file path and audio parameters, call write_samples() with your bytes and then either finalize() to finish writing the file or allow the destructor to do it automatically. finalize() is needed because the WAV header cannot be written until the size of the data section is known. You only need to call this manually if you want to write a WAV file and then immediately load it. You can also use one WavWriter instance multiple times by repeatedly calling finalize() and set_file().