Archived

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

Problem with loading Wave files(Adams book)

This topic is 5144 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

Hello, i''m using Jim Adams code from the book to loading a wav file, and playing it. But it dosen''t work correct(or i am doing wrong) any way, all my wav files gets rejected when checking: if(memcmp(Hdr->RiffSig,"RIFF",4) || memcmp(Hdr->WaveSig,"WAVE",4) || memcmp(Hdr->formatsig,"fmt",4) || memcmp(Hdr->Datasig,"data",4) ) in the function CreateBufferFromWAV

Share this post


Link to post
Share on other sites
Somewhere in the MSDN it states the format of RIFF-files. There's actually the chunk code ("fmt ", "data", ...) and the size of the chunk (4 bytes chunk id followed by 4 bytes chunk size). Some chunks allow for nesting.

Try to read that up. All you need to do is skip the unknown chunk by setting the file pointer to the next chunk (with the known chunk size for the current chunk).

[edited by - Endurion on November 11, 2003 1:57:46 PM]

Share this post


Link to post
Share on other sites
thanks for all help, i have located the bug.
i realised that i was trying to play the wav file
with notifications flaggs whitout using the DSBCAPS_CTRLPOSITIONNOTIFY flag when creating the wav file.

Share this post


Link to post
Share on other sites