#ifndef SOUNDALIAS_H
#define SOUNDALIAS_H

#include "soundcurve.h"
#include "loadedsound.h"

struct StreamFileNameRaw
{
    const char *dir;
    const char *name;
};

struct StreamFileNamePacked
{
    unsigned int offset;
    unsigned int length;
};

union StreamFileInfo
{
    StreamFileNameRaw raw;
    StreamFileNamePacked packed;
};

struct StreamFileName
{
    unsigned int fileIndex;
    StreamFileInfo info;
};

struct StreamedSound
{
    StreamFileName filename;
};

union SoundFileRef
{
    LoadedSound *loadSnd;
    StreamedSound streamSnd;
};

struct SoundFile
{
    unsigned __int8 type;
    unsigned __int8 exists;
    SoundFileRef u;
};

struct XAUDIOCHANNELMAPENTRY
{
    unsigned __int8 InputChannel;
    unsigned __int8 OutputChannel;
    float Volume;
};

struct XAUDIOCHANNELMAP
{
    unsigned __int8 EntryCount;
    XAUDIOCHANNELMAPENTRY *paEntries;
};

struct SpeakerMap
{
    bool isDefault;
    const char *name;
    XAUDIOCHANNELMAP channelMaps[2][2];
};

struct snd_alias_t
{
    const char *aliasName;
    const char *subtitle;
    const char *secondaryAliasName;
    const char *chainAliasName;
    SoundFile *soundFile;
    int sequence;
    float volMin;
    float volMax;
    float pitchMin;
    float pitchMax;
    float distMin;
    float distMax;
    int flags;
    float slavePercentage;
    float probability;
    float lfePercentage;
    float centerPercentage;
    int startDelay;
    SoundCurve *volumeFalloffCurve;
    float envelopMin;
    float envelopMax;
    float envelopPercentage;
    SpeakerMap *speakerMap;
};

struct SoundAliasList
{
    const char *aliasName;
    snd_alias_t *head;
    int count;
};

#endif // SOUNDALIAS_H
