Move WAV structs outside of writer.

This commit is contained in:
Jared Boone 2016-10-04 10:04:38 -07:00
parent 1a2fd3e127
commit 43c4584a32

View File

@ -29,33 +29,6 @@
#include <cstddef>
#include <cstdint>
class WAVFileWriter : public FileWriter {
public:
WAVFileWriter() = default;
WAVFileWriter(const WAVFileWriter&) = delete;
WAVFileWriter& operator=(const WAVFileWriter&) = delete;
WAVFileWriter(WAVFileWriter&&) = delete;
WAVFileWriter& operator=(WAVFileWriter&&) = delete;
~WAVFileWriter() {
update_header();
}
Optional<File::Error> create(
const std::filesystem::path& filename,
size_t sampling_rate
) {
sampling_rate = sampling_rate;
const auto create_error = FileWriter::create(filename);
if( create_error.is_valid() ) {
return create_error;
} else {
return update_header();
}
}
private:
struct fmt_pcm_t {
constexpr fmt_pcm_t(
const uint32_t sampling_rate
@ -105,6 +78,33 @@ private:
data_t data;
};
class WAVFileWriter : public FileWriter {
public:
WAVFileWriter() = default;
WAVFileWriter(const WAVFileWriter&) = delete;
WAVFileWriter& operator=(const WAVFileWriter&) = delete;
WAVFileWriter(WAVFileWriter&&) = delete;
WAVFileWriter& operator=(WAVFileWriter&&) = delete;
~WAVFileWriter() {
update_header();
}
Optional<File::Error> create(
const std::filesystem::path& filename,
size_t sampling_rate
) {
sampling_rate = sampling_rate;
const auto create_error = FileWriter::create(filename);
if( create_error.is_valid() ) {
return create_error;
} else {
return update_header();
}
}
private:
uint32_t sampling_rate;
uint32_t bytes_written;