mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
70 lines
2.5 KiB
C++
70 lines
2.5 KiB
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
|
|
#include "Core/HLE/AtracCtx.h"
|
|
|
|
class Atrac2 : public AtracBase {
|
|
public:
|
|
Atrac2(int atracID, u32 contextAddr, int codecType);
|
|
~Atrac2() {
|
|
delete[] decodeTemp_;
|
|
}
|
|
|
|
AtracStatus BufferState() const {
|
|
return context_->info.state;
|
|
}
|
|
|
|
void DoState(PointerWrap &p) override;
|
|
|
|
int GetID() const override { return context_->info.atracID; }
|
|
|
|
int GetNextDecodePosition(int *pos) const override;
|
|
|
|
int RemainingFrames() const override;
|
|
int LoopStatus() const override;
|
|
int Bitrate() const override;
|
|
int LoopNum() const override;
|
|
int SamplesPerFrame() const override { return context_->info.SamplesPerFrame(); }
|
|
int Channels() const override { return context_->info.numChan; }
|
|
int BytesPerFrame() const override { return context_->info.sampleSize; }
|
|
int SetLoopNum(int loopNum) override;
|
|
|
|
void GetStreamDataInfo(u32 *writePtr, u32 *writableBytes, u32 *readOffset) override;
|
|
int AddStreamData(u32 bytesToAdd) override;
|
|
u32 AddStreamDataSas(u32 bufPtr, u32 bytesToAdd) override;
|
|
int ResetPlayPosition(int sample, int bytesWrittenFirstBuf, int bytesWrittenSecondBuf, bool *delay) override;
|
|
int GetResetBufferInfo(AtracResetBufferInfo *bufferInfo, int sample, bool *delay) override;
|
|
int SetData(const Track &track, u32 buffer, u32 readSize, u32 bufferSize, int outputChannels) override;
|
|
u32 SetSecondBuffer(u32 secondBuffer, u32 secondBufferSize) override;
|
|
bool HasSecondBuffer() const override;
|
|
|
|
u32 DecodeData(u8 *outbuf, u32 outbufPtr, u32 *SamplesNum, u32 *finish, int *remains) override;
|
|
int DecodeLowLevel(const u8 *srcData, int *bytesConsumed, s16 *dstData, int *bytesWritten) override;
|
|
u32 GetNextSamples() override;
|
|
|
|
void InitLowLevel(u32 paramsAddr, bool jointStereo, int codecType) override;
|
|
|
|
int GetSoundSample(int *endSample, int *loopStartSample, int *loopEndSample) const override;
|
|
|
|
// These will not be used by the new implementation.
|
|
void UpdateContextFromPSPMem() override {}
|
|
void NotifyGetContextAddress() override {}
|
|
|
|
bool IsNewAtracImpl() const override { return true; }
|
|
|
|
u32 GetInternalCodecError() const override;
|
|
|
|
private:
|
|
u32 DecodeInternal(u32 outbufAddr, u32 *SamplesNum, u32 *finish);
|
|
void GetResetBufferInfoInternal(AtracResetBufferInfo *bufferInfo, int sample);
|
|
u32 ResetPlayPositionInternal(int seekPos, int bytesWrittenFirstBuf, int bytesWrittenSecondBuf);
|
|
|
|
u32 SkipFrames(int *skippedCount);
|
|
void WrapLastPacket();
|
|
|
|
// Just the current decoded frame, in order to be able to cut off the first part of it
|
|
// to write the initial partial frame.
|
|
// Does not need to be saved.
|
|
int16_t *decodeTemp_ = nullptr;
|
|
};
|