Question for CreateInMemoryWaveBank

I want to load *.xwb file,

this function is from "XBUtil.h"

HRESULT XBUtil_LoadFile( const WCHAR* strFile, VOID** ppFileData, DWORD* pdwSize )

{// use as big as file size memory

"CreateFile" and get file size to "malloc" buffet and go to "ReadFile" and CreateInMemoryWaveBank

}


and next is sample from Microsoft DirectX SDK (June 2006)\Samples\C++\XACT\XACTGame\

void FunctionForLoadWaveBank()

{//won't use many memory

hFile = CreateFile( str, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL );
dwFileSize = GetFileSize( hFile, NULL );
hMapFile = CreateFileMapping( hFile, NULL, PAGE_READONLY, 0, dwFileSize, NULL );
pbWaveBank = MapViewOfFile( hMapFile, FILE_MAP_READ, 0, 0, 0 );
hr = pEngine->CreateInMemoryWaveBank( pbWaveBank, dwFileSize, 0, 0, &pWaveBank );
CloseHandle( hMapFile );
CloseHandle( hFile );

}

why get different memory volume

when I load File and those function for

Microsoft DirectX SDK (June 2006)\Samples\C++\XACT\XACTGame\media\audiodroid.xwb

what different between FunctionForLoadWaveBank and XBUtil_LoadFile

thx for any reply

PS: I have no idea within CreateFileMapping and MapViewOfFile.....

[1312 byte] By [Fatming] at [2008-2-2]
# 1

Are you asking why the June DXSDK uses CreateFileMapping and MapViewOfFile? That does memory mapped file access which is faster than reading the file into an allocated buffer. The results are the same however

JasonSandlin at 2007-8-30 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: Audio / XACT...