mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-06-08 23:22:46 -04:00
Added "artist" and "title" (=frequency) info chunks to WAV files
This commit is contained in:
parent
7f97a090e4
commit
96880d2fc6
5 changed files with 53 additions and 17 deletions
|
@ -124,9 +124,11 @@ uint16_t WAVFileReader::bits_per_sample() {
|
|||
|
||||
Optional<File::Error> WAVFileWriter::create(
|
||||
const std::filesystem::path& filename,
|
||||
size_t sampling_rate_set
|
||||
size_t sampling_rate_set,
|
||||
std::string title_set
|
||||
) {
|
||||
sampling_rate = sampling_rate_set;
|
||||
title = title_set;
|
||||
const auto create_error = FileWriter::create(filename);
|
||||
if( create_error.is_valid() ) {
|
||||
return create_error;
|
||||
|
@ -136,7 +138,7 @@ Optional<File::Error> WAVFileWriter::create(
|
|||
}
|
||||
|
||||
Optional<File::Error> WAVFileWriter::update_header() {
|
||||
header_t header { sampling_rate, (uint32_t)bytes_written };
|
||||
header_t header { sampling_rate, (uint32_t)bytes_written - sizeof(header_t), info_chunk_size };
|
||||
const auto seek_0_result = file.seek(0);
|
||||
if( seek_0_result.is_error() ) {
|
||||
return seek_0_result.error();
|
||||
|
@ -152,3 +154,16 @@ Optional<File::Error> WAVFileWriter::update_header() {
|
|||
}
|
||||
return { };
|
||||
}
|
||||
|
||||
Optional<File::Error> WAVFileWriter::write_tags() {
|
||||
tags_t tags { title };
|
||||
|
||||
const auto write_result = file.write(&tags, sizeof(tags));
|
||||
if( write_result.is_error() ) {
|
||||
return write_result.error();
|
||||
}
|
||||
|
||||
info_chunk_size = sizeof(tags);
|
||||
|
||||
return { };
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue