XWV

From Valve Developer Community
Jump to navigation Jump to search

Stub

This article or section is a stub. You can help by expanding it.

XWV is the proprietary sound format used by Valve's Xbox 360 Xbox 360 games. It is similar to the WAV format and uses the big-endian byte order. The format is defined in the SDK in Custom Iconpublic\xwvfile.h.

To convert some XMV file to WAV, you can use vgmstream.

Header

#define XWV_ID		(('X'<<24)|('W'<<16)|('V'<<8)|(' '<<0))
#define XWV_VERSION 4

enum xwvSampleRate_t
{
	XWV_RATE_11025 = 0,
	XWV_RATE_22050 = 1,
	XWV_RATE_44100 = 2,
};

enum xwvFormat_t
{
	XWV_FORMAT_PCM = 0,
	XWV_FORMAT_XMA = 1,
	XWV_FORMAT_ADPCM = 2,
};

// generated in big-endian
struct xwvHeader_t
{
	unsigned int	id;
	unsigned int	version;
	unsigned int	headerSize;		// header only
	unsigned int	staticDataSize;		// follows header
	unsigned int	dataOffset;		// start of samples, possibly sector aligned
	unsigned int	dataSize;		// length of samples in bytes
	unsigned int	numDecodedSamples;	// for duration calcs
	int		loopStart;		// -1 = no loop, offset of loop in samples
	unsigned short	loopBlock;		// the xma block where the loop starts 
	unsigned short	numLeadingSamples;	// number of leading samples in the loop block to discard
	unsigned short	numTrailingSamples;	// number of trailing samples at the final block to discard
	unsigned short	vdatSize;		// follows seek table
	byte		format;
	byte		bitsPerSample;
	byte		sampleRate;
	byte		channels;
	byte		quality;
	byte		bHasSeekTable;		// indicates presence, follows header
	byte		padding[2];		// created as 0
};