Beispiel #1
0
 public WaveInRecorder(WavInDevice device, WaveFormat format, int bufferSize, int bufferCount)
 {
     SaveBufSize = bufferSize;
     SaveBufCount = bufferCount;
     WaveInHelper.Try(WINMM_DLL.waveInOpen(out m_WaveIn, device.Index, format, m_BufferProc, 0, WINMM_DLL.CALLBACK_FUNCTION));
     WaveInFormat = format;
     AllocateBuffers(bufferSize, bufferCount);
     for (int i = 0; i < bufferCount; i++)
     {
         SelectNextBuffer();
         m_CurrentBuffer.Record();
     }
     WaveInHelper.Try(WINMM_DLL.waveInStart(m_WaveIn));
     m_Thread = new Thread(new ThreadStart(ThreadProc));
     m_Thread.Start();
 }
Beispiel #2
0
        public WaveOutPlayer(WavInDevice device, WaveFormat format, int bufferSize, int bufferCount)
        {
            SaveBufSize = bufferSize;
            SaveBufCount = bufferCount;
            WaveOutHelper.Try(WINMM_DLL.waveOutOpen(out m_WaveOut, device.Index, format, m_BufferProc, 0, WINMM_DLL.CALLBACK_FUNCTION));
            WaveOutFormat = format;
            AllocateBuffers(bufferSize, bufferCount);

            m_Thread = new Thread(new ThreadStart(ThreadProc));
            m_Thread.Start();
        }