Ejemplo n.º 1
0
        /// <summary>
        /// 循环播放当前配置文件中的音频文件,告警信息时候调用
        /// </summary>
        public void Play()
        {
            try
            {
                string source  = string.Empty;
                bool   enabled = false;
                VoiceXmlHelper.ReadFromXML(out source, out enabled);

                if (File.Exists(source) && enabled)
                {
                    m_currentPlayer.OpenFile(source, TStreamFormat.sfAutodetect);
                    // 循环播放
                    TStreamInfo info = new TStreamInfo();
                    m_currentPlayer.GetStreamInfo(ref info);

                    TStreamTime time = new TStreamTime();
                    time.sec = 0;
                    TStreamTime timeEnd = new TStreamTime();
                    timeEnd.sec = info.Length.sec;
                    m_currentPlayer.PlayLoop(TTimeFormat.tfSecond, ref time, TTimeFormat.tfSecond, ref timeEnd, Int32.MaxValue, true);
                    m_bIsCurrentFromWarningInfo = true;
                    //Play(source);
                }
            }
            catch (Exception exp)
            {
                System.Diagnostics.Debug.WriteLine(exp.Message);
            }
            finally
            {
            }
        }
Ejemplo n.º 2
0
		private void Button11_Click(object sender, System.EventArgs e)
		{
			TStreamTime startpos = new TStreamTime();
			TStreamTime endpos = new TStreamTime();
			player.GetPosition(ref startpos);
			endpos.sec = System.Convert.ToUInt32(startpos.sec + 2);
			player.PlayLoop(TTimeFormat.tfSecond, ref startpos, TTimeFormat.tfSecond, ref endpos, 3, true);

		}