Greetings eXpl0it3r:
I first saw the tone on the Visual Analyzer, as I showed already. I also saw a few level indicator lights on my external mixer, where I send the PC audio to directly. And no, I never heard it. I just did a hearing test, running my analog sine HP 204C Oscillator device (10Hz to 1MHz) to my mixer and turn it up (all level indicator lights on), I can only hear up to ~14kHz.
My initial idea was when "loop=false" and it plays to the end, it continue loops, but is pointing the the final sample. However, changing the final sample to zero did nothing, but worked at >124 samples to zero, and reduces the level as approaching. As a guess, that means the same "loop pointing at the last sample" is happening, but after the sample rate conversion.
For conversion i.e. 24000Hz to 96000 there are a few steps. Convert up-sample-rate to match, "sample, 0, 0, 0", increase level *4 (compensate for zeros), filter out anything above 12kHz (i.e. 256-bit software FIR filter), send higher-frequency-samples (4*original) to sound-card or Windows control.
The 124 zero samples needed seems to indicate the "loop pointing at the last sample" happens at the post-up-sample point after a normal 256-bit FIR filter.
In the old days, a sound-card only allowed 1 program to use it at a time (Win95 and earlier), and now Windows hold all the keys, so any audio needs to be passed to using its format, which means converted by software beforehand.
So I think from what I saw, the tone is produced by the "loop pointing at the last sample", post-conversion by software, and then sent to Windows. I checked out the 'sound.cpp' file, and it appears any issue, if it exists (but my hardware), is mostly in "openal32.lib", as it seems "sound.cpp" behaves as a wrapper, particularly of the functions posted in the demo-code I posted.
I tried adjusting the Playback-Device Sample Rate under Windows and it changed nothing. And I previously did the demo code test using 22050Hz, which has the audio range up to half that, 11025Hz. My sound-card claims it uses up to 192kHz on Playback, so everything prior to Windows7, or within Windows7 its self, is up-converted to that.
Below, I posted my Sound Card driver, if that helps...