Ejemplo n.º 1
0
 private void btnOpenSound_Click(object sender, EventArgs e)
 {
     //   private Int32 m_iPreviewType = 0;
     if (m_lRealHandle < 0)
     {
         MessageBox.Show("Please preview first");
     }
     else
     {
         if (m_iPreviewType == 0) //  callback
         {
             if (!m_bOpenSound)
             {
                 if (PlayCtrl.PlayM4_PlaySound(m_lPort))
                 {
                     m_bOpenSound      = true;
                     btnOpenSound.Text = "Stop sound";
                 }
                 else
                 {
                     Debug.Print("Fail to open sound");
                 }
             }
             else
             {
                 if (PlayCtrl.PlayM4_StopSound())
                 {
                     m_bOpenSound      = false;
                     btnOpenSound.Text = "Open sound";
                 }
             }
         }
         else                      // Sdk decode
         {
             if (!m_bOpenSound)
             {
                 if (CHCNetSDK.NET_DVR_OpenSound(m_lRealHandle))
                 {
                     m_bOpenSound      = true;
                     btnOpenSound.Text = "Stop sound";
                 }
                 else
                 {
                     Debug.Print("Fail to open sound");
                 }
             }
             else
             {
                 if (CHCNetSDK.NET_DVR_CloseSound())
                 {
                     m_bOpenSound      = false;
                     btnOpenSound.Text = "Open sound";
                 }
             }
         }
     }
 }