public AcmHeader(IntPtr acmStreamHandle, WaveFormat sourceFormat, int sourceBufferSize, int destinationBufferSize) { if (acmStreamHandle == IntPtr.Zero) throw new ArgumentNullException("acmStreamHandle"); if (sourceFormat == null) throw new ArgumentNullException("sourceForamt"); if (sourceBufferSize <= 0) throw new ArgumentOutOfRangeException("sourceBufferSize"); if (destinationBufferSize <= 0) throw new ArgumentOutOfRangeException("destinationBufferSize"); _handle = acmStreamHandle; _sourceBufferSize = sourceBufferSize; _destinationBufferSize = destinationBufferSize; _sourceFormat = sourceFormat; _sourceBuffer = new byte[sourceBufferSize]; _destinationBuffer = new byte[destinationBufferSize]; _sourceBufferPtr = GCHandle.Alloc(_sourceBuffer, GCHandleType.Pinned); _destinationBufferPtr = GCHandle.Alloc(_destinationBuffer, GCHandleType.Pinned); _header = new NativeAcmHeader(); }
private void SetupHeader(NativeAcmHeader header) { header.outputBufferLength = _destinationBufferSize; header.inputBufferLength = _sourceBufferSize; header.outputBufferPointer = _destinationBufferPtr.AddrOfPinnedObject(); header.inputBufferPointer = _sourceBufferPtr.AddrOfPinnedObject(); }