I have a problem and I am unsure of whether I am doing something wrong, or whether the java bindings i am using (jouvieje’s nativefmod) have a serious bug in them.

I create two sources, two DSP units, two DSP callbacks. The two sources play over two channels. Each DSP is linked with its callback via a DSP_DESCRIPTION object.

The problem is that the second DSP callback is always used, for both sources. This is true even if I use 10 sources – the last DSP callback created is always used to filter every source.

I am currently trying to debug the java bindings to work out if the problem lies there, but in the meantime does anybody have any idea of what might be going wrong?

Thank you


  • You must to post comments

Okay, found the answer. It’s a bug in NativeFMODEx. I’m a little surprised it’s gone unnoticed for this long …

For anyone else having this problem:

The issue lies with the CallbackManager’s getCallback function. The first line reads:
Long owner = (object == 0) ? new Long(0) : (Long)ownersTable.get(new Long(object));

This is incorrect, since "object" (there are worse variable and class names in this project. "System" is one of them…) is passed in as the pointer of a dsp_state object instead of something more useful like the DSP instance itself, or the DSP description instance.

Fortunately, you can obtain a reference from this "object" pointer, as so:
FMOD_DSP_STATE.asFMOD_DSP_STATE((new Pointer()).asPointer(object)).getInstance().asLong()

So, replacing the original (incorrect) "new Long(object)" with the above, we get (brace yourself)
Long owner = (object == 0) ? new Long(0) : (Long)ownersTable.get(FMOD_DSP_STATE.asFMOD_DSP_STATE((new Pointer()).asPointer(object)).getInstance().asLong());

To clarify: Replace the very first line of the getCallback(int type, long object, boolean autoAttach) method in the CallbackManager class and all should work as expected.

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.