我試圖使用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