🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Cannot load wave files

Started by
-1 comments, last by Holgersson 23 years, 2 months ago
Using DirectX Audio i need to load wave file through custom class, which inherited IDirectMusicLoader class. For loading data to pick it up by GetObject function i`m using class public from IStream. Reading and moving of file pointer are made by these functions. STDMETHODIMP CFileStream::Read( void* pv, ULONG cb, ULONG* pcbRead ) { DWORD dw; ReadFile(m_hFile,pv,cb,&dw,NULL); if (cb == dw){ if( pcbRead != NULL ) { *pcbRead = cb; } return S_OK; } return E_FAIL ; } STDMETHODIMP CFileStream::Seek( LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER* plibNewPosition ) { // fseek can''t handle a LARGE_INTEGER seek... long lOffset; DWORD dwSeek; lOffset = dlibMove.LowPart; DWORD pos = SetFilePointer(m_hFile,lOffset,NULL,dwOrigin); if(pos == 0xffffffff) { return E_FAIL;} if( plibNewPosition != NULL ) { pos = SetFilePointer(m_hFile,0,NULL,FILE_CURRENT); if(pos == 0xffffffff) { return E_FAIL;} plibNewPosition->LowPart = pos; if( lOffset < 0 ) { plibNewPosition->HighPart = -1; } else { plibNewPosition->HighPart = 0; } } return S_OK; } Using this functions i can successfully play midi file, but wave file cannot be read to it`s end.

This topic is closed to new replies.

Advertisement