做 ... 当 System.Media.SoundPlayer() 正在使用时
Do ... While System.Media.SoundPlayer() is in use
我一直在尝试在当前正在播放声音文件时在我的控制台应用程序上显示文本,例如歌词。最好的方法是什么?
struct Music
{
public
void PlaySong() {
System.Media.SoundPlayer player = new System.Media.SoundPlayer();
player.SoundLocation = @"C:\Users\MyPC\Music\MoreMusic\songsample.wav";
player.Load();
player.PlaySync();
}
}
class Program
{
static public void Main(string[] args)
{
Music music;
do
{
//Display Lyrics
} while (true); //as the song progresses
}
}
用 Play 替换 PlaySync
struct Music
{
public
void PlaySong() {
System.Media.SoundPlayer player = new System.Media.SoundPlayer();
player.SoundLocation = @"C:\Users\MyPC\Music\MoreMusic\songsample.wav";
player.Load();
player.Play();
}
}
我一直在尝试在当前正在播放声音文件时在我的控制台应用程序上显示文本,例如歌词。最好的方法是什么?
struct Music
{
public
void PlaySong() {
System.Media.SoundPlayer player = new System.Media.SoundPlayer();
player.SoundLocation = @"C:\Users\MyPC\Music\MoreMusic\songsample.wav";
player.Load();
player.PlaySync();
}
}
class Program
{
static public void Main(string[] args)
{
Music music;
do
{
//Display Lyrics
} while (true); //as the song progresses
}
}
用 Play 替换 PlaySync
struct Music
{
public
void PlaySong() {
System.Media.SoundPlayer player = new System.Media.SoundPlayer();
player.SoundLocation = @"C:\Users\MyPC\Music\MoreMusic\songsample.wav";
player.Load();
player.Play();
}
}