I'm using the PlaySound API call in VB6. My OS is Windows 7 Home Premium x64.
When I generate a wave form that has lets say a 1000Hz sine wave, that plays for exactly 10000 complete cycles of this waveform, and then send it (along with the correct WAV header) to the PlaySound API call, with it set to play in memory (so that it loads my waveform and wav header from the byte Array I'm sending it), I find it truncates the output audio. I can tell because if I use a loopback, and then have another known working audio program like GoldWave recording the audio, I find that audio output from my program is truncated (the waveform in the last cycle is chopped off prior to completion by my sound generating program, or more specifically by the PlaySound API it depends on to output the audio). And I've checked the WAV header multiple times in my program, and it is correct (proper blockallign, bit-depth, etc). And when I save my WAV header and byte array of the waveform to a .wav file, and load that into GoldWave audio software, I find that my complete waveform data is present (the last sine wave cycle is not truncated). So it appears that my PlaySound API isn't reading/playing all the data in the byte array.
Is this a known problem? And is there a known fix for it?