views:

198

answers:

1

Ive been playing around with XAudio2 but have encountered some strange problems with the mmioOpen function

For some reason it seems to fail with MMIOERR_FILENOTFOUND, even though the file is there, in fact the file is in the same directory as other files I'm loading which work fine...

The wav files im using to test with are just the ones in the August SDK samples, which work fine if I copy the names into the XAudio2BasicSound sample...In some cases I actauly had to rename the sounds to stuff like 1.wav to get them to open...

//"Counting.wav" does not work
Sounds.append(Audio.Sound(L"c:/test/xaudio2/Counting.wav"))
Sounds.append(Audio.Sound(L"Electro_1.wav"))
//"heli.wav" does not work
Sounds.append(Audio.Sound(L"c:/test/xaudio2/heli.wav"))
//"HipHoppy_1.wav" does not work
//"c:/test/xaudio2/HipHoppy_1.wav" does not work
Sounds.append(Audio.Sound(L"1.wav"))
Sounds.append(Audio.Sound(L"MusicMono.wav"))
Sounds.append(Audio.Sound(L"MusicSurround.wav"))
//"Techno_1.wav" does not work
//"c:/test/xaudio2/Techno_1.wav" does not work
Sounds.append(Audio.Sound(L"2.wav"))

I'm just using the wav class from SDKwavefile.h. I added the mmioinfo struct to get the error number and in the casses which dont work it gave me MMIOERR_FILENOTFOUND, even though the files are there, all in the same directory...I just changed line 63 a bit so i could get the error code from mmioOpen. Audio.Sound doesnt do anything with the string except pass it to the wav.Open method.

MMIOINFO info;
ZeroMemory(&info, sizeof(MMIOINFO));
m_hmmio = mmioOpen( strFileName, &info, MMIO_ALLOCBUF | MMIO_READ );
if(!h_hmmio)
    std::wcout << L"Error Code: " << info.wErrorRet << L"\n";

I really see no reason why it fails to open some of these waves...

A: 

Change

m_hmmio = mmioOpen( strFileName, &info, MMIO_ALLOCBUF | MMIO_READ )

to

m_hmmio = mmioOpen( strFileName, NULL, MMIO_ALLOCBUF | MMIO_READ )