Phil Steinmeyer
10-27-2006, 11:05 AM
So I installed Vista RC 1, which was a pain for other reasons I won't go into here...
My game seems ok, with one glaring exception:
I'm getting stuttering on my sound/music. I'm using WaveOutWrite, rather than DirectSound or anything like that.
Usually this is a case of audio buffers being too small, and sure enough, if I doubled them, the problem goes away. But that, in turn, makes my audio quite laggy.
Basically, I use 3 buffers of 1024 samples each, and my playback is 22050 Hz. Assuming the 'playing buffer' is half done, on average, my latency is 2.5 * 1024 *1000 / 22050, or 116 ms on average, plus whatever time it takes for Windows to actually put the data to the hardware.
To solve the stuttering, I had to double my buffers to 2048 samples, bumping up latency from a barely noticeable 116 ms to a rather noticeable 232 ms.
I logged my audio thread, and I'm averaging calling it every ~20 ms, with a max time between calls of 32 ms. This is the same on my Vista machine as my XP machine, and the latter works fine with the smaller buffers.
In theory, the smaller buffers should be ok as long as my time between calls to my audio thread never exceeds 2.0 * 1024 *1000 / 22050, or 93 ms. Since I'm actually at a max of 32 ms, I should be ok, with a fair amount of 'headroom' here.
So, it would appear that rather than being something on my side of the fence (i.e. my app failing to fill buffers in time), it appears to be something on Windows Vista's side of the fence - it just doesn't like the small buffers.
Anybody else run into this and have insight/fixes for it?
My game seems ok, with one glaring exception:
I'm getting stuttering on my sound/music. I'm using WaveOutWrite, rather than DirectSound or anything like that.
Usually this is a case of audio buffers being too small, and sure enough, if I doubled them, the problem goes away. But that, in turn, makes my audio quite laggy.
Basically, I use 3 buffers of 1024 samples each, and my playback is 22050 Hz. Assuming the 'playing buffer' is half done, on average, my latency is 2.5 * 1024 *1000 / 22050, or 116 ms on average, plus whatever time it takes for Windows to actually put the data to the hardware.
To solve the stuttering, I had to double my buffers to 2048 samples, bumping up latency from a barely noticeable 116 ms to a rather noticeable 232 ms.
I logged my audio thread, and I'm averaging calling it every ~20 ms, with a max time between calls of 32 ms. This is the same on my Vista machine as my XP machine, and the latter works fine with the smaller buffers.
In theory, the smaller buffers should be ok as long as my time between calls to my audio thread never exceeds 2.0 * 1024 *1000 / 22050, or 93 ms. Since I'm actually at a max of 32 ms, I should be ok, with a fair amount of 'headroom' here.
So, it would appear that rather than being something on my side of the fence (i.e. my app failing to fill buffers in time), it appears to be something on Windows Vista's side of the fence - it just doesn't like the small buffers.
Anybody else run into this and have insight/fixes for it?