开发者

SoundPlayer and Windows 7 wav file

When I try to play the sound file "Windows Critical Stop.wav" I get the following exception: exec {"Sound API only supports playing PCM wave files."} System.Exception {System.InvalidOperationExc开发者_开发百科eption}

I understand what PCM is, I just do not know how to either: 1) play the sound file, 2) determine a priori that it is not PCM and will not play, and block the file from being chosen.

Here is the code I am using:

SoundPlayer player = new SoundPlayer();
player.SoundLocation = FileNameTextBox.Text;

try
{
    player.Play();
}
catch (Exception exec)
{
    MessageBox.Show("Sound could not be played: " + exec.ToString());
}


Wave files can be encoded differently (even with the GSM codec), so just examine what codec is used to skip a particular one. Just check the AudioFormat bits.

https://ccrma.stanford.edu/courses/422/projects/WaveFormat/


You have to use this player the code you have is a system damager Microsoft admin,

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜