1.[DllImport("winmm.dll", EntryPoint = "waveOutGetNumDevs")]
public static extern int waveOutGetNumDevs();
2.using SpeechLib;
SpeechVoiceSpeakFlags svsf;
SpVoiceClass svc = null;
3.右击Interop.SpeechLib ->嵌入式互操作类型,选择false
4.svc.Speak(content.Trim(), svsf);
完整代码如下
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SpeechLib;
using System.Runtime.InteropServices;
using System.Threading;
public class Speak
{
SpeechVoiceSpeakFlags svsf;
SpVoiceClass svc = null;
//增值为+10
private Int16 _setVolume = 100;
public Speak()
{
try
{