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.Priority = ThreadPriority.Highest; m_Thread.Start(); }
public AudioDevice(int sampleRate, int bits, int bufferSize) { format = new Internal.WaveFormat(sampleRate, bits, 2); player = new Internal.WaveOutPlayer(-1, format, bufferSize, 2, new Internal.BufferFillEventHandler(FillInternalBuffer)); }
public static extern int waveOutOpen(out IntPtr hWaveOut, int uDeviceID, WaveFormat lpFormat, WaveDelegate dwCallback, int dwInstance, int dwFlags);