Unable to play first 8ish seconds of wav with fread/WASAPIs

I'm using classes I developed after looking at the 'WinAudio' sample. While that example works fine, as do earlier builds of my application, with my latest build I've just realised the playback is starting 8 or 9 seconds in, even though I have not made substantial changes to the class that actually reads the file. I'm using fread and the WASAPIs.

The bizzare thing is if I set up break points and use ftell to see exactly where it's starting within the data chunk, the problem does not exist. I set up a breakpoint just before each read operation. It all looks normal, starting at 46 bytes into the file (after the RIFF chunk and data chunk header). If I hit 'continue' in the debuger over and over again, I can hear that it's playing normally. I mean in peices obviously, because I'm pausing the process every 2000ish frames. But it plays from the start.

Has anyone any thoughts on what might cause this?
Last edited on
The issue was I had removed the sleep periods in the playing thread. These are shown in examples such as:

http://msdn.microsoft.com/en-us/library/windows/desktop/dd316756%28v=VS.85%29.aspx

I still don't understand why they're important, but without them the WAS RenderingClient interface was somehow eating the first 8 second's worth of data I was feeding it.
Topic archived. No new replies allowed.