Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/267.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# x86代码上的NAudio崩溃_C#_X86_Naudio - Fatal编程技术网

C# x86代码上的NAudio崩溃

C# x86代码上的NAudio崩溃,c#,x86,naudio,C#,X86,Naudio,就像在subject中一样,在AnyCPU中一切都正常,但当我切换到x86->应用程序崩溃时。我在Win7 x64下工作 编辑: (Exception from HRESULT: 0x80070057 (E_INVALIDARG))"} 堆栈: at System.StubHelpers.InterfaceMarshaler.ConvertToManaged(IntPtr pUnk, IntPtr itfMT, IntPtr classMT, Int32 flags) at

就像在subject中一样,在
AnyCPU
中一切都正常,但当我切换到
x86
->应用程序崩溃时。我在Win7 x64下工作

编辑:

(Exception from HRESULT: 0x80070057 (E_INVALIDARG))"}  
堆栈:

   at System.StubHelpers.InterfaceMarshaler.ConvertToManaged(IntPtr pUnk, IntPtr itfMT, IntPtr classMT, Int32 flags)  
   at NAudio.Wave.DirectSoundOut.IDirectSound.CreateSoundBuffer(BufferDescription desc, Object& dsDSoundBuffer, IntPtr pUnkOuter)  
   at NAudio.Wave.DirectSoundOut.InitializeDirectSound()  
   at NAudio.Wave.DirectSoundOut.PlaybackThreadFunc()  
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)  
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)  
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)  
   at System.Threading.ThreadHelper.ThreadStart()

奇怪的是,唯一值得注意的输入参数是缓冲区描述(一个
DSBUFFERDESC
的实例),但我看不到NAudio interop对它有任何x64/x86问题。可能您的设备不支持某些辅助缓冲区标志:

bufferDesc2.dwFlags = DirectSoundBufferCaps.DSBCAPS_GETCURRENTPOSITION2
    | DirectSoundBufferCaps.DSBCAPS_CTRLPOSITIONNOTIFY
    | DirectSoundBufferCaps.DSBCAPS_GLOBALFOCUS
    | DirectSoundBufferCaps.DSBCAPS_CTRLVOLUME
    | DirectSoundBufferCaps.DSBCAPS_STICKYFOCUS;
堆栈跟踪的另一个奇怪之处是错误出现在
ConvertToManaged
中,这表明声音缓冲区到托管对象的转换出现了错误,但我不知道为什么会发生这种情况,因为在调用
CreateSoundBuffer
完成之前,我们不会尝试强制转换到
IDirectSoundBuffer


你的应用程序为什么不能使用WaveOut或WaveOutEvent?您可能会发现它们更可靠。

如果没有关于代码或崩溃的任何详细信息,就不可能提供任何建议。Sry,我认为这是配置问题。但是,我添加了错误消息。我还在VirtualBox中的Windows Xp中检查了它,它在32位模式下运行良好。我的应用程序使用WaveOut(非事件版本)、DirecSound、ASIO和WASAPI。然而,ASIO和WASAPI在随机调用停止/播放后使应用程序崩溃。无论如何,我不明白你的答案,对我来说太复杂了+1.