XPlor/libs/xassets/xaudiochannelmapentry.cpp
njohnson f88eeec7ee Fix: Parse Data Handling
This commit updates the `ParseData` method to correctly parse input channel, output channel and volume from the `XDataStream`.
2025-09-10 21:56:35 -04:00

64 lines
1.3 KiB
C++

#include "xaudiochannelmapentry.h"
XAudioChannelMapEntry::XAudioChannelMapEntry()
: XAsset()
, mInputChannel(0)
, mOutputChannel(0)
, mVolume(0.0)
{
SetName("Audio Channel Map Entry");
}
XAudioChannelMapEntry::~XAudioChannelMapEntry()
{
}
quint8 XAudioChannelMapEntry::GetInputChannel() const
{
return mInputChannel;
}
void XAudioChannelMapEntry::SetInputChannel(quint8 aInputChannel)
{
mInputChannel = aInputChannel;
}
quint8 XAudioChannelMapEntry::GetOutputChannel() const
{
return mOutputChannel;
}
void XAudioChannelMapEntry::SetOutputChannel(quint8 aOutputChannel)
{
mOutputChannel = aOutputChannel;
}
float XAudioChannelMapEntry::GetVolume() const
{
return mVolume;
}
void XAudioChannelMapEntry::SetVolume(float aVolume)
{
mVolume = aVolume;
}
void XAudioChannelMapEntry::ParseData(XDataStream *aStream)
{
mInputChannel = aStream->ParseUInt8(QString("%1 input channel").arg(GetName()));
mOutputChannel = aStream->ParseUInt8(QString("%1 output channel").arg(GetName()));
// Skip padding bytes in struct
aStream->skipRawData(2);
mVolume = aStream->ParseSingle(QString("%1 volume").arg(GetName()));
}
void XAudioChannelMapEntry::Clear()
{
mInputChannel = 0;
mOutputChannel = 0;
mVolume = 0.0;
}