I have been trying to integrate Picovoice Porcupine (https://github.com/Picovoice/Porcupine) into a proof of concept demo built for ARMv7 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!
I have included the relevant code below, along with the Java native calls from the Android demo I was using as a reference.
**Java reference:**
private native long init(String modelFilePath, String[] keywordFilePaths, float[] sensitivities);
private native int process(long object, short[] pcm);
private native void delete(long object);
**Unity code:**
public class PorcupineManager : ScriptableObject {
...
[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);
public void Init() {
porcupineObject = init(Path.Combine(Application.dataPath, modelPath), new string[] { Path.Combine(Application.dataPath, keywordPath)}, new float[] { sensitivity });
}
...
}
**Excerpt from log:**
> 2018-10-16 17:51:06.654 19176-19208/com.meowtek.commandandcontrol E/Unity: EntryPointNotFoundException: init
at (wrapper managed-to-native) PorcupineManager:init (string,string[],single[])> at PorcupineManager.Init () [0x0006e] in /Users/Ronan/Unity Projects/CommandAndControl/Assets/Scripts/Porcupine/PorcupineManager.cs:40> at PorcupineTest+c__Iterator0.MoveNext () [0x0005d] in /Users/Ronan/Unity Projects/CommandAndControl/Assets/Scripts/Porcupine/PorcupineTest.cs:17> at UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) [0x00028] in /Users/builduser/buildslave/unity/build/Runtime/Export/Coroutines.cs:17
↧