[英]C# Naudio Mp3 Play Button
I'm trying over a few days and can't make a simple Play button over C# using NAudio. 我正在尝试几天,并且不能使用NAudio在C#上制作一个简单的播放按钮。 It works, but when I hit the button the sound doesn't come out.
它工作,但当我按下按钮时声音不会出来。 Tried to put the mp3 file on the project folder and nothing happens.
试图将mp3文件放在项目文件夹中,没有任何反应。
public partial class MainForm : Form
{
public MainForm()
{
InitializeComponent();
}
private WaveOut waveOut;
private Mp3FileReader reader;
private void Button1(object sender, EventArgs e)
{
reader = new Mp3FileReader("c:\\tng\\tng.mp3");
waveOut = new WaveOut();
waveOut.Init(reader);
waveOut.Play();
}
}
} }
(I didn't really run just guess) Try this? (我没有真正开始猜测)试试这个?
reader = new Mp3FileReader("c:\\tng\\tng.mp3");
waveOut = new WaveOut();
waveOut.Init(reader);
waveOut.Play();
//add this line
Thread.Sleep(600000);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.