Example #1
0
        /// <summary>
        /// 语音朗诵
        /// </summary>
        /// <param name="message">朗诵信息</param>
        /// <param name="msg">返回的异常信息</param>
        public void VoiceSpeak(string callString, ref string msg)
        {
            try
            {
                if (callString.Trim() == "")
                {
                    return;
                }

                // jianqg 修改 不限定使用捷通 2013-12-05
                SpeechLib.SpVoice speech = new SpVoice();
                if (voiceInfo.init)
                {
                    speech.Voice  = speech.GetVoices(string.Empty, string.Empty).Item(voiceInfo.voices);
                    speech.Volume = voiceInfo.lolume;
                    //   speech.Rate = voiceInfo.rate;
                }
                // speech.WaitUntilDone(-1);

                speech.Speak(callString, SpeechVoiceSpeakFlags.SVSFlagsAsync);


                //SpVoice speech1 = new SpVoice();
                //speech1.Voice = speech1.GetVoices(string.Empty, string.Empty).Item(3);
                //speech1.Rate = -1;
                //speech1.Volume = 100;
                //speech1.WaitUntilDone(-1);
                //speech1.Speak("测试", SpeechVoiceSpeakFlags.SVSFlagsAsync);//.
                //以下是 周鹏原来使用 捷通语音的 jianqg 2013-12-05  注释



                int iErr = Jtts.jTTS_Play(callString, 0);

                if (Jtts.ERR_NONE != iErr)
                {
                    msg = "语音包错误!错误号:" + iErr.ToString();
                    return;
                }
            }
            catch (Exception ex)
            {
                msg = ex.Message;
            }
        }
Example #2
0
        /// <summary>
        /// 语音朗诵
        /// </summary>
        /// <param name="message">朗诵信息</param>
        /// <param name="msg">返回的异常信息</param>
        public void VoiceSpeak(string callString, ref string msg)
        {
            try
            {
                if (callString.Trim() == "")
                {
                    return;
                }

                int iErr = Jtts.jTTS_Play(callString, 0);

                if (Jtts.ERR_NONE != iErr)
                {
                    msg = "语音包错误!错误号:" + iErr.ToString();
                    return;
                }
            }
            catch (Exception ex)
            {
                msg = ex.Message;
            }
        }