mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-02 00:22:43 +08:00
sync v3.6.1 to develop
This commit is contained in:
@@ -26,9 +26,8 @@ THE SOFTWARE.
|
||||
#define LOG_TAG "AudioDecoderWav"
|
||||
|
||||
#include "audio/common/decoder/AudioDecoderWav.h"
|
||||
#include "platform/FileUtils.h"
|
||||
#include "base/Log.h"
|
||||
|
||||
#include "platform/FileUtils.h"
|
||||
|
||||
namespace cc {
|
||||
|
||||
@@ -61,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 * info.channels; // FIXED_16
|
||||
_pcmHeader.dataFormat = AudioDataFormat::SIGNED_16;//FIXED,
|
||||
_pcmHeader.dataFormat = AudioDataFormat::SIGNED_16; //FIXED,
|
||||
_pcmHeader.sampleRate = info.samplerate;
|
||||
_pcmHeader.totalFrames = info.frames;
|
||||
_isOpened = true;
|
||||
@@ -79,7 +78,7 @@ uint32_t AudioDecoderWav::read(uint32_t framesToRead, char *pcmBuf) {
|
||||
|
||||
bool AudioDecoderWav::seek(uint32_t frameOffset) {
|
||||
auto offset = sf::sf_seek(_sf_handle, frameOffset, SEEK_SET);
|
||||
return offset >=0 && offset == frameOffset;
|
||||
return offset >= 0 && offset == frameOffset;
|
||||
}
|
||||
uint32_t AudioDecoderWav::tell() const {
|
||||
return static_cast<uint32_t>(sf::sf_tell(_sf_handle));
|
||||
@@ -91,6 +90,5 @@ void AudioDecoderWav::close() {
|
||||
}
|
||||
_isOpened = false;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace cc
|
||||
|
||||
Reference in New Issue
Block a user