c# - NAudio 演示不再有效

标签 c# .net audio naudio

我刚刚尝试运行 NAudio 演示,但出现了一个奇怪的错误:

System.BadImageFormatException: Could not load file or a
ssembly 'NAudio, Version=1.3.8.0, Culture=neutral, PublicKeyToken=null' or one o
f its dependencies. An attempt was made to load a program with an incorrect form
at.
File name: 'NAudio, Version=1.3.8.0, Culture=neutral, PublicKeyToken=null'
   at NAudioWpfDemo.AudioGraph..ctor()
   at NAudioWpfDemo.ControlPanelViewModel..ctor(IWaveFormRenderer waveFormRender
er, SpectrumAnalyser analyzer) in C:\Users\Admin\Downloads\NAudio-1.3\NAudio-1-3
\Source Code\NAudioWpfDemo\ControlPanelViewModel.cs:line 23
   at NAudioWpfDemo.MainWindow..ctor() in C:\Users\Admin\Downloads\NAudio-1.3\NA
udio-1-3\Source Code\NAudioWpfDemo\MainWindow.xaml.cs:line 15

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\M
icrosoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure lo
gging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fus
ion!EnableLog].

自从我上次使用 NAudio 演示后,我已经从 32 位 Windows XP 更改为 64 位 Windows 7。这会导致这个问题吗?这非常烦人,因为我正准备再次尝试使用 C# 处理音频

最佳答案

我没有使用 NAudio 的经验,但是您提到的异常最常发生在出现位数问题时。这意味着 NAudio 可能仅针对 32 位编译,而您运行 64 位。

要尝试解决此问题,请在项目的编译属性中将输出设置为 32 位 (x86)。

关于c# - NAudio 演示不再有效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2799071/

相关文章:

javascript - 在没有用户交互的情况下如何下载和播放音频片段?

c# - 从字节数组实时播放

c# - 为什么var不能应用于成员变量

c# - 在方法中传递对派生对象的引用时出错

c# - 双击时无法访问 csproj 文件

c# - 如何使用 .Net Windows 服务的新基本身份验证对 Visual Studio Team Services 进行身份验证?

c# - OOP 说明

flash - Safari 中的 Ogg 音频

c# - DataGrid 中的 WPF 绑定(bind)到 DataContext

c# - 如何创建类似于 ForEach 的方法