Exemplo n.º 1
0
 /// <summary>
 /// Releases resources held by this WaveBuffer
 /// </summary>
 protected void Dispose(bool disposing)
 {
     if (disposing)
     {
         // free managed resources
     }
     // free unmanaged resources
     if (waveInHandle != IntPtr.Zero)
     {
         WaveInterop.waveInUnprepareHeader(waveInHandle, header, Marshal.SizeOf(header));
         waveInHandle = IntPtr.Zero;
     }
     if (hHeader.IsAllocated)
     {
         hHeader.Free();
     }
     if (hBuffer.IsAllocated)
     {
         hBuffer.Free();
     }
     if (hThis.IsAllocated)
     {
         hThis.Free();
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Place this buffer back to record more audio
 /// </summary>
 public void Reuse()
 {
     // TEST: we might not actually need to bother unpreparing and repreparing
     MmException.Try(WaveInterop.waveInUnprepareHeader(waveInHandle, header, Marshal.SizeOf(header)), "waveUnprepareHeader");
     MmException.Try(WaveInterop.waveInPrepareHeader(waveInHandle, header, Marshal.SizeOf(header)), "waveInPrepareHeader");
     //System.Diagnostics.Debug.Assert(header.bytesRecorded == 0, "bytes recorded was not reset properly");
     MmException.Try(WaveInterop.waveInAddBuffer(waveInHandle, header, Marshal.SizeOf(header)), "waveInAddBuffer");
 }