【发布时间】:2014-03-18 14:27:30
【问题描述】:
我正在尝试捕获一个 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 通话没有被记录。
我的路径规范有什么问题?
第二件事是,当生成波形文件时,没有录制声音。为什么?
【问题讨论】:
标签: c# skype4com mcisendstring