XPlor/libs/xassets/xaudiopacketaligned.cpp

52 lines
1.1 KiB
C++
Raw Normal View History

2025-09-07 12:36:08 -04:00
#include "xaudiopacketaligned.h"
XAudioPacketAligned::XAudioPacketAligned()
: XAsset()
, mBuffer()
, mBufferSize(0)
, mLoopCount(0)
, aXmaLoop()
, mContext()
2025-08-14 17:30:25 -04:00
{
SetName("Audio Packet Aligned");
2025-08-14 17:30:25 -04:00
}
2025-09-07 12:36:08 -04:00
XAudioPacketAligned::~XAudioPacketAligned()
2025-08-14 17:30:25 -04:00
{
2025-09-07 12:36:08 -04:00
2025-08-14 17:30:25 -04:00
}
void XAudioPacketAligned::ParseData(XDataStream *aStream)
2025-08-14 17:30:25 -04:00
{
qint32 bufferPtr = aStream->ParseInt32(QString("%1 buffer ptr").arg(GetName()));
mBufferSize = aStream->ParseUInt32(QString("%1 buffer size").arg(GetName()));
mLoopCount = aStream->ParseUInt32(QString("%1 loop count").arg(GetName()));
2025-09-07 12:36:08 -04:00
for (int i = 0; i < 6; i++)
{
XAudioXmaLoopRegion loop;
loop.ParseData(aStream);
}
qint32 contextPtr = aStream->ParseInt32(QString("%1 context ptr").arg(GetName()));
2025-09-07 12:36:08 -04:00
if (bufferPtr)
{
aStream->readRawData(mBuffer.data(), mBufferSize);
}
2025-09-07 12:36:08 -04:00
if (contextPtr)
{
mContext = aStream->ParseInt8(QString("%1 context").arg(GetName()));
2025-09-07 12:36:08 -04:00
}
2025-08-14 17:30:25 -04:00
}
2025-09-07 12:36:08 -04:00
void XAudioPacketAligned::Clear()
2025-08-14 17:30:25 -04:00
{
2025-09-07 12:36:08 -04:00
mBuffer.clear();
mBufferSize = 0;
mLoopCount = 0;
aXmaLoop.clear();
mContext = '\0';
2025-08-14 17:30:25 -04:00
}