Sprache: C#
Mithilfe dieses Codes können Sie Wave-Dateien über MCISendString aufgenommen werden. Damit die Qualität auch entsprechend ist, werden außerdem noch Frequenz, Kanäle etc. angepasst.
[b]Achtung[/b]: Dies funktioniert nur auf Windows XP! Bei Windows 7 ist die Qualität allerdings trotz der Einstellungen schlecht.
//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);
}
//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);
}
Alte URL:
/snippet/wave-dateien-ueber-mci-aufnehmen/1594