- avoid double loading sound data for monoization.

This commit is contained in:
Christoph Oelckers 2017-04-26 20:51:06 +02:00
commit 21af612224
9 changed files with 192 additions and 67 deletions

View file

@ -175,16 +175,16 @@ size_t SndFileDecoder::read(char *buffer, size_t bytes)
return total * SndInfo.channels * 2;
}
TArray<char> SndFileDecoder::readAll()
TArray<uint8_t> SndFileDecoder::readAll()
{
if(SndInfo.frames <= 0)
return SoundDecoder::readAll();
int framesize = 2 * SndInfo.channels;
TArray<char> output;
TArray<uint8_t> output;
output.Resize((unsigned)(SndInfo.frames * framesize));
size_t got = read(&output[0], output.Size());
size_t got = read((char*)&output[0], output.Size());
output.Resize((unsigned)got);
return output;