我试图使用DirectSound从麦克风捕捉声音。这里是我的代码:C#DirectSound中的模糊呼叫
using Microsoft.DirectX.DirectSound;
public MicrophoneSensor()
{
CaptureBufferDescription micBufferDesc = new CaptureBufferDescription();
WaveFormat format = new WaveFormat();
format.SamplesPerSecond = 22000;
format.Channels = 1;
format.BitsPerSample = 8;
format.AverageBytesPerSecond = 22000;
format.BlockAlign = 1;
micBufferDesc.Format = format;
micBufferDesc.BufferBytes = 100000;
micBufferDesc.ControlEffects = false;
micBufferDesc.WaveMapped = true;
micBuffer = new CaptureBuffer(micBufferDesc, microphone);
}
的micBufferDesc和格式变量的实例导致Visual Studio 2008年抛出了以下错误:
The call is ambiguous between the following methods or properties: 'Microsoft.DirectX.DirectSound.CaptureBufferDescription.CaptureBufferDescription()' and 'Microsoft.DirectX.DirectSound.CaptureBufferDescription.CaptureBufferDescription()'
and
The call is ambiguous between the following methods or properties: 'Microsoft.DirectX.DirectSound.WaveFormat.WaveFormat()' and 'Microsoft.DirectX.DirectSound.WaveFormet.WaveFormat()'
我试图说明的命名空间的好几个不同的组合和使用陈述,但没有运气。
我也检查了解决方案资源管理器中的引用,并且据我所知,没有重复。
一个全新的测试项目只有Microsoft.DirectX.DirectSound引用,没有其他东西仍然抛出相同的错误。
我还卸载并重新安装了DirectX SDK(2009年3月)以及DirectX SDK(2008年11月)。仍然没有运气。
最后,我在实验室的另一台计算机上尝试了一个新项目,但它仍然无法工作。
下面是引用我有:
- 图
- Microsoft.DirectX.DirectSound
- Microsoft.DirectX.DirectInput
- PresentationCore
- PresentationFramework
- 服务
- 系统
- System.Core程序
- System.Data
- System.Data.DataSetExtensions
- System.Deployment
- System.Drawing中
- System.Runtime.Serialization
- System.ServiceModel
- 系统。 Windows.Forms
- System.Xml
- System.Xml.Linq
- UIAutomationProvider
- WindowsBase
- WindowsFormsIntegration程序
我在帖子中增加了一些信息。这是一个奇怪的问题。 – JohnS 2009-06-24 14:56:13