Failed to Prepared the Streaming Cue - XACTENGINE_E_NOWAVEBANK

Hello,

When I'm try to load the soundbank, the creating wavebank steps seems to be fine, the creating soundbank is fine too. But when I create the cue which use sample from the wavebank that is the streaming bank, the XACT_E_NOWAVEBANK is returned.

Below is the loading code. Of course, there is some point to improve, but all I need to know is what am I missing to create the cue/create the streaming wavebank.

Regards,
Wutipong W.

HRESULT InitXACT()
{
HRESULT hr = S_OK;
hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
if(FAILED(hr))
{
return hr;
}
//Create Engine
hr = XACTCreateEngine(0,&pAudioEngine);
if(FAILED(hr))
{
return hr;
}
//Initialize Engine
XACT_RUNTIME_PARAMETERS Params;
ZeroMemory(&Params, sizeof(Params));
hr = pAudioEngine->Initialize(&Params);
if(FAILED(hr))
{
return hr;
}

hInMemFile = CreateFile(TEXT("./Sample/InMemoryWaveBank.xwb"),GENERIC_READ,
FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL );
hStreamFile = CreateFile(TEXT("./Sample/StreamingWaveBank.xwb"),
GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
FILE_FLAG_OVERLAPPED | FILE_FLAG_NO_BUFFERING, NULL );
hSoundBankFile = CreateFile(TEXT("./Sample/Sounds.xsb"),GENERIC_READ,
FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL );

if(hInMemFile == INVALID_HANDLE_VALUE ||
hStreamFile == INVALID_HANDLE_VALUE||hSoundBankFile == INVALID_HANDLE_VALUE)
{
return E_HANDLE;
}

DWORD dwFilesize;
DWORD byteread;

//Load Streaming WaveBank
XACT_WAVEBANK_STREAMING_PARAMETERS XStreaming_Params;
ZeroMemory(&XStreaming_Params,sizeof( XStreaming_Params));
XStreaming_Params.file = hStreamFile;
XStreaming_Params.packetSize = 64; // Four DVD sectors = 8192 bytes

hr = pAudioEngine->CreateStreamingWaveBank( &XStreaming_Params, &pStreamWaveBank ) ;
if(FAILED(hr))
{
return hr;
}

//Load In-Memory WaveBank
dwFilesize = GetFileSize(hInMemFile,NULL);
pbInMemBank = new byte[dwFilesize];
ReadFile(hInMemFile,pbInMemBank,dwFilesize,&byteread,NULL);

hr = pAudioEngine->CreateInMemoryWaveBank(pbInMemBank,dwFilesize,0,0,&pInMemWaveBank);
CloseHandle(hInMemFile);
if(FAILED(hr))
{
return hr;
}

dwFilesize = GetFileSize(hSoundBankFile,NULL);
pbSoundBank = new byte[dwFilesize];
ReadFile(hSoundBankFile,pbSoundBank,dwFilesize,&byteread,NULL);

hr = pAudioEngine->CreateSoundBank(pbSoundBank,dwFilesize,0,0,&pSoundBank);

if(FAILED(hr))
{
return hr;
}
CloseHandle(hSoundBankFile);

XACTINDEX index;

index = pSoundBank->GetCueIndex("zap");
hr = pSoundBank->Prepare(index,0,0,&pEFXCue[0]);
if(FAILED(hr))
{
return hr;
}

index = pSoundBank->GetCueIndex("zap");
hr = pSoundBank->Prepare(index,0,0,&pEFXCue[1]);
if(FAILED(hr))
{
return hr;
}

index = pSoundBank->GetCueIndex("song1");
hr = pSoundBank->Prepare(index,0,0,&pBGMCue[0]);
if(FAILED(hr))
{
return hr;
}

index = pSoundBank->GetCueIndex("song2");
hr = pSoundBank->Prepare(index,0,0,&pBGMCue[1]);
if(FAILED(hr))
{
return hr;
}

return hr;
}

[3446 byte] By [mr_tawan] at [2008-2-2]
# 1
Nevermind, I just have it working (there's explaination in the Tutorial)

Thank you,

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