public Buffer(WAVEFORMATEX Format, int Count) { handle = GCHandle.Alloc(this); size = BlockAlignedSize(Format, Count); samples = new Audio.SampleBuffer(Count) { Tag = this }; header = new WAVEHDR(); header.lpData = Marshal.AllocHGlobal(size); header.dwUser = (IntPtr)handle; header.dwBufferLength = (uint)size; header.dwFlags = 0; pin = GCHandle.Alloc(header, GCHandleType.Pinned); }
public Buffer(WAVEFORMATEX Format, int Count) { samples = new Audio.SampleBuffer(Count) { Tag = this }; int size = BlockAlignedSize(Format, Count); data = new byte[size]; dataPin = GCHandle.Alloc(data, GCHandleType.Pinned); header = new WAVEHDR(); headerPin = GCHandle.Alloc(header, GCHandleType.Pinned); header.lpData = dataPin.AddrOfPinnedObject(); header.dwBufferLength = (uint)size; header.dwFlags = 0; }
public static extern MMRESULT waveOutWrite(IntPtr hWaveOut, ref WAVEHDR lpWaveOutHdr, int uSize);
public static extern MMRESULT waveOutUnprepareHeader(IntPtr hWaveOut, ref WAVEHDR lpWaveOutHdr, int uSize);
public static extern MMRESULT waveInPrepareHeader(IntPtr hWaveIn, ref WAVEHDR lpWaveInHdr, int uSize);
public static extern MMRESULT waveInAddBuffer(IntPtr hwi, ref WAVEHDR pwh, int cbwh);
public static extern MMRESULT waveInUnprepareHeader(IntPtr hWaveIn, WAVEHDR lpWaveInHdr, int uSize);
public static extern MMRESULT waveInAddBuffer(IntPtr hwi, WAVEHDR pwh, int cbwh);
public static extern MMRESULT waveOutWrite(IntPtr hWaveOut, WAVEHDR lpWaveOutHdr, int uSize);
public static extern MMRESULT waveOutPrepareHeader(IntPtr hWaveOut, WAVEHDR lpWaveOutHdr, int uSize);