Conversation
- replaced the openal C++ interface: replaced functions which passes multiple floats by value with function that pass array of floats. Passing a single or multiple floats by value corrupts all parameters after it, this is a workaround.
| namespace OpenTK | ||
| { | ||
| #if OPENTK_0 | ||
| /*#if OPENTK_0 |
There was a problem hiding this comment.
@roponator It think this line needs to be uncommented again.
|
@dellis1972 If I uncomment this I get this error when compiling: I've done the same in AndroidGameView.cs. I haven't worked with this 'Register' stuff until now so I'm not sure what's up with it. Could it be some other change which cause it to be reigstered already? |
|
It seems this is a know problem: Not sure if it's safe to change 1.0 to 1.1 though. Any thoughts? |
|
@roponator when debugging the code locally you need to change it to Register ("opentk_1_0/GameViewBase1") This is because of the code generator. Its just a side effect of trying to debug. When a release is done (i.e. when we ship OpenTK with the android product) those attributes need to be in place. |
|
@dellis1972 ok, thx for explaining. Reverted those files. |
|
@dellis1972 Hey, you said you work on Xamarin.Android and that you could get someone to take a quick look at this, could you please poke someone so we know if the problem is in Xamarin.Android or somewhere else. |
|
@radekdoulik are you able to review this issue/change? |
|
@dellis1972 @radekdoulik |
TLDR: there is an issue when calling C++ functions from C# which have float parameters passed by value: the parameters in the function signature after the float parameters are corrupted. I'm totaly out of ideas, I have not tried compiling mono/xamarin, but it seems as if there is an issues in the C# -> C++ interop layer.
Therefore if a function has more than one float parameters or has a parameter after the float parameter it will get corrupted. The funny thing is that if paramters are of type int it works 100% correctly.
In practice this causes sounds to not be played, because calls like AL.Source that set position (which accepts 3 floats) pass two of the three floats corrupted (their values become like 5*10^38)
This branch is a workaround around the issue as it passes multiple float parameters by reference(pointers).
This fix could be considered totaly "legit" if all functions with float params (even those with just a single float param) would be passed by reference, and not just those with multiple float params, but this seems to cause no issues in practice.
I wrote a detailed issue report on stack overflow and on git:
http://stackoverflow.com/questions/42028853
MonoGame/MonoGame#5443