/// <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"); }
/// <summary> /// creates a new wavebuffer /// </summary> /// <param name="waveInHandle">WaveIn device to write to</param> /// <param name="bufferSize">Buffer size in bytes</param> // Token: 0x06000BA4 RID: 2980 RVA: 0x00022D0C File Offset: 0x00020F0C public WaveInBuffer(IntPtr waveInHandle, int bufferSize) { this.bufferSize = bufferSize; this.buffer = new byte[bufferSize]; this.hBuffer = GCHandle.Alloc(this.buffer, GCHandleType.Pinned); this.waveInHandle = waveInHandle; 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; MmException.Try(WaveInterop.waveInPrepareHeader(waveInHandle, this.header, Marshal.SizeOf(this.header)), "waveInPrepareHeader"); }
/// <summary> /// Place this buffer back to record more audio /// </summary> // Token: 0x06000BA5 RID: 2981 RVA: 0x00022DDC File Offset: 0x00020FDC public void Reuse() { MmException.Try(WaveInterop.waveInUnprepareHeader(this.waveInHandle, this.header, Marshal.SizeOf(this.header)), "waveUnprepareHeader"); MmException.Try(WaveInterop.waveInPrepareHeader(this.waveInHandle, this.header, Marshal.SizeOf(this.header)), "waveInPrepareHeader"); MmException.Try(WaveInterop.waveInAddBuffer(this.waveInHandle, this.header, Marshal.SizeOf(this.header)), "waveInAddBuffer"); }