When I open an exclusive mode audio stream on one of my speakers, there is a strange buzzing noise. This buzzing noise does not happen under the same conditions on my other devices, nor does it happen in exclusive push mode or shared mode in general.
The problem seems to be that WASAPI is setting the periodicity to be 5 milliseconds higher than what I requested, for no reason in particular. I've tried 10 ms to see timeGetTime() to reveal a period of 15 ms, so I tried requesting 15 ms instead. The period then became 20 ms. This does not happen with my other devices, which are streamed under the same conditions as the problem device, and timeGetTime() reveals a periodicity equal to that requested. Is this a glitch in a driver somewhere, or might I be making an assumption in my code that I shouldn't be?
UPDATE: The buzzing noise goes away when I send a packet of silence before starting the stream. I'm not sure how this affects the periodicity, so I'm still looking for an explanation.
Thanks go to Maurits from MSDN for helping me figure out the answer.
The WASAPI documentation instructs that a period of audio should be sent to the device before starting to avoid start-up glitches. The buzzing noise heard here qualifies as one of those. The reason that only my amp, which is a USB connected device, had this problem while other non-USB devices did not (the other two devices include the built-in laptop speakers and an HDMI-connected TV monitor) is because it uses a different kind of streaming than the other two ("standard streaming" instead of "standard looped streaming").