コード例 #1
0
ファイル: WaveLib.cs プロジェクト: Sammuel-Miranda/Sip-Phone
 public void Dispose()
 {
     if (this.m_Thread != null)
     {
         try
         {
             this.m_Finished = true;
             if (this.m_WaveOut != global::System.IntPtr.Zero)
             {
                 global::WaveLib.WaveNative.waveOutReset(this.m_WaveOut);
             }
             this.m_Thread.Join();
             this.m_FillProc = null;
             this.FreeBuffers();
             if (this.m_WaveOut != global::System.IntPtr.Zero)
             {
                 global::WaveLib.WaveNative.waveOutClose(this.m_WaveOut);
             }
         }
         finally
         {
             this.m_Thread  = null;
             this.m_WaveOut = global::System.IntPtr.Zero;
         }
     }
     global::System.GC.SuppressFinalize(this);
 }
コード例 #2
0
ファイル: WaveLib.cs プロジェクト: Sammuel-Miranda/Sip-Phone
 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();
 }
コード例 #3
0
ファイル: WaveLib.cs プロジェクト: Sammuel-Miranda/Sip-Phone
 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();
 }