在.NET n音讯NoDriver错误音讯、错误、NET、NoDriver

2023-09-06 06:51:34 作者:總有刁民想害本宫

我得到的异常NoDriver呼吁acmFormatSuggest执行此功能时:

I get the exception "NoDriver calling acmFormatSuggest" when executing this function:

private static WaveChannel32 OpenMp3Stream(string fileName)
    {
        WaveChannel32 inputStream;
        WaveStream mp3Reader = new Mp3FileReader(fileName);
        WaveStream pcmStream = WaveFormatConversionStream.CreatePcmStream(mp3Reader);
        WaveStream blockAlignedStream = new BlockAlignReductionStream(pcmStream);
        inputStream = new WaveChannel32(blockAlignedStream);
        return inputStream;
    }

在这一行:

WaveStream pcmStream = WaveFormatConversionStream.CreatePcmStream(mp3Reader);

我试图改变NAudio.dll的平台(从86到64,反之亦然),但是这并没有帮助。

I've tried to change the platform of NAudio.dll (from x86 to x64 and vice-versa), but that didn't help.

有另一种方式来播放从MemoryStream的一个 MP3 文件或如何解决这个错误?

Is there another way to play an MP3 file from MemoryStream or how do I fix this error?

推荐答案

这code依赖于ACM codeC可以去code MP3是你的系统上present。什么操作系统您使用的?此外ACM codeCS通常是32位,在64所以上运行就意味着没有可用codeCS。

This code relies on an ACM codec that can decode MP3 being present on your system. What OS are you using? Also ACM codecs are typically 32 bit, so running in x64 would mean there are no codecs available.

n音讯并还提供使用DMO MP3德codeR作为替代,这是不是在XP提供的可能性,但似乎是大多数较新版本的Windows present。

NAudio does also offer the possibility of using the DMO MP3 decoder as an alternative, which isn't available in XP, but seems to be present on most newer versions of Windows.

最后,我建议使用最新n音讯源$ C ​​$ C,其中MP3FileReader有建于PCM转换,这意味着你可以叫阅读,并得到PCM了。

Finally, I would recommend using the very latest NAudio source code, in which the MP3FileReader has the PCM conversion built in, meaning you can just call Read and get PCM out.