码迷,mamicode.com
首页 > Windows程序 > 详细

c# 播放 mp3格式文件

时间:2017-04-17 12:30:27      阅读:259      评论:0      收藏:0      [点我收藏+]

标签:director   hwnd   nload   filename   use   stat   div   open   imp   

        public static uint SND_ASYNC = 0x0001;
        public static uint SND_FILENAME = 0x00020000;
        [DllImport("winmm.dll")]
        public static extern uint mciSendString(string lpstrCommand,
        string lpstrReturnString, uint uReturnLength, uint hWndCallback);
        public static void SoundText(string paratext)
        {
            string temp = System.Environment.GetEnvironmentVariable("TEMP");
            DirectoryInfo info = new DirectoryInfo(temp);
            UserDefined.WebDownLoad("http://tts.baidu.com/text2audio?idx=1&tex=" + System.Web.HttpUtility.UrlEncode(paratext, System.Text.Encoding.GetEncoding("utf-8")) + "&cuid=baidu_speech_demo&cod=2&lan=zh&ctp=1&pdt=1&spd=6&per=0&vol=9&pit=5",
                info.FullName + "\\" + paratext + ".mp3");
            mciSendString(@"close temp_alias", null, 0, 0);
            mciSendString("open " + info.FullName + "\\" + paratext + ".mp3" + " alias temp_alias", null, 0, 0);
            mciSendString("play temp_alias", null, 0, 0);
        }

 

c# 播放 mp3格式文件

标签:director   hwnd   nload   filename   use   stat   div   open   imp   

原文地址:http://www.cnblogs.com/cxlater/p/6722306.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!