public override void Init(IntPtr display, IntPtr window, uint samples, bool vsync, bool sRGB)
        {
            _display = display;
            _window  = window;
            _vsync   = vsync;

            FeatureLevel[] features =
            {
                FeatureLevel.Level_11_1,
                FeatureLevel.Level_11_0
            };

            SharpDX.Direct3D11.Device dev11 = new SharpDX.Direct3D11.Device(DriverType.Hardware, DeviceCreationFlags.None, features);
            _dev = dev11.QueryInterfaceOrNull <SharpDX.Direct3D11.Device1>();

            SampleDescription sampleDesc = new SampleDescription();

            do
            {
                if (_dev.CheckMultisampleQualityLevels(Format.R8G8B8A8_UNorm, (int)samples) > 0)
                {
                    sampleDesc.Count   = (int)samples;
                    sampleDesc.Quality = 0;
                    break;
                }
                else
                {
                    samples >>= 1;
                }
            } while (samples > 0);

            SwapChainDescription1 desc = new SwapChainDescription1();

            desc.Width             = 0;
            desc.Height            = 0;
            desc.Format            = sRGB ? Format.R8G8B8A8_UNorm_SRgb : Format.R8G8B8A8_UNorm;
            desc.Scaling           = Scaling.None;
            desc.SampleDescription = sampleDesc;
            desc.Usage             = Usage.RenderTargetOutput;
            desc.BufferCount       = 2;
            desc.SwapEffect        = SwapEffect.FlipSequential;
            desc.Flags             = SwapChainFlags.None;

            SharpDX.DXGI.Device2 dev = _dev.QueryInterface <SharpDX.DXGI.Device2>();
            Adapter  adapter         = dev.Adapter;
            Factory2 factory         = adapter.GetParent <Factory2>();

            if (display == IntPtr.Zero)
            {
                GCHandle          handle     = (GCHandle)window;
                SharpDX.ComObject coreWindow = new SharpDX.ComObject(handle.Target as object);
                _swapChain = new SwapChain1(factory, _dev, coreWindow, ref desc);
            }
            else
            {
                _swapChain = new SwapChain1(factory, _dev, window, ref desc);
            }

            _device = new RenderDeviceD3D11(_dev.ImmediateContext.NativePointer, sRGB);
        }
Exemple #2
0
        /// <summary>
        /// <p> Creates a device that uses Direct3D 11 functionality in Direct3D 12, specifying a pre-existing D3D12 device to use for D3D11 interop. </p>
        /// </summary>
        /// <param name="deviceRef"><dd>  <p> Specifies a pre-existing D3D12 device to use for D3D11 interop. May not be <c>null</c>. </p> </dd></param>
        /// <param name="flags"><dd>  <p> Any of those documented for <strong>D3D11CreateDeviceAndSwapChain</strong>. Specifies which runtime layers to enable (see the <strong><see cref="SharpDX.Direct3D11.DeviceCreationFlags"/></strong> enumeration); values can be bitwise OR'd together. <em>Flags</em> must be compatible with device flags, and its <em>NodeMask</em> must be a subset of the <em>NodeMask</em> provided to the present API. </p> </dd></param>
        /// <param name="featureLevelsRef"><dd>  <p> An array of any of the following: </p> <ul> <li><see cref="SharpDX.Direct3D.FeatureLevel.Level_12_1"/></li> <li><see cref="SharpDX.Direct3D.FeatureLevel.Level_12_0"/></li> <li><see cref="SharpDX.Direct3D.FeatureLevel.Level_11_1"/></li> <li><see cref="SharpDX.Direct3D.FeatureLevel.Level_11_0"/></li> <li><see cref="SharpDX.Direct3D.FeatureLevel.Level_10_1"/></li> <li><see cref="SharpDX.Direct3D.FeatureLevel.Level_10_0"/></li> <li><see cref="SharpDX.Direct3D.FeatureLevel.Level_9_3"/></li> <li><see cref="SharpDX.Direct3D.FeatureLevel.Level_9_2"/></li> <li><see cref="SharpDX.Direct3D.FeatureLevel.Level_9_1"/></li> </ul> <p> The first feature level which is less than or equal to the D3D12 device's feature level will be used to perform D3D11 validation. Creation will fail if no acceptable feature levels are provided. Providing <c>null</c> will default to the D3D12 device's feature level. </p> </dd></param>
        /// <param name="featureLevels"><dd>  <p> The size of the feature levels array, in bytes. </p> </dd></param>
        /// <param name="commandQueuesOut"><dd>  <p> An array of unique queues for D3D11On12 to use. Valid queue types: 3D command queue. </p> </dd></param>
        /// <param name="numQueues"><dd>  <p> The size of the command queue array, in bytes. </p> </dd></param>
        /// <param name="nodeMask"><dd>  <p> Which node of the D3D12 device to use. Only 1 bit may be set. </p> </dd></param>
        /// <param name="deviceOut"><dd>  <p> Pointer to the returned <strong><see cref="SharpDX.Direct3D11.Device"/></strong>. May be <c>null</c>. </p> </dd></param>
        /// <param name="immediateContextOut"><dd>  <p> A reference to the returned <strong><see cref="SharpDX.Direct3D11.DeviceContext"/></strong>. May be <c>null</c>. </p> </dd></param>
        /// <param name="chosenFeatureLevelRef"><dd>  <p> A reference to the returned feature level. May be <c>null</c>. </p> </dd></param>
        /// <returns><p> This method returns one of the Direct3D 12 Return Codes that are documented for <strong><see cref="SharpDX.Direct3D11.D3D11.CreateDevice"/></strong>. See Direct3D 12 Return Codes. </p><p> This method returns <strong><see cref="SharpDX.DXGI.ResultCode.SdkComponentMissing"/></strong> if you specify <strong><see cref="SharpDX.Direct3D11.DeviceCreationFlags.Debug"/></strong> in <em>Flags</em> and the incorrect version of the debug layer is installed on your computer. Install the latest Windows SDK to get the correct version. </p></returns>
        /// <remarks>
        /// <p> The function signature PFN_D3D11ON12_CREATE_DEVICE is provided as a typedef, so that you can use dynamic linking techniques (GetProcAddress) instead of statically linking. </p>
        /// </remarks>
        /// <include file='.\..\Documentation\CodeComments.xml' path="/comments/comment[@id='D3D11On12CreateDevice']/*"/>
        /// <msdn-id>dn933209</msdn-id>
        /// <unmanaged>HRESULT D3D11On12CreateDevice([In] IUnknown* pDevice,[In] D3D11_CREATE_DEVICE_FLAG Flags,[In, Buffer, Optional] const D3D_FEATURE_LEVEL* pFeatureLevels,[In] unsigned int FeatureLevels,[In, Buffer, Optional] const IUnknown** ppCommandQueues,[In] unsigned int NumQueues,[In] unsigned int NodeMask,[Out] ID3D11Device** ppDevice,[Out, Optional] ID3D11DeviceContext** ppImmediateContext,[Out, Optional] D3D_FEATURE_LEVEL* pChosenFeatureLevel)</unmanaged>
        /// <unmanaged-short>D3D11On12CreateDevice</unmanaged-short>
        public static void On12CreateDevice(SharpDX.ComObject deviceRef, SharpDX.Direct3D11.DeviceCreationFlags flags, SharpDX.Direct3D.FeatureLevel[] featureLevelsRef, int featureLevels, SharpDX.ComObject[] commandQueuesOut, int numQueues, int nodeMask, out SharpDX.Direct3D11.Device deviceOut, out SharpDX.Direct3D11.DeviceContext immediateContextOut, out SharpDX.Direct3D.FeatureLevel chosenFeatureLevelRef)
        {
            unsafe {
                SharpDX.Direct3D.FeatureLevel[] featureLevelsRef__ = featureLevelsRef;
                IntPtr *commandQueuesOut_ = (IntPtr *)0;
                if (commandQueuesOut != null)
                {
                    IntPtr *commandQueuesOut__ = stackalloc IntPtr[commandQueuesOut.Length];
                    commandQueuesOut_ = commandQueuesOut__;
                    for (int i = 0; i < commandQueuesOut.Length; i++)
                    {
                        commandQueuesOut_[i] = (commandQueuesOut[i] == null)? IntPtr.Zero : commandQueuesOut[i].NativePointer;
                    }
                }
                IntPtr         deviceOut_           = IntPtr.Zero;
                IntPtr         immediateContextOut_ = IntPtr.Zero;
                SharpDX.Result __result__;

                fixed(void *featureLevelsRef_ = featureLevelsRef__)
                fixed(void *chosenFeatureLevelRef_ = &chosenFeatureLevelRef)
                __result__ =
                    D3D11On12CreateDevice_((void *)((deviceRef == null)?IntPtr.Zero:deviceRef.NativePointer), unchecked ((int)flags), featureLevelsRef_, featureLevels, commandQueuesOut_, numQueues, nodeMask, &deviceOut_, &immediateContextOut_, chosenFeatureLevelRef_);

                deviceOut           = (deviceOut_ == IntPtr.Zero)?null:new SharpDX.Direct3D11.Device(deviceOut_);
                immediateContextOut = (immediateContextOut_ == IntPtr.Zero)?null:new SharpDX.Direct3D11.DeviceContext(immediateContextOut_);
                __result__.CheckError();
            }
        }
        private void SurfaceUpdated(IntPtr surfaceHandle)
        {
            SharpDX.ComObject            sharedObject   = new SharpDX.ComObject(surfaceHandle);
            SharpDX.DXGI.Resource        sharedResource = sharedObject.QueryInterface <SharpDX.DXGI.Resource>();
            SharpDX.Direct3D11.Texture2D nativeRexture  = dX11GraphicsContext.DXDevice.OpenSharedResource <SharpDX.Direct3D11.Texture2D>(sharedResource.SharedHandle);

            var texture = DX11Texture.FromDirectXTexture(dX11GraphicsContext, nativeRexture);
            var rTDepthTargetDescription = new TextureDescription()
            {
                Type        = TextureType.Texture2D,
                Format      = PixelFormat.D24_UNorm_S8_UInt,
                Width       = texture.Description.Width,
                Height      = texture.Description.Height,
                Depth       = 1,
                ArraySize   = 1,
                Faces       = 1,
                Flags       = TextureFlags.DepthStencil,
                CpuAccess   = ResourceCpuAccess.None,
                MipLevels   = 1,
                Usage       = ResourceUsage.Default,
                SampleCount = TextureSampleCount.None,
            };

            var rTDepthTarget = this.dX11GraphicsContext.Factory.CreateTexture(ref rTDepthTargetDescription, "SwapChain_Depth");
            var frameBuffer   = this.dX11GraphicsContext.Factory.CreateFrameBuffer(new FrameBufferAttachment(rTDepthTarget, 0, 1), new[] { new FrameBufferAttachment(texture, 0, 1) });

            frameBuffer.SwapchainAssociated = true;
            display.FrameBuffer?.Dispose();
            display.UpdateFrameBuffer(frameBuffer);
        }
Exemple #4
0
        public static void CreateFX(System.Guid clsid, SharpDX.ComObject effectRef)
        {
#if DESKTOP_APP
            if (XAudio2.XAudio2.Version == XAudio2Version.Version27)
            {
                var clsid15 = clsid;
                if (clsid15 == CLSID_FXEcho)
                {
                    clsid15 = CLSID_FXEcho_15;
                }
                else if (clsid15 == CLSID_FXEQ)
                {
                    clsid15 = CLSID_FXEQ_15;
                }
                else if (clsid15 == CLSID_FXMasteringLimiter)
                {
                    clsid15 = CLSID_FXMasteringLimiter_15;
                }
                else if (clsid15 == CLSID_FXReverb)
                {
                    clsid15 = CLSID_FXReverb_15;
                }

                IntPtr nativePtr;
                var    result = (Result)CreateFX15(ref clsid15, out nativePtr);
                if (result.Success)
                {
                    effectRef.NativePointer = nativePtr;
                    return;
                }
            }
#endif
            CreateFX(clsid, effectRef, IntPtr.Zero, 0);
        }
Exemple #5
0
        public CorMetadataImport(CorApi.Portable.Module managedModule)
        {
            SharpDX.ComObject mdi = null;
            managedModule.GetMetaDataInterface(typeof(CorApi.Portable.IMetaDataImport).GUID, out mdi);

            m_importer = mdi.QueryInterfaceOrNull <CorApi.Portable.IMetaDataImport>();
            Debug.Assert(m_importer != null);
        }
Exemple #6
0
        private SourceReader CreateSourceReader(Activate activate)
        {
            SourceReader reader = null;

            using (var source = activate.ActivateObject <MediaSource>())
            {
                using (var mediaAttributes = new MediaAttributes())
                {
                    if (asyncMode)
                    {
                        sourceReaderCallback = new SourceReaderCallback();
                        sourceReaderCallback.OnReadSample += SourceReaderCallback_OnReadSample;
                        sourceReaderCallback.OnFlush      += SourceReaderCallback_OnFlush;

                        //sourceReaderCallback.OnEvent += SourceReaderCallback_OnEvent;

                        var pUnk = Marshal.GetIUnknownForObject(sourceReaderCallback);
                        try
                        {
                            using (var comObj = new SharpDX.ComObject(pUnk))
                            {
                                mediaAttributes.Set(SourceReaderAttributeKeys.AsyncCallback, comObj);
                            }
                        }
                        finally
                        {
                            if (pUnk != IntPtr.Zero)
                            {
                                Marshal.Release(pUnk);
                            }
                        }
                    }

                    //mediaAttributes.Set(SourceReaderAttributeKeys.EnableVideoProcessing, 1);

                    /* //Не все камеры поддерживают!
                     * mediaAttributes.Set(SinkWriterAttributeKeys.LowLatency, true);
                     *
                     * mediaAttributes.Set(SourceReaderAttributeKeys.EnableAdvancedVideoProcessing, true);
                     * mediaAttributes.Set(SinkWriterAttributeKeys.ReadwriteDisableConverters, 0);
                     *
                     * mediaAttributes.Set(SinkWriterAttributeKeys.ReadwriteEnableHardwareTransforms, 1);
                     * using (var devMan = new DXGIDeviceManager())
                     * {
                     *  devMan.ResetDevice(device);
                     *  mediaAttributes.Set(SourceReaderAttributeKeys.D3DManager, devMan);
                     * }
                     */


                    reader = new SourceReader(source, mediaAttributes);
                }
            }


            return(reader);
        }
Exemple #7
0
 public void ReleaseContext(GraphicsDevice graphicsDevice)
 {
     SharpDX.ComObject obj = GetRenderTargetResource(graphicsDevice);
     D2DContext context;
     if (this.dictContext.TryGetValue(obj, out context))
     {
         context.Dispose();
     }
 }
Exemple #8
0
        /// <summary>
        /// Sets the application-defined drawing effect.
        /// </summary>
        /// <remarks>
        /// An <see cref="SharpDX.Direct2D1.Brush"/>, such as a color or gradient brush, can be set as a drawing effect if you are using the <see cref="RenderTarget.DrawTextLayout(System.Drawing.PointF,SharpDX.DirectWrite.TextLayout,SharpDX.Direct2D1.Brush,SharpDX.Direct2D1.DrawTextOptions)"/> to draw text and that brush will be used to draw the specified range of text.  This drawing effect is associated with the specified range and will be passed back to the application by way of the callback when the range is drawn at drawing time.
        /// </remarks>
        /// <param name="drawingEffect">Application-defined drawing effects that apply to the range. This data object will be passed back to the application's drawing callbacks for final rendering. </param>
        /// <param name="textRange">The text range to which this change applies. </param>
        /// <returns>If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. </returns>
        /// <unmanaged>HRESULT IDWriteTextLayout::SetDrawingEffect([None] IUnknown* drawingEffect,[None] DWRITE_TEXT_RANGE textRange)</unmanaged>
        public void SetDrawingEffect(SharpDX.ComObject drawingEffect, SharpDX.DirectWrite.TextRange textRange)
        {
            var drawingEffectPtr = Utilities.GetIUnknownForObject(drawingEffect);

            SetDrawingEffect(drawingEffectPtr, textRange);
            if (drawingEffectPtr != IntPtr.Zero)
            {
                Marshal.Release(drawingEffectPtr);
            }
        }
Exemple #9
0
            public Framebuffer FrameBuffer(IntPtr surface, bool isNewSurface)
            {
                if (isNewSurface)
                {
                    if (_framebuffer != null)
                    {
                        _framebuffer.Dispose();
                        _framebuffer = null;
                    }
                }

                if (_framebuffer == null)
                {
                    SharpDX.Direct3D11.Device _deviceD11 = device;
                    if (_deviceD11 == null)
                    {
                        return(null);
                    }

                    using (var _ComObject = new SharpDX.ComObject(surface))
                    {
                        Texture2D _texture2D = null;
                        Texture   _texture   = null;
                        try
                        {
                            var _dxgiResource = _ComObject.QueryInterface <SharpDX.DXGI.Resource>();
                            if (_dxgiResource == null)
                            {
                                return(null);
                            }

                            _texture2D = _deviceD11.OpenSharedResource <Texture2D>(_dxgiResource.SharedHandle);
                            if (_texture2D == null)
                            {
                                return(null);
                            }

                            _texture = graphicsDevice.ResourceFactory.CreateTexture((ulong)_texture2D.NativePointer, getTexture2DDescription(_texture2D));
                            if (_texture == null)
                            {
                                return(null);
                            }

                            _framebuffer = s_graphicsDevice.ResourceFactory.CreateFramebuffer(new FramebufferDescription(null, _texture));
                        }
                        finally
                        {
                            _texture?.Dispose();
                            _texture2D?.Dispose();
                        }
                    }
                }

                return(_framebuffer);
            }
 /// <summary>
 /// <p>Creates a new reverb audio processing object (APO), and returns a reference to it.</p>
 /// </summary>
 /// <param name="apoOut"><dd> <p>Contains a reference to the reverb APO that is created.</p> </dd></param>
 /// <returns><p>If this function succeeds, it returns <strong><see cref="SharpDX.Result.Ok"/></strong>. Otherwise, it returns an <strong><see cref="SharpDX.Result"/></strong> error code.</p></returns>
 /// <remarks>
 /// <p><strong>XAudio2CreateReverb</strong> creates an effect performing Princeton Digital Reverb. The XAPO effect library (XAPOFX) includes an alternate reverb effect. Use <strong>CreateFX</strong> to create this alternate effect. </p><p>The reverb APO supports has the following restrictions: </p><ul> <li>Input audio data must be FLOAT32. </li> <li>Framerate must be within XAUDIO2FX_REVERB_MIN_FRAMERATE (20,000 Hz) and XAUDIO2FX_REVERB_MAX_FRAMERATE (48,000 Hz). </li> <li>The input and output channels must be one of the following combinations.<ul> <li>Mono input and mono output </li> <li>Mono input and 5.1 output </li> <li>Stereo input and stereo output </li> <li>Stereo input and 5.1 output</li> </ul> </li> </ul>The reverb APO maintains internal state information between processing samples. You can only use an instance of the APO with one source of audio data at a time. Multiple voices that require reverb effects would each need to create a separate reverb effect with<strong>XAudio2CreateReverb</strong>.<p>For information about creating new effects for use with XAudio2, see the XAPO Overview. </p><table> <tr><th>Windows</th></tr> <tr><td> <p>Because <strong>XAudio2CreateReverb</strong> calls <strong>CoCreateInstance</strong> on Windows, the application must have called the <strong>CoInitializeEx</strong> method before calling <strong>XAudio2CreateReverb</strong>. <strong><see cref="XAudio29Functions.XAudio2Create"/></strong> has the same requirement, which means <strong>CoInitializeEx</strong> typically will be called long before <strong>XAudio2CreateReverb</strong> is called. </p> <p>A typical calling pattern on Windows would be as follows: </p>  <pre>#ifndef _XBOX
 /// CoInitializeEx(<c>null</c>, COINIT_MULTITHREADED);
 /// #endif
 /// <see cref="SharpDX.XAudio2.XAudio2"/>* pXAudio2 = <c>null</c>;
 /// <see cref="SharpDX.Result"/> hr;
 /// if ( FAILED(hr = <see cref="XAudio29Functions.XAudio2Create"/>( &amp;pXAudio2, 0, <see cref="SharpDX.XAudio2.ProcessorSpecifier.DefaultProcessor"/> ) ) ) return hr;
 /// ...
 /// <see cref="SharpDX.ComObject"/> * pReverbAPO;
 /// XAudio2CreateReverb(&amp;pReverbAPO);
 /// </pre>  </td></tr> </table><p>?</p><p>The xaudio2fx.h header defines the <strong>AudioReverb</strong> class <see cref="System.Guid"/> as   a cross-platform audio processing object (XAPO). </p><code> class __declspec(uuid("C2633B16-471B-4498-B8C5-4F0959E2EC09")) AudioReverb;
 /// </code><p><strong>XAudio2CreateReverb</strong> returns this object as a reference to a reference to <strong><see cref="SharpDX.ComObject"/></strong> in the <em>ppApo</em> parameter. Although you can query the <strong><see cref="SharpDX.XAPO.AudioProcessor"/></strong> and <strong><see cref="SharpDX.XAPO.ParameterProvider"/></strong> interfaces from this <strong><see cref="SharpDX.ComObject"/></strong>, you typically never use these interfaces directly. Instead, you use them when you create a voice to add them as part of the effects chain. </p><p>The reverb uses the <strong><see cref="SharpDX.XAudio2.Fx.ReverbParameters"/></strong> parameter structure that you access via the <strong><see cref="SharpDX.XAudio2.Voice.SetEffectParameters"/></strong>. </p><p><strong>Note</strong>??<strong>XAudio2CreateReverb</strong> is an inline function in xaudio2fx.h that calls <strong>CreateAudioReverb</strong>: </p><code> XAUDIO2FX_STDAPI CreateAudioReverb(_Outptr_ <see cref="SharpDX.ComObject"/>** ppApo);
 /// __inline <see cref="SharpDX.Result"/> XAudio2CreateReverb(_Outptr_ <see cref="SharpDX.ComObject"/>** ppApo, UINT32 /*Flags*/ DEFAULT(0))
 /// { return CreateAudioReverb(ppApo);
 /// }
 /// </code>
 /// </remarks>
 /// <include file='.\..\Documentation\CodeComments.xml' path="/comments/comment[@id='CreateAudioReverb']/*"/>
 /// <msdn-id>microsoft.directx_sdk.xaudio2.xaudio2createreverb</msdn-id>
 /// <unmanaged>HRESULT CreateAudioReverb([Out, Fast] IUnknown** ppApo)</unmanaged>
 /// <unmanaged-short>CreateAudioReverb</unmanaged-short>
 public static void CreateAudioReverb(SharpDX.ComObject apoOut)
 {
     unsafe {
         IntPtr         apoOut_ = IntPtr.Zero;
         SharpDX.Result __result__;
         __result__ =
             CreateAudioReverb_(&apoOut_);
         ((SharpDX.ComObject)apoOut).NativePointer = apoOut_;
         __result__.CheckError();
     }
 }
Exemple #11
0
        /// <summary>
        /// <p><strong>Applies to: </strong>desktop apps | Metro style apps</p><p> Creates a media source or a byte stream from a URL. This method is synchronous. </p>
        /// </summary>
        /// <param name="url"><dd> <p> Null-terminated string that contains the URL to resolve. </p> </dd></param>
        /// <param name="flags"><dd> <p> Bitwise OR of one or more flags. See <strong>Source Resolver Flags</strong>. </p> </dd></param>
        /// <param name="propertyStore"><dd> <p> Pointer to the <strong><see cref="SharpDX.ComObject"/></strong> interface of a property store. The method passes the property store to the scheme handler or byte-stream handler that creates the object. The handler can use the property store to configure the object. This parameter can be <strong><c>null</c></strong>. For more information, see Configuring a Media Source. </p> </dd></param>
        /// <param name="objectType"><dd> <p> Receives a member of the <strong><see cref="SharpDX.MediaFoundation.ObjectType"/></strong> enumeration, specifying the type of object that was created. </p> </dd></param>
        /// <returns>A reference to the object's <strong><see cref="SharpDX.ComObject"/></strong> interface. The caller must release the interface.</returns>
        /// <remarks>
        /// <p>The <em>dwFlags</em> parameter must contain either the <strong><see cref="SharpDX.MediaFoundation.SourceResolverFlags.MediaSource"/></strong> flag or the <strong><see cref="SharpDX.MediaFoundation.SourceResolverFlags.ByteStream"/></strong> flag, but should not contain both.</p><p>For local files, you can pass the file name in the <em>pwszURL</em> parameter; the <code>file:</code> scheme is not required.</p><p><strong>Note</strong>??This method cannot be called remotely.</p>
        /// </remarks>
        /// <msdn-id>ms702279</msdn-id>
        /// <unmanaged>HRESULT IMFSourceResolver::CreateObjectFromURL([In] const wchar_t* pwszURL,[In] unsigned int dwFlags,[In] IPropertyStore* pProps,[Out] MF_OBJECT_TYPE* pObjectType,[Out] IUnknown** ppObject)</unmanaged>
        /// <unmanaged-short>IMFSourceResolver::CreateObjectFromURL</unmanaged-short>
        public SharpDX.ComObject CreateObjectFromURL(string url,
                                                     SourceResolverFlags flags,
                                                     SharpDX.ComObject propertyStore,
                                                     out SharpDX.MediaFoundation.ObjectType objectType
                                                     )
        {
            ComObject result;

            CreateObjectFromURL(url, (int)(flags | SourceResolverFlags.MediaSource), propertyStore, out objectType, out result);
            return(result);
        }
 /// <summary>
 /// <p>Creates an instance of the requested XAPOFX effect.</p>
 /// </summary>
 /// <param name="clsid">No documentation.</param>
 /// <param name="effectRef">No documentation.</param>
 /// <param name="initDataRef">No documentation.</param>
 /// <param name="initDataByteSize">No documentation.</param>
 /// <returns><p>If this function succeeds, it returns <strong><see cref="SharpDX.Result.Ok"/></strong>. Otherwise, it returns an <strong><see cref="SharpDX.Result"/></strong> error code.</p></returns>
 /// <remarks>
 /// <p>The created XAPO will have a reference count of 1. Client code must call <strong>IUnknown::Release</strong> after passing the XAPO to XAudio2 to allow XAudio2 to dispose of the XAPO when it is no longer needed. Use <strong> <see cref="SharpDX.XAudio2.XAudio2.CreateSourceVoice_"/></strong> or <strong><see cref="SharpDX.XAudio2.Voice.SetEffectChain"/></strong> to pass an XAPO to XAudio2. </p><p><strong>Note</strong>??The DirectX SDK version of this function doesn't have the <em>pInitData</em> or <em>InitDataByteSize</em> parameters as it only takes the first 2 parameters. To set initial parameters for the XAPOFX effect that is  created with the DirectX SDK version of this function, you must bind that effect to a voice and use <strong><see cref="SharpDX.XAudio2.Voice.SetEffectParameters"/></strong>.
 /// For info about how to do this, see How to: Use XAPOFX in XAudio2.</p>
 /// </remarks>
 /// <include file='..\..\Documentation\CodeComments.xml' path="/comments/comment[@id='CreateFX']/*"/>
 /// <msdn-id>hh405044</msdn-id>
 /// <unmanaged>HRESULT CreateFX([In] const GUID&amp; clsid,[Out, Fast] IUnknown** pEffect,[In, Buffer, Optional] const void* pInitData,[In] unsigned int InitDataByteSize)</unmanaged>
 /// <unmanaged-short>CreateFX</unmanaged-short>
 public static void CreateFX29(System.Guid clsid, SharpDX.ComObject effectRef, System.IntPtr initDataRef, int initDataByteSize)
 {
     unsafe {
         IntPtr         effectRef_ = IntPtr.Zero;
         SharpDX.Result __result__;
         __result__ =
             CreateFX_29(&clsid, &effectRef_, (void *)initDataRef, initDataByteSize);
         ((SharpDX.ComObject)effectRef).NativePointer = effectRef_;
         __result__.CheckError();
     }
 }
Exemple #13
0
 /// <summary>
 /// <p>Creates a device that represents the display adapter.</p>
 /// </summary>
 /// <param name="adapterRef"><dd>  <p> A reference to the video adapter to use when creating a device. Pass <strong><c>null</c></strong> to use the default adapter, which is the first adapter that is enumerated by <strong>IDXGIFactory1::EnumAdapters</strong>. </p> <strong>Note</strong>?? Do not mix the use of DXGI 1.0 (<strong><see cref="SharpDX.DXGI.Factory"/></strong>) and DXGI 1.1 (<strong><see cref="SharpDX.DXGI.Factory1"/></strong>) in an application. Use <strong><see cref="SharpDX.DXGI.Factory"/></strong> or <strong><see cref="SharpDX.DXGI.Factory1"/></strong>, but not both in an application.  ? </dd></param>
 /// <param name="minimumFeatureLevel"><dd>  <p> The <strong><see cref="SharpDX.Direct3D.DriverType"/></strong>, which represents the driver type to create. </p> </dd></param>
 /// <param name="riid"><dd>  <p> A handle to a DLL that implements a software rasterizer. If <em>DriverType</em> is <em><see cref="SharpDX.Direct3D.DriverType.Software"/></em>, <em>Software</em> must not be <strong><c>null</c></strong>. Get the handle by calling LoadLibrary, LoadLibraryEx , or GetModuleHandle. </p> </dd></param>
 /// <param name="deviceOut"><dd>  <p> Returns the address of a reference to an <strong><see cref="SharpDX.Direct3D11.Device"/></strong> object that represents the device created. If this parameter is <strong><c>null</c></strong>, no <see cref="SharpDX.Direct3D11.Device"/> will be returned. </p> </dd></param>
 /// <returns><p> This method can return one of the Direct3D 11 Return Codes. </p><p> This method returns E_INVALIDARG if you set the <em>pAdapter</em> parameter to a non-<strong><c>null</c></strong> value and the <em>DriverType</em> parameter to the <see cref="SharpDX.Direct3D.DriverType.Hardware"/> value. </p><p> This method returns <strong><see cref="SharpDX.DXGI.ResultCode.SdkComponentMissing"/></strong> if you specify <strong><see cref="SharpDX.Direct3D11.DeviceCreationFlags.Debug"/></strong> in <em>Flags</em> and the incorrect version of the debug layer is installed on your computer. Install the latest Windows SDK to get the correct version. </p></returns>
 /// <remarks>
 /// <p> This entry-point is supported by the Direct3D 11 runtime, which is available on Windows 7, Windows Server 2008 R2, and as an update to Windows Vista (KB971644). </p><p> To create a Direct3D 11.1 device (<strong><see cref="SharpDX.Direct3D11.Device1"/></strong>), which is available on Windows?8, Windows Server?2012, and Windows?7 and Windows Server?2008?R2 with the Platform Update for Windows 7 installed, you first create a <strong><see cref="SharpDX.Direct3D11.Device"/></strong> with this function, and then call the <strong>QueryInterface</strong> method on the <strong><see cref="SharpDX.Direct3D11.Device"/></strong> object to obtain the <strong><see cref="SharpDX.Direct3D11.Device1"/></strong> interface. </p><p> To create a Direct3D 11.2 device (<strong><see cref="SharpDX.Direct3D11.Device2"/></strong>), which is available on Windows?8.1 and Windows Server?2012?R2, you first create a <strong><see cref="SharpDX.Direct3D11.Device"/></strong> with this function, and then call the <strong>QueryInterface</strong> method on the <strong><see cref="SharpDX.Direct3D11.Device"/></strong> object to obtain the <strong><see cref="SharpDX.Direct3D11.Device2"/></strong> interface. </p><p> Set <em>ppDevice</em> and <em>ppImmediateContext</em> to <strong><c>null</c></strong> to determine which feature level is supported by looking at <em>pFeatureLevel</em> without creating a device. </p><p> For an example, see How To: Create a Device and Immediate Context; to create a device and a swap chain at the same time, use <strong>D3D11CreateDeviceAndSwapChain</strong>. </p><p> If you set the <em>pAdapter</em> parameter to a non-<strong><c>null</c></strong> value, you must also set the <em>DriverType</em> parameter to the <see cref="SharpDX.Direct3D.DriverType.Unknown"/> value. If you set the <em>pAdapter</em> parameter to a non-<strong><c>null</c></strong> value and the <em>DriverType</em> parameter to the <see cref="SharpDX.Direct3D.DriverType.Hardware"/> value, <strong><see cref="SharpDX.Direct3D11.D3D11.CreateDevice"/></strong> returns an <strong><see cref="SharpDX.Result"/></strong> of E_INVALIDARG. </p><table> <tr><td> <p>Differences between Direct3D 10 and Direct3D 11:</p> <p> In Direct3D 10, the presence of <em>pAdapter</em> dictated which adapter to use and the <em>DriverType</em> could mismatch what the adapter was. </p> <p> In Direct3D 11, if you are trying to create a hardware or a software device, set <em>pAdapter</em> != <strong><c>null</c></strong> which constrains the other inputs to be: </p> <ul> <li><em>DriverType</em> must be <see cref="SharpDX.Direct3D.DriverType.Unknown"/> </li> <li><em>Software</em> must be <strong><c>null</c></strong>. </li> </ul> <p> On the other hand, if <em>pAdapter</em> == <strong><c>null</c></strong>, the <em>DriverType</em> cannot be set to <see cref="SharpDX.Direct3D.DriverType.Unknown"/>; it can be set to either: </p> <ul> <li> If <em>DriverType</em> == <see cref="SharpDX.Direct3D.DriverType.Software"/>,  <em>Software</em> cannot be <strong><c>null</c></strong>. </li> <li> If <em>DriverType</em> == <see cref="SharpDX.Direct3D.DriverType.Hardware"/>, the adapter used will be the default adapter, which is the first adapter that is enumerated by <strong>IDXGIFactory1::EnumAdapters</strong> </li> </ul> </td></tr> </table><p>?</p><p> The function signature PFN_D3D11_CREATE_DEVICE is provided as a typedef, so that you can use dynamic linking techniques (GetProcAddress) instead of statically linking. </p><p><strong>Windows?Phone?8: </strong> This API is supported. </p><p><strong>Windows Phone 8.1: </strong> This API is supported. </p>
 /// </remarks>
 /// <include file='.\..\Documentation\CodeComments.xml' path="/comments/comment[@id='D3D12CreateDevice']/*"/>
 /// <msdn-id>ff476082</msdn-id>
 /// <unmanaged>HRESULT D3D12CreateDevice([In, Optional] IUnknown* pAdapter,[In] D3D_FEATURE_LEVEL MinimumFeatureLevel,[In] const GUID&amp; riid,[Out, Fast] ID3D12Device** ppDevice)</unmanaged>
 /// <unmanaged-short>D3D12CreateDevice</unmanaged-short>
 public static SharpDX.Result CreateDevice(SharpDX.ComObject adapterRef, SharpDX.Direct3D.FeatureLevel minimumFeatureLevel, System.Guid riid, SharpDX.Direct3D12.Device deviceOut)
 {
     unsafe {
         IntPtr         deviceOut_ = IntPtr.Zero;
         SharpDX.Result __result__;
         __result__ =
             D3D12CreateDevice_((void *)((adapterRef == null)?IntPtr.Zero:adapterRef.NativePointer), unchecked ((int)minimumFeatureLevel), &riid, &deviceOut_);
         ((SharpDX.Direct3D12.Device)deviceOut).NativePointer = deviceOut_;
         return(__result__);
     }
 }
Exemple #14
0
        /// <summary>
        /// <p>Creates a new device object that can be used to create other Microsoft DirectComposition objects.</p>
        /// </summary>
        /// <param name="renderingDevice"><dd> <p>An optional reference to a DirectX device to be used to create DirectComposition surface objects. Must be a reference to an object implementing the <strong><see cref="SharpDX.DXGI.Device"/></strong> or <strong><see cref="SharpDX.Direct2D1.Device"/></strong> interfaces.</p> </dd></param>
        /// <param name="iid"><dd> <p>The identifier of the interface to retrieve. This must be one of __uuidof(<see cref="SharpDX.DirectComposition.Device"/>) or __uuidof(<see cref="SharpDX.DirectComposition.DesktopDevice"/>).</p> </dd></param>
        /// <param name="dcompositionDevice"><dd> <p>Receives an interface reference to the newly created device object. The reference is of the type specified by the <em>iid</em> parameter. This parameter must not be <c>null</c>.</p> </dd></param>
        /// <returns><p>If the function succeeds, it returns <see cref="SharpDX.Result.Ok"/>. Otherwise, it returns an <strong><see cref="SharpDX.Result"/></strong> error code. See DirectComposition Error Codes for a list of error codes.</p></returns>
        /// <remarks>
        /// <p>A device object serves as the factory for all other DirectComposition objects. It also controls transactional composition through the <see cref="SharpDX.DirectComposition.Device2.Commit"/> method. </p><p>The <em>renderingDevice</em> parameter may point to a DXGI, Direct3D, Direct2D device object, or it may be <c>null</c>. This parameter affects the behavior of the <see cref="SharpDX.DirectComposition.Device2.CreateSurface"/>, <see cref="SharpDX.DirectComposition.Device2.CreateVirtualSurface"/> and <see cref="SharpDX.DirectComposition.Surface.BeginDraw"/> methods. </p><p>If the <em>renderingDevice</em> parameter is <c>null</c> then the returned DirectComposition device cannot directly create DirectComposition surface objects. In particular, <see cref="SharpDX.DirectComposition.Device2.CreateSurface"/> and <see cref="SharpDX.DirectComposition.Device2.CreateVirtualSurface"/> methods return E_INVALIDARG, regardless of the supplied parameters. However, such a DirectComposition device object can still be used to indirectly create surfaces if the application creates a surface factory object via the <see cref="SharpDX.DirectComposition.Device2.CreateSurfaceFactory"/> method. </p><p>If the <em>renderingDevice</em> parameter points to a DXGI device, that device is used to allocate all video memory needed by the <see cref="SharpDX.DirectComposition.Device2.CreateSurface"/> and <see cref="SharpDX.DirectComposition.Device2.CreateVirtualSurface"/> methods. Moreover, the <see cref="SharpDX.DirectComposition.Surface.BeginDraw"/> method returns an interface reference to a DXGI surface that belongs to that same DXGI device. </p><p>If the <em>renderingDevice</em> parameter points to a Direct2D device object, DirectComposition extracts from it the underlying DXGI device object and uses it as if that DXGI device object had been passed in as the <em>renderingDevice</em> parameter. However, passing in a Direct2D object further causes <see cref="SharpDX.DirectComposition.Surface.BeginDraw"/> to accept __uuidof(<see cref="SharpDX.Direct2D1.DeviceContext"/>) for its <em>iid</em> parameter for any objects created with the <see cref="SharpDX.DirectComposition.Device2.CreateSurface"/> or <see cref="SharpDX.DirectComposition.Device2.CreateVirtualSurface"/> methods. In that case, the Direct2D device context object returned by <see cref="SharpDX.DirectComposition.Surface.BeginDraw"/> will belong to the same Direct2D device passed as the <em>renderingDevice</em> parameter. </p><p>If the <em>iid</em> parameter is __uuidof(<see cref="SharpDX.DirectComposition.Device"/>), then the dcompositionDevice parameter receives a reference to a Version 1 <see cref="SharpDX.DirectComposition.Device"/> interface, but the underlying object is a Version 2 desktop device object. The application can later obtain a reference to either the <see cref="SharpDX.DirectComposition.Device2"/> or <see cref="SharpDX.DirectComposition.DesktopDevice"/> interfaces by calling the <strong>QueryInterface</strong> method on that device. Similarly, all DirectComposition objects created from such a device are Version 2 objects under the covers. For example, the <see cref="SharpDX.DirectComposition.Device.CreateVisual"/> method will return an <see cref="SharpDX.DirectComposition.Visual"/> interface to the created visual, but the application can obtain a reference to the <see cref="SharpDX.DirectComposition.Visual2"/> interface via the QueryInterface method. This behavior allows an application written to the DirectComposition V1 API to incrementally adopt DirectComposition V2 features by changing the device creation method from <see cref="SharpDX.DirectComposition.DComp.CreateDevice"/> to <see cref="SharpDX.DirectComposition.DComp.CreateDevice2"/>, while still requesting the <see cref="SharpDX.DirectComposition.Device2"/> interface. This allows the rest of the code to remain unchanged, while allowing the application to use QueryInterface in just the places where new functionality is needed.
        /// </p>
        /// </remarks>
        /// <include file='.\..\Documentation\CodeComments.xml' path="/comments/comment[@id='DCompositionCreateDevice2']/*"/>
        /// <msdn-id>dn280347</msdn-id>
        /// <unmanaged>HRESULT DCompositionCreateDevice2([In, Optional] IUnknown* renderingDevice,[In] const GUID&amp; iid,[Out] void** dcompositionDevice)</unmanaged>
        /// <unmanaged-short>DCompositionCreateDevice2</unmanaged-short>
        internal static void CreateDevice2(SharpDX.ComObject renderingDevice, System.Guid iid, out System.IntPtr dcompositionDevice)
        {
            unsafe {
                SharpDX.Result __result__;

                fixed(void *dcompositionDevice_ = &dcompositionDevice)
                __result__ =
                    DCompositionCreateDevice2_((void *)((renderingDevice == null)?IntPtr.Zero:renderingDevice.NativePointer), &iid, dcompositionDevice_);

                __result__.CheckError();
            }
        }
Exemple #15
0
        public D2DContext GetContext(GraphicsDevice graphicsDevice)
        {
            SharpDX.ComObject obj     = GetRenderTargetResource(graphicsDevice);
            D2DContext        context = GetOrCreateContext(obj);

            if (context == null)
            {
                return(null);
            }

            AlphaMode alphaMode = AlphaMode.Ignore;

            if (context.DxgiSurface == null || context.DxgiSurface.IsDisposed)
            {
                if (obj is SharpDX.DXGI.SwapChain)
                {
                    var swapChain = (SharpDX.DXGI.SwapChain)obj;
                    context.DxgiSurface = SharpDX.DXGI.Surface.FromSwapChain(swapChain, 0);
                    alphaMode           = AlphaMode.Ignore;
                }
                else if (obj is SharpDX.Direct3D11.Resource)
                {
                    context.DxgiSurface = obj.QueryInterface <SharpDX.DXGI.Surface>();
                    alphaMode           = AlphaMode.Premultiplied;
                }
                else
                {
                    return(null);
                }
            }

            if (context.D2DRenderTarget == null || context.D2DRenderTarget.IsDisposed)
            {
                var rtProp = new RenderTargetProperties(new PixelFormat(SharpDX.DXGI.Format.Unknown, alphaMode));
                var d2drt  = new RenderTarget(this.factory2D, context.DxgiSurface, rtProp);
                d2drt.TextRenderingParams      = new RenderingParams(factoryDWrite, 1f, 0f, 0f, PixelGeometry.Flat, RenderingMode.CleartypeGdiClassic);
                d2drt.TextAntialiasMode        = SharpDX.Direct2D1.TextAntialiasMode.Grayscale;
                context.D2DRenderTarget        = d2drt;
                context.DxgiSurface.Disposing += (o, e) => d2drt.Dispose();
            }

            return(context);
        }
Exemple #16
0
        private void OnRender(IntPtr handle, bool isNewSurface)
        {
            if (isNewSurface)
            {
                if (brush != null)
                {
                    brush.Dispose();
                    brush = null;
                }

                if (renderTarget != null)
                {
                    renderTarget.Dispose();
                    renderTarget = null;
                }

                SharpDX.ComObject            comObject = new SharpDX.ComObject(handle);
                SharpDX.DXGI.Resource        resource  = comObject.QueryInterface <SharpDX.DXGI.Resource>();
                SharpDX.Direct3D10.Texture2D texture   = resource.QueryInterface <SharpDX.Direct3D10.Texture2D>();
                using (var surface = texture.QueryInterface <SharpDX.DXGI.Surface>())
                {
                    var properties = new RenderTargetProperties();
                    properties.DpiX        = 96;
                    properties.DpiY        = 96;
                    properties.MinLevel    = FeatureLevel.Level_DEFAULT;
                    properties.PixelFormat = new SharpDX.Direct2D1.PixelFormat(SharpDX.DXGI.Format.Unknown, AlphaMode.Premultiplied);
                    properties.Type        = RenderTargetType.Default;
                    properties.Usage       = RenderTargetUsage.None;

                    renderTarget = new RenderTarget(new Factory(), surface, properties);
                }
            }

            if (brush == null)
            {
                brush = new SharpDX.Direct2D1.SolidColorBrush(renderTarget, new SharpDX.Color4(0.2f, 0.2f, 0.2f, 0.5f));
            }

            renderTarget.BeginDraw();
            renderTarget.DrawTextLayout(new SharpDX.Vector2(50, 50), textLayout, brush);
            renderTarget.EndDraw();
        }
Exemple #17
0
        private D2DContext GetOrCreateContext(SharpDX.ComObject comObject)
        {
            if (comObject == null)
            {
                return null;
            }

            if (comObject.IsDisposed)
            {
                dictContext.Remove(comObject);
                return null;
            }

            D2DContext context;
            if (!this.dictContext.TryGetValue(comObject, out context))
            {
                context = new D2DContext();
                comObject.Disposing += ComObject_Disposing;
                this.dictContext.Add(comObject, context);
            }
            return context;
        }
        public Tuple <D3D11.Texture2D, D3D11.RenderTargetView, D3D11.Texture2D, D3D11.DepthStencilView, SDM.RawViewportF, Size2, DpiScaling> OnRenderLoop_CreateViewResources(EngineDevice device)
        {
            // Get the pixel size of the screen
            Size2 viewSize = GetTargetRenderPixelSize();

            // Create the SwapChain and associate it with the SwapChainBackgroundPanel
            using (SharpDX.ComObject targetWindowCom = new SharpDX.ComObject(m_targetWindow))
            {
                m_swapChain = GraphicsHelper.CreateSwapChainForCoreWindow(device, targetWindowCom, viewSize.Width, viewSize.Height, m_renderLoop.ViewConfiguration);
            }

            // Get the backbuffer from the SwapChain
            m_backBuffer = D3D11.Texture2D.FromSwapChain <D3D11.Texture2D>(m_swapChain, 0);

            // Define the render target (in case of multisample an own render target)
            D3D11.Texture2D backBufferForRenderloop = null;
            if (m_renderLoop.ViewConfiguration.AntialiasingEnabled)
            {
                m_backBufferMultisampled = GraphicsHelper.CreateRenderTargetTexture(device, viewSize.Width, viewSize.Height, m_renderLoop.ViewConfiguration);
                m_renderTargetView       = new D3D11.RenderTargetView(device.DeviceD3D11_1, m_backBufferMultisampled);
                backBufferForRenderloop  = m_backBufferMultisampled;
            }
            else
            {
                m_renderTargetView      = new D3D11.RenderTargetView(device.DeviceD3D11_1, m_backBuffer);
                backBufferForRenderloop = m_backBuffer;
            }

            //Create the depth buffer
            m_depthBuffer       = GraphicsHelper.CreateDepthBufferTexture(device, viewSize.Width, viewSize.Height, m_renderLoop.ViewConfiguration);
            m_renderTargetDepth = new D3D11.DepthStencilView(device.DeviceD3D11_1, m_depthBuffer);

            //Define the viewport for rendering
            SharpDX.Mathematics.Interop.RawViewportF viewPort = GraphicsHelper.CreateDefaultViewport(viewSize.Width, viewSize.Height);
            m_lastRefreshTargetSize = new Size(viewSize.Width, viewSize.Height);

            return(Tuple.Create(backBufferForRenderloop, m_renderTargetView, m_depthBuffer, m_renderTargetDepth, viewPort, viewSize, m_dpiScaling));
        }
Exemple #19
0
 /// <summary>
 /// <p>The <strong>DirectSoundFullDuplexCreate</strong> function is documented under a different name. For complete documentation of this function, see DirectSoundFullDuplexCreate8. </p>
 /// </summary>
 /// <param name="cGuidCaptureDeviceRef">No documentation.</param>
 /// <param name="cGuidRenderDeviceRef">No documentation.</param>
 /// <param name="cDSCBufferDescRef">No documentation.</param>
 /// <param name="cDSBufferDescRef">No documentation.</param>
 /// <param name="hWnd">No documentation.</param>
 /// <param name="dwLevel">No documentation.</param>
 /// <param name="dSFDOut">No documentation.</param>
 /// <param name="dSCBuffer8Out">No documentation.</param>
 /// <param name="dSBuffer8Out">No documentation.</param>
 /// <param name="unkOuterRef">No documentation.</param>
 /// <returns><p>If this function succeeds, it returns <strong><see cref="SharpDX.Result.Ok"/></strong>. Otherwise, it returns an <strong><see cref="SharpDX.Result"/></strong> error code.</p></returns>
 /// <include file='.\..\Documentation\CodeComments.xml' path="/comments/comment[@id='DirectSoundFullDuplexCreate']/*"/>
 /// <msdn-id>bb432248</msdn-id>
 /// <unmanaged>HRESULT DirectSoundFullDuplexCreate([In, Optional] const GUID* pcGuidCaptureDevice,[In, Optional] const GUID* pcGuidRenderDevice,[In] const DSCBUFFERDESC* pcDSCBufferDesc,[In] const DSBUFFERDESC* pcDSBufferDesc,[In] HWND hWnd,[In] unsigned int dwLevel,[Out, Fast] IDirectSoundFullDuplex** ppDSFD,[Out] IDirectSoundCaptureBuffer8** ppDSCBuffer8,[Out] IDirectSoundBuffer8** ppDSBuffer8,[In] IUnknown* pUnkOuter)</unmanaged>
 /// <unmanaged-short>DirectSoundFullDuplexCreate</unmanaged-short>
 public static void FullDuplexCreate(System.Guid?cGuidCaptureDeviceRef, System.Guid?cGuidRenderDeviceRef, SharpDX.DirectSound.CaptureBufferDescription cDSCBufferDescRef, SharpDX.DirectSound.SoundBufferDescription cDSBufferDescRef, System.IntPtr hWnd, int dwLevel, SharpDX.DirectSound.FullDuplex dSFDOut, out SharpDX.DirectSound.CaptureBuffer dSCBuffer8Out, out SharpDX.DirectSound.SecondarySoundBuffer dSBuffer8Out, SharpDX.ComObject unkOuterRef)
 {
     unsafe {
         System.Guid cGuidCaptureDeviceRef_;
         if (cGuidCaptureDeviceRef.HasValue)
         {
             cGuidCaptureDeviceRef_ = cGuidCaptureDeviceRef.Value;
         }
         System.Guid cGuidRenderDeviceRef_;
         if (cGuidRenderDeviceRef.HasValue)
         {
             cGuidRenderDeviceRef_ = cGuidRenderDeviceRef.Value;
         }
         var cDSCBufferDescRef_ = SharpDX.DirectSound.CaptureBufferDescription.__NewNative();
         cDSCBufferDescRef.__MarshalTo(ref cDSCBufferDescRef_);
         var cDSBufferDescRef_ = SharpDX.DirectSound.SoundBufferDescription.__NewNative();
         cDSBufferDescRef.__MarshalTo(ref cDSBufferDescRef_);
         IntPtr         dSFDOut_       = IntPtr.Zero;
         IntPtr         dSCBuffer8Out_ = IntPtr.Zero;
         IntPtr         dSBuffer8Out_  = IntPtr.Zero;
         SharpDX.Result __result__;
         __result__ =
             DirectSoundFullDuplexCreate_((cGuidCaptureDeviceRef.HasValue)?&cGuidCaptureDeviceRef_:(void *)IntPtr.Zero, (cGuidRenderDeviceRef.HasValue)?&cGuidRenderDeviceRef_:(void *)IntPtr.Zero, &cDSCBufferDescRef_, &cDSBufferDescRef_, (void *)hWnd, dwLevel, &dSFDOut_, &dSCBuffer8Out_, &dSBuffer8Out_, (void *)((unkOuterRef == null)?IntPtr.Zero:unkOuterRef.NativePointer));
         cDSCBufferDescRef.__MarshalFree(ref cDSCBufferDescRef_);
         cDSBufferDescRef.__MarshalFree(ref cDSBufferDescRef_);
         ((SharpDX.DirectSound.FullDuplex)dSFDOut).NativePointer = dSFDOut_;
         dSCBuffer8Out = (dSCBuffer8Out_ == IntPtr.Zero)?null:new SharpDX.DirectSound.CaptureBuffer(dSCBuffer8Out_);
         dSBuffer8Out  = (dSBuffer8Out_ == IntPtr.Zero)?null:new SharpDX.DirectSound.SecondarySoundBuffer(dSBuffer8Out_);
         __result__.CheckError();
     }
 }
Exemple #20
0
 /// <summary>
 /// Find the display mode that most closely matches the requested display mode.
 /// </summary>
 /// <remarks>
 /// Direct3D devices require UNORM formats. This method finds the closest matching available display mode to the mode specified in pModeToMatch. Similarly ranked fields (ie. all specified, or all unspecified, etc) are resolved in the following order.  ScanlineOrdering Scaling Format Resolution RefreshRate  When determining the closest value for a particular field, previously matched fields are used to filter the display mode list choices, and  other fields are ignored. For example, when matching Resolution, the display mode list will have already been filtered by a certain ScanlineOrdering,  Scaling, and Format, while RefreshRate is ignored. This ordering doesn't define the absolute ordering for every usage scenario of FindClosestMatchingMode, because  the application can choose some values initially, effectively changing the order that fields are chosen. Fields of the display mode are matched one at a time, generally in a specified order. If a field is unspecified, FindClosestMatchingMode gravitates toward the values for the desktop related to this output.  If this output is not part of the desktop, then the default desktop output is used to find values. If an application uses a fully unspecified  display mode, FindClosestMatchingMode will typically return a display mode that matches the desktop settings for this output.   Unspecified fields are lower priority than specified fields and will be resolved later than specified fields.
 /// </remarks>
 /// <param name="device">A reference to the Direct3D device interface. If this parameter is NULL, only modes whose format matches that of pModeToMatch will  be returned; otherwise, only those formats that are supported for scan-out by the device are returned. </param>
 /// <param name="modeToMatch">The desired display mode (see <see cref="SharpDX.DXGI.ModeDescription"/>). Members of DXGI_MODE_DESC can be unspecified indicating no preference for  that member.  A value of 0 for Width or Height indicates the value is unspecified.  If either Width or  Height are 0 both must be 0.  A numerator and denominator of 0 in RefreshRate indicate it is unspecified. Other members  of DXGI_MODE_DESC have enumeration values indicating the member is unspecified.  If pConnectedDevice is NULL Format cannot be DXGI_FORMAT_UNKNOWN. </param>
 /// <param name="closestMatch">The mode that most closely matches pModeToMatch. </param>
 /// <returns>Returns one of the following <see cref="SharpDX.DXGI.DXGIError"/>. </returns>
 /// <unmanaged>HRESULT IDXGIOutput::FindClosestMatchingMode([In] const DXGI_MODE_DESC* pModeToMatch,[Out] DXGI_MODE_DESC* pClosestMatch,[In, Optional] IUnknown* pConcernedDevice)</unmanaged>
 public void GetClosestMatchingMode(SharpDX.ComObject device, SharpDX.DXGI.ModeDescription modeToMatch, out SharpDX.DXGI.ModeDescription closestMatch)
 {
     FindClosestMatchingMode(ref modeToMatch, out closestMatch, device);
 }
Exemple #21
0
 /// <summary>
 /// <p>Associates content with the compositor, assigns a composition device to the content, and specifies the position of the content in the composition tree relative to other composition visuals. </p>Syntax<pre><see cref="SharpDX.Result"/> AddContent( [in]????????????<see cref="SharpDX.DirectManipulation.Content"/> *content, [in, optional]??<see cref="SharpDX.ComObject"/>   device, [in]????????????<see cref="SharpDX.ComObject"/> *parentVisual, [in]????????????<see cref="SharpDX.ComObject"/> *childVisual
 /// );</pre>Parameters<dl> <dt><em>content</em> [in]</dt> <dd> <p>The content to add to the composition tree.</p> <p><em>content</em> is placed  between <em>parentVisual</em> and <em>childVisual</em> in the composition tree. </p> </dd> <dt><em> device</em> [in, optional]</dt> <dd> <p>The device used to compose the content. </p> <p><strong>Note</strong>??<em>device</em> is created by the application.</p> </dd> <dt><em>parentVisual</em> [in]</dt> <dd> <p>The parent in the composition tree for the content being added.</p> <p><em>parentVisual</em> must also be a parent of <em>childVisual</em> in the composition tree.</p> </dd> <dt><em>childVisual</em> [in]</dt> <dd> <p>The child in the composition tree for the content being added.</p> <p><em>parentVisual</em> must also be a parent of <em>childVisual</em> in the composition tree.</p> </dd> </dl>Return value<p>If the method succeeds, it returns <strong><see cref="SharpDX.Result.Ok"/></strong>. Otherwise, it returns an <strong><see cref="SharpDX.Result"/></strong> error code.</p>Remarks<p>All content, regardless of type, must be added to the compositor. This can be primary content, obtained from the viewport by calling <strong>GetPrimaryContent</strong>, or secondary content, such as a panning indicator, created by calling <strong>CreateContent</strong>.
 /// </p><p>If the application uses a system-provided <strong><see cref="SharpDX.DirectManipulation.Compositor"/></strong>:</p><ul> <li><em>device</em> must be an  <strong><see cref="SharpDX.DirectComposition.Device"/></strong> object, and parent and child visuals must be <strong><see cref="SharpDX.DirectComposition.Visual"/></strong> objects.</li> <li><em>device</em>, <em>parentVisual</em>, and <em>childVisual</em> cannot be <c>null</c>. </li> <li><em>device</em>, <em>parentVisual</em>, and <em>childVisual</em> objects are created and owned by the application.
 /// </li> <li>When content is added to the composition tree using this method, the new composition visuals are inserted between <em>parentVisual</em> and <em>childVisual</em>. The new visuals should not be destroyed until they are disassociated from the compositor with <strong>RemoveContent</strong>.</li> </ul><p>If the application uses a custom implementation of <strong><see cref="SharpDX.DirectManipulation.Compositor"/></strong>:</p><ul> <li><em>device</em>, <em>parentVisual</em>, and <em>childVisual</em> must be a valid type for the compositor. They do not have to be <strong><see cref="SharpDX.DirectComposition.Device"/></strong> or <strong><see cref="SharpDX.DirectComposition.Visual"/></strong> objects.</li> <li><em>device</em>, <em>parentVisual</em>, and <em>childVisual</em> can be <c>null</c>, depending on the compositor. </li> </ul>Requirements
 /// </summary>
 /// <param name="content"><dd> <p>The content to add to the composition tree.</p> <p><em>content</em> is placed  between <em>parentVisual</em> and <em>childVisual</em> in the composition tree. </p> </dd></param>
 /// <param name="device"><dd> <p>The device used to compose the content. </p> <p><strong>Note</strong>??<em>device</em> is created by the application.</p> </dd></param>
 /// <param name="arentVisualRef"><dd> <p>The parent in the composition tree for the content being added.</p> <p><em>parentVisual</em> must also be a parent of <em>childVisual</em> in the composition tree.</p> </dd></param>
 /// <param name="childVisual"><dd> <p>The child in the composition tree for the content being added.</p> <p><em>parentVisual</em> must also be a parent of <em>childVisual</em> in the composition tree.</p> </dd></param>
 /// <returns>No documentation.</returns>
 /// <include file='Documentation\CodeComments.xml' path="/comments/comment[@id='IDirectManipulationCompositor::AddContent']/*"/>
 /// <msdn-id>Hh768898</msdn-id>
 /// <unmanaged>HRESULT IDirectManipulationCompositor::AddContent([In] IDirectManipulationContent* content,[In, Optional] IUnknown* device,[In, Optional] IUnknown* parentVisual,[In, Optional] IUnknown* childVisual)</unmanaged>
 /// <unmanaged-short>IDirectManipulationCompositor::AddContent</unmanaged-short>
 public void AddContent(SharpDX.DirectManipulation.Content content, SharpDX.ComObject device, SharpDX.ComObject arentVisualRef, SharpDX.ComObject childVisual)
 {
     AddContent(content, (SharpDX.IUnknown)device, (SharpDX.IUnknown)arentVisualRef, (SharpDX.IUnknown)childVisual);
 }
Exemple #22
0
        public static void CreateFX(SharpDX.XAudio2.XAudio2 device, System.Guid clsid, SharpDX.ComObject effectRef)
        {
#if !WINDOWS_UWP
            if (device.Version == XAudio2Version.Version27)
            {
                var clsid15 = clsid;
                if (clsid15 == CLSID_FXEcho)
                {
                    clsid15 = CLSID_FXEcho_15;
                }
                else if (clsid15 == CLSID_FXEQ)
                {
                    clsid15 = CLSID_FXEQ_15;
                }
                else if (clsid15 == CLSID_FXMasteringLimiter)
                {
                    clsid15 = CLSID_FXMasteringLimiter_15;
                }
                else if (clsid15 == CLSID_FXReverb)
                {
                    clsid15 = CLSID_FXReverb_15;
                }

                IntPtr nativePtr;
                var    result = (Result)CreateFX15(ref clsid15, out nativePtr);
                if (result.Success)
                {
                    effectRef.NativePointer = nativePtr;
                    return;
                }
            }
#endif
            if (device.Version == XAudio2Version.Version28)
            {
                CreateFX28(clsid, effectRef, IntPtr.Zero, 0);
            }
#if WINDOWS_UWP
            else if (device.Version == XAudio2Version.Version29)
            {
                CreateFX29(clsid, effectRef, IntPtr.Zero, 0);
            }
#endif
            else
            {
                throw new NotSupportedException(string.Format("XAudio2 Version [{0}] is not supported for this effect", device.Version));
            }
        }
Exemple #23
0
 /// <summary>
 /// <p>Creates a DirectWrite factory object that is used for subsequent creation of individual DirectWrite objects.</p>
 /// </summary>
 /// <param name="factoryType"><dd>  <p>A value that specifies whether the factory object will be shared or isolated.</p> </dd></param>
 /// <param name="iid"><dd>  <p>A <see cref="System.Guid"/> value that identifies the DirectWrite factory interface, such as __uuidof(<strong><see cref="SharpDX.DirectWrite.Factory"/></strong>).</p> </dd></param>
 /// <param name="factory"><dd>  <p>An address of a reference to the newly created DirectWrite factory object.</p> </dd></param>
 /// <returns><p>If this function succeeds, it returns <strong><see cref="SharpDX.Result.Ok"/></strong>. Otherwise, it returns an <strong><see cref="SharpDX.Result"/></strong> error code.</p></returns>
 /// <remarks>
 /// <p>This function creates a DirectWrite factory object that is used for subsequent creation of individual DirectWrite objects. DirectWrite factory contains internal state data such as font loader registration and cached font data. In most cases it is recommended you use the shared factory object, because it allows multiple components that use DirectWrite to share internal DirectWrite state data, and thereby reduce memory usage. However, there are cases when it is desirable to reduce the impact of a component, such as a plug-in from an untrusted source, on the rest of the process, by sandboxing and isolating it from the rest of the process components. In such cases, it is recommended you use an isolated factory for the sandboxed component.</p><p>The following example shows how to create a shared DirectWrite factory.</p><pre> if (SUCCEEDED(hr))
 /// { hr = <see cref="SharpDX.DirectWrite.DWrite.CreateFactory"/>( <see cref="SharpDX.DirectWrite.FactoryType.Shared"/>, __uuidof(<see cref="SharpDX.DirectWrite.Factory"/>), reinterpret_cast&lt;<see cref="SharpDX.ComObject"/>**&gt;(&amp;pDWriteFactory_) );
 /// } </pre><p><strong>Windows Phone 8.1:</strong> This API is supported.</p>
 /// </remarks>
 /// <include file='..\..\Documentation\CodeComments.xml' path="/comments/comment[@id='DWriteCreateFactory']/*"/>
 /// <msdn-id>dd368040</msdn-id>
 /// <unmanaged>HRESULT DWriteCreateFactory([In] DWRITE_FACTORY_TYPE factoryType,[In] const GUID&amp; iid,[Out, Fast] IUnknown** factory)</unmanaged>
 /// <unmanaged-short>DWriteCreateFactory</unmanaged-short>
 public static void CreateFactory(SharpDX.DirectWrite.FactoryType factoryType, System.Guid iid, SharpDX.ComObject factory)
 {
     unsafe {
         IntPtr         factory_ = IntPtr.Zero;
         SharpDX.Result __result__;
         __result__ =
             DWriteCreateFactory_(unchecked ((int)factoryType), &iid, &factory_);
         ((SharpDX.ComObject)factory).NativePointer = factory_;
         __result__.CheckError();
     }
 }
Exemple #24
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PrintControl"/> class.
 /// </summary>
 /// <param name="device">The device.</param>
 /// <param name="wicFactory">The WIC factory.</param>
 /// <param name="documentTarget">The document target.</param>
 /// <unmanaged>HRESULT ID2D1Device::CreatePrintControl([In] IWICImagingFactory* wicFactory,[In] IPrintDocumentPackageTarget* documentTarget,[In, Optional] const D2D1_PRINT_CONTROL_PROPERTIES* printControlProperties,[Out] ID2D1PrintControl** printControl)</unmanaged>
 public PrintControl(Device device, SharpDX.WIC.ImagingFactory wicFactory, SharpDX.ComObject documentTarget)
 {
     device.CreatePrintControl(wicFactory, documentTarget, null, this);
 }
Exemple #25
0
 /// <summary>
 /// <p>Associates content with the compositor, assigns a composition device to the content, and specifies the position of the content in the composition tree relative to other composition visuals. </p>Syntax<pre><see cref="SharpDX.Result"/> AddContent( [in]????????????<see cref="SharpDX.DirectManipulation.Content"/> *content, [in, optional]??<see cref="SharpDX.ComObject"/>   device, [in]????????????<see cref="SharpDX.ComObject"/> *parentVisual, [in]????????????<see cref="SharpDX.ComObject"/> *childVisual
 /// );</pre>Parameters<dl> <dt><em>content</em> [in]</dt> <dd> <p>The content to add to the composition tree.</p> <p><em>content</em> is placed  between <em>parentVisual</em> and <em>childVisual</em> in the composition tree. </p> </dd> <dt><em> device</em> [in, optional]</dt> <dd> <p>The device used to compose the content. </p> <p><strong>Note</strong>??<em>device</em> is created by the application.</p> </dd> <dt><em>parentVisual</em> [in]</dt> <dd> <p>The parent in the composition tree for the content being added.</p> <p><em>parentVisual</em> must also be a parent of <em>childVisual</em> in the composition tree.</p> </dd> <dt><em>childVisual</em> [in]</dt> <dd> <p>The child in the composition tree for the content being added.</p> <p><em>parentVisual</em> must also be a parent of <em>childVisual</em> in the composition tree.</p> </dd> </dl>Return value<p>If the method succeeds, it returns <strong><see cref="SharpDX.Result.Ok"/></strong>. Otherwise, it returns an <strong><see cref="SharpDX.Result"/></strong> error code.</p>Remarks<p>All content, regardless of type, must be added to the compositor. This can be primary content, obtained from the viewport by calling <strong>GetPrimaryContent</strong>, or secondary content, such as a panning indicator, created by calling <strong>CreateContent</strong>.
 /// </p><p>If the application uses a system-provided <strong><see cref="SharpDX.DirectManipulation.Compositor"/></strong>:</p><ul> <li><em>device</em> must be an  <strong><see cref="SharpDX.DirectComposition.Device"/></strong> object, and parent and child visuals must be <strong><see cref="SharpDX.DirectComposition.Visual"/></strong> objects.</li> <li><em>device</em>, <em>parentVisual</em>, and <em>childVisual</em> cannot be <c>null</c>. </li> <li><em>device</em>, <em>parentVisual</em>, and <em>childVisual</em> objects are created and owned by the application.
 /// </li> <li>When content is added to the composition tree using this method, the new composition visuals are inserted between <em>parentVisual</em> and <em>childVisual</em>. The new visuals should not be destroyed until they are disassociated from the compositor with <strong>RemoveContent</strong>.</li> </ul><p>If the application uses a custom implementation of <strong><see cref="SharpDX.DirectManipulation.Compositor"/></strong>:</p><ul> <li><em>device</em>, <em>parentVisual</em>, and <em>childVisual</em> must be a valid type for the compositor. They do not have to be <strong><see cref="SharpDX.DirectComposition.Device"/></strong> or <strong><see cref="SharpDX.DirectComposition.Visual"/></strong> objects.</li> <li><em>device</em>, <em>parentVisual</em>, and <em>childVisual</em> can be <c>null</c>, depending on the compositor. </li> </ul>Requirements
 /// </summary>
 /// <param name="content"><dd> <p>The content to add to the composition tree.</p> <p><em>content</em> is placed  between <em>parentVisual</em> and <em>childVisual</em> in the composition tree. </p> </dd></param>
 /// <param name="device"><dd> <p>The device used to compose the content. </p> <p><strong>Note</strong>??<em>device</em> is created by the application.</p> </dd></param>
 /// <param name="arentVisualRef"><dd> <p>The parent in the composition tree for the content being added.</p> <p><em>parentVisual</em> must also be a parent of <em>childVisual</em> in the composition tree.</p> </dd></param>
 /// <param name="childVisual"><dd> <p>The child in the composition tree for the content being added.</p> <p><em>parentVisual</em> must also be a parent of <em>childVisual</em> in the composition tree.</p> </dd></param>
 /// <returns>No documentation.</returns>
 /// <include file='Documentation\CodeComments.xml' path="/comments/comment[@id='IDirectManipulationCompositor::AddContent']/*"/>
 /// <msdn-id>Hh768898</msdn-id>
 /// <unmanaged>HRESULT IDirectManipulationCompositor::AddContent([In] IDirectManipulationContent* content,[In, Optional] IUnknown* device,[In, Optional] IUnknown* parentVisual,[In, Optional] IUnknown* childVisual)</unmanaged>
 /// <unmanaged-short>IDirectManipulationCompositor::AddContent</unmanaged-short>
 public void AddContent(SharpDX.DirectManipulation.Content content, SharpDX.ComObject device, SharpDX.ComObject arentVisualRef, SharpDX.ComObject childVisual)
 {
     AddContent_(content, device, arentVisualRef, childVisual);
 }
Exemple #26
0
 public static void CreateFX(System.Guid clsid, SharpDX.ComObject effectRef)
 {
     CreateFX(clsid, effectRef, IntPtr.Zero, 0);
 }
Exemple #27
0
            // This method creates all application resources that depend on
            // the application window size.  It is called at app initialization,
            // and whenever the application window size changes.
            void CreateWindowSizeDependentResources()
            {
                if (m_swapChain != null)
                {
                    // If the swap chain already exists, resize it.
                    m_swapChain.ResizeBuffers(
                        2,
                        0,
                        0,
                        SharpDX.DXGI.Format.B8G8R8A8_UNorm,
                        0
                        );
                }
                else
                {
                    // If the swap chain does not exist, create it.
                    var swapChainDesc = new SharpDX.DXGI.SwapChainDescription1
                    {
                        Stereo  = false,
                        Usage   = SharpDX.DXGI.Usage.RenderTargetOutput,
                        Scaling = SharpDX.DXGI.Scaling.None,
                        Flags   = 0,
                    };

                    // Use automatic sizing.
                    swapChainDesc.Width  = 0;
                    swapChainDesc.Height = 0;

                    // This is the most common swap chain format.
                    swapChainDesc.Format = SharpDX.DXGI.Format.B8G8R8A8_UNorm;

                    // Don't use multi-sampling.
                    swapChainDesc.SampleDescription.Count   = 1;
                    swapChainDesc.SampleDescription.Quality = 0;

                    // Use two buffers to enable flip effect.
                    swapChainDesc.BufferCount = 2;

                    // We recommend using this swap effect for all applications.
                    swapChainDesc.SwapEffect = SharpDX.DXGI.SwapEffect.FlipSequential;

                    // Once the swap chain description is configured, it must be
                    // created on the same adapter as the existing D3D Device.

                    // First, retrieve the underlying DXGI Device from the D3D Device.
                    using (var dxgiDevice = m_d3dDevice.QueryInterface <SharpDX.DXGI.Device2>())
                    {
                        // Ensure that DXGI does not queue more than one frame at a time. This both reduces
                        // latency and ensures that the application will only render after each VSync, minimizing
                        // power consumption.
                        dxgiDevice.MaximumFrameLatency = 1;

                        // Next, get the parent factory from the DXGI Device.
                        using (var dxgiAdapter = dxgiDevice.Adapter)
                            using (var dxgiFactory = dxgiAdapter.GetParent <SharpDX.DXGI.Factory2>())
                                // Finally, create the swap chain.
                                using (var coreWindow = new SharpDX.ComObject(m_window))
                                {
                                    m_swapChain = new SharpDX.DXGI.SwapChain1(dxgiFactory
                                                                              , m_d3dDevice, coreWindow, ref swapChainDesc);
                                }
                    }
                }

                // Once the swap chain is created, create a render target view.  This will
                // allow Direct3D to render graphics to the window.
                using (var backBuffer = m_swapChain.GetBackBuffer <SharpDX.Direct3D11.Texture2D>(0))
                {
                    m_renderTargetView = new SharpDX.Direct3D11.RenderTargetView(m_d3dDevice, backBuffer);

                    // After the render target view is created, specify that the viewport,
                    // which describes what portion of the window to draw to, should cover
                    // the entire window.

                    var backBufferDesc = backBuffer.Description;

                    var viewport = new SharpDX.ViewportF
                    {
                        X        = 0.0f,
                        Y        = 0.0f,
                        Width    = backBufferDesc.Width,
                        Height   = backBufferDesc.Height,
                        MinDepth = 0,
                        MaxDepth = 1,
                    };

                    m_d3dDeviceContext.Rasterizer.SetViewport(viewport);
                }
            }
Exemple #28
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();
     }
 }
Exemple #29
0
 /// <summary>
 /// No documentation.
 /// </summary>
 /// <param name="cGuidDeviceRef">No documentation.</param>
 /// <param name="dSOut">No documentation.</param>
 /// <param name="unkOuterRef">No documentation.</param>
 /// <returns>No documentation.</returns>
 /// <include file='.\..\Documentation\CodeComments.xml' path="/comments/comment[@id='DirectSoundCreate']/*"/>
 /// <unmanaged>HRESULT DirectSoundCreate([In, Optional] const GUID* pcGuidDevice,[Out] IDirectSound** ppDS,[In] IUnknown* pUnkOuter)</unmanaged>
 /// <unmanaged-short>DirectSoundCreate</unmanaged-short>
 public static void Create(System.Guid?cGuidDeviceRef, out SharpDX.DirectSound.DirectSoundBase dSOut, SharpDX.ComObject unkOuterRef)
 {
     unsafe {
         System.Guid cGuidDeviceRef_;
         if (cGuidDeviceRef.HasValue)
         {
             cGuidDeviceRef_ = cGuidDeviceRef.Value;
         }
         IntPtr         dSOut_ = IntPtr.Zero;
         SharpDX.Result __result__;
         __result__ =
             DirectSoundCreate_((cGuidDeviceRef.HasValue)?&cGuidDeviceRef_:(void *)IntPtr.Zero, &dSOut_, (void *)((unkOuterRef == null)?IntPtr.Zero:unkOuterRef.NativePointer));
         dSOut = (dSOut_ == IntPtr.Zero)?null:new SharpDX.DirectSound.DirectSoundBase(dSOut_);
         __result__.CheckError();
     }
 }
Exemple #30
-1
 /// <unmanaged>HRESULT ID2D1Device::CreatePrintControl([In] IWICImagingFactory* wicFactory,[In] IPrintDocumentPackageTarget* documentTarget,[In, Optional] const D2D1_PRINT_CONTROL_PROPERTIES* printControlProperties,[Out] ID2D1PrintControl** printControl)</unmanaged>
 public PrintControl(Device device, SharpDX.WIC.ImagingFactory wicFactory, SharpDX.ComObject documentTarget, SharpDX.Direct2D1.PrintControlProperties rintControlPropertiesRef)
 {
     device.CreatePrintControl(wicFactory, documentTarget, rintControlPropertiesRef, this);
 }