Closed rtumelty closed 6 years ago
isn't this more of a question for unity folks?
Not really - my issue isn't so much with how to do external calls to Unity (I know how to do that). It's to do with how exactly the functions are declared in the Porcupine library, as my attempt to mirror the calls in the Android demo aren't finding the entry points in the library. Ideally I'm looking for an API reference.
You mean the C JNI interface?
Documentation on it, yes. I have found the relevant calls in Porcupine.java:
` private native long init(String modelFilePath, String[] keywordFilePaths, float[] sensitivities);
private native int process(long object, short[] pcm);
private native void delete(long object);`
And created corresponding external calls in my Unity C#:
[DllImport("pv_porcupine")] private static extern long init(string modelFilePath, string[] keywordFilePaths, float[] sensitivities); [DllImport("pv_porcupine")] private static extern int process(long porcupineObjectId, short[] pcm); [DllImport("pv_porcupine")] private static extern void delete(long porcupineObjectId);
Clearly though, something doesn't match up, and is causing the entry point for the library to not be found - I'm guessing it's something to do with the parameters passed.
I think its the way methods are named. JNI has a specific way of doing it. Why don't you use the build for armlinux or RPi (2/3)? You can build your own JNI on top of it. At this point, we do not have plans to open source the JNI code as there is proprietary information in it.
Hi, I have been trying to integrate Porcupine into a proof of concept demo built for Android in Unity. I am attempting to access the ARMv7 .so library supplied in the GitHub repo using the DllImport function. The library appears to load correctly (as I do not receive a DllNotFoundException), however I am experiencing EntryPointNotFoundExceptions when trying to call the native functions. I think perhaps I am declaring the function calls incorrectly - if you can help me see where I'm going wrong I'd greatly appreciate it! See relevant code below.
` public class PorcupineManager : ScriptableObject {
...
...
} `
Excerpt from log: