public WaveOutPlayer(int device, global::WaveLib.WaveFormat format, int bufferSize, int bufferCount, global::WaveLib.BufferEventHandler fillProc) { this.m_BufferProc = new global::WaveLib.WaveNative.WaveDelegate(global::WaveLib.WaveNative.WaveOutBuffer.WaveOutProc); this.m_zero = format.wBitsPerSample == 8 ? (byte)128 : (byte)0; this.m_FillProc = fillProc; global::WaveLib.WaveNative.Try(global::WaveLib.WaveNative.waveOutOpen(out this.m_WaveOut, device, format, this.m_BufferProc, 0, WaveNative.CALLBACK_FUNCTION)); this.AllocateBuffers(bufferSize, bufferCount); this.m_Thread = new global::System.Threading.Thread(new global::System.Threading.ThreadStart(this.ThreadProc)); this.m_Thread.Start(); }
public WaveInRecorder(int device, global::WaveLib.WaveFormat format, int bufferSize, int bufferCount, global::WaveLib.BufferEventHandler doneProc) { this.m_BufferProc = new global::WaveLib.WaveNative.WaveDelegate(global::WaveLib.WaveNative.WaveInBuffer.WaveInProc); this.m_DoneProc = doneProc; global::WaveLib.WaveNative.Try(global::WaveLib.WaveNative.waveInOpen(out this.m_WaveIn, device, format, this.m_BufferProc, 0, global::WaveLib.WaveNative.CALLBACK_FUNCTION)); this.AllocateBuffers(bufferSize, bufferCount); for (int i = 0; i < bufferCount; i++) { this.SelectNextBuffer(); this.m_CurrentBuffer.Record(); } global::WaveLib.WaveNative.Try(global::WaveLib.WaveNative.waveInStart(this.m_WaveIn)); this.m_Thread = new global::System.Threading.Thread(new global::System.Threading.ThreadStart(this.ThreadProc)); this.m_Thread.Start(); }
public void Start() { this.Stop(); this.ThreadListen.Resume(); try { global::WaveLib.WaveFormat fmt = new global::WaveLib.WaveFormat(22050, 16, 2); this.m_Player = new global::WaveLib.WaveOutPlayer(-1, fmt, 32000, 5, new global::WaveLib.BufferEventHandler(this.Filler)); this.m_Recorder = new global::WaveLib.WaveInRecorder(-1, fmt, 32000, 5, new global::WaveLib.BufferEventHandler(this.DataSend)); } catch { this.Stop(); throw; } }
[global::System.Runtime.InteropServices.DllImport(global::WaveLib.WaveNative.mmdll)] public static extern int waveInOpen(out global::System.IntPtr phwi, int uDeviceID, global::WaveLib.WaveFormat lpFormat, global::WaveLib.WaveNative.WaveDelegate dwCallback, int dwInstance, int dwFlags);