I am trying to use DirectSound8 to play the interference wave between two sinusoidal tones, 110 and 111 Hz. I would like to record 2.0 seconds worth of this sound, sampled at 11025 samples per second. To do so, I try to set lBufferBytes to the number of samples with the following code:

Dim BB As Long
BB = CLng((intSmpl - intShift) * DsDesc.fxFormat.nBlockAlign)
DsDesc.lBufferBytes = BB

However, the line BB = CLng... never executes. VB6 just jumps out of the sub.

The value of DsDesc.fxFormat.nBlockAlign is 4.
The value of (intSmpl -intShift) is 22050.
Any ideas?