mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-07-27 08:46:01 -04:00
WAV Viewer & Soundboard enhancements (8 or 16-bit WAV files) (#1849)
* WAV Viewer & Soundboard enhancements * Reduced width of sample rate field
This commit is contained in:
parent
bc035cff6a
commit
5ea1bff1e6
6 changed files with 129 additions and 58 deletions
|
@ -27,7 +27,7 @@ bool WAVFileReader::open(const std::filesystem::path& path) {
|
|||
size_t i = 0;
|
||||
char ch;
|
||||
const uint8_t tag_INAM[4] = {'I', 'N', 'A', 'M'};
|
||||
char title_buffer[32];
|
||||
char title_buffer[32]{0};
|
||||
uint32_t riff_size, data_end, title_size;
|
||||
size_t search_limit = 0;
|
||||
|
||||
|
@ -37,11 +37,17 @@ bool WAVFileReader::open(const std::filesystem::path& path) {
|
|||
return true;
|
||||
}
|
||||
|
||||
// Reinitialize to avoid old data when switching files
|
||||
title_string = "";
|
||||
sample_rate_ = 0;
|
||||
bytes_per_sample = 0;
|
||||
|
||||
auto error = file_.open(path);
|
||||
|
||||
if (!error.is_valid()) {
|
||||
file_.read((void*)&header, sizeof(header)); // Read header (RIFF and WAVE)
|
||||
|
||||
// TODO: Work needed here to process RIFF file format correctly, i.e. properly skip over LIST & INFO chunks
|
||||
riff_size = header.cksize + 8;
|
||||
data_start = header.fmt.cksize + 28;
|
||||
data_size_ = header.data.cksize;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue