Problem with loading Wave files(Adams book)

Started by
6 comments, last by Keba 20 years, 5 months ago
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
Advertisement
did you enter a space with "fmt "?
It''s supposed to be 4 bytes with a space at the end.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

no i didn''t, but i changed, but it still want work
Riffsig = "RIFF\x"
WaveSig = "WAVEfmt"
formatSig = "fmt "
and all of them got a square symbol att the end
hmm datasig was "cue "....
but the other sigs first four bytes was correct
Probably a quite hacked wav loader (like mine ) ).

The RIFF docs say when you happen onto an unknown segment, skip it. I haven''t heard of a "cue " segment, probably some extra information saved by the wav generator.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

so, you mean if i get a unknow segment i read another 4 bytes?
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]

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

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.

This topic is closed to new replies.

Advertisement