Play() public method

public Play ( ) : bool
return bool
Esempio n. 1
0
        public bool PlaySound(byte [] data, int size)
        {
            if (!playing)
            {
                playing = true;
                Advance();

                Marshal.Copy(data, 0, m_CurrentBuffer.Data, size);

                m_CurrentBuffer.Play();

                playing = false;
                return(true);
            }
            return(false);
        }
Esempio n. 2
0
 private void ThreadProc()
 {
     while (!m_Finished)
     {
         Advance();
         if (m_FillProc != null && !m_Finished)
         {
             m_FillProc(m_CurrentBuffer.Data, m_CurrentBuffer.Size);
         }
         else
         {
             // zero out buffer
             byte   v = m_zero;
             byte[] b = new byte[m_CurrentBuffer.Size];
             for (int i = 0; i < b.Length; i++)
             {
                 b[i] = v;
             }
             Marshal.Copy(b, 0, m_CurrentBuffer.Data, b.Length);
         }
         m_CurrentBuffer.Play();
     }
     WaitForAllBuffers();
 }
Esempio n. 3
0
 /// <summary>Play buffer delegate</summary>
 private void ThreadProc()
 {
     while (!_bFinished)
     {
         Advance();
         if (_eFillProc != null && !_bFinished)
         {
             _eFillProc(_cCurrentBuffer.Data, _cCurrentBuffer.Size);
         }
         else
         {
             // zero out buffer
             byte   v = _btZero;
             byte[] b = new byte[_cCurrentBuffer.Size];
             for (int i = 0; i < b.Length; i++)
             {
                 b[i] = v;
             }
             Marshal.Copy(b, 0, _cCurrentBuffer.Data, b.Length);
         }
         _cCurrentBuffer.Play();
     }
     WaitForAllBuffers();
 }