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; }
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); }