我正在尝试捕获一个 Skype 呼叫并将其保存在我的 PC 中并带有波形扩展名,但每次我尝试mciSendString
它都无法创建声音文件。
这是我的代码
public void Skype_CallStatus(Call call, TCallStatus status)
{
int result = 0;
Configuration config = ConfigurationManager.OpenExeConfiguration(System.Windows.Forms.Application.ExecutablePath);
if (status == TCallStatus.clsInProgress)
{
mciSendString("open new Type waveaudio Alias recsound", "", 0, 0);
mciSendString("record recsound", "", 0, 0);
}
//else if (status == TCallStatus.clsFinished)
else if (status == TCallStatus.clsFinished)
{
DateTime currdate = DateTime.Now;
//string datetime = currdate.Day + currdate.Month + currdate.Year + "_" + currdate.Hour + currdate.Minute + currdate.Second;
string datetime = string.Format("{0:yyyyMMddhhmmss}.wav", DateTime.Now);
string wavfilename = "";
if (config.AppSettings.Settings["VoiceRecordsPath"].Value != null)
{
//wavfilename = config.AppSettings.Settings["VoiceRecordsPath"].Value.Replace(",","") + "_" + CSRBusiness.User.Country + "_" + datetime + @".wav";
wavfilename = CSRBusiness.User.Country + "_" + datetime;
}
Directory.SetCurrentDirectory(config.AppSettings.Settings["VoiceRecordsPath"].Value.Replace(",", ""));
result = mciSendString("save recsound " + wavfilename, "", 0, 0);
//result = mciSendString("save recsound d://test.wav", "", 0, 0);
mciSendString("close recsound ", "", 0, 0);
MessageBox.Show(result.ToString());
}
// MessageBox.Show(result.ToString());
}
该路径是我需要保存文件的位置:
C:\\Users\\tridip.BBAKOLKATA\\Documents\\Visual Studio 2010\\Projects\\CSRAssistant\\CSRAssistant\\bin\\Debug\\VoiceRecords
我的代码中有什么样的错误?
但是当我硬编码路径和文件名时,创建mciSendString
了result = mciSendString("save recsound d://test.wav", "", 0, 0);
一个文件,但是当我播放该波形文件时没有记录 Skype 通话。
我的路径规范有什么问题?
第二件事是,当生成波形文件时,声音没有被记录下来。为什么?