Hi, I am trying to write a program to play a small .wav file in C++. I have programmed it following the DirectX SDK documents to write and play on a secondary static buffer. It runs correctly except that at the end of the playback for any .wav file, there is a very noticeable "clicking" noise. I am certain that it's not a defect on my audio hardware's part because any other game that I know uses DirectSound doesn't have it.
I've tried polling GetCurrentPosition for it every cycle and stopping it right before it ends but was unreliable. I can't play it on a primary buffer because .wav's played on primary buffers must be looped, which I don't want.
Does anybody know a fix to this problem? Thanks in advance.