//Zuerst muss die entsprechende DLL importiert werden
[DllImport("winmm.dll")]
private static extern int mciSendString(string lpstrCommand, string lpstrReturnString, int uReturnLength, int hwndCallback);
private void Aufnahme_Start()
{
mciSendString("open new Type waveaudio Alias recsound", "", 0, 0);
mciSendString("set recsound TIME FORMAT MS", "", 0, 0);
mciSendString("set recsound BITSPERSAMPLE 16", "", 0, 0);
mciSendString("set recsound CHANNELS 2", "", 0, 0);
mciSendString("set recsound SAMPLESPERSEC 48000", "", 0, 0);
mciSendString("set recsound BYTESPERSEC 192000", "", 0, 0);
mciSendString("set recsound ALIGNMENT 4", "", 0, 0);
mciSendString("record recsound", "", 0, 0);
}
private void Aufnahme_Stop()
{
mciSendString("save recsound C:/Aufnahme.wav", "", 0, 0);
mciSendString("close recsound", "", 0, 0);
}