[highlight=c#]using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.DirectX;
using Microsoft.DirectX.DirectSound;
using System.Windows.Forms;
using System.IO;

namespace Voice_Cappppp
{

class VoicePacket
{
CaptureBufferDescription _c_desk;
public CaptureBuffer c;
Device dev;
SecondaryBuffer playback;
//Notify notify;
DeviceInformation info;
//Capture cap;
WaveFormat wave;
BufferDescription pDesc;

public VoicePacket(CaptureBufferDescription cp, IntPtr handle)
{
dev = new Device();
dev.SetCooperativeLevel(handle, CooperativeLevel.Normal);

CaptureDevicesCollection ccp = new CaptureDevicesCollection();
info = ccp[0];

//cap = new Capture(info.DriverGuid);

wave.Channels = 1;
wave.FormatTag = WaveFormatTag.Pcm;
wave.SamplesPerSecond = 22050;
wave.BitsPerSample = 8;
wave.BlockAlign = (short)(1 * (8 / (short)8));
wave.AverageBytesPerSecond = wave.BlockAlign * 22050;

_c_desk = cp;
_c_desk.BufferBytes = wave.AverageBytesPerSecond / 5;
_c_desk.Format = wave;

pDesc = new BufferDescription(wave);
pDesc.BufferBytes = wave.AverageBytesPerSecond / 5;

playback = new SecondaryBuffer(pDesc, dev);
Capture cap = new Capture(info.DriverGuid);

c = new CaptureBuffer(_c_desk, cap);
}

/// <summary>
/// Buffer which contains the recorded voice as a array of bytes.
/// </summary>
public byte[] BufferData { get; set; }

/// <summary>
/// Records your voice from a microphone, and transfers the data to the buffer. (BufferData)
/// </summary>
public void GetCurrentVoiceType()
{
//if (!c.Capturing)
//{
c.Start(true);
Stream s = Stream.Null;
c.Read(0, s, c.Caps.BufferBytes, LockFlag.None);
if (s != null)
{
byte[] bt = new byte[c.Caps.BufferBytes];
s.Read(bt, 0, bt.Length);
BufferData = bt;
}
else
{
MessageBox.Show("Crap");
}
//c.Stop();
// }
}

/// <summary>
/// Plays the current captured buffer.
/// </summary>
public void PlaySound()
{
if (BufferData.Length > 0)
{
playback.Write(0, BufferData, LockFlag.None);
playback.Play(0, BufferPlayFlags.Default);

}
else
{
MessageBox.Show("Crap");
}
}

/// <summary>
/// Plays a received buffer.
/// </summary>
/// <param name="pcms"></param>
public void PlaySound(byte[] pcms)
{
playback.Write(0, pcms, LockFlag.None);
playback.Play(0, BufferPlayFlags.Default);
}
}

class Program
{
[System.Runtime.InteropServices.DllImport("user32")]
public static extern bool GetAsyncKeyState(int vKey);

static void Main(string[] args)
{
VoicePacket vp = new VoicePacket(default(CaptureBufferDescription), System.Diagnostics.Process.GetCurrentProcess().Han dle);
while (true)
{
vp.GetCurrentVoiceType();
if (GetAsyncKeyState((int)Keys.F1)){
vp.c.Stop();
vp.PlaySound();
MessageBox.Show(ASCIIEncoding.ASCII.GetString(vp.B ufferData));
}
if (GetAsyncKeyState((int)Keys.F2))
{
vp.GetCurrentVoiceType();
}
}
}
}
}
[/highlight]

I'm posting this here because on the C# section I won't get that much help. So basically I want to capture my mothafucking voice using DirectSound () It does not throw any exceptions or anything else. It just doesn't capture my voice. Help?