Note that there are some explanatory texts on larger screens.

plurals
  1. POC# Ambiguous call in DirectSound
    text
    copied!<p>I'm trying to use DirectSound to capture sound from a microphone. Here's my code:</p> <pre><code> 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); } </code></pre> <p>The instantiations of the micBufferDesc and format variables cause Visual Studio 2008 to throw the following error:</p> <blockquote> <p>The call is ambiguous between the following methods or properties: 'Microsoft.DirectX.DirectSound.CaptureBufferDescription.CaptureBufferDescription()' and 'Microsoft.DirectX.DirectSound.CaptureBufferDescription.CaptureBufferDescription()'</p> <p>and</p> <p>The call is ambiguous between the following methods or properties: 'Microsoft.DirectX.DirectSound.WaveFormat.WaveFormat()' and 'Microsoft.DirectX.DirectSound.WaveFormet.WaveFormat()'</p> </blockquote> <p>I've tried quite a few different combinations of stating the namespace and using statements but no luck.</p> <p>I've also checked the references in the solution explorer and as far as I can tell there are no duplicates.</p> <p>A brand new test project with only the Microsoft.DirectX.DirectSound reference and nothing else still throws the same error.</p> <p>I have also uninstalled and reinstalled the DirectX SDK (March 2009) as well as the DirectX SDK (November 2008). Still no luck.</p> <p>Finally, I've tried a new project on another computer here in the lab and it still doesn't work. </p> <p>Here are the references I have:</p> <ul> <li>Graph</li> <li>Microsoft.DirectX.DirectSound</li> <li>Microsoft.DirectX.DirectInput</li> <li>PresentationCore</li> <li>PresentationFramework</li> <li>Service</li> <li>System</li> <li>System.Core</li> <li>System.Data</li> <li>System.Data.DataSetExtensions</li> <li>System.Deployment</li> <li>System.Drawing</li> <li>System.Runtime.Serialization</li> <li>System.ServiceModel</li> <li>System.Windows.Forms</li> <li>System.Xml</li> <li>System.Xml.Linq</li> <li>UIAutomationProvider</li> <li>WindowsBase</li> <li>WindowsFormsIntegration</li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload