我正在按照本教程使用 NAudio 播放 MP3 音频文件。要创建 WaveStream,我使用以下方法:
private WaveStream CreateInputStream(string fileName)
{
WaveChannel32 inputStream;
if (fileName.EndsWith(".mp3"))
{
WaveStream mp3Reader = new Mp3FileReader(fileName);
inputStream = new WaveChannel32(mp3Reader);
}
else
{
throw new InvalidOperationException("Unsupported extension");
}
volumeStream = inputStream;
return volumeStream;
}
不幸的是,我总是在
line inputStream = new WaveChanne32(mp3Reader):
块引用
System.ApplicationException was unhandled
Message=Only PCM supported
Source=NAudio
StackTrace: