Game Development Reference
In-Depth Information
bool copiedBuffer = false;
// Load the .wav format and the .wav data
// Note that these blocks can be in either order.
while(file < fileEnd)
{
type = *((DWORD *)(wavStream+pos)); pos+=sizeof(DWORD);
file += sizeof(DWORD);
length = *((DWORD *)(wavStream+pos)); pos+=sizeof(DWORD);
file += sizeof(DWORD);
switch(type)
{
case mmioFOURCC(
'
f
'
,
'
a
'
,
'
c
'
,
'
t
'
):
{
GCC_ERROR
We don
'
t handle compressed wav files
);
break;
}
case mmioFOURCC('f', 'm', 't', ''):
{
memcpy(&extra->m_WavFormatEx, wavStream+pos, length);
pos+=length;
extra->m_WavFormatEx.cbSize = (WORD)length;
break;
}
case mmioFOURCC(
'
d
'
,
'
a
'
,
'
t
'
,
'
a
'
):
{
copiedBuffer = true;
if (length != handle->Size())
{
GCC_ERROR
Wav resource size does not equal buffer size
));
return 0;
}
memcpy(handle->WritableBuffer(), wavStream+pos, length);
pos+=length;
break;
}
}
file += length;
// If both blocks have been seen, we can return true.
if( copiedBuffer )
Search WWH ::




Custom Search