I noticed that once I read some values from an AudioEndpointVolume, my application would crash when I changed the volume manually afterwards. After some searching, I traced the problem to AudioEndpointVolumeCallback where OnNotify gets called when the volume changes.
In this method Marshal.PtrToStructure is used, which causes an access violation, causing the crash.
I'm running Win7 x64 and the latest Naudio (b3a412ad55a8)
Comments: After some more searching, I find the answer in the forum: http://naudio.codeplex.com/discussions/208808/ All that's needed is, in AudioEndpointVolumeCallback .cs, change the return type of OnNotify to 'void' and remove the 'return 0;' statement, then update the interface in IAudioEndpointVolumeCallback.cs to reflect this change, and the crash is gone.
In this method Marshal.PtrToStructure is used, which causes an access violation, causing the crash.
I'm running Win7 x64 and the latest Naudio (b3a412ad55a8)
Comments: After some more searching, I find the answer in the forum: http://naudio.codeplex.com/discussions/208808/ All that's needed is, in AudioEndpointVolumeCallback .cs, change the return type of OnNotify to 'void' and remove the 'return 0;' statement, then update the interface in IAudioEndpointVolumeCallback.cs to reflect this change, and the crash is gone.