Example #1
0
        public AudioDevice( IWindow window )
        {
            dSound = new SharpDX.DirectSound.DirectSound ();
            dSound.SetCooperativeLevel ( ( window.Handle as Form ).Handle, SharpDX.DirectSound.CooperativeLevel.Priority );

            soundBuffer = new SharpDX.DirectSound.PrimarySoundBuffer ( dSound, new SharpDX.DirectSound.SoundBufferDescription ()
            {
                Flags = SharpDX.DirectSound.BufferFlags.PrimaryBuffer,
            } );

            soundBuffer.Play ( 0, SharpDX.DirectSound.PlayFlags.Looping );

            audioList = new List<IAudio> ();
        }
Example #2
0
 /// <summary>
 /// The DirectSoundCreate8 function creates and initializes an object that supports theIDirectSound8interface.
 /// </summary>
 /// <param name="cGuidDeviceRef">No documentation.</param>
 /// <param name="dS8Out">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.</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_NODRIVER</td></tr> <tr><td>DSERR_OUTOFMEMORY</td></tr> </table></returns>
 /// <remarks>
 /// <p>The application must call the IDirectSound8::SetCooperativeLevel method immediately after creating a device object.</p>
 /// </remarks>
 /// <include file='.\..\Documentation\CodeComments.xml' path="/comments/comment[@id='DirectSoundCreate8']/*"/>
 /// <msdn-id>microsoft.directx_sdk.reference.directsoundcreate8</msdn-id>
 /// <unmanaged>HRESULT DirectSoundCreate8([In, Optional] const GUID* pcGuidDevice,[Out, Fast] IDirectSound8** ppDS8,[In] IUnknown* pUnkOuter)</unmanaged>
 /// <unmanaged-short>DirectSoundCreate8</unmanaged-short>
 public static void Create8(System.Guid?cGuidDeviceRef, SharpDX.DirectSound.DirectSound dS8Out, SharpDX.ComObject unkOuterRef)
 {
     unsafe {
         System.Guid cGuidDeviceRef_;
         if (cGuidDeviceRef.HasValue)
         {
             cGuidDeviceRef_ = cGuidDeviceRef.Value;
         }
         IntPtr         dS8Out_ = IntPtr.Zero;
         SharpDX.Result __result__;
         __result__ =
             DirectSoundCreate8_((cGuidDeviceRef.HasValue)?&cGuidDeviceRef_:(void *)IntPtr.Zero, &dS8Out_, (void *)((unkOuterRef == null)?IntPtr.Zero:unkOuterRef.NativePointer));
         ((SharpDX.DirectSound.DirectSound)dS8Out).NativePointer = dS8Out_;
         __result__.CheckError();
     }
 }