mirror of
https://github.com/celisej567/mcpe.git
synced 2026-09-11 20:11:18 +03:00
Fix Loading Stereo Sound Data
This commit is contained in:
committed by
iProgramInCpp
parent
b985edac32
commit
cc3310b556
@@ -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;
|
||||
|
||||
@@ -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{'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user