I am using an Native library in android for streaming.
Here is the scenario:
I am passing a url to c file and after lot of processing it writes the data in wav file.
I’m not so much familiar with C but what i could understand is there is a pointer of int16_t from which wav file is written.
Here is the question.
Is there any way to convert int16_t to jbytearray so that i can return a byte array to my java code?
Thanks
You need to allocate a byte[] and then copy the WAV data into it. Alternatively, create a “direct” ByteBuffer that spans the WAV data, and pass that into your Java code.
Read the JNI documentation and the JNI Tips doc for more info. In particular:
SetByteArrayRegion
NewDirectByteBuffer