Hi there
Have been totally pulling my hair out with the above error. It is
occuring when I try to initalise the capture buffer as follows:
dxCaptureBuffer = new CaptureBuffer(dxCaptureBufferDescription,
dxCapture);
Maybe somebody else can spot something I am missing, as I have spent
hours trying to figure this out to no avail.
Capture Buffer Description code:
dxCaptureBufferDescription = new CaptureBufferDescription
();
dxCaptureBufferDescription.BufferBytes =
wavFormat.AverageBytesPerSecond / 5;
Audio Device code:
//Initalise the DirectSound device
dxSoundDevice = new Device();
//Set cooperative level from form control.
dxSoundDevice.SetCooperativeLevel(control,
CooperativeLevel.Normal);
/**
* The following code sets up the format of the Wav
capture.
* Format is as follows:
* PCM audio - 22KHz - 16bit - Mono
**/
short channels = 1;
short bitsPerSample = 16;
int samplesPerSecond = 22050;
wavFormat = new WaveFormat();
wavFormat.Channels = channels;
wavFormat.FormatTag = WaveFormatTag.Pcm;
wavFormat.SamplesPerSecond = samplesPerSecond;
wavFormat.BitsPerSample = bitsPerSample;
/**
* BlockAlign is the minimum atomic unit of data
* The value of the BlockAlign property must be equal
to the product of Channels and
* BitsPerSample divided by 8 (bits per byte).
**/
wavFormat.BlockAlign = (short)(channels * (bitsPerSample /
(short)8));
//Average bytes per second = block align * samples per
second.
wavFormat.AverageBytesPerSecond = wavFormat.BlockAlign *
samplesPerSecond;
Thanks in advance, hopefully somebody can put an end to my DirectX
misery :-)
Paul