Main Site Links Resources Tutorials
News VB Gaming Code Downloads DirectX 7
Contact Webmaster VB Programming Product Reviews DirectX 8
  General Multimedia Articles DirectX 9
      Miscellaneous

DirectSound: Recording
By: Jack Hoxley
Written: June 2000

Download: DS_Record.Zip (11kb)


Using Directsound to record input from the user is much more likely to be used in a multimedia application than a game. Recording a sound is fairly easy, which is good.

Recording is dependant on the user's computer; they will need a microphone and a directsound driver that supports DirectSoundCapture.

Up till now (if you're following my tutorials) you will only have some across the normal playback mode of directsound. In this example you will meet the DirectSoundCapture device. This device is designed to record sounds, and it can't play them back. In order for us to play them back we must copy the recorded data to a blank playback buffer - then play the playback buffer. This isn't too difficult, but it is, however, very useful and opens up several possibilities.

Copying the data from one buffer to another allows us to access the memory and data behind the buffer; although this is nothing special to recording, it is used in this example so now is a good time to explain it. During the copying process we will have a byte-array of the data in a normal VB array. With some clever maths we could quite easily change this data before writing it back to the buffer - opening the door to sound effects. You can use this array to create tones; if you set every entry to be '12' you will get a certain sound tone.

I advise that you download the program from the top of the page or download it from the downloads page. It is a fairly simple program to learn from...

DirectX 4 VB 2000 Jack Hoxley. All rights reserved.
Reproduction of this site and it's contents, in whole or in part, is prohibited,
except where explicitly stated otherwise.
Design by Mateo
Contact Webmaster