Example #1
0
        public AcmStream(IntPtr driverId, WaveFormat sourceFormat, WaveFilter waveFilter)
        {
            int num = Math.Max(16384, sourceFormat.AverageBytesPerSecond);

            this.sourceFormat = sourceFormat;
            num -= num % sourceFormat.BlockAlign;
            MmException.Try(AcmInterop.acmDriverOpen(out this.driverHandle, driverId, 0), "acmDriverOpen");
            MmException.Try(AcmInterop.acmStreamOpen(out this.streamHandle, this.driverHandle, sourceFormat, sourceFormat, waveFilter, IntPtr.Zero, IntPtr.Zero, AcmStreamOpenFlags.NonRealTime), "acmStreamOpen");
            this.streamHeader = new AcmStreamHeader(this.streamHandle, num, this.SourceToDest(num));
        }
Example #2
0
 public AcmStream(WaveFormat sourceFormat, WaveFormat destFormat)
 {
     try
     {
         this.streamHandle = IntPtr.Zero;
         this.sourceFormat = sourceFormat;
         int num = Math.Max(65536, sourceFormat.AverageBytesPerSecond);
         num -= num % sourceFormat.BlockAlign;
         MmException.Try(AcmInterop.acmStreamOpen(out this.streamHandle, IntPtr.Zero, sourceFormat, destFormat, null, IntPtr.Zero, IntPtr.Zero, AcmStreamOpenFlags.NonRealTime), "acmStreamOpen");
         int destBufferLength = this.SourceToDest(num);
         this.streamHeader = new AcmStreamHeader(this.streamHandle, num, destBufferLength);
         this.driverHandle = IntPtr.Zero;
     }
     catch
     {
         this.Dispose();
         throw;
     }
 }