From 3e7d44925f024228ef7d6e1c9f8dc3b7ca850986 Mon Sep 17 00:00:00 2001 From: timlyeee <43355299+timlyeee@users.noreply.github.com> Date: Thu, 15 Sep 2022 09:44:34 +0800 Subject: [PATCH] [BUG] Decoder returns a wrong bytesPerFrame. (#12771) As it forget to calculate the channel count for multi-channel audio --- native/cocos/audio/common/decoder/AudioDecoderWav.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/native/cocos/audio/common/decoder/AudioDecoderWav.cpp b/native/cocos/audio/common/decoder/AudioDecoderWav.cpp index c1c4c23d1c..b79e1e794a 100644 --- a/native/cocos/audio/common/decoder/AudioDecoderWav.cpp +++ b/native/cocos/audio/common/decoder/AudioDecoderWav.cpp @@ -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;