DirectSound & Certain WAV Files
-
I am learning how to use DirectX from a book (SAMS Teach Yourself DirectX 7 In 24 Hours - although it received some negative reviews, on the whole I think it is pretty good). I have got some DirectSound code working, but only on certain WAV files. The WAV files that work properly have 8 as the wBitsPerSample member of the WAVEFORMATEX structure. The ones that don't have 0 as this value (what actually happens is that the sound plays as fast as it can go, rather than using the frequency it should be played at). In the VC++ docs (VC++ 6) it says that that member CAN be 0 if the format is not PCM, as sometimes this member can't be used in the compression algorithm the WAV uses. I also notice that the cbSize member can indicate that the WAVEFORMATEX structure has some extra bytes tacked onto the end, so I duly coded to allow for this and passed the extended structure to CreateSoundBuffer(). Although it didn't cause a crash, it made no difference whatsoever. Does anyone know if I am doing something wrong? How can I overcome this problem? According to the book DirectSound can handle ANY format...