示例#1
0
        public int Release()
        {
            Marshal.FreeHGlobal(this.pBufferDesc_free);
            Marshal.FreeHGlobal(this.pwfx_free);
            Marshal.Release(this.pdscb8);
            Marshal.Release(this.pdsc8);
            //Marshal.ReleaseComObject(this.dscb8);
            //Marshal.ReleaseComObject(this.dsc8);
            Marshal.FinalReleaseComObject(this.dscb8);
            Marshal.FinalReleaseComObject(this.dsc8);

            this.pBufferDesc_free = IntPtr.Zero;
            this.pwfx_free        = IntPtr.Zero;

            this.pdscb8 = IntPtr.Zero;
            this.pdsc8  = IntPtr.Zero;

            this.dscb8 = null;
            this.dsc8  = null;

            foreach (var hwnd in this.notifyHwnd_close)
            {
                DSLibNatives.CloseHandle(hwnd);
            }
            this.notifyHwnd_close = null;

            return((int)DSERR.DS_OK);
        }
        public override void Release()
        {
            Marshal.FreeHGlobal(this.pwfx_free);
            Marshal.Release(this.pdscb8);
            Marshal.Release(this.pdsc8);
            //Marshal.ReleaseComObject(this.dscb8);
            //Marshal.ReleaseComObject(this.dsc8);
            Marshal.FinalReleaseComObject(this.dscb8);
            Marshal.FinalReleaseComObject(this.dsc8);

            this.pwfx_free = IntPtr.Zero;

            this.pdscb8 = IntPtr.Zero;
            this.pdsc8  = IntPtr.Zero;

            this.dscb8 = null;
            this.dsc8  = null;

            foreach (var handle in this.notifyHandle_close)
            {
                Win32API.CloseHandle(handle);
            }
            this.notifyHandle_close = null;

            base.Release();
        }
示例#3
0
        public int Release()
        {
            Marshal.FreeHGlobal(this.pwfx_free);
            Marshal.Release(this.pdscb8);
            Marshal.Release(this.pdsc8);
            //Marshal.ReleaseComObject(this.dscb8);
            //Marshal.ReleaseComObject(this.dsc8);
            Marshal.FinalReleaseComObject(this.dscb8);
            Marshal.FinalReleaseComObject(this.dsc8);

            this.pwfx_free = IntPtr.Zero;

            this.pdscb8 = IntPtr.Zero;
            this.pdsc8  = IntPtr.Zero;

            this.dscb8 = null;
            this.dsc8  = null;

            foreach (var hwnd in this.notifyHwnd_close)
            {
                LibNatives.CloseHandle(hwnd);
            }
            this.notifyHwnd_close = null;

            return(LibErrors.SUCCESS);
        }
        private bool CreateIDirectSoundCapture8()
        {
            uint error = DSERR.DS_OK;

            if ((error = Win32API.DirectSoundCaptureCreate8(IntPtr.Zero, out this.pdsc8, IntPtr.Zero)) != DSERR.DS_OK)
            {
                logger.ErrorFormat("DirectSoundCaptureCreate8失败, DSERROR = {0}", error);
                return(false);
            }

            this.dsc8 = Marshal.GetObjectForIUnknown(this.pdsc8) as IDirectSoundCapture8;

            return(true);
        }
示例#5
0
        private bool CreateIDirectSoundCapture8(out uint dsErr)
        {
            dsErr = DSERR.DS_OK;

            dsErr = DSLibNatives.DirectSoundCaptureCreate8(IntPtr.Zero, out this.pdsc8, IntPtr.Zero);
            if (dsErr != DSERR.DS_OK)
            {
                DSLibUtils.PrintLog("DirectSoundCaptureCreate8失败, DSERROR = {0}", dsErr);
                return(false);
            }

            this.dsc8 = Marshal.GetObjectForIUnknown(this.pdsc8) as IDirectSoundCapture8;

            return(true);
        }