public WaveOutPlayer(int device, WaveFormat format, int bufferSize, int bufferCount, BufferFillEventHandler fillProc) { m_zero = format.wBitsPerSample == 8 ? (byte)128 : (byte)0; m_FillProc = fillProc; WaveOutHelper.Try(WaveNative.waveOutOpen(out m_WaveOut, device, format, m_BufferProc, 0, WaveNative.CALLBACK_FUNCTION)); AllocateBuffers(bufferSize, bufferCount); m_Thread = new Thread(new ThreadStart(ThreadProc)); m_Thread.Start(); }
public WaveOutBuffer(IntPtr waveOutHandle, int size) { this.m_WaveOut = waveOutHandle; this.m_HeaderHandle = GCHandle.Alloc((object)this.m_Header, GCHandleType.Pinned); this.m_Header.dwUser = (IntPtr)GCHandle.Alloc((object)this); this.m_HeaderData = new byte[size]; this.m_HeaderDataHandle = GCHandle.Alloc((object)this.m_HeaderData, GCHandleType.Pinned); this.m_Header.lpData = this.m_HeaderDataHandle.AddrOfPinnedObject(); this.m_Header.dwBufferLength = size; WaveOutHelper.Try(WaveNative.waveOutPrepareHeader(this.m_WaveOut, ref this.m_Header, Marshal.SizeOf((object)this.m_Header))); }
public WaveOutPlayer( int device, WaveFormat format, int bufferSize, int bufferCount, BufferFillEventHandler fillProc) { this.m_zero = format.wBitsPerSample == (short)8 ? (byte)128 : (byte)0; this.m_FillProc = fillProc; WaveOutHelper.Try(WaveNative.waveOutOpen(out this.m_WaveOut, device, format, this.m_BufferProc, 0, 196608)); this.AllocateBuffers(bufferSize, bufferCount); this.m_Thread = new Thread(new ThreadStart(this.ThreadProc)); this.m_Thread.Start(); }