#include "xsoundalias.h"

XSoundAlias::XSoundAlias()
    : XAsset()
    , mAliasName()
    , mSubtitle()
    , mSecondaryAliasName()
    , mChainAliasName()
    , mSoundFile()
    , mSequence(0)
    , mVolMin(0.0f)
    , mVolMax(0.0f)
    , mPitchMin(0.0f)
    , mPitchMax(0.0f)
    , mDistMin(0.0f)
    , mDistMax(0.0f)
    , mFlags(0)
    , mSlavePercentage(0.0f)
    , mProbability(0.0f)
    , mLfePercentage(0.0f)
    , mCenterPercentage(0.0f)
    , mStartDelay(0)
    , mVolumeFalloffCurve()
    , mEnvelopMin(0.0f)
    , mEnvelopMax(0.0f)
    , mEnvelopPercentage(0.0f)
    , mSpeakerMap()
{

}

XSoundAlias::~XSoundAlias()
{

}

void XSoundAlias::Clear()
{

}

void XSoundAlias::ParseData(QDataStream *aStream)
{
    mAliasName.ParsePtr(aStream, false);
    mSubtitle.ParsePtr(aStream, false);
    mSecondaryAliasName.ParsePtr(aStream, false);
    mChainAliasName.ParsePtr(aStream, false);

    qint32 soundFilePtr;
    *aStream
        >> soundFilePtr
        >> mSequence
        >> mVolMin
        >> mVolMax
        >> mPitchMin
        >> mPitchMax
        >> mDistMin
        >> mDistMax
        >> mFlags
        >> mSlavePercentage
        >> mProbability
        >> mLfePercentage
        >> mCenterPercentage
        >> mStartDelay;

    mVolumeFalloffCurve.ParsePtr(aStream, false);

    *aStream
        >> mEnvelopMin
        >> mEnvelopMax
        >> mEnvelopPercentage;

    mSpeakerMap.ParsePtr(aStream, false);

    mAliasName.ParseData(aStream);
    mSubtitle.ParseData(aStream);
    mSecondaryAliasName.ParseData(aStream);
    mChainAliasName.ParseData(aStream);
    mSoundFile.ParseData(aStream);
    mVolumeFalloffCurve.ParseData(aStream);
    mSpeakerMap.ParseData(aStream);
}
