Open MTHolbert opened 4 years ago
It seems that the value for dwInstance is causing it to point towards a memory address that isn't that of the created sound object. So all the variables associated with "this" are now null and thus the exception is thrown due to the value of the atomic variable m_nBlockFree is missing.
I think I've found the solution. By looking at https://docs.microsoft.com/en-us/previous-versions/dd743869(v=vs.85) it seems, that the waveOutProcWrap should specify DWORD_PTR instead of DWORD for the parameters dwInstance, dwParam1 and dwParam2.
Ok seems that I was too slow. @MrTraan already resolved the issue in #4
I keep getting this Exception every time I run the code block, the sound plays through for a second before getting cut off by the exception. I'm running on Visual Studio Community 2019. I went through the debugger and it seems that m_nBlockFree loses it's value or becomes garbage when waveOutProcWrap is called. And when waveOutProc is called and it reaches the m_nBlockFree++; line , the atomic exception handler for the overloaded operator++ is thrown, stating: Exception thrown at 0x00007FF785B2B8DD in Synth.exe: 0xC0000005: Access violation writing location 0x00000000BA2FF8EC.