DLL call to K8062 DMX Interface quite slow

I have the K8062 DMX interface and have successfully used it with DMXControl, Freestyler, and the softwar bundled with the interface.
Now i want to control my lights with a Java application and created a JNI interface to communicate with the DLL. The problem is that this method is really slow. If i set the RGB colors of four LED lights, i can see that light no.1 changes its color first, then no. 2, and so on. Setting the channel count to the absolute minimum doesn’t help.

I read that DLL calls over JNI are quite slow, so is there a way to access the interface directly via Java?
Or maybe there’s a way to implement a DLL with a method, which takes a whole array of values and passes it to the interface. So i only have to invoke JNI one time and can transmit several values at once.

Now the DLL is slightly modified.
A function SetAllData is added.
The parameter is a pointer to an array of 512 elements of data. The data must be 32 bit integers.

DMX_data: array [0..512] of integer;

Here is the function declaration in Delphi:

PROCEDURE SetAllData(DataArray: Pointer); stdcall; external 'K8062d.dll';

And the usage:

       SetAllData(@DMX_data[1]);

The original code in the example code was:

    //for i:=1 to max_ch do SetData(i,DMX_data[i]);

Here is the link to download the modified DLL: box.net/shared/2l0b2tk8e1

Thanks a lot for your quick help!
I will try that.

I finally managed to gain JNI access through the new DLL :smiley: , and it is much better now! Still not perfect, but notably faster.

Thank you for your help!