diff --git a/Core/HLE/sceAtrac.cpp b/Core/HLE/sceAtrac.cpp index 7fcfc949d5..db27f22461 100644 --- a/Core/HLE/sceAtrac.cpp +++ b/Core/HLE/sceAtrac.cpp @@ -179,20 +179,9 @@ struct AVPacket { #endif struct Atrac { - Atrac() : atracID_(-1), dataBuf_(0), decodePos_(0), bufferPos_(0), - channels_(0), outputChannels_(2), bitrate_(64), bytesPerFrame_(0), bufferMaxSize_(0), jointStereo_(0), - currentSample_(0), endSample_(0), firstSampleOffset_(0), dataOff_(0), - loopStartSample_(-1), loopEndSample_(-1), loopNum_(0), - failedDecode_(false), ignoreDataBuf_(false), codecType_(0), - bufferState_(ATRAC_STATUS_NO_DATA) { + Atrac() { memset(&first_, 0, sizeof(first_)); memset(&second_, 0, sizeof(second_)); -#ifdef USE_FFMPEG - codecCtx_ = nullptr; - swrCtx_ = nullptr; - frame_ = nullptr; - packet_ = nullptr; -#endif // USE_FFMPEG context_ = 0; } @@ -401,40 +390,40 @@ struct Atrac { return remainingBytes / bytesPerFrame_; } - int atracID_; - u8 *dataBuf_; + int atracID_ = -1; + u8 *dataBuf_ = nullptr; - u32 decodePos_; + u32 decodePos_ = 0; // Used by low-level decoding and to track streaming. - u32 bufferPos_; - u32 bufferValidBytes_; + u32 bufferPos_ = 0; + u32 bufferValidBytes_ = 0; u32 bufferHeaderSize_ = 0; - u16 channels_; - u16 outputChannels_; - u32 bitrate_; - u16 bytesPerFrame_; - u32 bufferMaxSize_; - int jointStereo_; + u16 channels_ = 0; + u16 outputChannels_ = 2; + u32 bitrate_ = 64; + u16 bytesPerFrame_ = 0; + u32 bufferMaxSize_ = 0; + int jointStereo_ = 0; - int currentSample_; - int endSample_; - int firstSampleOffset_; + int currentSample_ = 0; + int endSample_ = 0; + int firstSampleOffset_ = 0; // Offset of the first sample in the input buffer - int dataOff_; + int dataOff_ = 0; std::vector loopinfo_; - int loopStartSample_; - int loopEndSample_; - int loopNum_; + int loopStartSample_ = -1; + int loopEndSample_ = -1; + int loopNum_ = 0; - bool failedDecode_; + bool failedDecode_ = false; // Indicates that the dataBuf_ array should not be used. - bool ignoreDataBuf_; + bool ignoreDataBuf_ = false; - u32 codecType_; - AtracStatus bufferState_; + u32 codecType_ = 0; + AtracStatus bufferState_ = ATRAC_STATUS_NO_DATA; InputBuffer first_; InputBuffer second_; diff --git a/Core/HLE/sceAtrac.h b/Core/HLE/sceAtrac.h index f0914c1c63..cc2c14e943 100644 --- a/Core/HLE/sceAtrac.h +++ b/Core/HLE/sceAtrac.h @@ -48,8 +48,7 @@ typedef AtracStatus AtracStatus_le; typedef swap_struct_t > AtracStatus_le; #endif -typedef struct -{ +struct SceAtracIdInfo { u32_le decodePos; // 0 u32_le endSample; // 4 u32_le loopStart; // 8 @@ -76,15 +75,14 @@ typedef struct u32_le secondBufferByte; // 68 // make sure the size is 128 u8 unk[56]; -} SceAtracIdInfo; +}; -typedef struct -{ +struct SceAtracId { // size 128 SceAudiocodecCodec codec; // size 128 SceAtracIdInfo info; -} SceAtracId; +}; // provide some decoder interface diff --git a/Core/HW/Atrac3Standalone.cpp b/Core/HW/Atrac3Standalone.cpp index da1ccdcd21..1e505c02db 100644 --- a/Core/HW/Atrac3Standalone.cpp +++ b/Core/HW/Atrac3Standalone.cpp @@ -16,13 +16,13 @@ inline int16_t clamp16(float f) { class Atrac3Audio : public AudioDecoder { public: Atrac3Audio(PSPAudioType audioType, int channels, size_t blockAlign, const uint8_t *extraData, size_t extraDataSize) : audioType_(audioType) { - blockAlign_ = blockAlign; + blockAlign_ = (int)blockAlign; if (audioType == PSP_CODEC_AT3PLUS) { at3pCtx_ = atrac3p_alloc(channels, &blockAlign_); if (at3pCtx_) codecOpen_ = true; } else if (audioType_ == PSP_CODEC_AT3) { - at3Ctx_ = atrac3_alloc(channels, &blockAlign_, extraData, extraDataSize); + at3Ctx_ = atrac3_alloc(channels, &blockAlign_, extraData, (int)extraDataSize); if (at3Ctx_) codecOpen_ = true; }