c# winform播放聲音的兩種方式


 axWindowsMediaPlayer1.settings.setMode("", true);

axWindowsMediaPlayer1.URL = "skcg.mp3";

//等待時間大概2秒

//異步,主程序不會卡住

//生成語音網址  https://developer.baidu.com/vcast

 

using System.Speech.Synthesis;

SpeechSynthesizer synth = new SpeechSynthesizer();
synth.Speak("刷卡成功!");

//等待時間大概1.1秒

//同步,主程序會卡住

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM