Beispiel #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>
 public MyBuffer(
     IntPtr hWaveOut,
     int bufferSize,
     IWaveProvider bufferFillStream,
     object waveOutLock)
 {
     this.bufferSize          = bufferSize;
     this.buffer              = new byte[bufferSize];
     this.hBuffer             = GCHandle.Alloc((object)this.buffer, GCHandleType.Pinned);
     this.hWaveOut            = hWaveOut;
     this.waveStream          = bufferFillStream;
     this.waveOutLock         = waveOutLock;
     this.header              = new WaveHeader();
     this.hHeader             = GCHandle.Alloc((object)this.header, GCHandleType.Pinned);
     this.header.dataBuffer   = this.hBuffer.AddrOfPinnedObject();
     this.header.bufferLength = bufferSize;
     this.header.loops        = 1;
     this.hThis           = GCHandle.Alloc((object)this);
     this.header.userData = (IntPtr)this.hThis;
     lock (waveOutLock)
         MmException.Try(MyInterop.waveOutPrepareHeader(hWaveOut, this.header, Marshal.SizeOf((object)this.header)), "waveOutPrepareHeader");
 }
Beispiel #2
0
 public static extern MmResult waveInAddBuffer(IntPtr hWaveIn, WaveHeader pwh, int cbwh);
Beispiel #3
0
 public static extern MmResult waveOutUnprepareHeader(
     IntPtr hWaveOut,
     WaveHeader lpWaveOutHdr,
     int uSize);
Beispiel #4
0
 public static extern MmResult waveOutWrite(
     IntPtr hWaveOut,
     WaveHeader lpWaveOutHdr,
     int uSize);
Beispiel #5
0
 public static extern MmResult waveInPrepareHeader(
     IntPtr hWaveIn,
     WaveHeader lpWaveInHdr,
     int uSize);