C#wave文件不可用? [英] C# wave file is not vaild?
本文介绍了C#wave文件不可用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的代码
this is my code
private void PlayPause_Click(object sender, EventArgs e)
{
System.Media.SoundPlayer player = new System.Media.SoundPlayer();
player.SoundLocation = "Z:\MUSIC\test.mp3";
player.Play();
}
这是我的错误
The file located at Z:\MUSIC\test.mp3 is not a valid wave file.
and this is my error
The file located at Z:\MUSIC\test.mp3 is not a valid wave file.
Can some one please help me?
推荐答案
否.
System.Media.SoundPlayer不支持MP3文件-它仅支持WAV文件.
您将需要使用WindowsMediaPlayer实例代替: http://msdn.microsoft.com/en-gb/library/windows/desktop/dd562388(v=vs.85).aspx [
No.
System.Media.SoundPlayer does not support MP3 files - it only supports WAV files.
You will need to use a WindowsMediaPlayer instance instead: http://msdn.microsoft.com/en-gb/library/windows/desktop/dd562388(v=vs.85).aspx[^]
消息是清除:您正在尝试使用只能播放WAV
文件的System.Media.SoundPlayer
播放MP3
文件.
音频文件格式为 MP3 [ ^ ]和 WAV [
The message is clear: you are trying to play aMP3
file with theSystem.Media.SoundPlayer
that can only playWAV
files.
The audio files formats MP3[^] and WAV[^] are very different.
You might, for instance, convert yourMP3
file into aWAV
one and then use theSoundPlayer
to play it,
这篇关于C#wave文件不可用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文