0
0

Hi there

I am having problems calling FSOUND_3D_Listener_SetAttributes from C# on WinCE. Other functions are working fine. I have the following Pinvoke code:

[DllImport(“fmodce.dll”)]
public static extern void FSOUND_3D_Listener_SetAttributes(float [] pos, float [] vel, float fx, float fy, float fz, float tx, float ty, float tz);

which corresponds to the C prototype:

void F_API FSOUND_3D_Listener_SetAttributes(
const F_FLOAT_API *pos,
const F_FLOAT_API *vel,
F_FLOAT_API fx,
F_FLOAT_API fy,
F_FLOAT_API fz,
F_FLOAT_API tx,
F_FLOAT_API ty,
F_FLOAT_API tz
);

when i call the function through

float [] pos = {50f, 50f, 50f};
Fmod.FSOUND_3D_SetAttributes(channel, pos, null);

i get a NotSupportedException – as if my DllImport prototype doesn’t match up. I have had issues passing floats to my own DLLs as well – my workaround was to change to float* and ref, which seemed to satisfy c#.

I am otherwise able to call this function fine directly from a DLL, and call other functions from C#, so I assume the issue lies with float marshalling.

The vaunted FmodManaged wrapper available seems to have an incorrect prototype for the function as the first two parameters are declared as single floats – not arrays.

Please Help,

James

  • You must to post comments
0
0

never mind – i found a solution

basically the compact framework doesnt support float marshalling at all, which wasnt really made clear in the docs imho

so i created a wrapper dll which deals with float* only .. seems like a dirty solution but it works

love your product btw

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.