Difference between revisions of "Sound Asset"

From COD Engine Research
Jump to: navigation, search
m
(World at War)
 
Line 156: Line 156:
 
const char *unknownString;
 
const char *unknownString;
 
const char *buffer;
 
const char *buffer;
int unknown;
+
int size;
 
};
 
};
  
Line 163: Line 163:
 
struct
 
struct
 
{
 
{
int unknown;
+
unsigned int hash;
const char *unknownStrings[2];
+
const char *dir;
 +
const char *name;
 
};
 
};
 
PrimedSound *primedSnd;
 
PrimedSound *primedSnd;
 
};
 
};
  
 +
union SoundFileRef
 +
{
 +
LoadedSound *loadSnd;
 +
StreamedSound streamSnd;
 +
};
 
struct SoundFile
 
struct SoundFile
 
{
 
{
 
snd_alias_type_t type;
 
snd_alias_type_t type;
 
bool exists;
 
bool exists;
union
+
SoundFileRef u;
{
+
StreamedSound streamSnd;
+
LoadedSound *loadSnd;
+
} u;
+
 
};
 
};
  
Line 237: Line 239:
 
};
 
};
 
</source>
 
</source>
 +
 
== Black Ops ==
 
== Black Ops ==
 
<source lang="cpp">
 
<source lang="cpp">

Latest revision as of 17:49, 7 February 2015

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;
#if defined(MW3) || defined(GHOSTS)
  int volModIndex;
#endif
  float pitchMin;
  float pitchMax;
  float distMin;
  float distMax;
#ifndef COD4
  float velocityMin;
#endif
  int flags;
#if defined(MW3) || defined(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 size;
};
 
struct StreamedSound
{
	struct
	{
		unsigned int hash;
		const char *dir;
		const char *name;
	};
	PrimedSound *primedSnd;
};
 
union SoundFileRef
{
	LoadedSound *loadSnd;
	StreamedSound streamSnd;
};
struct SoundFile
{
	snd_alias_type_t type;
	bool exists;
	SoundFileRef 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 SndIndexEntry
{
  unsigned __int16 value;
  unsigned __int16 next;
};
 
struct snd_radverb
{
  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;
};
 
struct snd_snapshot
{
  char name[32];
  unsigned int id;
  char occlusionName[32];
  unsigned int occlusionId;
  float fadeIn;
  float fadeOut;
  float distance;
  unsigned int fadeInCurve;
  unsigned int fadeOutCurve;
  float attenuation[64];
};
 
struct snd_alias_t
{
  const char *name;
  unsigned int id;
  const char *subtitle;
  const char *secondaryname;
  SoundFile *soundFile;
  unsigned int flags;
  unsigned int duck;
  unsigned int contextType;
  unsigned int contextValue;
  unsigned __int16 fluxTime;
  unsigned __int16 startDelay;
  unsigned __int16 reverbSend;
  unsigned __int16 centerSend;
  unsigned __int16 volMin;
  unsigned __int16 volMax;
  unsigned __int16 teamVolMod;
  unsigned __int16 pitchMin;
  unsigned __int16 pitchMax;
  unsigned __int16 teamPitchMod;
  unsigned __int16 distMin;
  unsigned __int16 distMax;
  unsigned __int16 distReverbMax;
  unsigned __int16 envelopMin;
  unsigned __int16 envelopMax;
  unsigned __int16 envelopPercentage;
  char minPriorityThreshold;
  char maxPriorityThreshold;
  char probability;
  char occlusionLevel;
  char occlusionWetDry;
  char minPriority;
  char maxPriority;
  char pan;
  char dryCurve;
  char wetCurve;
  char dryMinCurve;
  char wetMinCurve;
  char limitCount;
  char entityLimitCount;
  char snapshotGroup;
};
 
struct SndBank
{
  const char *name;
  unsigned int aliasCount;
  snd_alias_list_t *alias;
  SndIndexEntry *aliasIndex;
  unsigned int packHash;
  unsigned int packLocation;
  unsigned int radverbCount;
  snd_radverb *radverbs;
  unsigned int snapshotCount;
  snd_snapshot *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;
};