/// <summary> /// The DirectSoundCaptureCreate8 function creates and initializes an object that supports the IDirectSoundCapture8 interface. Although the older<strong>DirectSoundCaptureCreate</strong>function can also be used to obtain theIDirectSoundCapture8interface, the object created by that function cannot be used to create capture buffers that support theIDirectSoundCaptureBuffer8interface. /// </summary> /// <param name="cGuidDeviceRef">No documentation.</param> /// <param name="dSCOut">No documentation.</param> /// <param name="unkOuterRef">No documentation.</param> /// <returns><p>If the function succeeds, it returns DS_OK. If it fails, the return value may be one of the following values.</p> <table> <tr><th>Return Code</th></tr> <tr><td>DSERR_ALLOCATED</td></tr> <tr><td>DSERR_INVALIDPARAM</td></tr> <tr><td>DSERR_NOAGGREGATION</td></tr> <tr><td>DSERR_OUTOFMEMORY</td></tr> </table></returns> /// <remarks> /// <p>On sound cards that do not support full duplex, this method will fail and return DSERR_ALLOCATED.</p> /// </remarks> /// <include file='.\..\Documentation\CodeComments.xml' path="/comments/comment[@id='DirectSoundCaptureCreate']/*"/> /// <msdn-id>microsoft.directx_sdk.reference.directsoundcapturecreate8</msdn-id> /// <unmanaged>HRESULT DirectSoundCaptureCreate([In, Optional] const GUID* pcGuidDevice,[Out] IDirectSoundCapture** ppDSC,[In] IUnknown* pUnkOuter)</unmanaged> /// <unmanaged-short>DirectSoundCaptureCreate</unmanaged-short> public static void CaptureCreate(System.Guid?cGuidDeviceRef, out SharpDX.DirectSound.DirectSoundCapture dSCOut, SharpDX.ComObject unkOuterRef) { unsafe { System.Guid cGuidDeviceRef_; if (cGuidDeviceRef.HasValue) { cGuidDeviceRef_ = cGuidDeviceRef.Value; } IntPtr dSCOut_ = IntPtr.Zero; SharpDX.Result __result__; __result__ = DirectSoundCaptureCreate_((cGuidDeviceRef.HasValue)?&cGuidDeviceRef_:(void *)IntPtr.Zero, &dSCOut_, (void *)((unkOuterRef == null)?IntPtr.Zero:unkOuterRef.NativePointer)); dSCOut = (dSCOut_ == IntPtr.Zero)?null:new SharpDX.DirectSound.DirectSoundCapture(dSCOut_); __result__.CheckError(); } }
public AudioDevice( IWindow window ) { dSound = new SharpDX.DirectSound.DirectSound (); dSound.SetCooperativeLevel ( ( window.Handle as Form ).Handle, SharpDX.DirectSound.CooperativeLevel.Normal ); soundBuffer = new SharpDX.DirectSound.PrimarySoundBuffer ( dSound, new SharpDX.DirectSound.SoundBufferDescription () { Flags = SharpDX.DirectSound.BufferFlags.PrimaryBuffer, } ); soundBuffer.Play ( 0, SharpDX.DirectSound.PlayFlags.Looping ); dCapture = new SharpDX.DirectSound.DirectSoundCapture (); audioList = new List<IAudioBuffer> (); }