pinvokestackimbalance when calling ChannelGroup.addGroup

Hi there,

I’m pretty new to FMOD, so I apologize if this is incorrect.

The VS2012 MDA is triggering a pInvokeStackImbalance whenever I call ChannelGroup.addGroup in C#. It looks like it might be a bug with the C# wrapper, with the pInvoke signature not matching the DLLs.

The MDA exception no longer triggers if I change the DLLImport to include a bool and an out ref for the dsp connection. I’m unfamiliar with audio programming, so I’m not sure what to do with the dsp reference (if anything at all). The code below works:

private static extern RESULT FMOD_ChannelGroup_AddGroup(IntPtr channelgroup, IntPtr group, bool propagatedspclock, out IntPtr dspConnection);

Thanks for the bug report. We’ll get that fixed in the next release. In addition to your changes the ChannelGroup.addGroup function should look like

    public RESULT addGroup (ChannelGroup group, bool propagatedspclock, out DSPConnection connection)
    {
        connection = null;

        IntPtr connectionRaw;
        RESULT result = FMOD5_ChannelGroup_AddGroup(getRaw(), group.getRaw(), propagatedspclock, out connectionRaw);
        connection = new DSPConnection(connectionRaw);

        return result;

    }
1 Like

Cool, thanks!