I built tinyalsa lib using the sources from tinyalsa-ndk and wrapped it with JNI calls and I'm trying to use it in my code.
I used Swig to generate Java wrappers (and modified output to comply with my package) My native method declaration is:
public final static native long mixer_open(long jarg);
My JNI wrapper call is inside a wrapper class TinyAlsa.java under the root pacakge (for the example I'll use com.Example.App):
public static SWIGTYPE_p_mixer mixer_open(long card)
{
long cPtr = TinyAlsaJNI.mixer_open(card);
return (cPtr == 0) ? null : new SWIGTYPE_p_mixer(cPtr, false);
}
and my wrapper c method is:
SWIGEXPORT jlong JNICALL Java_com_Example_App_Native_TinyAlsaJNI_mixer_1open(JNIEnv *jenv, jclass jcls, jlong jarg1)
{
jlong jresult = 0 ;
unsigned int arg1 ;
struct mixer *result = 0 ;
(void)jenv;
(void)jcls;
arg1 = (unsigned int)jarg1;
result = (struct mixer *)mixer_open(arg1);
*(struct mixer **)&jresult = result;
return jresult;
}
The tinalsa library is loaded OK without exceptions but calls such as mixer_open(0)
returns null pointers.
However If I execute the compiled tinymix mixer is open and mixer controls are listed as should.
Am I missing something? How can I make it work from my code?