#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;
}
