zoukankan      html  css  js  c++  java
  • 用C#播放声音文件

    为了系统人性话,更加智能,有时候需要一些声音辅助系统
    下面这个例子可以播放指定音频文件,而且还可以读字符串:

    /// <summary>

            /// 播放声音文件

            /// </summary>

            /// <param name="FileName">文件全名</param>

            public void PlaySound(string FileName)

            {//要加载COM组件:Microsoft speech object Library

                if (!System.IO.File.Exists(FileName))

                {

                    return;

                }

                SpeechLib.SpVoiceClass pp = new SpeechLib.SpVoiceClass();

     

                SpeechLib.SpFileStreamClass spFs = new SpeechLib.SpFileStreamClass();

     

                spFs.Open(FileName, SpeechLib.SpeechStreamFileMode.SSFMOpenForRead, true);

                SpeechLib.ISpeechBaseStream Istream = spFs as SpeechLib.ISpeechBaseStream;

                pp.SpeakStream(Istream, SpeechLib.SpeechVoiceSpeakFlags.SVSFIsFilename);

                spFs.Close();

            }
  • 相关阅读:
    java各种框架的比较,分析
    HTTP请求响应码
    jersey获取各个参数的总结
    web项目中各种路径的获取
    netsh学习
    解决sqlplus: command not found
    win10 提速
    解决win10 64位系统可用2.99g
    Windows10关闭SearchUI.exe进程的方法
    msf payload
  • 原文地址:https://www.cnblogs.com/longyi/p/1459779.html
Copyright © 2011-2022 走看看