[BUG] Decoder returns a wrong bytesPerFrame. (#12771)

As it forget to calculate the channel count for multi-channel audio
This commit is contained in:
timlyeee
2022-09-15 09:44:34 +08:00
committed by GitHub
parent b0600bd89e
commit 3e7d44925f
@@ -60,7 +60,7 @@ bool AudioDecoderWav::open(const char *path) {
}
CC_LOG_DEBUG("wav info: frames: %d, samplerate: %d, channels: %d, format: %d", info.frames, info.samplerate, info.channels, info.format);
_pcmHeader.channelCount = info.channels;
_pcmHeader.bytesPerFrame = 2; // FIXED_16
_pcmHeader.bytesPerFrame = 2 * info.channels; // FIXED_16
_pcmHeader.dataFormat = AudioDataFormat::SIGNED_16;//FIXED,
_pcmHeader.sampleRate = info.samplerate;
_pcmHeader.totalFrames = info.frames;