报错:未处理 System.ApplicationException
Message="应用程序中的错误。"
Source="Microsoft.DirectX.DirectSound"
代码:Device dv=null;
Device dv=new Device(guid);在这一段代码指定设备guid时报错:"应用程序中的错误。" 不明白为什么在指定设备guid时报错;
Message="应用程序中的错误。"
Source="Microsoft.DirectX.DirectSound"
代码:Device dv=null;
Device dv=new Device(guid);在这一段代码指定设备guid时报错:"应用程序中的错误。" 不明白为什么在指定设备guid时报错;
{
// 获取默认音频捕捉设备
CaptureDevicesCollection devices = new CaptureDevicesCollection(); // 枚举音频捕捉设备
Guid deviceGuid = Guid.Empty; // 音频捕捉设备的ID
if (devices.Count > 0)
deviceGuid = devices[0].DriverGuid;
else
{
MessageBox.Show("系统中没有音频捕捉设备");
return false;
}
// 用指定的捕捉设备创建Capture对象
try
{
mCapDev = new Capture(deviceGuid);
}
catch (DirectXException e)
{
MessageBox.Show(e.ToString());
return false;
}
return true;
}
在指定声卡的:guid时;
public Device(Guid guidDev);
首先:
device dv=null;
然后获取:声卡guid
接着:指定设备id
dv= new device(guid)
就在这个时候出现错误:
Message="应用程序中的错误。"
Source="Microsoft.DirectX.DirectSound"