wav文件不使用mciSendString保存

时间:2015-07-22 14:53:57

标签: c# winforms

我使用mciSend方法记录wav文件,但问题是文件没有保存。我的代码是:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Speech.Recognition;
using System.Speech.Synthesis;
using Microsoft.VisualBasic.Devices;
using System.Runtime.InteropServices;
public class Form1

{

[DllImport("winmm.dll", EntryPoint="mciSendStringA")]
private static extern int mciSendString(string lpstrCommand, string    lpstrReturnString, int uReturnLength, int hwndCallback);

private void Button1_Click(object sender, System.EventArgs e)

{
// record from microphone
mciSendString("open new Type waveaudio Alias recsound", "", 0, 0);
mciSendString("record recsound", "", 0, 0);
}

 private void Button2_Click(object sender, System.EventArgs e)

{
// code that not working
mciSendString("save recsound D:\\MyFile.wav", "", 0, 0);
mciSendString("close recsound", "", 0, 0);
}
}

代码没有错误,但没有在上面的路径上创建任何文件。

0 个答案:

没有答案