Fix Loading Stereo Sound Data

This commit is contained in:
TheBrokenRail
2023-08-05 03:55:30 -04:00
committed by iProgramInCpp
parent b985edac32
commit cc3310b556
2 changed files with 5 additions and 2 deletions

View File

@@ -117,7 +117,7 @@ ALuint SoundSystemAL::get_buffer(const SoundDesc &sound) {
}
// Sound Data Size
int size = sound.m_header.m_length * sound.m_header.m_bytes_per_sample;
int size = sound.m_header.m_channels * sound.m_header.m_length * sound.m_header.m_bytes_per_sample;
// Create Buffer
ALuint buffer;

View File

@@ -108,16 +108,19 @@ def main():
include_all_str += '#include "' + item[0] + '.h"\n'
ostr = header_1 + header_2
channels = read_int_from_bytes(bytes, item[1] + 0)
data_length = read_int_from_bytes(bytes, item[1] + 12)
# @NOTE: All the PCM sound data is in `.data`. So there's no consts to be found.
ostr += 'PCMSoundHeader '+item[0]+' =\n{\n'
ostr += '\t' + str(read_int_from_bytes(bytes, item[1] + 0)) + ',\n'
ostr += '\t' + str(channels) + ',\n'
ostr += '\t' + str(read_int_from_bytes(bytes, item[1] + 4)) + ',\n'
ostr += '\t' + str(read_int_from_bytes(bytes, item[1] + 8)) + ',\n'
ostr += '\t' + str(data_length)
ostr += '\n};\n\n'
data_length *= channels
ostr += 'uint16_t '+item[0]+'_data['+str(data_length)+'] =\n{'