Пример #1
0
        protected virtual void Dispose(bool disposing)
        {
            if (!_disposed)
            {
                if (_handle != IntPtr.Zero)
                {
                    AcmInterop.acmStreamClose(_handle);
                    _handle = IntPtr.Zero;
                }

                if (_header != null)
                {
                    _header.Dispose();
                    _header = null;
                }
            }
            _disposed = true;
        }
Пример #2
0
        public AcmBufferConverter(WaveFormat sourceFormat, WaveFormat destinationFormat, IntPtr driver)
        {
            AcmException.Try(AcmInterop.acmStreamOpen(
                    out _handle,
                    driver,
                    sourceFormat,
                    destinationFormat,
                    null,
                    IntPtr.Zero,
                    IntPtr.Zero,
                    AcmStreamOpenFlags.ACM_STREAMOPENF_NONREALTIME),
                "acmStreamOpen");

            int sourceBufferSize = Math.Max(UInt16.MaxValue + 1 /*65536*/, sourceFormat.BytesPerSecond);
            sourceBufferSize -= (sourceBufferSize % sourceFormat.BlockAlign);

            int destinationBufferSize = StreamSize(_handle, sourceBufferSize, AcmStreamSizeFlags.Input);
            _header = new AcmHeader(_handle, sourceFormat, sourceBufferSize, destinationBufferSize);
        }
Пример #3
0
        public AcmBufferConverter(WaveFormat sourceFormat, WaveFormat destinationFormat, IntPtr driver)
        {
            AcmException.Try(AcmInterop.acmStreamOpen(
                                 out _handle,
                                 driver,
                                 sourceFormat,
                                 destinationFormat,
                                 null,
                                 IntPtr.Zero,
                                 IntPtr.Zero,
                                 AcmStreamOpenFlags.ACM_STREAMOPENF_NONREALTIME),
                             "acmStreamOpen");

            int sourceBufferSize = Math.Max(UInt16.MaxValue + 1 /*65536*/, sourceFormat.BytesPerSecond);

            sourceBufferSize -= (sourceBufferSize % sourceFormat.BlockAlign);

            int destinationBufferSize = StreamSize(_handle, sourceBufferSize, AcmStreamSizeFlags.Input);

            _header = new AcmHeader(_handle, sourceFormat, sourceBufferSize, destinationBufferSize);
        }
Пример #4
0
        protected virtual void Dispose(bool disposing)
        {
            if (!_disposed)
            {
                if (_handle != IntPtr.Zero)
                {
                    AcmInterop.acmStreamClose(_handle);
                    _handle = IntPtr.Zero;
                }

                if (_header != null)
                {
                    _header.Dispose();
                    _header = null;
                }
            }
            _disposed = true;
        }