/// <summary> /// Opens this driver /// </summary> public void Open() { if (driverHandle == IntPtr.Zero) { MmException.Try(AcmInterop.acmDriverOpen(out driverHandle, DriverId, 0), "acmDriverOpen"); } }
/// <summary> /// Creates a new ACM stream to convert one format to another, using a /// specified driver identified and wave filter /// </summary> /// <param name="driverId">the driver identifier</param> /// <param name="sourceFormat">the source format</param> /// <param name="waveFilter">the wave filter</param> public AcmStream(IntPtr driverId, WaveFormat sourceFormat, WaveFilter waveFilter) { int sourceBufferSize = Math.Max(16384, sourceFormat.AverageBytesPerSecond); this.sourceFormat = sourceFormat; sourceBufferSize -= (sourceBufferSize % sourceFormat.BlockAlign); MmException.Try(AcmInterop.acmDriverOpen(out driverHandle, driverId, 0), "acmDriverOpen"); MmException.Try(AcmInterop.acmStreamOpen(out streamHandle, driverHandle, sourceFormat, sourceFormat, waveFilter, IntPtr.Zero, IntPtr.Zero, AcmStreamOpenFlags.NonRealTime), "acmStreamOpen"); streamHeader = new AcmStreamHeader(streamHandle, sourceBufferSize, SourceToDest(sourceBufferSize)); }