audio - 使用MediaFoundationReader时出现COMException

标签 audio com naudio ms-media-foundation flac

我正在尝试使用NAudio和MS Media Foundation编解码器播放.flac音乐文件。但是,无论何时歌曲到达末尾或接近末尾,都会引发异常。有什么方法可以修复它,或者有其他方法可以演奏吗?

抛出异常

System.Runtime.InteropServices.COMException (0xC00D36E3): Exception from HRESULT: 0xC00D36E3



加载和播放音乐的代码
readerStream = new MediaFoundationReader(FilePath);
waveChannel = new WaveChannel32(readerStream);
readerStream = new DSPEffectStream(waveChannel, m_eqEffect);
postVolumeMeter = new MeteringSampleProvider(readerStream.ToSampleProvider());
waveOutDevice.Init(postVolumeMeter, true);

waveOutDevice.Play();

我发现有些人也有类似的问题,但没有解决方法。 Discussion link

最佳答案

0xC00D36E3是 MF_E_BAD_STARTUP_VERSION "You are calling MFStartup with the wrong MF_VERSION. Mismatched bits?"。依次means:

If MFStartup returns MF_E_BAD_STARTUP_VERSION, it means your application was compiled using a version of the Media Foundation headers that does not match the Media Foundation DLLs on your system.



该问题应该与Media Foundation初始化有关,并且您没有明确进行初始化,那么NAudio可能会以某种方式不正确地进行初始化(或过早取消初始化)。

关于audio - 使用MediaFoundationReader时出现COMException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26316736/

相关文章:

c# - 在使用naudio播放期间调整字节流

c# - 使用 Naudio 将系统音频传输到 Skype

matlab - 使用 Matlab 从 .wav 文件中去除脉冲噪声

c# - 进程外 COM 服务器

.net - 可以将 DebuggerDisplay 属性应用于 Microsoft.Office.Interop.Word.Range 吗?

c# - 我想删除警告 : "Replace this with a lock against an object with strong-identity"

android - 在 Android 中播放 PCM 流

android - 从一类其他应用程序中在Android中打开一个应用程序

macos - 在 Mac 上使用 OpenAL 播放音频时出现随机噪音

c# - 如何在 C# 中获取播放音频(不是系统音量)的软件中的音量?