mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-12-24 23:09:26 -05:00
Move WAV structs outside of writer.
This commit is contained in:
parent
1a2fd3e127
commit
43c4584a32
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user