Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Holgersson

Cannot load wave files

This topic is 6296 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!