2025-08-14 18:50:13 -04:00
|
|
|
#include "xsoundcurve.h"
|
|
|
|
|
|
|
|
|
|
XSoundCurve::XSoundCurve()
|
2025-08-17 13:14:17 -04:00
|
|
|
: XAsset()
|
|
|
|
|
, mFileName(nullptr)
|
|
|
|
|
, mKnotCount(0)
|
|
|
|
|
, mKnots(QVector<QVector<float>>())
|
2025-08-14 18:50:13 -04:00
|
|
|
{
|
2025-09-05 18:35:17 -04:00
|
|
|
SetType(ASSET_TYPE_SOUND_CURVE);
|
|
|
|
|
SetName("Sound Curve");
|
2025-08-14 18:50:13 -04:00
|
|
|
}
|
|
|
|
|
|
2025-08-17 13:14:17 -04:00
|
|
|
XString *XSoundCurve::GetFileName()
|
|
|
|
|
{
|
|
|
|
|
return mFileName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void XSoundCurve::SetFileName(XString *aFileName)
|
|
|
|
|
{
|
|
|
|
|
mFileName = aFileName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
float XSoundCurve::GetKnotEntry(int aRow, int aColumn)
|
|
|
|
|
{
|
|
|
|
|
return mKnots[aRow][aColumn];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void XSoundCurve::SetKnotEntry(int aRow, int aColumn, float aValue)
|
2025-08-14 18:50:13 -04:00
|
|
|
{
|
2025-08-17 13:14:17 -04:00
|
|
|
mKnots[aRow][aColumn] = aValue;
|
|
|
|
|
}
|
2025-08-14 18:50:13 -04:00
|
|
|
|
2025-08-17 13:14:17 -04:00
|
|
|
int XSoundCurve::GetKnotCount()
|
|
|
|
|
{
|
|
|
|
|
return mKnotCount;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void XSoundCurve::Clear()
|
|
|
|
|
{
|
|
|
|
|
if (mFileName != nullptr)
|
|
|
|
|
{
|
|
|
|
|
mFileName->Clear();
|
|
|
|
|
}
|
|
|
|
|
mKnotCount = 0;
|
|
|
|
|
mKnots.clear();
|
2025-08-14 18:50:13 -04:00
|
|
|
}
|
|
|
|
|
|
2025-09-10 21:58:26 -04:00
|
|
|
void XSoundCurve::ParseData(XDataStream *aStream)
|
2025-08-14 18:50:13 -04:00
|
|
|
{
|
2025-08-17 13:14:17 -04:00
|
|
|
if (mFileName != nullptr)
|
|
|
|
|
{
|
|
|
|
|
mFileName->ParsePtr(aStream, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
*aStream
|
|
|
|
|
>> mKnotCount;
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 8; i++)
|
|
|
|
|
{
|
|
|
|
|
for (int j = 0; j < 2; j++)
|
|
|
|
|
{
|
|
|
|
|
float knot;
|
|
|
|
|
*aStream >> knot;
|
2025-08-14 18:50:13 -04:00
|
|
|
|
2025-08-17 13:14:17 -04:00
|
|
|
mKnots[i][j] = knot;
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-08-14 18:50:13 -04:00
|
|
|
}
|