using DotNetSpeech;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace YLSoft.Pola.Utils.Common
{
public class VoiceHelper
{
private int _volume=100;
/// <summary>
/// 音量(从0到100的整数)
/// </summary>
public int Volume
{
get
{
if (_volume < 0)
_volume= 0;
else if(_volume>100)
{
_volume = 100;
}
return _volume;
}
set { _volume = value; }
}
private int _rate=0;
public int Rate
{
get { return _rate; }
set { _rate = value; }
}
public void ProduceVoice(string strContent)
{
DotNetSpeech.SpeechVoiceSpeakFlags SSF = DotNetSpeech.SpeechVoiceSpeakFlags.SVSFlagsAsync;
DotNetSpeech.SpVoice vo = new SpVoiceClass();
vo.Volume = Volume;
vo.Rate = Rate;
vo.Speak(strContent, SSF);
}
}
}