Exemple #1
0
 /// <summary>
 /// creates a new wavebuffer
 /// </summary>
 /// <param name="hWaveOut">WaveOut device to write to</param>
 /// <param name="bufferSize">Buffer size in bytes</param>
 /// <param name="bufferFillStream">Stream to provide more data</param>
 /// <param name="waveOutLock">Lock to protect WaveOut API's from being called on &gt;1 thread</param>
 // Token: 0x06000BCD RID: 3021 RVA: 0x00023868 File Offset: 0x00021A68
 public WaveOutBuffer(IntPtr hWaveOut, int bufferSize, IWaveProvider bufferFillStream, object waveOutLock)
 {
     this.bufferSize          = bufferSize;
     this.buffer              = new byte[bufferSize];
     this.hBuffer             = GCHandle.Alloc(this.buffer, GCHandleType.Pinned);
     this.hWaveOut            = hWaveOut;
     this.waveStream          = bufferFillStream;
     this.waveOutLock         = waveOutLock;
     this.header              = new WaveHeader();
     this.hHeader             = GCHandle.Alloc(this.header, GCHandleType.Pinned);
     this.header.dataBuffer   = this.hBuffer.AddrOfPinnedObject();
     this.header.bufferLength = bufferSize;
     this.header.loops        = 1;
     this.hThis           = GCHandle.Alloc(this);
     this.header.userData = (IntPtr)this.hThis;
     lock (waveOutLock)
     {
         MmException.Try(WaveInterop.waveOutPrepareHeader(hWaveOut, this.header, Marshal.SizeOf(this.header)), "waveOutPrepareHeader");
     }
 }