Sound Asset: Difference between revisions

From COD Engine Research
No edit summary
Line 10: Line 10:
== Infinity Ward ==
== Infinity Ward ==
<source lang="cpp">
<source lang="cpp">
struct SpeakerMapChannelEntry
struct SpeakerLevels
{
{
int InputChannel;
  int speaker;
int OutputChannel;
  int numLevels;
float CurrentVolume;
  float levels[2];
float TargetVolume;
};
};


struct SpeakerMapChannel
struct ChannelMap
{
{
int entryCount; // how many entries are used
  int entryCount; // how many entries are used
SpeakerMapChannelEntry entries[6];
  SpeakerLevels speakers6];
};
};


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


Line 38: Line 37:
SAT_PRIMED = 0x3,
SAT_PRIMED = 0x3,
SAT_COUNT = 0x4,
SAT_COUNT = 0x4,
};
struct StreamFileNamePacked
{
  unsigned __int64 offset;
  unsigned __int64 length;
};
struct StreamFileNameRaw
{
  const char *dir;
  const char *name;
};
union StreamFileInfo
{
  StreamFileNameRaw raw;
  StreamFileNamePacked packed;
};
struct StreamFileName
{
  unsigned __int16 isLocalized;
  unsigned __int16 fileIndex;
  StreamFileInfo info;
};
};


struct StreamedSound
struct StreamedSound
{
{
int packfileNum;
  StreamFileName filename;
union
  unsigned int totalMsec;
{
};
const char *strings[2]; // if packfileNum == 0
 
struct
struct PrimedSound
{
{
int soundOffset;
  StreamFileName filename;
int soundSize;
  LoadedSound *loadedPart;
};
  int dataOffset;
};
  int totalSize;
  unsigned int primedCrc;
};
};


union SoundData
union SoundData
{
{
LoadedSound *loadSnd; // SoundFile->type == SAT_LOADED
  LoadedSound *loadSnd; // SoundFile->type == SAT_LOADED
StreamedSound streamSnd; // SoundFile->type == SAT_STREAMED
  StreamedSound streamSnd; // SoundFile->type == SAT_STREAMED
  PrimedSound primedSnd; // SoundFile->type == SAT_PRIMED
};
};


Line 64: Line 90:
snd_alias_type_t type;
snd_alias_type_t type;
bool exists;
bool exists;
SoundData sound;
SoundFileRef sound;
};
};


struct snd_alias_t
struct snd_alias_t
{
{
const char *aliasName;
  const char *aliasName;
const char *subtitle;
  const char *subtitle;
const char *secondaryAliasName;
  const char *secondaryAliasName;
const char *chainAliasName;
  const char *chainAliasName;
#ifndef COD4
#ifndef COD4
const char *devSoundMixerGroup;
  const char *mixerGroup;
#endif
#endif
SoundFile *soundFile;
  SoundFile *soundFile;
int sequence;
  int sequence;
float volMin;
  float volMin;
float volMax;
  float volMax;
#ifdef MW3 || GHOSTS
#ifdef MW3 || GHOSTS
short volMod;
  int volModIndex;
#endif
#endif
float pitchMin;
  float pitchMin;
float pitchMax;
  float pitchMax;
float distMin;
  float distMin;
float distMax;
  float distMax;
#ifndef COD4
#ifndef COD4
float velocityMin;
  float velocityMin;
#endif
#endif
int flags;
  int flags;
#ifdef MW3 || GHOSTS
#ifdef MW3 || GHOSTS
char masterPriority;
  char masterPriority;
float masterPercentage;
  float masterPercentage;
#endif
#endif
float slavePercentage;
  float slavePercentage;
float probability;
  float probability;
float lfePercentage;
  float lfePercentage;
float centerPercentage;
  float centerPercentage;
int startDelay;
  int startDelay;
SndCurve *volumeFalloffCurve;
  SndCurve *volumeFalloffCurve;
#ifdef GHOSTS
#ifdef GHOSTS
LPFCurve *unknownLPFCurve;
  SndCurve *lpfCurve;
ReverbSendCurve *unknownReverbSendCurve;
  SndCurve *reverbSendCurve;
#endif
#endif
float envelopMin;
  float envelopMin;
float envelopMax;
  float envelopMax;
float envelopPercentage;
  float envelopPercentage;
SpeakerMap *speakerMap;
  SpeakerMap *speakerMap;
#ifdef GHOSTS
#ifdef GHOSTS
int unknown3;
  float wetMixOverride;
char (*unknown4)[0x18];
  OcclusionShape *occlusionShape;
int unknown5;
  char allowDoppler;
DopplerPreset *unknownDopplerPreset;
  DopplerPreset *dopplerPreset;
#endif
#endif
};
};
Line 119: Line 145:
struct snd_alias_list_t
struct snd_alias_list_t
{
{
const char *aliasName;
  const char *aliasName;
snd_alias_t *head;
  snd_alias_t *head;
int count;
  int count;
};
};
</source>
</source>

Revision as of 07:24, 22 December 2014

Infinity Ward

struct SpeakerLevels
{
  int speaker;
  int numLevels;
  float levels[2];
};

struct ChannelMap
{
  int entryCount;	// how many entries are used
  SpeakerLevels speakers6];
};

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

enum snd_alias_type_t : char
{
	SAT_UNKNOWN = 0x0,
	SAT_LOADED = 0x1,
	SAT_STREAMED = 0x2,
	SAT_PRIMED = 0x3,
	SAT_COUNT = 0x4,
};

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

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

union StreamFileInfo
{
  StreamFileNameRaw raw;
  StreamFileNamePacked packed;
};

struct StreamFileName
{
  unsigned __int16 isLocalized;
  unsigned __int16 fileIndex;
  StreamFileInfo info;
};

struct StreamedSound
{
  StreamFileName filename;
  unsigned int totalMsec;
};

struct PrimedSound
{
  StreamFileName filename;
  LoadedSound *loadedPart;
  int dataOffset;
  int totalSize;
  unsigned int primedCrc;
};

union SoundData
{
  LoadedSound *loadSnd;	// SoundFile->type == SAT_LOADED
  StreamedSound streamSnd;	// SoundFile->type == SAT_STREAMED
  PrimedSound primedSnd;	// SoundFile->type == SAT_PRIMED
};

struct SoundFile	// 0x10
{
	snd_alias_type_t type;
	bool exists;
	SoundFileRef sound;
};

struct snd_alias_t
{
  const char *aliasName;
  const char *subtitle;
  const char *secondaryAliasName;
  const char *chainAliasName;
#ifndef COD4
  const char *mixerGroup;
#endif
  SoundFile *soundFile;
  int sequence;
  float volMin;
  float volMax;
#ifdef MW3 || GHOSTS
  int volModIndex;
#endif
  float pitchMin;
  float pitchMax;
  float distMin;
  float distMax;
#ifndef COD4
  float velocityMin;
#endif
  int flags;
#ifdef MW3 || GHOSTS
  char masterPriority;
  float masterPercentage;
#endif
  float slavePercentage;
  float probability;
  float lfePercentage;
  float centerPercentage;
  int startDelay;
  SndCurve *volumeFalloffCurve;
#ifdef GHOSTS
  SndCurve *lpfCurve;
  SndCurve *reverbSendCurve;
#endif
  float envelopMin;
  float envelopMax;
  float envelopPercentage;
  SpeakerMap *speakerMap;
#ifdef GHOSTS
  float wetMixOverride;
  OcclusionShape *occlusionShape;
  char allowDoppler;
  DopplerPreset *dopplerPreset;
#endif
};

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

World at War

struct PrimedSound
{
	const char *unknownString;
	const char *buffer;
	int unknown;
};

struct StreamedSound
{
	struct
	{
		int unknown;
		const char *unknownStrings[2];
	};
	PrimedSound *primedSnd;
};

struct SoundFile
{
	snd_alias_type_t type;
	bool exists;
	union
	{
		StreamedSound streamSnd;
		LoadedSound *loadSnd;
	} u;
};

struct snd_alias_t	// 0xB8
{
	const char *aliasName;
	unsigned int aliasNameHash;
	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;
	float distReverbMax;
	float slavePercentage;
	float probability;
	float lifePercentage;
	float centerPercentage;
	float envelopMin;
	float envelopMax;
	float realDelay;
	int minPriority;
	float maxPriority;
	float minPriorityThreshold;
	float maxPriorityThreshold;
	float reverbSend;
	float teamVolMod;
	float teamPitchMod;
	float occlusionLevel;
	float occlusionWetDry;
	float moveTime;
	int startDelay;
	int speakerMap;
	int flags;
	int volumeFallOffCurve;
	int reverbFallOffCurve;
	int volumeMinFallOffCurve;
	int reverbMinFallOfCurve;
	int limitCount;
	int limitType;
	int entityLimitCount;
	int entityLimitType;
	int randomizeType;
	float cylInnerRadius;
	float cylOuterRadius;
	float cylOuterLevel;
};

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

Black Ops

struct SndRadverb
{
	char name[0x20];
	int nameHash;
	float smoothing;
	float earlyTime;
	float lateTime;
	float earlyGain;
	float lateGain;
	float returnGain;
	float earlyLpf;
	float lateLpf;
	float inputLpf;
	float dampLpf;
	float wallReflect;
	float dryGain;
	float earlySize;
	float lateSize;
	float diffusion;
};

struct SndSnapshot
{
	char name[0x20];
	int nameHash;
	char occlusion[0x20];
	int occlusionHash;
	int fadeIn;
	int fadeOut;
	int distance;
	int fadeInCurve;
	int fadeOutCurve;
	float field_5C[64];
};

struct snd_alias_t
{
	const char *aliasName;
	int subtitle;
	const char *secondaryAliasName;
	const char *chainAliasName;
	SoundFile *soundFile;
	int flags;
	int duck;
	int contextType;
	int contextValue;
	short moveTime;
	short startDelay;
	short centerSend;
	short reverbSend;
	short volMin;
	short volMax;
	short teamVolMod;
	short pitchMin;
	short pitchMax;
	short teamPitchMod;
	short distMin;
	short distMax;
	short distReverbMax;
	short envelopMin;
	short envelopMax;
	short envelopPercentage;
	char minPriorityThreshold;
	char maxPriorityThreshold;
	char probability;
	char occlusionLevel;
	char occlusionWetDry;
	char minPriority;
	char maxPriority;
	char pan;
	char volumeFalloffCurve;
	char reverbFalloffCurve;
	char volumeMinFalloffCurve;
	char reverbMinFalloffCurve;
	char limitCount;
	char entityLimitCount;
	char snapshot;
};

struct SndBank
{
	int name;
	int aliasCount;
	snd_alias_list_t *alias;
	int *aliasIndex;
	int unknown[2];
	int numRadverbs;
	SndRadverb *radverbs;
	int numSnapshots;
	SndSnapshot *snapshots;
};

Black Ops 2

enum SndBankState
{
  SND_BANK_STATE_NEW = 0x0,
  SND_BANK_STATE_STREAM_HEADER = 0x1,
  SND_BANK_STATE_STREAM_TOC = 0x2,
  SND_BANK_STATE_LOADED_HEADER = 0x3,
  SND_BANK_STATE_LOADED_TOC = 0x4,
  SND_BANK_STATE_LOADED_ASSET_WAIT = 0x5,
  SND_BANK_STATE_LOADED_ASSETS = 0x6,
  SND_BANK_STATE_READY_TO_USE = 0x7,
  SND_BANK_STATE_ERROR = 0x8,
};

struct SndAssetBankEntry
{
  unsigned int id;
  unsigned int size;
  unsigned int offset;
  unsigned int frameCount;
  char frameRateIndex;
  char channelCount;
  char looping;
  char format;
};

struct SndLoadedAssets // 0x1C
{
  const char *zone;
  const char *language;
  unsigned int loadedCount;
  unsigned int entryCount;
  SndAssetBankEntry *entries;
  unsigned int dataSize;
  char *data;
};

struct SndDuck	// 0x4C
{
  char name[32];
  unsigned int id;
  float fadeIn;
  float fadeOut;
  float startDelay;
  float distance;
  float length;
  unsigned int fadeInCurve;
  unsigned int fadeOutCurve;
  float *attenuation;
  float *filter;
  int updateWhilePaused;
};

struct SndAlias
{
  const char *name;
  unsigned int id;
  const char *subtitle;
  const char *secondaryname;
  unsigned int assetId;
  const char *assetFileName;
  unsigned int flags0;
  unsigned int flags1;
  unsigned int duck;
  unsigned int contextType;
  unsigned int contextValue;
  unsigned int stopOnPlay;
  unsigned int futzPatch;
  unsigned __int16 fluxTime;
  unsigned __int16 startDelay;
  unsigned __int16 reverbSend;
  unsigned __int16 centerSend;
  unsigned __int16 volMin;
  unsigned __int16 volMax;
  unsigned __int16 pitchMin;
  unsigned __int16 pitchMax;
  unsigned __int16 distMin;
  unsigned __int16 distMax;
  unsigned __int16 distReverbMax;
  unsigned __int16 envelopMin;
  unsigned __int16 envelopMax;
  unsigned __int16 envelopPercentage;
  __int16 fadeIn;
  __int16 fadeOut;
  __int16 dopplerScale;
  char minPriorityThreshold;
  char maxPriorityThreshold;
  char probability;
  char occlusionLevel;
  char minPriority;
  char maxPriority;
  char pan;
  char limitCount;
  char entityLimitCount;
  char duckGroup;
};

struct SndAliasList // 0x14
{
  const char *name;
  unsigned int id;
  SndAlias *head;
  int count;
  int sequence;
};

struct SndRadverb
{
  char name[32];
  unsigned int id;
  float smoothing;
  float earlyTime;
  float lateTime;
  float earlyGain;
  float lateGain;
  float returnGain;
  float earlyLpf;
  float lateLpf;
  float inputLpf;
  float dampLpf;
  float wallReflect;
  float dryGain;
  float earlySize;
  float lateSize;
  float diffusion;
  float returnHighpass;
};

struct SndIndexEntry
{
  unsigned __int16 value;
  unsigned __int16 next;
};

struct SndAssetBankHeader
{
  unsigned int magic;
  unsigned int version;
  unsigned int entrySize;
  unsigned int checksumSize;
  unsigned int dependencySize;
  unsigned int entryCount;
  unsigned int dependencyCount;
  unsigned int pad32;
  __int64 fileSize;
  __int64 entryOffset;
  __int64 checksumOffset;
  char checksumChecksum[16];
  char dependencies[512];
  char padding[1464];
};

#pragma pack(push, 1)
struct SndRuntimeAssetBank
{
  const char *zone;
  const char *language;
  int fileHandle;
  SndAssetBankHeader header;
  unsigned int entryOffset;
  char linkTimeChecksum[16];
  char filename[256];
  bool indicesLoaded;
  bool indicesAllocated;
};
#pragma pack(pop)

struct SndDialogScriptIdLookup
{
  unsigned int scriptId;
  unsigned int aliasId;
};

struct SndBank // 0x1294
{
  const char *name;
  unsigned int aliasCount;
  SndAliasList *alias;
  SndIndexEntry *aliasIndex;
  unsigned int radverbCount;
  SndRadverb *radverbs;
  unsigned int duckCount;
  SndDuck *ducks;
  SndRuntimeAssetBank streamAssetBank;
  SndRuntimeAssetBank loadAssetBank;
  SndLoadedAssets loadedAssets;
  unsigned int scriptIdLookupCount;
  SndDialogScriptIdLookup *scriptIdLookups;
  SndBankState state;
  int streamRequestId;
  bool pendingIo;
  bool ioError;
  bool runtimeAssetLoad;
};