Update .wav samples to use 'agbl' chunk to accomodate for vanilla's off-by-one loop end behavior (#712)
This commit is contained in:
@@ -396,6 +396,11 @@ void convert(const std::string& wav_file_str, const std::string& out_file_str,
|
||||
pitch_value = static_cast<uint32_t>(pitch * 1024.0);
|
||||
}
|
||||
|
||||
uint32_t loop_end = wf.loopEnd;
|
||||
if (wf.agbLoopEnd != 0) {
|
||||
loop_end = wf.agbLoopEnd;
|
||||
}
|
||||
|
||||
if (ot == out_type::binary) {
|
||||
// Binary output mode
|
||||
std::vector<uint8_t> bin_data;
|
||||
@@ -414,8 +419,7 @@ void convert(const std::string& wav_file_str, const std::string& out_file_str,
|
||||
bin_write_u32_le(bin_data, wf.loopStart);
|
||||
|
||||
// Bytes 12-15: loop end
|
||||
// wf.loopEnd is the exclusive end position; binary format expects (end - 1)
|
||||
bin_write_u32_le(bin_data, wf.loopEnd > 0 ? wf.loopEnd - 1 : 0);
|
||||
bin_write_u32_le(bin_data, loop_end);
|
||||
|
||||
// Write sample data
|
||||
if (ct == cmp_type::none)
|
||||
@@ -447,7 +451,7 @@ void convert(const std::string& wav_file_str, const std::string& out_file_str,
|
||||
|
||||
agb_out(fout, " .byte 0x%X, 0x0, 0x0, 0x%X\n", fmt, wf.loopEnabled ? 0x40 : 0x0);
|
||||
agb_out(fout, " .word 0x%08X @ Mid-C ~%f\n", pitch_value, pitch);
|
||||
agb_out(fout, " .word %u, %u\n", wf.loopStart, wf.loopEnd);
|
||||
agb_out(fout, " .word %u, %u\n", wf.loopStart, loop_end);
|
||||
|
||||
if (ct == cmp_type::none)
|
||||
convert_uncompressed(wf, fout);
|
||||
|
||||
Reference in New Issue
Block a user